Skip to contentSkip to conversation

git-gui: stop using deprecated merge syntax

PATCH In review René Scharfe 5 participants 7 messages Sep 24, 2016 – Oct 3, 2016 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-gui: stop using deprecated merge syntax

Starting with v2.5.0 git merge can handle FETCH_HEAD internally and warns when it's called like 'git merge <message> HEAD <commit>' because that syntax is deprecated. Use this feature in git-gui and get rid of that warning.

---
Tested only _very_ lightly!

 git-gui/lib/merge.tcl | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
git-gui/lib/merge.tcl +1 -6
index 460d32f..5ab6f8f 100644
@@ -112,12 +112,7 @@ method _start {} {
 	close $fh
 	set _last_merged_branch $branch
 
-	set cmd [list git]
-	lappend cmd merge
-	lappend cmd --strategy=recursive
-	lappend cmd [git fmt-merge-msg <[gitdir FETCH_HEAD]]
-	lappend cmd HEAD
-	lappend cmd $name
+	set cmd [list git merge --strategy=recursive FETCH_HEAD]
 
 	ui_status [mc "Merging %s and %s..." $current_branch $stitle]
 	set cons [console::new [mc "Merge"] "merge $stitle"]
Signature · 1 line
2.10.0
Tested-by on v1 1/1
#1 lore raw

Am 24.09.2016 um 13:30 schrieb René Scharfe:

Quoted 21 lines

Starting with v2.5.0 git merge can handle FETCH_HEAD internally and warns when it's called like 'git merge <message> HEAD <commit>' because that syntax is deprecated. Use this feature in git-gui and get rid of that warning.

---
Tested only _very_ lightly!

 git-gui/lib/merge.tcl | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
git-gui/lib/merge.tcl +0 -0
index 460d32f..5ab6f8f 100644
@@ -112,12 +112,7 @@ method _start {} {
 	close $fh
 	set _last_merged_branch $branch
 

git-gui/lib/merge.tcl method _start {} { · line 118

Quoted 10 lines
git-gui/lib/merge.tcl +1 -6
-	set cmd [list git]
-	lappend cmd merge
-	lappend cmd --strategy=recursive
-	lappend cmd [git fmt-merge-msg <[gitdir FETCH_HEAD]]
-	lappend cmd HEAD
-	lappend cmd $name
+	set cmd [list git merge --strategy=recursive FETCH_HEAD]
 
 	ui_status [mc "Merging %s and %s..." $current_branch $stitle]
 	set cons [console::new [mc "Merge"] "merge $stitle"]

Much better than my version. I had left fmt-merge-msg and added --no-log to treat merge.log config suitably. But this works too, and is much more obvious.

-- Hannes

#2 lore raw
Quoted 37 lines · Johannes Sixt

Am 24.09.2016 um 13:30 schrieb René Scharfe:

Quoted 21 lines

Starting with v2.5.0 git merge can handle FETCH_HEAD internally and warns when it's called like 'git merge <message> HEAD <commit>' because that syntax is deprecated. Use this feature in git-gui and get rid of that warning.

---
Tested only _very_ lightly!

 git-gui/lib/merge.tcl | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
git-gui/lib/merge.tcl +0 -0
index 460d32f..5ab6f8f 100644
@@ -112,12 +112,7 @@ method _start {} {
 	close $fh
 	set _last_merged_branch $branch
 

git-gui/lib/merge.tcl method _start {} { · line 118

Quoted 10 lines
git-gui/lib/merge.tcl +1 -6
-	set cmd [list git]
-	lappend cmd merge
-	lappend cmd --strategy=recursive
-	lappend cmd [git fmt-merge-msg <[gitdir FETCH_HEAD]]
-	lappend cmd HEAD
-	lappend cmd $name
+	set cmd [list git merge --strategy=recursive FETCH_HEAD]
 
 	ui_status [mc "Merging %s and %s..." $current_branch $stitle]
 	set cons [console::new [mc "Merge"] "merge $stitle"]

Much better than my version. I had left fmt-merge-msg and added --no-log to treat merge.log config suitably. But this works too, and is much more obvious.

Quoted 1 line

Thanks both.

We can finally deprecate and remove the ancient "git merge" syntax with this, which should make me happy, but with git-gui maintainer missing, it nudges me to be an interim maintainer one more time.

Sigh...

Reviewed-by
#3 lore raw
Quoted 39 lines · Junio C Hamano
Quoted 37 lines · Johannes Sixt

Am 24.09.2016 um 13:30 schrieb René Scharfe:

Quoted 21 lines

Starting with v2.5.0 git merge can handle FETCH_HEAD internally and warns when it's called like 'git merge <message> HEAD <commit>' because that syntax is deprecated. Use this feature in git-gui and get rid of that warning.

---
Tested only _very_ lightly!

 git-gui/lib/merge.tcl | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
git-gui/lib/merge.tcl +0 -0
index 460d32f..5ab6f8f 100644
@@ -112,12 +112,7 @@ method _start {} {
     close $fh
     set _last_merged_branch $branch
 

git-gui/lib/merge.tcl method _start {} { · line 118

Quoted 10 lines
git-gui/lib/merge.tcl +1 -6
-    set cmd [list git]
-    lappend cmd merge
-    lappend cmd --strategy=recursive
-    lappend cmd [git fmt-merge-msg <[gitdir FETCH_HEAD]]
-    lappend cmd HEAD
-    lappend cmd $name
+    set cmd [list git merge --strategy=recursive FETCH_HEAD]
 
     ui_status [mc "Merging %s and %s..." $current_branch $stitle]
     set cons [console::new [mc "Merge"] "merge $stitle"]

Much better than my version. I had left fmt-merge-msg and added --no-log to treat merge.log config suitably. But this works too, and is much more obvious.

Quoted 1 line
Quoted 1 line
Tested-by Johannes Sixt Reviewed-by Stefan Beller
#4 lore raw
Quoted 40 lines · Stefan Beller
Quoted 39 lines · Junio C Hamano
Quoted 37 lines · Johannes Sixt

Am 24.09.2016 um 13:30 schrieb René Scharfe:

Quoted 21 lines

Starting with v2.5.0 git merge can handle FETCH_HEAD internally and warns when it's called like 'git merge <message> HEAD <commit>' because that syntax is deprecated. Use this feature in git-gui and get rid of that warning.

---
Tested only _very_ lightly!

 git-gui/lib/merge.tcl | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
git-gui/lib/merge.tcl +0 -0
index 460d32f..5ab6f8f 100644
@@ -112,12 +112,7 @@ method _start {} {
     close $fh
     set _last_merged_branch $branch
 

git-gui/lib/merge.tcl method _start {} { · line 118

Quoted 10 lines
git-gui/lib/merge.tcl +1 -6
-    set cmd [list git]
-    lappend cmd merge
-    lappend cmd --strategy=recursive
-    lappend cmd [git fmt-merge-msg <[gitdir FETCH_HEAD]]
-    lappend cmd HEAD
-    lappend cmd $name
+    set cmd [list git merge --strategy=recursive FETCH_HEAD]
 
     ui_status [mc "Merging %s and %s..." $current_branch $stitle]
     set cons [console::new [mc "Merge"] "merge $stitle"]

Much better than my version. I had left fmt-merge-msg and added --no-log to treat merge.log config suitably. But this works too, and is much more obvious.

Quoted 4 lines
Quoted 1 line
Quoted 1 line

The only problem I see here is that generally git-gui tries to continue to work with older versions of git as well. So adding a guard using the git-version procedure should maintain that backwards compatibility.

I suggest:

From c2716458f05893ca88c05ce211a295a330e74590 Mon Sep 17 00:00:00 2001
From: René Scharfe <[email protected]>
Date: Sat, 24 Sep 2016 13:30:22 +0200
Subject: [PATCH] git-gui: stop using deprecated merge syntax

Starting with v2.5.0 git merge can handle FETCH_HEAD internally and warns when it's called like 'git merge <message> HEAD <commit>' because that syntax is deprecated. Use this feature in git-gui and get rid of that warning.

---
 lib/merge.tcl | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
lib/merge.tcl +10 -7
index 460d32f..2361b78 100644
@@ -112,13 +112,16 @@ method _start {} {
 	close $fh
 	set _last_merged_branch $branch
 
-	set cmd [list git]
-	lappend cmd merge
-	lappend cmd --strategy=recursive
-	lappend cmd [git fmt-merge-msg <[gitdir FETCH_HEAD]]
-	lappend cmd HEAD
-	lappend cmd $name
-
+	if {[git-version >= "2.5.0"]} {
+		set cmd [list git merge --strategy=recursive FETCH_HEAD]
+	} else {
+		set cmd [list git]
+		lappend cmd merge
+		lappend cmd --strategy=recursive
+		lappend cmd [git fmt-merge-msg <[gitdir FETCH_HEAD]]
+		lappend cmd HEAD
+		lappend cmd $name
+	}
 	ui_status [mc "Merging %s and %s..." $current_branch $stitle]
 	set cons [console::new [mc "Merge"] "merge $stitle"]
 	console::exec $cons $cmd [cb _finish $cons]
Signature · 1 line
2.10.0.windows.1
#5 lore raw

Am 03.10.2016 um 10:30 schrieb Pat Thoyts:

Quoted 3 lines

The only problem I see here is that generally git-gui tries to continue to work with older versions of git as well. So adding a guard using the git-version procedure should maintain that backwards compatibility.

Makes sense for a stand-alone tool.

Quoted 12 lines

I suggest:

From c2716458f05893ca88c05ce211a295a330e74590 Mon Sep 17 00:00:00 2001
From: René Scharfe <[email protected]>
Date: Sat, 24 Sep 2016 13:30:22 +0200
Subject: [PATCH] git-gui: stop using deprecated merge syntax

Starting with v2.5.0 git merge can handle FETCH_HEAD internally and warns when it's called like 'git merge <message> HEAD <commit>' because that syntax is deprecated. Use this feature in git-gui and get rid of that warning.

Quoted 4 lines

OK, but perhaps move me from From: to Original-patch-by: as the version check is a big enough change in itself. Or add a separate commit for it. Or at least mention that you added the check in the commit message.

Thanks,
René

#6 lore raw
Quoted 24 lines · René Scharfe

Am 03.10.2016 um 10:30 schrieb Pat Thoyts:

Quoted 3 lines

The only problem I see here is that generally git-gui tries to continue to work with older versions of git as well. So adding a guard using the git-version procedure should maintain that backwards compatibility.

Makes sense for a stand-alone tool.

Quoted 12 lines

I suggest:

From c2716458f05893ca88c05ce211a295a330e74590 Mon Sep 17 00:00:00 2001
From: René Scharfe <[email protected]>
Date: Sat, 24 Sep 2016 13:30:22 +0200
Subject: [PATCH] git-gui: stop using deprecated merge syntax

Starting with v2.5.0 git merge can handle FETCH_HEAD internally and warns when it's called like 'git merge <message> HEAD <commit>' because that syntax is deprecated. Use this feature in git-gui and get rid of that warning.

Quoted 4 lines
Quoted 7 lines

OK, but perhaps move me from From: to Original-patch-by: as the version check is a big enough change in itself. Or add a separate commit for it. Or at least mention that you added the check in the commit message.

Thanks,
René

As this is one of the ones already staged to git's 'next' I'll make this as a separate commit on top.

Signature · 2 lines
Pat Thoyts                            http://www.patthoyts.tk/
PGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD