From 490544b1282416a033dc25481db205248ac0bfc8 Mon Sep 17 00:00:00 2001 From: Clemens Buchacher Date: Sat, 22 May 2010 13:13:05 +0200 Subject: get_cwd_relative(): do not misinterpret suffix as subdirectory If the current working directory is the same as the work tree path plus a suffix, e.g. 'work' and 'work-xyz', then the suffix '-xyz' would be interpreted as a subdirectory of 'work'. Signed-off-by: Clemens Buchacher Signed-off-by: Junio C Hamano diff --git a/dir.c b/dir.c index cb83332..5615f33 100644 --- a/dir.c +++ b/dir.c @@ -958,9 +958,14 @@ char *get_relative_cwd(char *buffer, int size, const char *dir) } if (*dir) return NULL; - if (*cwd == '/') + switch (*cwd) { + case '\0': + return cwd; + case '/': return cwd + 1; - return cwd; + default: + return NULL; + } } int is_inside_dir(const char *dir) diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh index 9df3012..bd8b607 100755 --- a/t/t1501-worktree.sh +++ b/t/t1501-worktree.sh @@ -30,6 +30,7 @@ test_rev_parse() { EMPTY_TREE=$(git write-tree) mkdir -p work/sub/dir || exit 1 +mkdir -p work2 || exit 1 mv .git repo.git || exit 1 say "core.worktree = relative path" @@ -54,7 +55,9 @@ GIT_DIR=$(pwd)/repo.git GIT_CONFIG=$GIT_DIR/config git config core.worktree "$(pwd)/work" test_rev_parse 'outside' false false false -cd work || exit 1 +cd work2 +test_rev_parse 'outside2' false false false +cd ../work || exit 1 test_rev_parse 'inside' false false true '' cd sub/dir || exit 1 test_rev_parse 'subdirectory' false false true sub/dir/ @@ -67,7 +70,9 @@ git config core.worktree non-existent GIT_WORK_TREE=work export GIT_WORK_TREE test_rev_parse 'outside' false false false -cd work || exit 1 +cd work2 +test_rev_parse 'outside' false false false +cd ../work || exit 1 GIT_WORK_TREE=. test_rev_parse 'inside' false false true '' cd sub/dir || exit 1 @@ -76,6 +81,7 @@ test_rev_parse 'subdirectory' false false true sub/dir/ cd ../../.. || exit 1 mv work repo.git/work +mv work2 repo.git/work2 say "GIT_WORK_TREE=absolute path, work tree below git dir" GIT_DIR=$(pwd)/repo.git @@ -86,6 +92,8 @@ cd repo.git || exit 1 test_rev_parse 'in repo.git' false true false cd objects || exit 1 test_rev_parse 'in repo.git/objects' false true false +cd ../work2 || exit 1 +test_rev_parse 'in repo.git/work2' false true false cd ../work || exit 1 test_rev_parse 'in repo.git/work' false true true '' cd sub/dir || exit 1 -- cgit v0.10.2-6-g49f6 From ff9c0825cfb1840238b6019dddb52763ed96fc82 Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Wed, 26 May 2010 10:46:41 +0200 Subject: completion: --set-upstream option for git-branch Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 545bd4b..57245a8 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -797,6 +797,7 @@ _git_branch () __gitcomp " --color --no-color --verbose --abbrev= --no-abbrev --track --no-track --contains --merged --no-merged + --set-upstream " ;; *) -- cgit v0.10.2-6-g49f6 From 70b89f871e1afa1fe3ffa22bf3e2043d4405954a Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Wed, 26 May 2010 16:24:34 +0200 Subject: Makefile: reenable install with NO_CURL Setting NO_CURL leaves some variables like REMOTE_CURL_ALIASES empty, which creates no fun when for-looping over $(REMOTE_CURL_ALIASES) unconditionally. Make it conditional. Reported-by: Paul Walker Signed-off-by: Michael J Gruber Signed-off-by: Junio C Hamano diff --git a/Makefile b/Makefile index 5b86806..02d6ea3 100644 --- a/Makefile +++ b/Makefile @@ -1841,12 +1841,13 @@ endif ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \ cp "$$execdir/git$X" "$$execdir/$$p" || exit; \ done; } && \ - { for p in $(REMOTE_CURL_ALIASES); do \ + { test x"$(REMOTE_CURL_ALIASES)" = x || \ + { for p in $(REMOTE_CURL_ALIASES); do \ $(RM) "$$execdir/$$p" && \ ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \ ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \ cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \ - done; } && \ + done; } ; } && \ ./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X" install-doc: -- cgit v0.10.2-6-g49f6