git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] contrib/rerere-train: optionally overwrite existing resolutions

From
Raman Gupta <rocketraman@gmail.com>
Date
Jul 25, 2017, 22:48 UTC
Message-ID
<ae4d9b77-c47e-199b-d40f-ad5b49c5dd60@gmail.com>
In-Reply-To
<xmqqwp6wtdu0.fsf@gitster.mtv.corp.google.com>

Provide the user an option to overwrite existing resolutions using an `--overwrite` flag. This might be used, for example, if the user knows that they already have an entry in their rerere cache for a conflict, but wish to drop it and retrain based on the merge commit(s) passed to the rerere-train script.

Signed-off-by: Raman Gupta <rocketraman@gmail.com>
---
 contrib/rerere-train.sh | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)
diff --git a/contrib/rerere-train.sh b/contrib/rerere-train.sh
index 52ad9e4..e25bf8a 100755
--- a/contrib/rerere-train.sh
+++ b/contrib/rerere-train.sh
@@ -3,10 +3,38 @@
 # Prime rerere database from existing merge commits
 
 me=rerere-train
-USAGE="$me rev-list-args"
 
 SUBDIRECTORY_OK=Yes
-OPTIONS_SPEC=
+OPTS_SPEC="\
+$me [--overwrite] <rev-list-args>
+--
+h,help        show the help
+o,overwrite   overwrite any existing rerere cache
+"
+eval "$(echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?)"
+
+overwrite=0
+
+while test $# -gt 0
+do
+	opt="$1"
+	case "$opt" in
+	-o)
+		overwrite=1
+		shift
+		shift
+		;;
+	--)
+		shift
+		break
+		;;
+	*)
+		break
+		exit 1
+		;;
+	esac
+done
+
 . "$(git --exec-path)/git-sh-setup"
 require_work_tree
 cd_to_toplevel
@@ -34,6 +62,10 @@ do
 		# Cleanly merges
 		continue
 	fi
+	if [ $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"
-- 
2.9.4
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 8 in “contrib: rerere-train overwrites existing resolutions”
  1. contrib: rerere-train overwrites existing resolutionsRaman Gupta, Jul 25, 2017
  2. Junio C HamanoJul 25, 2017
  3. contrib/rerere-train: optionally overwrite existing resolutionsRaman Gupta, Jul 25, 2017
  4. Junio C HamanoJul 26, 2017
  5. Raman GuptaJul 26, 2017
  6. Junio C HamanoJul 26, 2017
  7. Raman GuptaJul 28, 2017
  8. contrib/rerere-train: optionally overwrite existing resolutionsRaman Gupta, Jul 26, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.