[PATCH/RFC] updating examples/git-merge (plus a builtin/merge fix)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jonathan Nieder
Date: Monday, August 16, 2010 - 11:51 pm

While preparing to make some minor "git merge" changes, I noticed that
the old merge script does not pass all tests any more.  Since it can
be easier to prototype in shell and then port to C, I think that is
worth fixing.

Of course this is not urgent at all.

Patch 1 fixes a minor bug that the scripted implementation does not
suffer from, illustrated by the test "merge early part of c2" from
t7600-merge.sh.

The underlying problem is a subtlety in the resolve_ref() API (from
v0.99.8~13, Use resolve_ref() to implement read_ref(), 2005-09-30):
the "reading" argument to resolve_ref() should usually be true, but
that is not obvious to newcomers.

Patches 2-7 are minor test changes.  They are early in the series
to give flexibility about when to merge them.

Patches 8-10 expose functionality used by merge when handling octopus
merges.  merge-base --octopus is get_octopus_merge_bases(), used to
provide basis arguments when running the "git merge-octopus" command.
Of course the latter does not care about its basis arguments, but
that is a topic for another series.  merge-base --independent is
reduce_refs(), used to reduce the parent list when --no-ff is not
in use.

These are analagous to show-branch --merge-base and
show-branch --independent but are slower and can be used with more
than 25 refs.

Patch 11 exposes the functionality from fmt-merge-msg needed to
implement merge --log -m.

Patches 12 and later are ports of various patches to builtin/merge.c.
I did the bare minimum to make tests pass. :)

Patches are against jn/merge-renormalize~2 (rerere: migrate to
parse-options API) from pu, because without that,
"rerere --rerere-autoupdate" does not work.

Thoughts?

Jonathan Nieder (24):
  merge: do not mistake (ancestor of) tag for branch
  t7600 (merge): modernize style
  t7600 (merge): do not launch gitk for --debug
  t7600 (merge): check reflog entry
  t7600 (merge): test merge from branch yet to be born
  t6010 (merge-base): modernize style
  t6200 (fmt-merge-msg): style nitpicks
  Documentation: add a SEE ALSO section for merge-base
  merge-base --octopus to mimic show-branch --merge-base
  merge-base --independent to print reduced parent list in a merge
  fmt-merge-msg -m to replace subject line
  merge script: --squash, --ff from unborn branch are errors
  merge script: tweak unmerged files message to match builtin
  merge script: refuse to merge during merge
  merge script: improve log message subject
  merge script: merge -X<option>
  merge script: allow custom strategies
  merge script: forbid merge -s index
  merge script: handle -m --log correctly
  merge script: handle many-way octopus
  merge script: --ff-only to disallow true merge
  merge script: handle --no-ff --no-commit correctly
  merge script: notice @{-1} shorthand
  merge script: learn --[no-]rerere-autoupdate

 Documentation/git-fmt-merge-msg.txt |    9 +-
 Documentation/git-merge-base.txt    |   34 +++-
 builtin/fmt-merge-msg.c             |   18 ++-
 builtin/merge-base.c                |   44 ++++-
 builtin/merge.c                     |    2 +-
 contrib/examples/git-merge.sh       |  115 ++++++++---
 t/t6010-merge-base.sh               |  358 +++++++++++++++++++--------------
 t/t6200-fmt-merge-msg.sh            |  306 ++++++++++++++--------------
 t/t7600-merge.sh                    |  385 +++++++++++++++--------------------
 9 files changed, 705 insertions(+), 566 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH/RFC] updating examples/git-merge (plus a builtin/me ..., Jonathan Nieder, (Mon Aug 16, 11:51 pm)
[PATCH 01/24] merge: do not mistake (ancestor of) tag for ..., Jonathan Nieder, (Mon Aug 16, 11:52 pm)
[PATCH 02/24] t7600 (merge): modernize style, Jonathan Nieder, (Mon Aug 16, 11:53 pm)
[PATCH 03/24] t7600 (merge): do not launch gitk for --debug, Jonathan Nieder, (Mon Aug 16, 11:54 pm)
[PATCH 04/24] t7600 (merge): check reflog entry, Jonathan Nieder, (Mon Aug 16, 11:56 pm)
[PATCH 06/24] t6010 (merge-base): modernize style, Jonathan Nieder, (Mon Aug 16, 11:57 pm)
[PATCH 07/24] t6200 (fmt-merge-msg): style nitpicks, Jonathan Nieder, (Mon Aug 16, 11:57 pm)
[PATCH 11/24] fmt-merge-msg -m to override subject line, Jonathan Nieder, (Tue Aug 17, 12:02 am)
[PATCH 14/24] merge script: refuse to merge during merge, Jonathan Nieder, (Tue Aug 17, 12:03 am)
[PATCH 15/24] merge script: improve log message subject, Jonathan Nieder, (Tue Aug 17, 12:04 am)
[PATCH 16/24] merge script: merge -X&lt;option&gt;, Jonathan Nieder, (Tue Aug 17, 12:05 am)
[PATCH 17/24] merge script: allow custom strategies, Jonathan Nieder, (Tue Aug 17, 12:05 am)
[PATCH 18/24] merge script: forbid merge -s index, Jonathan Nieder, (Tue Aug 17, 12:06 am)
[PATCH 19/24] merge script: handle -m --log correctly, Jonathan Nieder, (Tue Aug 17, 12:06 am)
[PATCH 20/24] merge script: handle many-way octopus, Jonathan Nieder, (Tue Aug 17, 12:09 am)
[PATCH 21/24] merge script: --ff-only to disallow true merge, Jonathan Nieder, (Tue Aug 17, 12:10 am)
[PATCH 23/24] merge script: notice @{-1} shorthand, Jonathan Nieder, (Tue Aug 17, 12:11 am)
[PATCH 24/24] merge script: learn --[no-]rerere-autoupdate, Jonathan Nieder, (Tue Aug 17, 12:13 am)
Re: [PATCH 03/24] t7600 (merge): do not launch gitk for -- ..., Ævar Arnfjörð Bjarmason, (Tue Aug 17, 12:31 am)
Re: [PATCH 13/24] merge script: tweak unmerged files messa ..., Ævar Arnfjörð Bjarmason, (Tue Aug 17, 12:36 am)
Re: [PATCH/RFC] updating examples/git-merge (plus a builti ..., Ævar Arnfjörð Bjarmason, (Tue Aug 17, 12:46 am)
Re: [PATCH 19/24] merge script: handle -m --log correctly, Tay Ray Chuan, (Tue Aug 17, 2:55 am)
Re: [PATCH 03/24] t7600 (merge): do not launch gitk for -- ..., Sverre Rabbelier, (Tue Aug 17, 10:50 am)
Re: [PATCH 19/24] merge script: handle -m --log correctly, Jonathan Nieder, (Tue Aug 17, 2:54 pm)
[PATCH 11/24 v2] fmt-merge-msg -m to override merge title, Jonathan Nieder, (Tue Aug 17, 4:00 pm)
Re: [PATCH 03/24] t7600 (merge): do not launch gitk for -- ..., Ævar Arnfjörð Bjarmason, (Wed Aug 18, 1:55 am)