From: Linus Torvalds <torvalds@osdl.org>
To: Petr Baudis <pasky@suse.cz>
Cc: Junio C Hamano <junkio@cox.net>, Git Mailing List <git@vger.kernel.org>
Subject: Re: git-rev-list: add "--dense" flag
Date: Fri, 21 Oct 2005 18:26:27 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0510211814050.10477@g5.osdl.org> (raw)
In-Reply-To: <20051022003733.GA8351@pasky.or.cz>
On Sat, 22 Oct 2005, Petr Baudis wrote:
>
> There is no documentation for the --dense flag and it is even missing
> from the usage string.
I'm not much for docs ;)
The whole path argument also isn't even there (and without paths, --dense
doesn't matter)
> But my main concern is - will it be possible to do the rename detection
> here as well?
Yes. Note that git-rev-list doesn't actually _do_ the diff, it only checks
whether the tree is changed. You still just get a list of commits out of
it, and it is up to you to decide what to do with it.
If you're just going to feed them to diff-tree _anyway_, then you might as
well not even do the dense thing, because quite frankly, you're just doing
extra work.
But let's say that you want to follow a certain filename, what you can do
is basically (fake shell syntax with "goto restart")
rev=HEAD
restart:
git-rev-list $rev --dense --parents -- "$filename" |
while read commit parent1 restofparents
do
if [ "$restofparents" ]; then
.. it's a merge, do whatever it is you do
with merges ..
else
shaold=$(git-ls-tree $parent -- "$filename")
shanew=$(git-ls-tree $commit -- "$filename")
# Did it disappear?
# Maybe it got renamed from something
if [ -z "$shaold" ]; then
old=$(git-diff-tree -M -r $commit |
grep " R .* $filename")
echo "rename? $old"
filename=figure-it-out-from-$old
rev=$parent
goto restart
fi
git-diff-tree -p $commit -- "$filename"
fi
while
or something similar.
In other words: you'll basically have to figure out the renames on your
own, and follow the renaming, but something like the above should do it.
Linus
next prev parent reply other threads:[~2005-10-22 1:26 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-21 23:40 git-rev-list: add "--dense" flag Linus Torvalds
2005-10-21 23:47 ` Linus Torvalds
2005-10-21 23:55 ` Linus Torvalds
2005-10-22 0:37 ` Petr Baudis
2005-10-22 0:47 ` Handling renames Petr Baudis
2005-10-22 1:28 ` Linus Torvalds
2005-10-22 1:51 ` Petr Baudis
2005-10-22 2:10 ` Junio C Hamano
2005-10-22 2:49 ` Petr Baudis
2005-10-22 3:23 ` Linus Torvalds
2005-10-22 1:26 ` Linus Torvalds [this message]
2005-10-22 2:56 ` git-rev-list: add "--dense" flag Petr Baudis
2005-10-22 3:30 ` Linus Torvalds
2005-10-22 3:55 ` Junio C Hamano
2005-10-22 20:37 ` Linus Torvalds
2005-10-25 18:07 ` Jonas Fonseca
2005-10-25 18:23 ` Linus Torvalds
2005-10-25 18:40 ` Jonas Fonseca
2005-10-25 18:52 ` Linus Torvalds
2005-10-25 18:50 ` Linus Torvalds
-- strict thread matches above, loose matches on Subject: below --
2005-10-23 19:30 Marco Costalba
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=Pine.LNX.4.64.0510211814050.10477@g5.osdl.org \
--to=torvalds@osdl.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=pasky@suse.cz \
/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).