Skip to content

Commit e741c07

Browse files
ttaylorrgitster
authored andcommitted
builtin/pack-objects.c: remove unnecessary strbuf_reset()
When reading input with the `--cruft` option, `git pack-objects` reads each line into a strbuf, and then moves it to either the list of discarded or fresh packs, depending on whether or not the input line starts with a '-' character. At the beginning of each loop iteration, the next line of input is read with `strbuf_getline()`, which calls `strbuf_reset()` (as a part of `strbuf_getwholeline()`) before reading the next line of input. Thus, the call to `strbuf_reset()` (added back in b757353 (builtin/pack-objects.c: --cruft without expiration, 2022-05-20)) at the end of the loop is unnecessary, so let's remove it accordingly. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5dc72c0 commit e741c07

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

builtin/pack-objects.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3603,7 +3603,6 @@ static void read_cruft_objects(void)
36033603
string_list_append(&discard_packs, buf.buf + 1);
36043604
else
36053605
string_list_append(&fresh_packs, buf.buf);
3606-
strbuf_reset(&buf);
36073606
}
36083607

36093608
string_list_sort(&discard_packs);

0 commit comments

Comments
 (0)