]> git.ipfire.org Git - thirdparty/git.git/commit - fetch-pack.c
fetch-pack: always allow fetching of literal SHA1s
authorJonathan Tan <jonathantanmy@google.com>
Mon, 15 May 2017 17:32:20 +0000 (10:32 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 16 May 2017 01:17:05 +0000 (10:17 +0900)
commitfdb69d33c43eb56a564a3e1c805dea4b29162667
treed8b692594ae2b1c4baea45d1df966607a7b41353
parentb06d3643105c8758ed019125a4399cb7efdcce2c
fetch-pack: always allow fetching of literal SHA1s

fetch-pack, when fetching a literal SHA-1 from a server that is not
configured with uploadpack.allowtipsha1inwant (or similar), always
returns an error message of the form "Server does not allow request for
unadvertised object %s". However, it is sometimes the case that such
object is advertised. This situation would occur, for example, if a user
or a script was provided a SHA-1 instead of a branch or tag name for
fetching, and wanted to invoke "git fetch" or "git fetch-pack" using
that SHA-1.

Teach fetch-pack to also check the SHA-1s of the refs in the received
ref advertisement if a literal SHA-1 was given by the user.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
fetch-pack.c
t/t5500-fetch-pack.sh