builtin/describe.c: print debug statements earlier
authorStefan Beller <sbeller@google.com>
Thu, 16 Nov 2017 02:00:37 +0000 (18:00 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 16 Nov 2017 02:12:51 +0000 (11:12 +0900)
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>
builtin/describe.c
index fd61f463cf819941dfa05dfc1d01185b2aca8fd3..3136efde318b9b3eb319296b4650b437dd2d455e 100644 (file)
@@ -293,6 +293,9 @@ static void describe(const char *arg, int last_one)
        unsigned long seen_commits = 0;
        unsigned int unannotated_cnt = 0;
 
+       if (debug)
+               fprintf(stderr, _("describe %s\n"), arg);
+
        if (get_oid(arg, &oid))
                die(_("Not a valid object name %s"), arg);
        cmit = lookup_commit_reference(&oid);
@@ -316,7 +319,7 @@ static void describe(const char *arg, int last_one)
        if (!max_candidates)
                die(_("no tag exactly matches '%s'"), oid_to_hex(&cmit->object.oid));
        if (debug)
-               fprintf(stderr, _("searching to describe %s\n"), arg);
+               fprintf(stderr, _("No exact match on refs or tags, searching to describe\n"));
 
        if (!have_util) {
                struct hashmap_iter iter;