From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>,
Kyle Meyer <kyle@kyleam.com>,
git@vger.kernel.org, Sahil Dua <sahildua2305@gmail.com>,
Eric Wong <e@80x24.org>
Subject: Re: [PATCH v2 3/7] log: do not free parents when walking reflog
Date: Fri, 07 Jul 2017 10:10:54 -0700 [thread overview]
Message-ID: <xmqqwp7kb2ap.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20170707090734.x2ki7lluawf66g4a@sigill.intra.peff.net> (Jeff King's message of "Fri, 7 Jul 2017 05:07:34 -0400")
Jeff King <peff@peff.net> writes:
> When we're doing a reflog walk (instead of walking the
> actual parent pointers), we may see commits multiple times.
> For this reason, we hold on to the commit buffer for each
> commit rather than freeing it after we've showed the commit.
>
> We should do the same for the parent list. Right now this is
> just a minor optimization. But once we refactor how reflog
> walks are performed, keeping the parents will avoid
> confusing us the second time we see the commit.
>
> Signed-off-by: Jeff King <peff@peff.net>
> ---
> builtin/log.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/log.c b/builtin/log.c
> index 8ca1de9894..9c8bb3b5c3 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -374,9 +374,9 @@ static int cmd_log_walk(struct rev_info *rev)
> if (!rev->reflog_info) {
> /* we allow cycles in reflog ancestry */
> free_commit_buffer(commit);
> + free_commit_list(commit->parents);
> + commit->parents = NULL;
After step 6/7, we no longer "allow cycles in reflog ancestry", as
there will be no reflog ancestry to speak of ;-), so it would be
nice to remove the comment above in that step. But alternatively,
we can rephrase the comment here, to say something like "the same
commit can be shown multiple times while showing entries from the
reflog" instead.
> }
> - free_commit_list(commit->parents);
> - commit->parents = NULL;
> if (saved_nrl < rev->diffopt.needed_rename_limit)
> saved_nrl = rev->diffopt.needed_rename_limit;
> if (rev->diffopt.degraded_cc_to_c)
next prev parent reply other threads:[~2017-07-07 17:11 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-21 21:40 Truncating HEAD reflog on branch move brian m. carlson
2017-06-21 21:46 ` Junio C Hamano
2017-06-21 23:04 ` Kyle Meyer
2017-06-21 23:12 ` Kyle Meyer
2017-06-22 15:16 ` Jeff King
2017-06-22 18:32 ` Junio C Hamano
2017-06-22 18:45 ` Jeff King
2017-06-22 19:03 ` Junio C Hamano
2017-06-22 20:21 ` Jeff King
2017-06-22 20:32 ` Junio C Hamano
2017-06-22 21:52 ` Jeff King
2017-06-22 22:25 ` Jeff King
2017-06-23 3:13 ` Jeff King
2017-07-04 19:58 ` brian m. carlson
2017-07-04 21:24 ` Jeff King
2017-07-04 21:27 ` brian m. carlson
2017-07-04 21:28 ` Jeff King
2017-07-05 1:49 ` Junio C Hamano
2017-07-05 7:55 ` [PATCH 0/6] fixing reflog-walk oddities Jeff King
2017-07-05 7:57 ` [PATCH 1/6] reflog-walk: skip over double-null oid due to HEAD rename Jeff King
2017-07-05 17:34 ` Junio C Hamano
2017-07-05 21:21 ` Jeff King
2017-07-05 8:00 ` [PATCH 2/6] t1414: document some reflog-walk oddities Jeff King
2017-07-05 17:56 ` Junio C Hamano
2017-07-05 21:27 ` Jeff King
2017-07-05 22:45 ` Junio C Hamano
2017-07-06 7:16 ` Jeff King
2017-07-06 7:55 ` Jeff King
2017-07-06 15:42 ` Junio C Hamano
2017-07-07 5:19 ` Jeff King
2017-07-07 6:00 ` Junio C Hamano
2017-07-07 6:22 ` Jeff King
2017-07-05 20:05 ` Ramsay Jones
2017-07-05 21:30 ` Jeff King
2017-07-05 8:02 ` [PATCH 3/6] log: do not free parents when walking reflog Jeff King
2017-07-05 8:04 ` [PATCH 4/6] get_revision_1(): replace do-while with an early return Jeff King
2017-07-05 8:06 ` [PATCH 5/6] rev-list: check reflog_info before showing usage Jeff King
2017-07-05 18:07 ` Junio C Hamano
2017-07-05 21:31 ` Jeff King
2017-07-05 8:09 ` [PATCH 6/6] reflog-walk: stop using fake parents Jeff King
2017-07-07 0:32 ` Eric Wong
2017-07-07 3:02 ` Jeff King
2017-07-07 3:15 ` Jeff King
2017-07-10 9:42 ` Eric Wong
2017-07-10 11:20 ` Jeff King
2017-07-10 16:09 ` Junio C Hamano
2017-07-07 8:36 ` [PATCH v2 0/4] reflog-walk fixes for maint Jeff King
2017-07-07 8:37 ` [PATCH v2 1/4] reflog-walk: skip over double-null oid due to HEAD rename Jeff King
2017-07-07 8:39 ` [PATCH v2 2/4] reflog-walk: duplicate strings in complete_reflogs list Jeff King
2017-07-07 8:41 ` [PATCH v2 3/4] reflog-walk: don't free reflogs added to cache Jeff King
2017-07-07 8:43 ` [PATCH v2 4/4] reflog-walk: include all fields when freeing complete_reflogs Jeff King
2017-07-07 9:05 ` [PATCH v2 0/7] fixing reflog-walk oddities Jeff King
2017-07-07 9:06 ` [PATCH v2 1/7] t1414: document some " Jeff King
2017-07-07 9:21 ` Jeff King
2017-07-07 15:54 ` Kyle Meyer
2017-07-07 9:07 ` [PATCH v2 2/7] revision: disallow reflog walking with revs->limited Jeff King
2017-07-07 9:07 ` [PATCH v2 3/7] log: do not free parents when walking reflog Jeff King
2017-07-07 17:10 ` Junio C Hamano [this message]
2017-07-09 10:13 ` Jeff King
2017-07-09 16:59 ` Junio C Hamano
2017-07-10 13:27 ` Jeff King
2017-07-07 9:07 ` [PATCH v2 4/7] get_revision_1(): replace do-while with an early return Jeff King
2017-07-07 9:08 ` [PATCH v2 5/7] rev-list: check reflog_info before showing usage Jeff King
2017-07-07 9:14 ` [PATCH v2 6/7] reflog-walk: stop using fake parents Jeff King
2017-07-07 9:24 ` Jeff King
2017-07-07 15:54 ` Kyle Meyer
2017-07-09 10:08 ` Jeff King
2017-07-07 9:16 ` [PATCH v2 7/7] reflog-walk: apply --since/--until to reflog dates Jeff King
2017-07-07 20:15 ` [PATCH v2 0/4] reflog-walk fixes for maint Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqwp7kb2ap.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=e@80x24.org \
--cc=git@vger.kernel.org \
--cc=kyle@kyleam.com \
--cc=peff@peff.net \
--cc=sahildua2305@gmail.com \
--cc=sandals@crustytoothpaste.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.