Remove unnecessary pack-*.keep file after successful git-clone
Once a clone is successful we no longer need to hold onto the .keep file created by the transport. Delete the file so we can later repack the complete repository. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
0b294c0abf
commit
1db4a75c8d
@ -337,6 +337,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
|||||||
const struct ref *refs, *head_points_at, *remote_head, *mapped_refs;
|
const struct ref *refs, *head_points_at, *remote_head, *mapped_refs;
|
||||||
char branch_top[256], key[256], value[256];
|
char branch_top[256], key[256], value[256];
|
||||||
struct strbuf reflog_msg;
|
struct strbuf reflog_msg;
|
||||||
|
struct transport *transport = NULL;
|
||||||
|
|
||||||
struct refspec refspec;
|
struct refspec refspec;
|
||||||
|
|
||||||
@ -458,8 +459,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
|||||||
refs = clone_local(path, git_dir);
|
refs = clone_local(path, git_dir);
|
||||||
else {
|
else {
|
||||||
struct remote *remote = remote_get(argv[0]);
|
struct remote *remote = remote_get(argv[0]);
|
||||||
struct transport *transport =
|
transport = transport_get(remote, remote->url[0]);
|
||||||
transport_get(remote, remote->url[0]);
|
|
||||||
|
|
||||||
if (!transport->get_refs_list || !transport->fetch)
|
if (!transport->get_refs_list || !transport->fetch)
|
||||||
die("Don't know how to clone %s", transport->url);
|
die("Don't know how to clone %s", transport->url);
|
||||||
@ -529,6 +529,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
|||||||
option_no_checkout = 1;
|
option_no_checkout = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (transport)
|
||||||
|
transport_unlock_pack(transport);
|
||||||
|
|
||||||
if (!option_no_checkout) {
|
if (!option_no_checkout) {
|
||||||
struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
|
struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
|
||||||
struct unpack_trees_options opts;
|
struct unpack_trees_options opts;
|
||||||
|
@ -17,14 +17,32 @@ test_expect_success setup '
|
|||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'clone with excess parameters' '
|
test_expect_success 'clone with excess parameters (1)' '
|
||||||
|
|
||||||
|
rm -fr dst &&
|
||||||
|
test_must_fail git clone -n src dst junk
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'clone with excess parameters (2)' '
|
||||||
|
|
||||||
|
rm -fr dst &&
|
||||||
test_must_fail git clone -n "file://$(pwd)/src" dst junk
|
test_must_fail git clone -n "file://$(pwd)/src" dst junk
|
||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'clone does not keep pack' '
|
||||||
|
|
||||||
|
rm -fr dst &&
|
||||||
|
git clone -n "file://$(pwd)/src" dst &&
|
||||||
|
! test -f dst/file &&
|
||||||
|
! (echo dst/.git/objects/pack/pack-* | grep "\.keep")
|
||||||
|
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'clone checks out files' '
|
test_expect_success 'clone checks out files' '
|
||||||
|
|
||||||
|
rm -fr dst &&
|
||||||
git clone src dst &&
|
git clone src dst &&
|
||||||
test -f dst/file
|
test -f dst/file
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user