Code

Merge branch 'nd/maint-setup'
authorJunio C Hamano <gitster@pobox.com>
Mon, 2 May 2011 22:58:30 +0000 (15:58 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 May 2011 22:58:30 +0000 (15:58 -0700)
* nd/maint-setup:
  Kill off get_relative_cwd()
  setup: return correct prefix if worktree is '/'

Conflicts:
dir.c
setup.c

1  2 
dir.c
dir.h
setup.c

diff --cc dir.c
Simple merge
diff --cc dir.h
Simple merge
diff --cc setup.c
index 03cd84f2fcbf9cdbc25116308a9c2c9407af8e71,f0468c6864195e0ff9532f9ec5251d5288b38397..b6e6b5ae272b3ecae7dfa2cb446aef97e826884a
+++ b/setup.c
@@@ -390,9 -388,9 +391,9 @@@ static const char *setup_explicit_git_d
                return NULL;
        }
  
-       if (!prefixcmp(cwd, worktree) &&
-           cwd[strlen(worktree)] == '/') { /* cwd inside worktree */
+       offset = dir_inside_of(cwd, worktree);
+       if (offset >= 0) {      /* cwd inside worktree? */
 -              set_git_dir(make_absolute_path(gitdirenv));
 +              set_git_dir(real_path(gitdirenv));
                if (chdir(worktree))
                        die_errno("Could not chdir to '%s'", worktree);
                cwd[len++] = '/';