From: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: Linus Torvalds <torvalds@osdl.org>,
Junio C Hamano <junkio@cox.net>,
git@vger.kernel.org
Subject: Re: [ANNOUNCE] GIT 1.4.3
Date: Sat, 21 Oct 2006 16:29:38 +0200 [thread overview]
Message-ID: <453A2ED2.1000709@lsrfire.ath.cx> (raw)
In-Reply-To: <20061021021235.GA29920@ftp.linux.org.uk>
Al Viro schrieb:
> Speaking of irritations... There is a major (and AFAICS fixable)
> suckitude in git-cherry.
[...]
> For one thing, there are better ways to do set comparison than creating
> a file for each element in one set and going through another checking
> if corresponding files exist (join(1) and sort(1) or just use perl hashes).
[...]
> Note that we are calculating a function of commit; it _never_ changes.
> Even if we don't just calculate and memorize it at commit time, a cache
> somewhere under .git would speed the things up a lot...
How about this patch? It does away with using temporary files and instead
creates persistent cache files under .git/patch-ids/. It is a very stupid
cache layout: file name = commit SHA1, file contents = patch ID. Perhaps
it needs fan-out directories like .git/objects/ has before it can be
considered for merge.
The set compare is stupid, too, but at least it is in-shell now, using a
space separated list and the is_in function.
And the cache file creation is not safe for multiple parallel git-cherry's.
It survives "make test" and is otherwise untested. Care to test drive
this prototype? :-D
Thanks,
René
diff --git a/git-cherry.sh b/git-cherry.sh
index 8832573..c88afc3 100755
--- a/git-cherry.sh
+++ b/git-cherry.sh
@@ -46,18 +46,29 @@ # not that the order in inup matters...
inup=`git-rev-list ^$ours $upstream` &&
ours=`git-rev-list $ours ^$limit` || exit
-tmp=.cherry-tmp$$
-patch=$tmp-patch
-mkdir $patch
-trap "rm -rf $tmp-*" 0 1 2 3 15
+is_in() {
+ what="$1"
+ while [ $# -gt 1 ]; do
+ shift
+ [ "$what" = "$1" ] && return 0
+ done
+ return 1
+}
+# prime patch-ID cache
+PATCH_ID_CACHE="$GIT_DIR/patch-ids"
+mkdir -p "$PATCH_ID_CACHE"
+for commit in $inup $ours; do
+ [ -f "$PATCH_ID_CACHE/$commit" ] && continue
+ set x `git-diff-tree -p $commit | git-patch-id`
+ echo "$2" >"$PATCH_ID_CACHE/$commit"
+done
+
+ids_inup=
for c in $inup
do
- git-diff-tree -p $c
-done | git-patch-id |
-while read id name
-do
- echo $name >>$patch/$id
+ read id <"$PATCH_ID_CACHE/$c"
+ ids_inup="$ids_inup $id"
done
LF='
@@ -66,10 +77,10 @@ LF='
O=
for c in $ours
do
- set x `git-diff-tree -p $c | git-patch-id`
- if test "$2" != ""
+ read id <"$PATCH_ID_CACHE/$c"
+ if test "$id" != ""
then
- if test -f "$patch/$2"
+ if is_in $id $ids_inup
then
sign=-
else
next prev parent reply other threads:[~2006-10-21 14:30 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-18 23:53 [ANNOUNCE] GIT 1.4.3 Junio C Hamano
2006-10-20 12:31 ` Horst H. von Brand
2006-10-20 13:26 ` Peter Eriksen
2006-10-20 13:26 ` Peter Eriksen
2006-10-20 23:35 ` Junio C Hamano
2006-10-21 0:14 ` Linus Torvalds
2006-10-21 0:22 ` Petr Baudis
2006-10-21 0:31 ` Linus Torvalds
2006-10-21 9:53 ` Andreas Schwab
2006-10-22 21:09 ` Anders Larsen
2006-10-22 21:09 ` Anders Larsen
2006-10-21 2:12 ` Al Viro
2006-10-21 5:29 ` Junio C Hamano
2006-10-21 5:40 ` Al Viro
2006-10-21 14:29 ` Rene Scharfe [this message]
2006-10-21 0:47 ` Nicolas Pitre
2006-10-23 0:53 ` prune/prune-packed J. Bruce Fields
2006-10-23 1:26 ` prune/prune-packed A Large Angry SCM
2006-10-23 2:36 ` [ANNOUNCE] GIT 1.4.3 J. Bruce Fields
2006-10-23 3:27 ` prune/prune-packed Junio C Hamano
2006-10-23 18:39 ` prune/prune-packed Petr Baudis
2006-10-27 21:19 ` prune/prune-packed Jon Loeliger
2006-10-27 21:55 ` prune/prune-packed Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2006-10-22 3:59 prune/prune-packed J. Bruce Fields
2006-10-22 4:59 ` prune/prune-packed Junio C Hamano
2006-10-22 23:14 ` prune/prune-packed J. Bruce Fields
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=453A2ED2.1000709@lsrfire.ath.cx \
--to=rene.scharfe@lsrfire.ath.cx \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=torvalds@osdl.org \
--cc=viro@ftp.linux.org.uk \
/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.