From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 0/3] Enumerating reflog entries in a wrong order
Date: Fri, 8 Mar 2013 13:53:41 -0800 [thread overview]
Message-ID: <1362779624-15513-1-git-send-email-gitster@pobox.com> (raw)
The for_each_reflog_ent() function yields reflog entries from the
oldest to newer, and is inefficient when we know what we are looking
for are near the newest end (e.g. "find the nth newest reflog entry
that matches 'checkout: moving from X to Y'"). To optimize for the
common case, we introduced for_each_recent_reflog_ent() to scan only
the newest part (i.e. tail) of the reflog file, but it is difficult
to use this function correctly.
Just bite the bullet and stop working around the API that reads the
file in a wrong order. The new for_each_reflog_ent_reverse()
function gives us reflog entries from the newest to older.
Junio C Hamano (3):
for_each_reflog_ent(): extract a helper to process a single entry
for_each_recent_reflog_ent(): simplify opening of a reflog file
reflog: add for_each_reflog_ent_reverse() API
refs.c | 161 +++++++++++++++++++++++++++++++++++++++++++-----------------
refs.h | 2 +-
sha1_name.c | 48 +++++++-----------
3 files changed, 134 insertions(+), 77 deletions(-)
--
1.8.2-rc3-189-g94c4d42
next reply other threads:[~2013-03-08 21:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-08 21:53 Junio C Hamano [this message]
2013-03-08 21:53 ` [PATCH 1/3] for_each_reflog_ent(): extract a helper to process a single entry Junio C Hamano
2013-03-08 21:53 ` [PATCH 2/3] for_each_recent_reflog_ent(): simplify opening of a reflog file Junio C Hamano
2013-03-08 21:53 ` [PATCH 3/3] reflog: add for_each_reflog_ent_reverse() API 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=1362779624-15513-1-git-send-email-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).