]> git.ipfire.org Git - thirdparty/git.git/commitdiff
ref-filter: modify error messages in `grab_objectname()`
authorHariom Verma <hariom18599@gmail.com>
Fri, 21 Aug 2020 21:41:45 +0000 (21:41 +0000)
committerJunio C Hamano <gitster@pobox.com>
Fri, 28 Aug 2020 20:52:50 +0000 (13:52 -0700)
As we plan to use `grab_objectname()` for `tree` and `parent` atom,
it's better to parameterize the error messages in the function
`grab_objectname()` where "objectname" is hard coded.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Heba Waly <heba.waly@gmail.com>
Signed-off-by: Hariom Verma <hariom18599@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ref-filter.c

index 9bf92db6df3d7185bd8bc0096d7be5b8aaa4a6d8..4f4591cad054c7b1ac21280195ec67ff4f167e71 100644 (file)
@@ -372,11 +372,11 @@ static int objectname_atom_parser(const struct ref_format *format, struct used_a
                atom->u.objectname.option = O_LENGTH;
                if (strtoul_ui(arg, 10, &atom->u.objectname.length) ||
                    atom->u.objectname.length == 0)
-                       return strbuf_addf_ret(err, -1, _("positive value expected objectname:short=%s"), arg);
+                       return strbuf_addf_ret(err, -1, _("positive value expected '%s' in %%(%s)"), arg, atom->name);
                if (atom->u.objectname.length < MINIMUM_ABBREV)
                        atom->u.objectname.length = MINIMUM_ABBREV;
        } else
-               return strbuf_addf_ret(err, -1, _("unrecognized %%(objectname) argument: %s"), arg);
+               return strbuf_addf_ret(err, -1, _("unrecognized argument '%s' in %%(%s)"), arg, atom->name);
        return 0;
 }