Skip to content

Commit 45ed4af

Browse files
committed
Merge branch 'jk/maint-clone-shared-no-connectivity-validation'
"git clone -s/-l" is a filesystem level copy and does not offer any protection against source repository being corrupt. While the connectivity validation checks commits and trees being readable, it made the otherwise instantaneous local modes of clone much more expensive, without protecting blob data from bitflips. * jk/maint-clone-shared-no-connectivity-validation: clone: drop connectivity check for local clones
2 parents db1a848 + 125a05f commit 45ed4af

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

builtin/clone.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -545,17 +545,20 @@ static void update_remote_refs(const struct ref *refs,
545545
const struct ref *remote_head_points_at,
546546
const char *branch_top,
547547
const char *msg,
548-
struct transport *transport)
548+
struct transport *transport,
549+
int check_connectivity)
549550
{
550551
const struct ref *rm = mapped_refs;
551552

552-
if (0 <= option_verbosity)
553-
printf(_("Checking connectivity... "));
554-
if (check_everything_connected_with_transport(iterate_ref_map,
555-
0, &rm, transport))
556-
die(_("remote did not send all necessary objects"));
557-
if (0 <= option_verbosity)
558-
printf(_("done\n"));
553+
if (check_connectivity) {
554+
if (0 <= option_verbosity)
555+
printf(_("Checking connectivity... "));
556+
if (check_everything_connected_with_transport(iterate_ref_map,
557+
0, &rm, transport))
558+
die(_("remote did not send all necessary objects"));
559+
if (0 <= option_verbosity)
560+
printf(_("done\n"));
561+
}
559562

560563
if (refs) {
561564
write_remote_refs(mapped_refs);
@@ -963,7 +966,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
963966
transport_fetch_refs(transport, mapped_refs);
964967

965968
update_remote_refs(refs, mapped_refs, remote_head_points_at,
966-
branch_top.buf, reflog_msg.buf, transport);
969+
branch_top.buf, reflog_msg.buf, transport, !is_local);
967970

968971
update_head(our_head_points_at, remote_head, reflog_msg.buf);
969972

t/t5710-info-alternate.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ test_expect_success 'creating too deep nesting' \
5858
git clone -l -s D E &&
5959
git clone -l -s E F &&
6060
git clone -l -s F G &&
61-
test_must_fail git clone --bare -l -s G H'
61+
git clone --bare -l -s G H'
62+
63+
test_expect_success 'invalidity of deepest repository' \
64+
'cd H && {
65+
test_valid_repo
66+
test $? -ne 0
67+
}'
6268

6369
cd "$base_dir"
6470

0 commit comments

Comments
 (0)