Merge branch 'af/clone-revision-v0-segfault-fix' into jch
'git clone --revision' talking to a server that does not support protocol v2 (falling back to protocol v0) segfaulted, which has been corrected. * af/clone-revision-v0-segfault-fix: builtin/clone: fix segfault when using --revision with protocol v0jch
commit
0e593abde0
|
|
@ -557,7 +557,7 @@ static void update_remote_refs(const struct ref *refs,
|
|||
write_followtags(refs, msg);
|
||||
}
|
||||
|
||||
if (remote_head_points_at && !option_bare) {
|
||||
if (remote_head_points_at && remote_head_points_at->peer_ref && !option_bare) {
|
||||
struct strbuf head_ref = STRBUF_INIT;
|
||||
strbuf_addstr(&head_ref, branch_top);
|
||||
strbuf_addstr(&head_ref, "HEAD");
|
||||
|
|
|
|||
|
|
@ -90,6 +90,14 @@ test_expect_success 'clone with --revision and --bare' '
|
|||
test_must_fail git -C dst config remote.origin.fetch
|
||||
'
|
||||
|
||||
test_expect_success 'clone with --revision and protocol v0' '
|
||||
test_when_finished "rm -rf dst" &&
|
||||
git -c protocol.version=0 clone --no-local --revision=refs/heads/main . dst &&
|
||||
git rev-parse refs/heads/main >expect &&
|
||||
git -C dst rev-parse HEAD >actual &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
test_expect_success 'clone with --revision being a short raw commit hash' '
|
||||
test_when_finished "rm -rf dst" &&
|
||||
oid=$(git rev-parse --short refs/heads/feature) &&
|
||||
|
|
|
|||
Loading…
Reference in New Issue