git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brad King <brad.king@kitware.com>
To: git@vger.kernel.org, gitster@pobox.com
Cc: Heiko Voigt <hvoigt@hvoigt.net>
Subject: [PATCH] rev-list: Demonstrate breakage with --ancestry-path --all
Date: Thu, 25 Aug 2011 12:49:13 -0400	[thread overview]
Message-ID: <438ea0b254ccafb3fc9f3431f8f86007cc03132b.1314290439.git.brad.king@kitware.com> (raw)
In-Reply-To: <20110824213205.GI45292@book.hvoigt.net>

The option added by commit ebdc94f3 (revision: --ancestry-path,
2010-04-20) does not work properly in combination with --all, at least
in the case of a criss-cross merge:

    b---bc
   / \ /
  a   X
   \ / \
    c---cb

There are no descendants of 'cb' in the history.  The command

  git rev-list --ancestry-path cb..bc

correctly reports no commits.  However, the command

  git rev-list --ancestry-path --all ^cb

reports 'bc'.  Add a test case to t6019-rev-list-ancestry-path
demonstrating this breakage.

Signed-off-by: Brad King <brad.king@kitware.com>
---

I tried to fix the submodule merge search during a recursive merge by
only doing it when o->call_depth is zero.  While testing the fix I
noticed that the merge search was reporting an incorrect commit as a
suggested submodule merge resolution.  Internally the merge search uses
"rev-list --merges --ancestry-path --all ^a" to find all merges that
contain 'a'.  The rev-list incorrectly reports the other side of the
criss-cross history.  I narrowed the problem down to this test case.

Brad

 t/t6019-rev-list-ancestry-path.sh |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/t/t6019-rev-list-ancestry-path.sh b/t/t6019-rev-list-ancestry-path.sh
index 7641029..aa4674f 100755
--- a/t/t6019-rev-list-ancestry-path.sh
+++ b/t/t6019-rev-list-ancestry-path.sh
@@ -70,4 +70,39 @@ test_expect_success 'rev-list --ancestry-patch D..M -- M.t' '
 	test_cmp expect actual
 '
 
+#   b---bc
+#  / \ /
+# a   X
+#  \ / \
+#   c---cb
+test_expect_success 'setup criss-cross' '
+	mkdir criss-cross &&
+	(cd criss-cross &&
+	 git init &&
+	 test_commit A &&
+	 git checkout -b b master &&
+	 test_commit B &&
+	 git checkout -b c master &&
+	 test_commit C &&
+	 git checkout -b bc b -- &&
+	 git merge c &&
+	 git checkout -b cb c -- &&
+	 git merge b &&
+	 git checkout master)
+'
+
+# no commits in bc descend from cb
+test_expect_success 'criss-cross: rev-list --ancestry-path cb..bc' '
+	(cd criss-cross &&
+	 git rev-list --ancestry-path cb..bc > actual &&
+	 test -z "$(cat actual)")
+'
+
+# no commits in repository descend from cb
+test_expect_failure 'criss-cross: rev-list --ancestry-path --all ^cb' '
+	(cd criss-cross &&
+	 git rev-list --ancestry-path --all ^cb > actual &&
+	 test -z "$(cat actual)")
+'
+
 test_done
-- 
1.7.4.4

  reply	other threads:[~2011-08-25 16:49 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-24 13:59 [PATCH] submodule: Demonstrate known breakage during recursive merge Brad King
2011-08-24 19:14 ` Heiko Voigt
2011-08-24 19:24   ` Junio C Hamano
2011-08-24 19:46     ` Heiko Voigt
2011-08-24 20:02       ` Brad King
2011-08-24 20:27         ` Heiko Voigt
2011-08-24 20:40           ` Brad King
2011-08-24 21:32             ` Heiko Voigt
2011-08-25 16:49               ` Brad King [this message]
2011-08-25 23:08                 ` [PATCH] rev-list: Demonstrate breakage with --ancestry-path --all Junio C Hamano
2011-08-25 23:49                   ` Junio C Hamano
2011-08-26  1:00                 ` [PATCH 1/2] revision: keep track of the end-user input from the command line Junio C Hamano
2011-08-26  1:08                   ` Sverre Rabbelier
2011-08-26  2:21                     ` Junio C Hamano
2011-08-26  1:00                 ` [PATCH 2/2] revision: do not include sibling history in --ancestry-path output Junio C Hamano
2011-08-26 12:51                   ` Brad King
2011-08-24 22:43       ` [PATCH] submodule: Demonstrate known breakage during recursive merge Junio C Hamano
2011-08-25 21:11         ` [PATCH] allow multiple calls to submodule merge search for the same path Heiko Voigt
2011-08-25 23:22           ` Junio C Hamano
2011-08-25 23:28             ` Junio C Hamano
2011-08-25 23:39               ` Junio C Hamano
2011-08-25 12:28 ` [PATCH v2] submodule: Demonstrate known breakage during recursive merge Brad King
2011-08-26 14:18   ` [PATCH/RFC] submodule: Search for merges only at end of " Brad King
2011-08-26 19:04     ` Junio C Hamano
2011-08-26 19:30       ` [PATCH v2/RFC] " Brad King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=438ea0b254ccafb3fc9f3431f8f86007cc03132b.1314290439.git.brad.king@kitware.com \
    --to=brad.king@kitware.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hvoigt@hvoigt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).