Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* maint:
  Makefile: reenable install with NO_CURL
  completion: --set-upstream option for git-branch
  get_cwd_relative(): do not misinterpret suffix as subdirectory
  • Loading branch information
Junio C Hamano committed May 28, 2010
2 parents d0b16c8 + 371276b commit 81fa024
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2008,12 +2008,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-gitweb:
Expand Down
1 change: 1 addition & 0 deletions contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,7 @@ _git_branch ()
__gitcomp "
--color --no-color --verbose --abbrev= --no-abbrev
--track --no-track --contains --merged --no-merged
--set-upstream
"
;;
*)
Expand Down
9 changes: 7 additions & 2 deletions dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 10 additions & 2 deletions t/t1501-worktree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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/
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 81fa024

Please sign in to comment.