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

[PATCH] git-merge: warn when -m provided on a fast forward

From
JFJ. Bruce Fields <bfields@fieldses.org>
Date
Mar 11, 2007, 16:28 UTC
Message-ID
<20070311162856.GB629@fieldses.org>
In-Reply-To
<20070311160424.GA629@fieldses.org>

Warn the user that the "-m" option is ignored in the case of a fast forward. That may save some confusion in the case where the user doesn't know about fast forwards yet and may not realize that the behavior here is intentional.

Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
---
 git-merge.sh |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/git-merge.sh b/git-merge.sh
index 4afcd95..8b6fcf0 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -294,7 +294,12 @@ f,*)
 	git-update-index --refresh 2>/dev/null
 	new_head=$(git-rev-parse --verify "$1^0") &&
 	git-read-tree -v -m -u --exclude-per-directory=.gitignore $head "$new_head" &&
-	finish "$new_head" "Fast forward" || exit
+	msg="Fast forward"
+	if test -n "$have_message"
+	then
+		msg="$msg (no commit created; -m option ignored)"
+	fi
+	finish "$new_head" "$msg" || exit
 	dropsave
 	exit 0
 	;;
-- 
1.5.0.gb75812-dirty
Previous: J. Bruce FieldsNext: Xavier Maillard
Message 3 of 15 in “git merge and merge message”
  1. Xavier MaillardMar 11, 2007
  2. J. Bruce FieldsMar 11, 2007
  3. git-merge: warn when -m provided on a fast forwardJ. Bruce Fields, Mar 11, 2007
  4. Xavier MaillardMar 11, 2007
  5. Linus TorvaldsMar 11, 2007
  6. Avi KivityMar 11, 2007
  7. Linus TorvaldsMar 11, 2007
  8. Avi KivityMar 12, 2007
  9. Johannes SchindelinMar 11, 2007
  10. Junio C HamanoMar 12, 2007
  11. Avi KivityMar 12, 2007
  12. Junio C HamanoMar 11, 2007
  13. [RFC] git log --first-parentJunio C Hamano, Mar 13, 2007
  14. Jeff KingMar 13, 2007
  15. Martin LanghoffMar 12, 2007

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.