Skip to content

Commit 4a43d37

Browse files
René Scharfegitster
authored andcommitted
revision: add leak_pending flag
The new flag leak_pending in struct rev_info can be used to prevent prepare_revision_walk from freeing the list of pending objects. It will still forget about them, so it really is leaked. This behaviour may look weird at first, but it can be useful if the pointer to the list is saved before calling prepare_revision_walk. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 468224e commit 4a43d37

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

revision.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1974,7 +1974,8 @@ int prepare_revision_walk(struct rev_info *revs)
19741974
}
19751975
e++;
19761976
}
1977-
free(list);
1977+
if (!revs->leak_pending)
1978+
free(list);
19781979

19791980
if (revs->no_walk)
19801981
return 0;

revision.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ struct rev_info {
9797
date_mode_explicit:1,
9898
preserve_subject:1;
9999
unsigned int disable_stdin:1;
100+
unsigned int leak_pending:1;
100101

101102
enum date_mode date_mode;
102103

0 commit comments

Comments
 (0)