Skip to content

Commit c92f319

Browse files
committed
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 <[email protected]>
1 parent 4210ea6 commit c92f319

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

builtin/patch-id.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
#include "hex.h"
77
#include "parse-options.h"
88

9-
static void flush_current_id(int patchlen, struct object_id *id, struct object_id *result)
9+
static void flush_current_id(struct object_id *id, struct object_id *result)
1010
{
11-
if (patchlen)
12-
printf("%s %s\n", oid_to_hex(result), oid_to_hex(id));
11+
printf("%s %s\n", oid_to_hex(result), oid_to_hex(id));
1312
}
1413

1514
static int remove_space(char *line)
@@ -181,7 +180,8 @@ static void generate_id_list(int stable, int verbatim)
181180
oidclr(&oid);
182181
while (!feof(stdin)) {
183182
patchlen = get_one_patchid(&n, &result, &line_buf, stable, verbatim);
184-
flush_current_id(patchlen, &oid, &result);
183+
if (patchlen)
184+
flush_current_id(&oid, &result);
185185
oidcpy(&oid, &n);
186186
}
187187
strbuf_release(&line_buf);

0 commit comments

Comments
 (0)