Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Wijen <ben@wijen.net>2020-07-10 11:47:32 +0300
committerJunio C Hamano <gitster@pobox.com>2020-07-10 21:43:29 +0300
commitdfaa209a79a831e8ff4f6b8e14a8b0c35b4f6b6e (patch)
treef20e0b5a062deec373346cb6782f6757eac132e1 /t/t5601-clone.sh
parenta08a83db2bf27f015bec9a435f6d73e223c21c5e (diff)
git clone: don't clone into non-empty directory
When using git clone with --separate-git-dir realgitdir and realgitdir already exists, it's content is destroyed. So, make sure we don't clone into an existing non-empty directory. When d45420c1 (clone: do not clean up directories we didn't create, 2018-01-02) tightened the clean-up procedure after a failed cloning into an empty directory, it assumed that the existing directory given is an empty one so it is OK to keep that directory, while running the clean-up procedure that is designed to remove everything in it (since there won't be any, anyway). Check and make sure that the $GIT_DIR is empty even cloning into an existing repository. Signed-off-by: Ben Wijen <ben@wijen.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5601-clone.sh')
-rwxr-xr-xt/t5601-clone.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 84ea2a3eb7..eb9a093e25 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -271,7 +271,9 @@ test_expect_success 'fetch from gitfile parent' '
test_expect_success 'clone separate gitdir where target already exists' '
rm -rf dst &&
- test_must_fail git clone --separate-git-dir realgitdir src dst
+ echo foo=bar >>realgitdir/config &&
+ test_must_fail git clone --separate-git-dir realgitdir src dst &&
+ grep foo=bar realgitdir/config
'
test_expect_success 'clone --reference from original' '