diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-05-30 05:16:43 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-05-30 05:16:43 +0300 |
commit | 02c531eba2925d89856baca8dc6a9d1b31bc4d7f (patch) | |
tree | ab20395eb52069bdd6c1ba24df70c4721388777e /t | |
parent | 07d4c760056b930246d5db1545c32d3cecd9d257 (diff) | |
parent | fdb69d33c43eb56a564a3e1c805dea4b29162667 (diff) |
Merge branch 'jt/fetch-allow-tip-sha1-implicitly'
There is no good reason why "git fetch $there $sha1" should fail
when the $sha1 names an object at the tip of an advertised ref,
even when the other side hasn't enabled allowTipSHA1InWant.
* jt/fetch-allow-tip-sha1-implicitly:
fetch-pack: always allow fetching of literal SHA1s
Diffstat (limited to 't')
-rwxr-xr-x | t/t5500-fetch-pack.sh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index b5865b385d..80a1a3239a 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -547,6 +547,41 @@ test_expect_success 'fetch-pack can fetch a raw sha1' ' git fetch-pack hidden $(git -C hidden rev-parse refs/hidden/one) ' +test_expect_success 'fetch-pack can fetch a raw sha1 that is advertised as a ref' ' + rm -rf server client && + git init server && + test_commit -C server 1 && + + git init client && + git -C client fetch-pack ../server \ + $(git -C server rev-parse refs/heads/master) +' + +test_expect_success 'fetch-pack can fetch a raw sha1 overlapping a named ref' ' + rm -rf server client && + git init server && + test_commit -C server 1 && + test_commit -C server 2 && + + git init client && + git -C client fetch-pack ../server \ + $(git -C server rev-parse refs/tags/1) refs/tags/1 +' + +test_expect_success 'fetch-pack cannot fetch a raw sha1 that is not advertised as a ref' ' + rm -rf server && + + git init server && + test_commit -C server 5 && + git -C server tag -d 5 && + test_commit -C server 6 && + + git init client && + test_must_fail git -C client fetch-pack ../server \ + $(git -C server rev-parse refs/heads/master^) 2>err && + test_i18ngrep "Server does not allow request for unadvertised object" err +' + check_prot_path () { cat >expected <<-EOF && Diag: url=$1 |