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

[PATCH] git-mergetool--lib.sh: make check_unchanged return 1 on invalid read

From
Jay Soffian <jaysoffian@gmail.com>
Date
Sep 19, 2011, 20:03 UTC
Message-ID
<1316462592-27255-1-git-send-email-jaysoffian@gmail.com>

Else when the user hits ctrl-c at the "Was the merge successful? [y/n]" prompt, mergetool goes into an infinite loop asking for input.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
---
 git-mergetool--lib.sh |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 8fc65d0400..0eb424484c 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -21,7 +21,11 @@ check_unchanged () {
 		do
 			echo "$MERGED seems unchanged."
 			printf "Was the merge successful? [y/n] "
-			read answer
+			if ! read answer
+			then
+				status=1
+				break
+			fi
 			case "$answer" in
 			y*|Y*) status=0; break ;;
 			n*|N*) status=1; break ;;
-- 
1.7.7.rc2.2.gf185
Next: Junio C Hamano
Message 1 of 5 in “git-mergetool--lib.sh: make check_unchanged return 1 on invalid read”
  1. git-mergetool--lib.sh: make check_unchanged return 1 on invalid readJay Soffian, Sep 19, 2011
  2. Junio C HamanoSep 19, 2011
  3. git-mergetool: check return value from readJay Soffian, Sep 19, 2011
  4. Junio C HamanoSep 20, 2011
  5. Andrew ArdillSep 20, 2011

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.