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

Re: [PATCH] git-merge: add option --no-ff

From
LHLars Hjemli <hjemli@gmail.com>
Date
Sep 17, 2007, 13:16 UTC
Message-ID
<8c5c35580709170616i49a8836hb60423c5eebf601d@mail.gmail.com>
In-Reply-To
<46EE7584.8010202@op5.se>
On 9/17/07, Andreas Ericsson <ae@op5.se> wrote:
Show 23 quoted lines
> Lars Hjemli wrote:
> > This new option forces all merges to create a "true" merge commit, i.e. a
> > commit with multiple parents.
> >
> > Although a fast-forward would normally be The Right Thing, it isn't when the
> > branches to be merged originated in subversion and the merge commit will
> > be pushed back by means of 'git svn dcommit'. In these cases, a fast-
> > forward merge simply will not work.
> >
> >       If there is no `-s` option, a built-in list of strategies
> >       is used instead (`git-merge-recursive` when merging a single
> >       head, `git-merge-octopus` otherwise).
> > +
> > +--no-ff::
> > +     Force the creation of a merge commit even when the merge would
> > +     have resolved as a fast-forward operation.
>
> + Although a fast-forward would normally be The Right Thing, it isn't when the
> + branches to be merged originated in subversion and the merge commit will
> + be pushed back by means of 'git svn dcommit'. In these cases, a fast-
> + forward merge simply will not work.
>
> Otherwise someone will sit down and try to figure out why this is necessary.
True.
> I'm having trouble understanding why this is needed, but I'll take your word
> for it ;-)
I'll try to explain:

When 'git-svn dcommit' decides which commits it should push back subversion, it scans the output from 'git-log --first-parent HEAD' looking for embedded 'git-svn-id' lines. These lines contain the url of the upstream subversion repository + the subversion revision number. So the problem with fast-forward merges of subversion branches is that the output from 'git-log --first-parent HEAD' will show commits from the wrong subversion branch (the fast-forwarded commits).

This could maybe be fixed in git-svn if it learned a different way of discovering the upstream subversion branch, but then it would make git-svn commit n revisions to subversion (again, the fast-forwarded commits) instead of a single merge-commit. This would look (in subversion) like a series of n cherry-picks from the merged branch.

Btw: maybe the --no-ff section in merge-options.txt could just link to
git-svn.txt, which in turn could have some lengthy explanation about
merge --no-ff/dcommit behaviour?

-- larsh

Previous: Andreas EricssonNext: Johannes Schindelin
Message 3 of 34 in “git-merge: add option --no-ff”
  1. git-merge: add option --no-ffLars Hjemli, Sep 17, 2007
  2. Andreas EricssonSep 17, 2007
  3. Lars HjemliSep 17, 2007
  4. Johannes SchindelinSep 17, 2007
  5. Chris ShoemakerSep 17, 2007
  6. Lars HjemliSep 17, 2007
  7. Johannes SchindelinSep 17, 2007
  8. Lars HjemliSep 17, 2007
  9. Johannes SchindelinSep 17, 2007
  10. Lars HjemliSep 17, 2007
  11. Johannes SchindelinSep 17, 2007
  12. Lars HjemliSep 17, 2007
  13. git-merge: add option --no-ffLars Hjemli, Sep 17, 2007
  14. Eric WongSep 18, 2007
  15. Junio C HamanoSep 18, 2007
  16. Eric WongSep 18, 2007
  17. Lars HjemliSep 18, 2007
  18. Eric WongSep 18, 2007
  19. Junio C HamanoSep 18, 2007
  20. Sam VilainSep 18, 2007
  21. Sam VilainSep 18, 2007
  22. Lars HjemliSep 18, 2007
  23. Sam VilainSep 18, 2007
  24. Lars HjemliSep 18, 2007
  25. Sam VilainSep 18, 2007
  26. Lars HjemliSep 18, 2007
  27. Sam VilainSep 18, 2007
  28. Johannes SchindelinSep 18, 2007
  29. Lars HjemliSep 18, 2007
  30. Lars HjemliSep 18, 2007
  31. Peter BaumannSep 18, 2007
  32. Lars HjemliSep 19, 2007
  33. Chris ShoemakerSep 17, 2007
  34. Lars HjemliSep 17, 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.