Skip to contentSkip to conversation

git-merge-ff: fast-forward only merge

PATCH In review Sam Vilain 3 participants 3 messages Jun 15, 2016

Subsystems (2)
lore
Share & tools
lore

Sam Vilain

author
#0 lore raw

PATCH 1/1 git-merge-ff: fast-forward only merge

This is primarily so that there is an easy switch to 'git-pull' to be sure to fast forward only.

---
 Documentation/merge-strategies.txt |    5 +++++
 Makefile                           |    2 +-
 git-merge-ff.sh                    |    8 ++++++++
 3 files changed, 14 insertions(+), 1 deletions(-)
 create mode 100644 git-merge-ff.sh
Documentation/merge-strategies.txt +5 -0
index 7df0266..00739bc 100644
@@ -33,3 +33,8 @@ ours::
 	merge is always the current branch head.  It is meant to
 	be used to supersede old development history of side
 	branches.
+
+ff::
+	This is a degenerate merge strategy that always fails, which
+	means that the only time the target branch will change is if
+	there was no merge ("fast-forward" merge only).
Makefile +1 -1
index 29243c6..6311eb5 100644
@@ -208,7 +208,7 @@ SCRIPT_SH = \
 	git-tag.sh git-verify-tag.sh \
 	git-applymbox.sh git-applypatch.sh git-am.sh \
 	git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
-	git-merge-resolve.sh git-merge-ours.sh \
+	git-merge-resolve.sh git-merge-ours.sh git-merge-ff.sh \
 	git-lost-found.sh git-quiltimport.sh
 
 SCRIPT_PERL = \
git-merge-ff.sh new file +8 -0
new file mode 100644
index 0000000..b0e0f85
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Sam Vilain
+#
+# A degenerate merge strategy that only allows fast-forwarding.
+#
+
+exit 1;
Signature · 1 line
1.5.2.1.1131.g3b90
#1 lore raw
Quoted 8 lines · Sam Vilain

This is primarily so that there is an easy switch to 'git-pull' to be sure to fast forward only.

---
 Documentation/merge-strategies.txt |    5 +++++
 Makefile                           |    2 +-
 git-merge-ff.sh                    |    8 ++++++++
 3 files changed, 14 insertions(+), 1 deletions(-)
 create mode 100644 git-merge-ff.sh

git-merge-ff.sh should be executable, added to .gitignore and the strategy should be added to the available strategies.

And somehow it did not work for me at all:

% git merge -s ff origin/master
git-merge.sh: needs update
Trying really trivial in-index merge...
Wonderful.
In-index merge
[..]
% git show HEAD|grep Merge
Merge: 117a93c... f578825...
Merge commit 'origin/master'

#2 lore raw

Hi,

Quoted 15 lines · Matthias Lederhofer
Quoted 8 lines · Sam Vilain

This is primarily so that there is an easy switch to 'git-pull' to be sure to fast forward only.

---
 Documentation/merge-strategies.txt |    5 +++++
 Makefile                           |    2 +-
 git-merge-ff.sh                    |    8 ++++++++
 3 files changed, 14 insertions(+), 1 deletions(-)
 create mode 100644 git-merge-ff.sh

git-merge-ff.sh should be executable, added to .gitignore and the strategy should be added to the available strategies.

And somehow it did not work for me at all:

Quoted 9 lines

% git merge -s ff origin/master
git-merge.sh: needs update
Trying really trivial in-index merge...
Wonderful.
In-index merge
[..]
% git show HEAD|grep Merge
Merge: 117a93c... f578825...
Merge commit 'origin/master'

To prevent something like this to happen, may I suggest adding a really simple, small test case?

Ciao,
Dscho