2 # Copyright (c) 2008, Nanako Shiraishi
3 # Prime rerere database from existing merge commits
6 USAGE
="$me rev-list-args"
14 # Remember original branch
15 branch
=$
(git symbolic-ref
-q HEAD
) ||
16 original_HEAD
=$
(git rev-parse
--verify HEAD
) ||
{
17 echo >&2 "Not on any branch and no commit yet?"
21 mkdir
-p "$GIT_DIR/rr-cache" ||
exit
23 git rev-list
--parents "$@" |
24 while read commit parent1 other_parents
26 if test -z "$other_parents"
31 git checkout
-q "$parent1^0"
32 if git merge
$other_parents >/dev
/null
2>&1
37 if test -s "$GIT_DIR/MERGE_RR"
39 git show
-s --pretty=format
:"Learning from %h %s" "$commit"
41 git checkout
-q $commit -- .
49 git checkout
"$original_HEAD"
51 git checkout
"${branch#refs/heads/}"