[PATCH 1/3] mergetools/kdiff3: do not use --auto when diffing

Subsystems: the rest

DORMANTno replies

5 messages, 2 authors, 2016-06-15 · open the first message on its own page

[PATCH 1/3] mergetools/kdiff3: do not use --auto when diffing

From: David Aguilar <hidden>
Date: 2016-06-15 22:57:11

The `kdiff3 --auto` help message is, "No GUI if all conflicts are auto-
solvable."  This flag was carried over from the original mergetool
commands.  diff_cmd() is for two-way comparisons only so remove the
superfluous flag.

Signed-off-by: David Aguilar <redacted>
---
This one is not RFC; just a trivial fix.

 mergetools/kdiff3 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mergetools/kdiff3 b/mergetools/kdiff3
index 28fead4..a30034f 100644
--- a/mergetools/kdiff3
+++ b/mergetools/kdiff3
@@ -1,5 +1,5 @@
 diff_cmd () {
-	"$merge_tool_path" --auto \
+	"$merge_tool_path" \
 		--L1 "$MERGED (A)" --L2 "$MERGED (B)" \
 		"$LOCAL" "$REMOTE" >/dev/null 2>&1
 }
-- 
1.8.3.rc1.38.g0f1704c

[RFC PATCH 2/3] mergetools/kdiff3: allow opting-out of auto-merges

From: David Aguilar <hidden>
Date: 2016-06-15 22:57:11

By default, "git mergetool" passes the `--auto` flag to `kdiff3` when
merging a file.  The `--auto` flag tells `kdiff3` to skip showing the
GUI and automatically save the merged result when it is able to
trivially resolve a merge.

Some users prefer to eyeball the merged result using mergetool and the
use of `--auto` prevents them from doing so.  Add a configuration
variable to allow opting-out of the auto-merge feature.

Signed-off-by: David Aguilar <redacted>
---
Marked "RFC" because I am kinda against adding more configuration
variables.  Someone ran into this and I did personally find the
behavior a bit surprising.  Alternatively, we *could* change the
default behavior, but I am not convinced that doing so is a good idea
either, hence this patch.  Other then the "kinda against",
it does make the behavior less surprising.

 Documentation/merge-config.txt |  9 +++++++++
 mergetools/kdiff3              | 20 ++++++++++++++++++--
 2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/Documentation/merge-config.txt b/Documentation/merge-config.txt
index d78d6d8..3bd5f21 100644
--- a/Documentation/merge-config.txt
+++ b/Documentation/merge-config.txt
@@ -59,6 +59,15 @@ merge.tool::
 
 include::mergetools-merge.txt[]
 
+mergetool.kdiff3.manualMerge::
+	Tell Git that not to use `kdiff3`'s auto-merge feature.
+	By default, "git mergetool" passes the `--auto` flag to `kdiff3`
+	when merging a file.  The `--auto` flag tells `kdiff3` to skip
+	showing the GUI and automatically save the merged result when it
+	is able to trivially resolve a merge.  The `--auto` flag will
+	not be used when this variable is set to `true`.  False by
+	default.
+
 merge.verbosity::
 	Controls the amount of output shown by the recursive merge
 	strategy.  Level 0 outputs nothing except a final error
diff --git a/mergetools/kdiff3 b/mergetools/kdiff3
index a30034f..d0acda9 100644
--- a/mergetools/kdiff3
+++ b/mergetools/kdiff3
@@ -1,3 +1,18 @@
+kdiff3_initialized=
+kdiff3_args=--auto
+
+kdiff3_init () {
+	if test -n "$kdiff3_initialized"
+	then
+		return
+	fi
+	if test "$(git config --bool mergetool.kdiff3.manualMerge)" = true
+	then
+		kdiff3_args=
+	fi
+	kdiff3_initialized=true
+}
+
 diff_cmd () {
 	"$merge_tool_path" \
 		--L1 "$MERGED (A)" --L2 "$MERGED (B)" \
@@ -5,16 +20,17 @@ diff_cmd () {
 }
 
 merge_cmd () {
+	kdiff3_init
 	if $base_present
 	then
-		"$merge_tool_path" --auto \
+		"$merge_tool_path" $kdiff3_args \
 			--L1 "$MERGED (Base)" \
 			--L2 "$MERGED (Local)" \
 			--L3 "$MERGED (Remote)" \
 			-o "$MERGED" "$BASE" "$LOCAL" "$REMOTE" \
 		>/dev/null 2>&1
 	else
-		"$merge_tool_path" --auto \
+		"$merge_tool_path" $kdiff3_args \
 			--L1 "$MERGED (Local)" \
 			--L2 "$MERGED (Remote)" \
 			-o "$MERGED" "$LOCAL" "$REMOTE" \
-- 
1.8.3.rc1.38.g0f1704c

[RFC PATCH 3/3] Makefile: avoid deprecation warnings on OS X 10.8

From: David Aguilar <hidden>
Date: 2016-06-15 22:57:11

Mac OS X Mountain Lion prints warnings when building git:

	warning: 'SHA1_Init' is deprecated
	(declared at /usr/include/openssl/sha.h:121)

Silence the warnings by disabling OpenSSH in favor of BLK_SHA1.

Signed-off-by: David Aguilar <redacted>
---
I know I can create config.mak, but do we prefer to have the default
settings be warning-free?  I do not see any other platforms that tweak
NO_OPENSSL themselves, hence "RFC".  Is there a better way to do this?
Are there any Darwin/PPC users that would be harmed by this patch?

 Makefile | 1 +
 1 file changed, 1 insertion(+)
diff --git a/Makefile b/Makefile
index 0f931a2..3bb9ac2 100644
--- a/Makefile
+++ b/Makefile
@@ -1055,6 +1055,7 @@ ifeq ($(uname_S),Darwin)
 		endif
 	endif
 	PTHREAD_LIBS =
+	NO_OPENSSL = YesPlease
 endif
 
 ifndef CC_LD_DYNPATH
-- 
1.8.3.rc1.38.g0f1704c

Re: [RFC PATCH 3/3] Makefile: avoid deprecation warnings on OS X 10.8

From: John Keeping <hidden>
Date: 2016-06-15 22:57:11

On Thu, May 09, 2013 at 02:13:30AM -0700, David Aguilar wrote:
Mac OS X Mountain Lion prints warnings when building git:

	warning: 'SHA1_Init' is deprecated
	(declared at /usr/include/openssl/sha.h:121)

Silence the warnings by disabling OpenSSH in favor of BLK_SHA1.

Signed-off-by: David Aguilar <redacted>
---
I know I can create config.mak, but do we prefer to have the default
settings be warning-free?  I do not see any other platforms that tweak
NO_OPENSSL themselves, hence "RFC".  Is there a better way to do this?
Are there any Darwin/PPC users that would be harmed by this patch?
Disabling OpenSSL also has the effect of disabling SSL support in
git-imap-send.  Does enabling BLK_SHA1 instead also remove the warnings?

Alternatively, it seems that the recommended update is to use Apple's
CommonCrypto library, as in this patch:
https://gist.github.com/anonymous/4466305

Re: [RFC PATCH 3/3] Makefile: avoid deprecation warnings on OS X 10.8

From: David Aguilar <hidden>
Date: 2016-06-15 22:57:11

On Thu, May 9, 2013 at 8:14 AM, John Keeping [off-list ref] wrote:
On Thu, May 09, 2013 at 02:13:30AM -0700, David Aguilar wrote:
quoted
Mac OS X Mountain Lion prints warnings when building git:

      warning: 'SHA1_Init' is deprecated
      (declared at /usr/include/openssl/sha.h:121)

Silence the warnings by disabling OpenSSH in favor of BLK_SHA1.

Signed-off-by: David Aguilar <redacted>
---
I know I can create config.mak, but do we prefer to have the default
settings be warning-free?  I do not see any other platforms that tweak
NO_OPENSSL themselves, hence "RFC".  Is there a better way to do this?
Are there any Darwin/PPC users that would be harmed by this patch?
Disabling OpenSSL also has the effect of disabling SSL support in
git-imap-send.  Does enabling BLK_SHA1 instead also remove the warnings?
Thanks.  Yes, setting BLK_SHA1 does eliminate the warnings.

I'll re-roll this patch and send it independently.
It's unrelated to the mergetool stuff so apologies for the wide
initial Cc: list.
Alternatively, it seems that the recommended update is to use Apple's
CommonCrypto library, as in this patch:
https://gist.github.com/anonymous/4466305
It seems like we'd want something like this in compat-util.h or
somewhere similar.  That'll be a bigger change so I'll try the
BLK_SHA1 approach first since it is minimally invasive.  This would be
nice to tackle once the dust has settled a bit.
--
David
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help