Code

revision: add leak_pending flag
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>
Sat, 1 Oct 2011 15:56:08 +0000 (17:56 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Oct 2011 18:04:34 +0000 (11:04 -0700)
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>
revision.c
revision.h

index 2e8aa3393a74faea41878914bd66636162d6d10c..6d329b46dc16828b78c975bc1619d8aa0fcc5b48 100644 (file)
@@ -1974,7 +1974,8 @@ int prepare_revision_walk(struct rev_info *revs)
                }
                e++;
        }
-       free(list);
+       if (!revs->leak_pending)
+               free(list);
 
        if (revs->no_walk)
                return 0;
index 45412656ddcbbf2904b8e1a86e32e456899a9718..366a9b49b0f43ee69fc43267a8f58fba19c7ae36 100644 (file)
@@ -97,6 +97,7 @@ struct rev_info {
                        date_mode_explicit:1,
                        preserve_subject:1;
        unsigned int    disable_stdin:1;
+       unsigned int    leak_pending:1;
 
        enum date_mode date_mode;