threads / patch / 8726

patchgit-merge-ff: fast-forward only merge

Subject: [PATCH] git-merge-ff: fast-forward only merge

## tl;dr

3 messages between Jun 26, 2007 and Jun 28, 2007. Diffs are folded; open one to read it.

replies: 2people: 3as markdown or json

Sam Vilain· Jun 26, 2007, 04:01 UTC · lore
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
Show changes to 3 files +14 −1

Documentation/merge-strategies.txt, Makefile, git-merge-ff.sh

diff --git a/Documentation/merge-strategies.txt b/Documentation/merge-strategies.txt
index 7df0266..00739bc 100644
--- a/Documentation/merge-strategies.txt
+++ b/Documentation/merge-strategies.txt
@@ -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).
diff --git a/Makefile b/Makefile
index 29243c6..6311eb5 100644
--- a/Makefile
+++ b/Makefile
@@ -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 = \
diff --git a/git-merge-ff.sh b/git-merge-ff.sh
new file mode 100644
index 0000000..b0e0f85
--- /dev/null
+++ b/git-merge-ff.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Sam Vilain
+#
+# A degenerate merge strategy that only allows fast-forwarding.
+#
+
+exit 1;
-- 
1.5.2.1.1131.g3b90
Matthias Lederhofer· Jun 28, 2007, 11:33 UTC · re: Sam Vilain · lore

Re: [PATCH] git-merge-ff: fast-forward only merge

Sam Vilain <sam.vilain@catalyst.net.nz> wrote:
Show 8 quoted lines
> 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'
Johannes Schindelin· Jun 28, 2007, 13:01 UTC · re: Matthias Lederhofer · lore

Re: [PATCH] git-merge-ff: fast-forward only merge

Hi,
On Thu, 28 Jun 2007, Matthias Lederhofer wrote:
Show 24 quoted lines
> Sam Vilain <sam.vilain@catalyst.net.nz> wrote:
> > 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'

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

Ciao, Dscho

← back to recent threads