Skip to content

Commit 81fa024

Browse files
committed
Merge branch 'maint'
* maint: Makefile: reenable install with NO_CURL completion: --set-upstream option for git-branch get_cwd_relative(): do not misinterpret suffix as subdirectory
2 parents d0b16c8 + 371276b commit 81fa024

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,12 +2008,13 @@ endif
20082008
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
20092009
cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
20102010
done; } && \
2011-
{ for p in $(REMOTE_CURL_ALIASES); do \
2011+
{ test x"$(REMOTE_CURL_ALIASES)" = x || \
2012+
{ for p in $(REMOTE_CURL_ALIASES); do \
20122013
$(RM) "$$execdir/$$p" && \
20132014
ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
20142015
ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
20152016
cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \
2016-
done; } && \
2017+
done; } ; } && \
20172018
./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
20182019

20192020
install-gitweb:

contrib/completion/git-completion.bash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,7 @@ _git_branch ()
797797
__gitcomp "
798798
--color --no-color --verbose --abbrev= --no-abbrev
799799
--track --no-track --contains --merged --no-merged
800+
--set-upstream
800801
"
801802
;;
802803
*)

dir.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -958,9 +958,14 @@ char *get_relative_cwd(char *buffer, int size, const char *dir)
958958
}
959959
if (*dir)
960960
return NULL;
961-
if (*cwd == '/')
961+
switch (*cwd) {
962+
case '\0':
963+
return cwd;
964+
case '/':
962965
return cwd + 1;
963-
return cwd;
966+
default:
967+
return NULL;
968+
}
964969
}
965970

966971
int is_inside_dir(const char *dir)

t/t1501-worktree.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ test_rev_parse() {
3030

3131
EMPTY_TREE=$(git write-tree)
3232
mkdir -p work/sub/dir || exit 1
33+
mkdir -p work2 || exit 1
3334
mv .git repo.git || exit 1
3435

3536
say "core.worktree = relative path"
@@ -54,7 +55,9 @@ GIT_DIR=$(pwd)/repo.git
5455
GIT_CONFIG=$GIT_DIR/config
5556
git config core.worktree "$(pwd)/work"
5657
test_rev_parse 'outside' false false false
57-
cd work || exit 1
58+
cd work2
59+
test_rev_parse 'outside2' false false false
60+
cd ../work || exit 1
5861
test_rev_parse 'inside' false false true ''
5962
cd sub/dir || exit 1
6063
test_rev_parse 'subdirectory' false false true sub/dir/
@@ -67,7 +70,9 @@ git config core.worktree non-existent
6770
GIT_WORK_TREE=work
6871
export GIT_WORK_TREE
6972
test_rev_parse 'outside' false false false
70-
cd work || exit 1
73+
cd work2
74+
test_rev_parse 'outside' false false false
75+
cd ../work || exit 1
7176
GIT_WORK_TREE=.
7277
test_rev_parse 'inside' false false true ''
7378
cd sub/dir || exit 1
@@ -76,6 +81,7 @@ test_rev_parse 'subdirectory' false false true sub/dir/
7681
cd ../../.. || exit 1
7782

7883
mv work repo.git/work
84+
mv work2 repo.git/work2
7985

8086
say "GIT_WORK_TREE=absolute path, work tree below git dir"
8187
GIT_DIR=$(pwd)/repo.git
@@ -86,6 +92,8 @@ cd repo.git || exit 1
8692
test_rev_parse 'in repo.git' false true false
8793
cd objects || exit 1
8894
test_rev_parse 'in repo.git/objects' false true false
95+
cd ../work2 || exit 1
96+
test_rev_parse 'in repo.git/work2' false true false
8997
cd ../work || exit 1
9098
test_rev_parse 'in repo.git/work' false true true ''
9199
cd sub/dir || exit 1

0 commit comments

Comments
 (0)