From: Junio C Hamano <hidden> Date: 2016-06-15 22:45:04
When merging an early part of a branch, e.g. "git merge xyzzy~20", we were
supposed to say "branch 'xyzzy' (early part)", but it incorrectly said
"branch 'refs/heads/xy' (early part)" instead.
The logic was supposed to first strip away "~20" part to make sure that
what follows "~" is a non-zero posint, prefix it with "refs/heads/" and
ask resolve_ref() if it is a ref. If it is, then we know xyzzy was a
branch, and we can give the correct message.
However, there were a few bugs. First of all, the logic to build this
"true branch refname" did not count the characters correctly. At this
point of the code, "len" is the number of trailing, non-name part of the
given extended SHA-1 expression given by the user, i.e. number of bytes in
"~20" in the above example.
In addition, the message forgot to skip "refs/heads/" it prefixed from the
output.
Signed-off-by: Junio C Hamano <redacted>
---
* It is a bit surprising that after beating merge-in-C to death, we
still find a minor breakage like this.
builtin-merge.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Signed-off-by: Miklos Vajna <redacted>
---
On Wed, Jul 30, 2008 at 01:12:19AM -0700, Junio C Hamano [off-list ref] wrote:
In addition, the message forgot to skip "refs/heads/" it prefixed from
the
output.
Signed-off-by: Junio C Hamano <redacted>
---
* It is a bit surprising that after beating merge-in-C to death, we
still find a minor breakage like this.
Uh-oh. Here is a testcase that fails with master, but passes with your
patch.
Thanks for catching this.
t/t7607-merge-early.sh | 39 +++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
create mode 100755 t/t7607-merge-early.sh
@@ -0,0 +1,39 @@+#!/bin/sh++test_description='git-merge++Testingmerginganearlypartofabranch.'++../test-lib.sh++test_expect_success'setup''+echoc0>c0.c&&+gitaddc0.c&&+gitcommit-mc0&&+gittagc0&&+echoc1>c1.c&&+gitaddc1.c&&+gitcommit-mc1&&+gittagc1&&+echoc2>c2.c&&+gitaddc2.c&&+gitcommit-mc2&&+gittagc2&&+gitreset--hardc0&&+echoc3>c3.c&&+gitaddc3.c&&+gitcommit-mc3&&+gittagc3+'++cat>expected<<EOF+Mergebranch'c2'(earlypart)+EOF++test_expect_success'merge early part of c2''+gitmergec2~1&&+gitshow-s--pretty=format:%sHEAD>actual&&+test_cmpactualexpected+'++test_done
Signed-off-by: Miklos Vajna <redacted>
---
[ Adding Shawn to CC as the interim maintainer. ]
On Wed, Jul 30, 2008 at 07:23:28PM +0200, Miklos Vajna [off-list ref] wrote:
Uh-oh. Here is a testcase that fails with master, but passes with your
patch.
I remember you had a note about it's a bad habit to write a new test for
every bug, so here is an updated version that just improves
t7600-merge.sh and does not adds a new one.
t/t7600-merge.sh | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
@@ -520,4 +520,30 @@ test_expect_success 'refresh the index before merging' ' test_debug'gitk --all'+cat>expected<<EOF+Mergebranch'c5'(earlypart)+EOF++test_expect_success'merge early part of c2''+gitreset--hardc3&&+echoc4>c4.c&&+gitaddc4.c&&+gitcommit-mc4&&+gittagc4&&+echoc5>c5.c&&+gitaddc5.c&&+gitcommit-mc5&&+gittagc5&&+gitreset--hardc3&&+echoc6>c6.c&&+gitaddc6.c&&+gitcommit-mc6&&+gittagc6&&+gitmergec5~1&&+gitshow-s--pretty=format:%sHEAD>actual&&+test_cmpactualexpected+'++test_debug'gitk --all'+ test_done
From: Shawn O. Pearce <hidden> Date: 2016-06-15 22:45:28
Miklos Vajna [off-list ref] wrote:
Signed-off-by: Miklos Vajna <redacted>
---
[ Adding Shawn to CC as the interim maintainer. ]
In case you missed it, Junio has the pumpkin now. (He's picked up
my topics, merged my tree, and has freed me from the time sink that
is known as maintainership.)
--
Shawn.