aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/patch-id.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-07-29 18:17:35 -0700
committerJunio C Hamano <gitster@pobox.com>2024-07-29 18:19:14 -0700
commitc92f3195adf61f248af5bc787def379b2db6f2e9 (patch)
tree731234bd9fe7cd72d99110450add0f97eb882dad /builtin/patch-id.c
parent4210ea6f0f2ee95370694e6a3d4fbb8ccf8c4847 (diff)
downloadgit-c92f3195adf61f248af5bc787def379b2db6f2e9.tar.gz
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>
Diffstat (limited to 'builtin/patch-id.c')
-rw-r--r--builtin/patch-id.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin/patch-id.c b/builtin/patch-id.c
index 3894d2b970..0f262e7a03 100644
--- a/builtin/patch-id.c
+++ b/builtin/patch-id.c
@@ -6,10 +6,9 @@
#include "hex.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));
}
static int remove_space(char *line)
@@ -181,7 +180,8 @@ static void generate_id_list(int stable, int verbatim)
oidclr(&oid);
while (!feof(stdin)) {
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);
}
strbuf_release(&line_buf);