Skip to content

Commit cdaed0c

Browse files
stefanbellergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c87b653 commit cdaed0c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

builtin/describe.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ static void describe(const char *arg, int last_one)
293293
unsigned long seen_commits = 0;
294294
unsigned int unannotated_cnt = 0;
295295

296+
if (debug)
297+
fprintf(stderr, _("describe %s\n"), arg);
298+
296299
if (get_oid(arg, &oid))
297300
die(_("Not a valid object name %s"), arg);
298301
cmit = lookup_commit_reference(&oid);
@@ -316,7 +319,7 @@ static void describe(const char *arg, int last_one)
316319
if (!max_candidates)
317320
die(_("no tag exactly matches '%s'"), oid_to_hex(&cmit->object.oid));
318321
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"));
320323

321324
if (!have_util) {
322325
struct hashmap_iter iter;

0 commit comments

Comments
 (0)