Skip to content

Commit 20bd35c

Browse files
committed
Merge branch 'mc/cd-p-pwd' into maint
* mc/cd-p-pwd: git-sh-setup: Fix scripts whose PWD is a symlink to a work-dir on OS X
2 parents 8561b52 + dd6c136 commit 20bd35c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

git-sh-setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ cd_to_toplevel () {
9696
..|../*|*/..|*/../*)
9797
# Interpret $cdup relative to the physical, not logical, cwd.
9898
# Probably /bin/pwd is more portable than passing -P to cd or pwd.
99-
phys="$(/bin/pwd)/$cdup"
99+
phys="$(unset PWD; /bin/pwd)/$cdup"
100100
;;
101101
*)
102102
# There's no "..", so no need to make things absolute.

t/t2300-cd-to-toplevel.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ test_cd_to_toplevel () {
1010
cd '"'$1'"' &&
1111
. git-sh-setup &&
1212
cd_to_toplevel &&
13-
[ "$(/bin/pwd)" = "$TOPLEVEL" ]
13+
[ "$(unset PWD; /bin/pwd)" = "$TOPLEVEL" ]
1414
)
1515
'
1616
}
1717

18-
TOPLEVEL="$(/bin/pwd)/repo"
18+
TOPLEVEL="$(unset PWD; /bin/pwd)/repo"
1919
mkdir -p repo/sub/dir
2020
mv .git repo/
2121
SUBDIRECTORY_OK=1

0 commit comments

Comments
 (0)