]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Meta/amlook: look in the text log first
authorJunio C Hamano <gitster@pobox.com>
Tue, 31 May 2011 19:56:57 +0000 (12:56 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 31 May 2011 19:56:57 +0000 (12:56 -0700)
as it is much faster than grepping from the notes tree.

amlook

diff --git a/amlook b/amlook
index 5c270d6da3e8f511989ff234dc842f2bcf073b89..809386b97a549c6d3da21babc9d101e36e942bd2 100755 (executable)
--- a/amlook
+++ b/amlook
@@ -6,11 +6,15 @@
 
 find_commit () {
        in=
-       # I know I know there should be "notes grep" command...
-       commits=$(
-               git grep -l -e "$1" notes/amlog |
-               sed -e 's|^notes/amlog:||' -e 's|/||g'
-       )
+       commits=$(sed -ne "s|^\([0-9a-f]\{40\}\) $1|\1|p" .git/am.log)
+       if test -z "$commits"
+       then
+               # I know I know there should be "notes grep" command...
+               commits=$(
+                       git grep -l -e "$1" notes/amlog |
+                       sed -e 's|^notes/amlog:||' -e 's|/||g'
+               )
+       fi
        if test -z "$commits"
        then
                echo "Never applied"