-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PATCH] Allow symlinks in the leading path in checkout-cache --prefix=
This is what Linus wrote, improving what David Greaves originally submitted. I just added a test case and verified the patch works. Author: David Greaves <[email protected]> Author: Linus Torvalds <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
- Loading branch information
Junio C Hamano
authored and
Linus Torvalds
committed
May 25, 2005
1 parent
d030935
commit d7f6ea3
Showing
2 changed files
with
110 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#!/bin/sh | ||
# | ||
# Copyright (c) 2005 Junio C Hamano | ||
# | ||
|
||
test_description='git-checkout-cache --prefix test. | ||
This test makes sure that --prefix option works as advertised, and | ||
also verifies that such leading path may contain symlinks, unlike | ||
the GIT controlled paths. | ||
' | ||
|
||
. ./test-lib.sh | ||
|
||
test_expect_success \ | ||
'setup' \ | ||
'mkdir path1 && | ||
echo frotz >path0 && | ||
echo rezrov >path1/file1 && | ||
git-update-cache --add path0 path1/file1' | ||
|
||
test_expect_success \ | ||
'have symlink in place where dir is expected.' \ | ||
'rm -fr path0 path1 && | ||
mkdir path2 && | ||
ln -s path2 path1 && | ||
git-checkout-cache -f -a && | ||
test ! -h path1 && test -d path1 && | ||
test -f path1/file1 && test ! -f path2/file1' | ||
|
||
test_expect_success \ | ||
'use --prefix=path2/' \ | ||
'rm -fr path0 path1 path2 && | ||
mkdir path2 && | ||
git-checkout-cache --prefix=path2/ -f -a && | ||
test -f path2/path0 && | ||
test -f path2/path1/file1 && | ||
test ! -f path0 && | ||
test ! -f path1/file1' | ||
|
||
test_expect_success \ | ||
'use --prefix=tmp-' \ | ||
'rm -fr path0 path1 path2 tmp* && | ||
git-checkout-cache --prefix=tmp- -f -a && | ||
test -f tmp-path0 && | ||
test -f tmp-path1/file1 && | ||
test ! -f path0 && | ||
test ! -f path1/file1' | ||
|
||
test_expect_success \ | ||
'use --prefix=tmp- but with a conflicting file and dir' \ | ||
'rm -fr path0 path1 path2 tmp* && | ||
echo nitfol >tmp-path1 && | ||
mkdir tmp-path0 && | ||
git-checkout-cache --prefix=tmp- -f -a && | ||
test -f tmp-path0 && | ||
test -f tmp-path1/file1 && | ||
test ! -f path0 && | ||
test ! -f path1/file1' | ||
|
||
# Linus fix #1 | ||
test_expect_success \ | ||
'use --prefix=tmp/orary/ where tmp is a symlink' \ | ||
'rm -fr path0 path1 path2 tmp* && | ||
mkdir tmp1 tmp1/orary && | ||
ln -s tmp1 tmp && | ||
git-checkout-cache --prefix=tmp/orary/ -f -a && | ||
test -d tmp1/orary && | ||
test -f tmp1/orary/path0 && | ||
test -f tmp1/orary/path1/file1 && | ||
test -h tmp' | ||
|
||
# Linus fix #2 | ||
test_expect_success \ | ||
'use --prefix=tmp/orary- where tmp is a symlink' \ | ||
'rm -fr path0 path1 path2 tmp* && | ||
mkdir tmp1 && | ||
ln -s tmp1 tmp && | ||
git-checkout-cache --prefix=tmp/orary- -f -a && | ||
test -f tmp1/orary-path0 && | ||
test -f tmp1/orary-path1/file1 && | ||
test -h tmp' | ||
|
||
# Linus fix #3 | ||
test_expect_success \ | ||
'use --prefix=tmp- where tmp-path1 is a symlink' \ | ||
'rm -fr path0 path1 path2 tmp* && | ||
mkdir tmp1 && | ||
ln -s tmp1 tmp-path1 && | ||
git-checkout-cache --prefix=tmp- -f -a && | ||
test -f tmp-path0 && | ||
test ! -h tmp-path1 && | ||
test -d tmp-path1 && | ||
test -f tmp-path1/file1' | ||
|