aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-08-11 13:27:05 -0700
committerJunio C Hamano <gitster@pobox.com>2017-08-11 13:27:05 -0700
commitaec68c3dde55601796ceee5f97cc362d58a9bd54 (patch)
tree9066f91edda0fd11182151fcfdecc7d22197c5fa /contrib
parent18965625b9f59d7e776f8da55a29c675c4668fef (diff)
parentad53bf79aa4ea20a8a94af9e2df5a8311ca1e55e (diff)
downloadgit-aec68c3dde55601796ceee5f97cc362d58a9bd54.tar.gz
git-aec68c3dde55601796ceee5f97cc362d58a9bd54.tar.xz
Merge branch 'rg/rerere-train-overwrite'
The "rerere-train" script (in contrib/) learned the "--overwrite" option to allow overwriting existing recorded resolutions. * rg/rerere-train-overwrite: contrib/rerere-train: optionally overwrite existing resolutions
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/rerere-train.sh54
1 files changed, 52 insertions, 2 deletions
diff --git a/contrib/rerere-train.sh b/contrib/rerere-train.sh
index 52ad9e41f..eeee45dd3 100755
--- a/contrib/rerere-train.sh
+++ b/contrib/rerere-train.sh
@@ -3,10 +3,56 @@
# Prime rerere database from existing merge commits
me=rerere-train
-USAGE="$me rev-list-args"
+USAGE=$(cat <<-EOF
+usage: $me [--overwrite] <rev-list-args>
+
+ -h, --help show the help
+ -o, --overwrite overwrite any existing rerere cache
+EOF
+)
SUBDIRECTORY_OK=Yes
-OPTIONS_SPEC=
+
+overwrite=0
+
+while test $# -gt 0
+do
+ opt="$1"
+ case "$opt" in
+ -h|--help)
+ echo "$USAGE"
+ exit 0
+ ;;
+ -o|--overwrite)
+ overwrite=1
+ shift
+ break
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *)
+ break
+ ;;
+ esac
+done
+
+# Overwrite or help options are not valid except as first arg
+for opt in "$@"
+do
+ case "$opt" in
+ -h|--help)
+ echo "$USAGE"
+ exit 0
+ ;;
+ -o|--overwrite)
+ echo "$USAGE"
+ exit 0
+ ;;
+ esac
+done
+
. "$(git --exec-path)/git-sh-setup"
require_work_tree
cd_to_toplevel
@@ -34,6 +80,10 @@ do
# Cleanly merges
continue
fi
+ if test $overwrite = 1
+ then
+ git rerere forget .
+ fi
if test -s "$GIT_DIR/MERGE_RR"
then
git show -s --pretty=format:"Learning from %h %s" "$commit"