From: Zack Brown Date: Sat, 14 May 2005 16:02:13 GMT Subject: Re: [PATCH] Add --author match to git-rev-list and git-rev-tree. Message-ID: <20050514160213.GF14184@tumblerings.org> In-Reply-To: <20050514155257.GR3905@pasky.ji.cz> On Sat, May 14, 2005 at 05:52:57PM +0200, Petr Baudis wrote: > Dear diary, on Sat, May 14, 2005 at 05:06:07PM CEST, I got a letter > where Zack Brown told me that... > > On Sat, May 14, 2005 at 02:50:24AM -0700, Junio C Hamano wrote: > > > Zack Brown wondered if handling author match at core GIT level > > > would make cg-log -u go faster (JIT also can use this in jit-log > > > --author). Here is a patch to implement it. > > > > > > I considered adding author and committer strings to commit > > > objects for general use as commit objects are parsed, but I was > > > unsure about the lifetime rules of the commit objects (nobody > > > seems to free them in the current code), so refrained from doing > > > so for the time being. The code instead re-reads the commit > > > object when it needs to filter them by the author. > > > > I applied this, but can't figure out the change to make to cg-log in order to > > actually test it. > > > > - git-cat-file commit $commit | grep -e '^author ' -e '^committer ' | grep -qi "$user" || continue > > + git-cat-file --author $user commit $commit || continue > > > > sure didn't work. > > You throw that whole thing away and pass the --author parameter directly > to git-rev-(list|tree). You mean like this? Be well, Zack Use git-rev-(list|tree) --author to cg-log Signed-off-by: Zack Brown --- de641904363cd3759f132ee7c0dfaf8a2ee58388/cg-log (mode:100755) +++ uncommitted/cg-log (mode:100755) @@ -112,12 +112,20 @@ if [ "$log_end" ]; then id1="$(commit-id $log_start)" || exit 1 id2="$(commit-id $log_end)" || exit 1 - revls="git-rev-tree $id2 ^$id1" + if [ "$user" ]; then + revls="git-rev-tree --author $user $id2 ^$id1" + else + revls="git-rev-tree $id2 ^$id1" + fi revsort="sort -rn" revfmt="git-rev-tree" else id1="$(commit-id $log_start)" || exit 1 - revls="git-rev-list $id1" + if [ "$user" ]; then + revls="git-rev-list --author $user $id1" + else + revls="git-rev-list $id1" + fi revsort="cat" revfmt="git-rev-list" fi @@ -131,9 +139,6 @@ parent=$(git-cat-file commit $commit | sed -n '2s/parent //p;2Q') [ "$parent" ] && [ "$(git-diff-tree -r $commit $parent "$@")" ] || continue fi - if [ "$user" ]; then - git-cat-file commit $commit | grep -e '^author ' -e '^committer ' | grep -qi "$user" || continue - fi echo $colheader""commit ${commit%:*} $coldefault; git-cat-file commit $commit | \ while read key rest; do > > -- > Petr "Pasky" Baudis > Stuff: http://pasky.or.cz/ > C++: an octopus made by nailing extra legs onto a dog. -- Steve Taylor > - > To unsubscribe from this list: send the line "unsubscribe git" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Zack Brown