diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-06-01 15:15:35 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-06-01 15:15:35 +0900 |
commit | 026b8ef9f7ca69c2669fd092ca42bc5b6244f36d (patch) | |
tree | 68131e4bdcb92c8593a275d66785cc43c60457c4 | |
parent | Merge branch 'cc/tests-without-assuming-ref-files-backend' (diff) | |
parent | fetch: do not pass ref-prefixes for fetch by exact SHA1 (diff) | |
download | tgif-026b8ef9f7ca69c2669fd092ca42bc5b6244f36d.tar.xz |
Merge branch 'bw/ref-prefix-for-configured-refspec'
* bw/ref-prefix-for-configured-refspec:
fetch: do not pass ref-prefixes for fetch by exact SHA1
-rw-r--r-- | refspec.c | 2 | ||||
-rw-r--r-- | refspec.h | 4 | ||||
-rwxr-xr-x | t/t5516-fetch-push.sh | 19 |
3 files changed, 25 insertions, 0 deletions
@@ -202,6 +202,8 @@ void refspec_ref_prefixes(const struct refspec *rs, const struct refspec_item *item = &rs->items[i]; const char *prefix = NULL; + if (item->exact_sha1) + continue; if (rs->fetch == REFSPEC_FETCH) prefix = item->src; else if (item->dst) @@ -42,6 +42,10 @@ void refspec_clear(struct refspec *rs); int valid_fetch_refspec(const char *refspec); struct argv_array; +/* + * Determine what <prefix> values to pass to the peer in ref-prefix lines + * (see Documentation/technical/protocol-v2.txt). + */ void refspec_ref_prefixes(const struct refspec *rs, struct argv_array *ref_prefixes); diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index f4d28288f0..a5077d8b7c 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -1121,6 +1121,25 @@ test_expect_success 'fetch exact SHA1' ' ) ' +test_expect_success 'fetch exact SHA1 in protocol v2' ' + mk_test testrepo heads/master hidden/one && + git push testrepo master:refs/hidden/one && + git -C testrepo config transfer.hiderefs refs/hidden && + check_push_result testrepo $the_commit hidden/one && + + mk_child testrepo child && + git -C child config protocol.version 2 && + + # make sure $the_commit does not exist here + git -C child repack -a -d && + git -C child prune && + test_must_fail git -C child cat-file -t $the_commit && + + # fetching the hidden object succeeds by default + # NEEDSWORK: should this match the v0 behavior instead? + git -C child fetch -v ../testrepo $the_commit:refs/heads/copy +' + for configallowtipsha1inwant in true false do test_expect_success "shallow fetch reachable SHA1 (but not a ref), allowtipsha1inwant=$configallowtipsha1inwant" ' |