git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH] rerere: enable by default
Date: Sun, 06 Jun 2021 21:30:25 +0900	[thread overview]
Message-ID: <xmqqfsxvxjj2.fsf@gitster.g> (raw)

By default, the rerere machinery has been disabled since a bug in
the machinery could screw up the end user's data at the most
stressful time during the end user's workday (i.e. during conflict
resolution).

It however has been in wide use without causing much trouble (other
than, obviously, replaying a broken conflict resolution that was
recorded earlier when the user made a mismerge), and it is about
time to enable it by default.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/config/rerere.txt |  5 ++---
 rerere.c                        | 12 +++---------
 t/t2030-unresolve-info.sh       |  3 +++
 3 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/Documentation/config/rerere.txt b/Documentation/config/rerere.txt
index 40abdf6a6b..45e97fc0fa 100644
--- a/Documentation/config/rerere.txt
+++ b/Documentation/config/rerere.txt
@@ -7,6 +7,5 @@ rerere.enabled::
 	Activate recording of resolved conflicts, so that identical
 	conflict hunks can be resolved automatically, should they be
 	encountered again.  By default, linkgit:git-rerere[1] is
-	enabled if there is an `rr-cache` directory under the
-	`$GIT_DIR`, e.g. if "rerere" was previously used in the
-	repository.
+	enabled, but this configuration can be set to 'false' to
+	turn it off.
diff --git a/rerere.c b/rerere.c
index d83d58df4f..83e740d730 100644
--- a/rerere.c
+++ b/rerere.c
@@ -18,8 +18,7 @@
 #define THREE_STAGED 2
 void *RERERE_RESOLVED = &RERERE_RESOLVED;
 
-/* if rerere_enabled == -1, fall back to detection of .git/rr-cache */
-static int rerere_enabled = -1;
+static int rerere_enabled = 1; /* default to true */
 
 /* automatically update cleanly resolved paths to the index */
 static int rerere_autoupdate;
@@ -852,16 +851,11 @@ static GIT_PATH_FUNC(git_path_rr_cache, "rr-cache")
 
 static int is_rerere_enabled(void)
 {
-	int rr_cache_exists;
-
 	if (!rerere_enabled)
 		return 0;
 
-	rr_cache_exists = is_directory(git_path_rr_cache());
-	if (rerere_enabled < 0)
-		return rr_cache_exists;
-
-	if (!rr_cache_exists && mkdir_in_gitdir(git_path_rr_cache()))
+	if (!is_directory(git_path_rr_cache()) &&
+	    mkdir_in_gitdir(git_path_rr_cache()))
 		die(_("could not create directory '%s'"), git_path_rr_cache());
 	return 1;
 }
diff --git a/t/t2030-unresolve-info.sh b/t/t2030-unresolve-info.sh
index be6c84c52a..8c571ddf92 100755
--- a/t/t2030-unresolve-info.sh
+++ b/t/t2030-unresolve-info.sh
@@ -46,6 +46,7 @@ prime_resolve_undo () {
 }
 
 test_expect_success setup '
+	git config rerere.enabled false &&
 	mkdir fi &&
 	printf "a\0a" >binary &&
 	git add binary &&
@@ -127,6 +128,8 @@ test_expect_success 'unmerge with plumbing' '
 '
 
 test_expect_success 'rerere and rerere forget' '
+	# from here on, use rerere.
+	git config rerere.enabled true &&
 	mkdir .git/rr-cache &&
 	prime_resolve_undo &&
 	echo record the resolution &&
-- 
2.32.0-189-ge1556ffcec


             reply	other threads:[~2021-06-06 12:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-06 12:30 Junio C Hamano [this message]
2021-06-07  0:56 ` [PATCH] rerere: enable by default brian m. carlson
2021-06-07  9:51   ` Junio C Hamano
2021-06-07  9:50 ` Ævar Arnfjörð Bjarmason
2021-06-07 11:05   ` Junio C Hamano
2021-06-07 12:56     ` Ævar Arnfjörð Bjarmason
2021-06-07 10:34 ` Andrei Rybak
2021-06-07 16:41 ` Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqfsxvxjj2.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).