File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -123,14 +123,13 @@ static char *expand_namespace(const char *raw_namespace)
123123
124124static void setup_git_env (void )
125125{
126+ const char * gitfile ;
127+
126128 git_dir = getenv (GIT_DIR_ENVIRONMENT );
127- git_dir = git_dir ? xstrdup (git_dir ) : NULL ;
128- if (!git_dir ) {
129- git_dir = read_gitfile (DEFAULT_GIT_DIR_ENVIRONMENT );
130- git_dir = git_dir ? xstrdup (git_dir ) : NULL ;
131- }
132129 if (!git_dir )
133130 git_dir = DEFAULT_GIT_DIR_ENVIRONMENT ;
131+ gitfile = read_gitfile (git_dir );
132+ git_dir = xstrdup (gitfile ? gitfile : git_dir );
134133 git_object_dir = getenv (DB_ENVIRONMENT );
135134 if (!git_object_dir ) {
136135 git_object_dir = xmalloc (strlen (git_dir ) + 9 );
Original file line number Diff line number Diff line change @@ -379,6 +379,10 @@ test_expect_success 'init with separate gitdir' '
379379 test -d realgitdir/refs
380380'
381381
382+ test_expect_success ' re-init on .git file' '
383+ ( cd newdir && git init )
384+ '
385+
382386test_expect_success ' re-init to update git link' '
383387 (
384388 cd newdir &&
You can’t perform that action at this time.
0 commit comments