patch-id: call flush_current_id() only when needed

The caller passes a flag that is used to become no-op when calling
flush_current_id().  Instead of calling something that becomes a
no-op, teach the caller not to call it in the first place.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Junio C Hamano 2024-07-29 18:17:35 -07:00
parent 4210ea6f0f
commit c92f3195ad
1 changed files with 4 additions and 4 deletions

View File

@ -6,9 +6,8 @@
#include "hex.h" #include "hex.h"
#include "parse-options.h" #include "parse-options.h"


static void flush_current_id(int patchlen, struct object_id *id, struct object_id *result) static void flush_current_id(struct object_id *id, struct object_id *result)
{ {
if (patchlen)
printf("%s %s\n", oid_to_hex(result), oid_to_hex(id)); printf("%s %s\n", oid_to_hex(result), oid_to_hex(id));
} }


@ -181,7 +180,8 @@ static void generate_id_list(int stable, int verbatim)
oidclr(&oid); oidclr(&oid);
while (!feof(stdin)) { while (!feof(stdin)) {
patchlen = get_one_patchid(&n, &result, &line_buf, stable, verbatim); patchlen = get_one_patchid(&n, &result, &line_buf, stable, verbatim);
flush_current_id(patchlen, &oid, &result); if (patchlen)
flush_current_id(&oid, &result);
oidcpy(&oid, &n); oidcpy(&oid, &n);
} }
strbuf_release(&line_buf); strbuf_release(&line_buf);