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

Re: [PATCH] git-gui: stop using deprecated merge syntax

From
Pat Thoyts <patthoyts@users.sourceforge.net>
Date
Oct 3, 2016, 08:30 UTC
Message-ID
<87mvilx2ak.fsf@red.patthoyts.tk>
In-Reply-To
<CAGZ79kZZwum+97JGL8OFWTdODZeqrEyj4MVMC6o6ynFMOhiFLg@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
Show 44 quoted lines
>On Sun, Sep 25, 2016 at 11:39 AM, Junio C Hamano <gitster@pobox.com> wrote:
>> Johannes Sixt <j6t@kdbg.org> writes:
>>
>>> Am 24.09.2016 um 13:30 schrieb René Scharfe:
>>>> 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.
>>>>
>>>> Signed-off-by: Rene Scharfe <l.s.r@web.de>
>>>> ---
>>>> Tested only _very_ lightly!
>>>>
>>>>  git-gui/lib/merge.tcl | 7 +------
>>>>  1 file changed, 1 insertion(+), 6 deletions(-)
>>>>
>>>> diff --git a/git-gui/lib/merge.tcl b/git-gui/lib/merge.tcl
>>>> index 460d32f..5ab6f8f 100644
>>>> --- a/git-gui/lib/merge.tcl
>>>> +++ b/git-gui/lib/merge.tcl
>>>> @@ -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"]
>>>>
>>>
>>> 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.
>>>
>>> Tested-by: Johannes Sixt <j6t@kdbg.org>
>
>Reviewed-by: Stefan Beller <sbeller@google.com>
>

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 <l.s.r@web.de>
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.

Tested-by: Johannes Sixt <j6t@kdbg.org>
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
---
 lib/merge.tcl | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/lib/merge.tcl b/lib/merge.tcl
index 460d32f..2361b78 100644
--- a/lib/merge.tcl
+++ b/lib/merge.tcl
@@ -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]
-- 
2.10.0.windows.1
Previous: Stefan BellerNext: René Scharfe
Message 5 of 7 in “git-gui: stop using deprecated merge syntax”
  1. git-gui: stop using deprecated merge syntaxRené Scharfe, Sep 24, 2016
  2. Johannes SixtSep 24, 2016
  3. Junio C HamanoSep 25, 2016
  4. Stefan BellerSep 26, 2016
  5. Pat ThoytsOct 3, 2016
  6. René ScharfeOct 3, 2016
  7. Pat ThoytsOct 3, 2016

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.