3 # Meta/amlook <mbox (for single message from MUA) or
4 # Meta/amlook id1 id2... (from the command line)
14 # I know I know there should be "notes grep" command...
16 git
grep -l -e "$1" notes
/amlog |
17 sed -e 's|^notes/amlog:||' -e 's|/||g'
23 commits
=$
(sed -ne "s|^\([0-9a-f]\{40\}\) $1|\1|p" .git
/am.log
)
38 git branch
--with $commit
39 done |
sed -e 's|^..||' |
45 echo "Not merged ($commits)"
49 *' maint '*) in=maint
;;
50 *" $MASTER "*) in=$MASTER ;;
51 *' next '*) in=next
;;
57 echo "Found in $found"
62 cutoff_days
=${1-"180"} &&
63 git notes
--ref amlog list |
65 xargs -n 1 git show
-s --format="%ci %H" 2>/dev
/null |
67 my @time = localtime(time() - $ARGV[0] * 24 * 3600);
68 my $cutoff = sprintf("%04d-%02d-%02d 00:00:00",
69 $time[5]+1900, $time[4]+1, $time[3]);
76 ' "$cutoff_days" >..gcinput
80 GIT_INDEX_FILE
=/tmp
/amlook.$$.tmp
&&
81 export GIT_INDEX_FILE
&&
82 rm -f "$GIT_INDEX_FILE" &&
83 git read-tree refs
/notes
/amlog
&&
85 T
=$
(git write-tree
) &&
86 C
=$
(echo Prune amlog | git commit-tree
$T -p refs
/notes
/amlog
) &&
87 git update-ref
-m "Prune amlog" refs
/notes
/amlog
$C
96 # Append continuation line
103 # Hold this new line, and look at what is in the hold space
105 # Is it the Message-ID line? If so, spit out and finish.
106 /^[Mm][Ee][Ss][Ss][Aa][Gg][Ee]-[Ii][Dd]:[ ]*/{
110 # Otherwise, check if this new line is empty
112 # Is it? Then we are done with the header
114 # Otherwise we need to hold onto this header line
116 # And start the next cycle
122 elif test "$1" = "--gc"
126 elif test "$1" == "--squash"
129 git notes
--ref=$L prune
&&
130 C
=$
(echo amlog | git commit-tree refs
/$L^
{tree
}) &&
131 git update-ref refs
/$L $C