builtin/describe.c: print debug statements earlier
When debugging, print the received argument at the start of the function instead of in the middle. This ensures that the received argument is printed in all code paths, and also allows a subsequent refactoring to not need to move the "arg" parameter. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Nov 15, 2017 at 18:00 UTC
cdaed0cf023a47cae327671fae11c10d88100ee7
1 file changed
+4
-1
builtin/describe.c
+4
-1
@@ -293,6 +293,9 @@ static void describe(const char *arg, int last_one)
293
unsigned long seen_commits = 0;
294
unsigned int unannotated_cnt = 0;
295
296
+ if (debug)
297
+ fprintf(stderr, _("describe %s\n"), arg);
298
+
299
if (get_oid(arg, &oid))
300
die(_("Not a valid object name %s"), arg);
301
cmit = lookup_commit_reference(&oid);
@@ -316,7 +319,7 @@ static void describe(const char *arg, int last_one)
319
if (!max_candidates)
320
die(_("no tag exactly matches '%s'"), oid_to_hex(&cmit->object.oid));
321
if (debug)
319
- fprintf(stderr, _("searching to describe %s\n"), arg);
322
+ fprintf(stderr, _("No exact match on refs or tags, searching to describe\n"));
323
324
if (!have_util) {
325
struct hashmap_iter iter;