All pastes #673157 Raw Edit

Stuff

public text v1 · immutable
#673157 ·published 2007-08-28 05:42 UTC
rendered paste body
From 3f8a3ada6a0bec7c34f9fc3d39fc3b7a5035d9ee Mon Sep 17 00:00:00 2001
From: Junio C Hamano <gitster@pobox.com>
Date: Mon, 27 Aug 2007 22:41:23 -0700
Subject: [PATCH] git --bare cmd: do not unconditionally nuke GIT_DIR

"GIT_DIR=some.where git --bare cmd" and worse yet
"git --git-dir=some.where --bare cmd" were very confusing.  They
both ignored git-dir specified, and instead made $cwd as GIT_DIR.

This changes --bare not to override existing GIT_DIR.

This has been like this for a long time.  Let's hope nobody sane
relied on this insane behaviour.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git.c b/git.c
index b6e292e..fd3d83c 100644
--- a/git.c
+++ b/git.c
@@ -94,7 +94,7 @@ static int handle_options(const char*** argv, int* argc, int* envchanged)
 		} else if (!strcmp(cmd, "--bare")) {
 			static char git_dir[PATH_MAX+1];
 			is_bare_repository_cfg = 1;
-			setenv(GIT_DIR_ENVIRONMENT, getcwd(git_dir, sizeof(git_dir)), 1);
+			setenv(GIT_DIR_ENVIRONMENT, getcwd(git_dir, sizeof(git_dir)), 0);
 			if (envchanged)
 				*envchanged = 1;
 		} else {
-- 
1.5.3.rc6.48.g17437