From 82823118b9cd397d6b626cc86a0e555069ea8253 Mon Sep 17 00:00:00 2001 From: Jonathan Tan Date: Thu, 15 Jul 2021 10:44:32 -0700 Subject: fetch: die on invalid --negotiation-tip hash If a full hexadecimal hash is given as a --negotiation-tip to "git fetch", and that hash does not correspond to an object, "git fetch" will segfault if --negotiate-only is given and will silently ignore that hash otherwise. Make these cases fatal errors, just like the case when an invalid ref name or abbreviated hash is given. While at it, mark the error messages as translatable. Signed-off-by: Jonathan Tan Signed-off-by: Junio C Hamano --- builtin/fetch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/fetch.c b/builtin/fetch.c index dfde96a435..0aeb043840 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1428,7 +1428,9 @@ static void add_negotiation_tips(struct git_transport_options *smart_options) if (!has_glob_specials(s)) { struct object_id oid; if (get_oid(s, &oid)) - die("%s is not a valid object", s); + die(_("%s is not a valid object"), s); + if (!has_object(the_repository, &oid, 0)) + die(_("the object %s does not exist"), s); oid_array_append(oids, &oid); continue; } -- cgit v1.2.3