diff mbox series

[v2,3/9] ref-filter: modify error messages in `grab_objectname()`

Message ID 65fee332a3819fcaaf557d4c29e414350e62c5db.1596664306.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series Improvements to ref-filter | expand

Commit Message

Jean-Noël Avila via GitGitGadget Aug. 5, 2020, 9:51 p.m. UTC
From: Hariom Verma <hariom18599@gmail.com>

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>
---
 ref-filter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/ref-filter.c b/ref-filter.c
index d078f893ff..4183ee2797 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -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;
 }