diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-10-14 12:38:52 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-10-15 14:34:45 -0700 |
commit | fb1d6dabce69bce3f28a7f442da990ef8df872ac (patch) | |
tree | e4b2b407ad99e4f8fafd38f0465cf93b5a943fbb /t/t5700-clone-reference.sh | |
parent | 3c2dc76f015b4d52ef02a08c59a4546d00b475e1 (diff) | |
download | git-fb1d6dabce69bce3f28a7f442da990ef8df872ac.tar.gz |
clone: --dissociate option to mark that reference is only temporaryjc/clone-borrow
While use of the --reference option to borrow objects from an
existing local repository of the same project is an effective way to
reduce traffic when cloning a project over the network, it makes the
resulting "borrowing" repository dependent on the "borrowed"
repository. After running
git clone --reference=P $URL Q
the resulting repository Q will be broken if the borrowed repository
P disappears.
The way to allow the borrowed repository to be removed is to repack
the borrowing repository (i.e. run "git repack -a -d" in Q); while
power users may know it very well, it is not easily discoverable.
Teach a new "--dissociate" option to "git clone" to run this
repacking for the user.
Helped-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5700-clone-reference.sh')
-rwxr-xr-x | t/t5700-clone-reference.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/t/t5700-clone-reference.sh b/t/t5700-clone-reference.sh index 6537911a43..3e783fc450 100755 --- a/t/t5700-clone-reference.sh +++ b/t/t5700-clone-reference.sh @@ -198,4 +198,21 @@ test_expect_success 'clone using repo pointed at by gitfile as reference' ' test_cmp expected "$base_dir/O/.git/objects/info/alternates" ' +test_expect_success 'clone and dissociate from reference' ' + git init P && + ( + cd P && test_commit one + ) && + git clone P Q && + ( + cd Q && test_commit two + ) && + git clone --no-local --reference=P Q R && + git clone --no-local --reference=P --dissociate Q S && + # removing the reference P would corrupt R but not S + rm -fr P && + test_must_fail git -C R fsck && + git -C S fsck +' + test_done |