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

[PATCH v3 5/5] pull: add warning on non-ff merges

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Sep 9, 2013, 01:23 UTC
Message-ID
<1378689796-19305-6-git-send-email-felipe.contreras@gmail.com>
In-Reply-To
<1378689796-19305-1-git-send-email-felipe.contreras@gmail.com>

To prepare our uses for the upcoming changes we should warn them and let them know that they will need to specify a merge or a rebase in the future (when a non-fast-forward situation arises). Also, let them know we fallback to 'git pull --merge', so when the obsoletion of this mode comes, they know what to type without interrupting or changing their workflow.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 git-pull.sh | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/git-pull.sh b/git-pull.sh
index 580d633..1f777de 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -62,7 +62,7 @@ then
 		echo "Please use pull.mode and branch.<name>.pullmode instead."
 	fi
 fi
-test -z "$mode" && mode=merge
+test -z "$mode" && mode=default
 dry_run=
 while :
 do
@@ -286,12 +286,21 @@ case "$merge_head" in
 *)
 	# check if a non-fast-foward merge would be needed
 	merge_head=${merge_head% }
-	if test "$mode" = merge-ff-only -a -z "$no_ff$ff_only${squash#--no-squash}" &&
+	if test -z "$no_ff$ff_only${squash#--no-squash}" &&
 		test -n "$orig_head" &&
 		! git merge-base --is-ancestor "$orig_head" "$merge_head" &&
 		! git merge-base --is-ancestor "$merge_head" "$orig_head"
 	then
-		die "The pull was not fast-forward, please either merge or rebase."
+		case "$mode" in
+		merge-ff-only)
+			die "The pull was not fast-forward, please either merge or rebase."
+			;;
+		default)
+			say "The pull was not fast-forward, in the future you would have to choose
+a merge or a rebase, falling back to old style for now (git pull --merge).
+Read 'git pull --help' for more information."
+			;;
+		esac
 	fi
 	;;
 esac
-- 
1.8.4-338-gefd7fa6
Previous: Felipe ContrerasNext: Felipe Contreras
Message 23 of 24 in “Preparation for non-ff pulls by default”
  1. 0/5 Preparation for non-ff pulls by defaultFelipe Contreras, Sep 9, 2013
  2. 1/5 pull: rename pull.rename to pull.modeFelipe Contreras, Sep 9, 2013
  3. Richard HansenSep 9, 2013
  4. Felipe ContrerasSep 9, 2013
  5. Jeff KingSep 10, 2013
  6. Felipe ContrerasSep 10, 2013
  7. Jeff KingSep 10, 2013
  8. Matthieu MoySep 10, 2013
  9. Felipe ContrerasOct 11, 2013
  10. Richard HansenOct 12, 2013
  11. Jeff KingOct 12, 2013
  12. Felipe ContrerasOct 12, 2013
  13. Jeff KingOct 12, 2013
  14. Felipe ContrerasOct 12, 2013
  15. Richard HansenOct 12, 2013
  16. Felipe ContrerasOct 12, 2013
  17. Richard HansenSep 19, 2013
  18. Felipe ContrerasOct 11, 2013
  19. Junio C HamanoSep 10, 2013
  20. 2/5 pull: refactor $rebase variable into $modeFelipe Contreras, Sep 9, 2013
  21. 3/5 pull: add --merge optionFelipe Contreras, Sep 9, 2013
  22. 4/5 pull: add merge-ff-only optionFelipe Contreras, Sep 9, 2013
  23. 5/5 pull: add warning on non-ff mergesFelipe Contreras, Sep 9, 2013
  24. Felipe ContrerasSep 9, 2013

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.