From: Jonathan Nieder <jrnieder@gmail.com>
To: Benjamin C Meyer <bmeyer@rim.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/4] pull: use --quiet rather than 2>/dev/null
Date: Sat, 20 Mar 2010 07:35:20 -0500 [thread overview]
Message-ID: <20100320123520.GA29041@progeny.tock> (raw)
In-Reply-To: <1269051518-25099-2-git-send-email-bmeyer@rim.com>
Benjamin C Meyer wrote:
> - for reflog in $(git rev-list -g $remoteref 2>/dev/null)
> + for reflog in $(git rev-list --quiet -g $remoteref)
Are you sure? My local copy of git-rev-list.1 says
--quiet
Don’t print anything to standard output. This form is primarily meant
to allow the caller to test the exit status to see if a range of
objects is fully connected (or not). It is faster than redirecting
stdout to /dev/null as the output does not have to be formatted.
A similar question applies to the other patches in this series: are
you sure they suppress the right output? (I haven’t checked, just
asking.)
Aside: that for loop looks like it could be improved. Maybe it is worth
factoring this into a separate function, something like:
old_upstream() {
remoteref=$1 &&
curr_branch=$2 &&
oldremoteref="$(git rev-parse -q --verify "$remoteref")" &&
{ git rev-list -g "$remoteref" 2>/dev/null || return $?; } |
while read reflog
do
if test -z "$(git rev-list "$curr_branch".."$reflog" | head -n 1)"
then
printf "%s\n" "$reflog"
return 0
fi
done &&
printf "%s\n" "$oldremoteref"
}
In other words, we can avoid walking the whole reflog before starting
to look for an ancestor for the current branch.
Jonathan
next prev parent reply other threads:[~2010-03-20 12:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-20 2:18 [PATCH 1/4] stash: use --quiet rather than using 2>/dev/null Benjamin C Meyer
2010-03-20 2:18 ` [PATCH 2/4] pull: use --quiet rather than 2>/dev/null Benjamin C Meyer
2010-03-20 12:35 ` Jonathan Nieder [this message]
2010-03-20 18:59 ` Benjamin Meyer
2010-03-21 4:33 ` Jonathan Nieder
2010-03-21 17:34 ` Benjamin Meyer
2010-03-23 3:23 ` Jonathan Nieder
2010-03-20 2:18 ` [PATCH 3/4] rebase: " Benjamin C Meyer
2010-03-20 2:18 ` [PATCH 4/4] rebase-interactive: " Benjamin C Meyer
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=20100320123520.GA29041@progeny.tock \
--to=jrnieder@gmail.com \
--cc=bmeyer@rim.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).