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

Re: [PATCH 0/3] mergetool/difftool cleanup

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 21, 2014, 19:28 UTC
Message-ID
<xmqqmw7kz73w.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1416532829-68662-1-git-send-email-davvid@gmail.com>
David Aguilar <davvid@gmail.com> writes:
Show 15 quoted lines
> This is a cleanup series to remove the use of the $status
> global variable in mergetool/difftool.
>
> This should wait until after the current RC series is
> over but figured I'd send it out.
>
> David Aguilar (3):
>   mergetool--lib: remove use of $status global
>   difftool--helper: add explicit exit statement
>   mergetool: simplify conditionals
>
>  git-difftool--helper.sh |  2 ++
>  git-mergetool--lib.sh   | 20 +++++---------------
>  git-mergetool.sh        | 16 +++++-----------
>  3 files changed, 12 insertions(+), 26 deletions(-)
Looked quite straight-forward from a cursory read.

I tentatively inserted the attached patch before 1/3. If the series was done with that extra step as preliminary clean-up, I wouldn't have had to wonder if the hunk at "@@ -130,13" was correct.

-- >8 --
From: Junio C Hamano <gitster@pobox.com>
Date: Fri, 21 Nov 2014 11:17:57 -0800
Subject: [PATCH] mergetool--lib: remove no-op assignment to $status from setup_user_tool

Even though setup_user_tool assigns the exit status from "eval $merge_tool_cmd" to $status, the variable is overwritten by the function it calls next, check_unchanged, without ever getting looked at by anybody. And "return $status" at the end of this function returns the value check_unchanged assigned to it (which is the same as the value the function returns). Which makes the assignment a no-op.

Remove it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-mergetool--lib.sh | 1 -
 1 file changed, 1 deletion(-)
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 2b66351..3e06389 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -130,7 +130,6 @@ setup_user_tool () {
 		then
 			touch "$BACKUP"
 			( eval $merge_tool_cmd )
-			status=$?
 			check_unchanged
 		else
 			( eval $merge_tool_cmd )
-- 
2.2.0-rc2-128-ge2b5e8e
Previous: David AguilarNext: David Aguilar
Message 7 of 8 in “mergetool/difftool cleanup”
  1. 0/3 mergetool/difftool cleanupDavid Aguilar, Nov 21, 2014
  2. 1/3 mergetool--lib: remove use of $status globalDavid Aguilar, Nov 21, 2014
  3. Junio C HamanoNov 21, 2014
  4. 2/3 difftool--helper: add explicit exit statementDavid Aguilar, Nov 21, 2014
  5. 3/3 mergetool: simplify conditionalsDavid Aguilar, Nov 21, 2014
  6. mergetools: stop setting $status in merge_cmd()David Aguilar, Nov 21, 2014
  7. Junio C HamanoNov 21, 2014
  8. David AguilarNov 22, 2014

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.