git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Bracey <kevin@bracey.fi>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Kevin Bracey <kevin@bracey.fi>
Subject: [PATCH v4 15/15] revision.c: make default history consider bottom commits
Date: Thu, 16 May 2013 18:32:41 +0300	[thread overview]
Message-ID: <1368718361-27859-16-git-send-email-kevin@bracey.fi> (raw)
In-Reply-To: <1368718361-27859-1-git-send-email-kevin@bracey.fi>

Previously, the default history treated bottom commits the same as any
other UNINTERESTING commit, which could force it down side branches.

Consider the following history:

   *A--*B---D--*F         * marks !TREESAME parent paths
     \     /*
      `-C-'

When requesting "B..F", B is UNINTERESTING but TREESAME to D. C is
!UNINTERESTING.

So default following would go from D into the irrelevant side branch C
to A, rather than to B.  Note also that if there had been an extra
!UNINTERESTING commit B1 between B and D, it wouldn't have gone down C.

Change the default following to test relevant_commit() instead of
!UNINTERESTING, so it can proceed straight from D to B, thus finishing
the traversal of that path.

Signed-off-by: Kevin Bracey <kevin@bracey.fi>
---
 revision.c                   |  2 +-
 t/t6111-rev-list-treesame.sh | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/revision.c b/revision.c
index edb7e1c..914ac78 100644
--- a/revision.c
+++ b/revision.c
@@ -684,7 +684,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
 			    sha1_to_hex(p->object.sha1));
 		switch (rev_compare_tree(revs, p, commit)) {
 		case REV_TREE_SAME:
-			if (!revs->simplify_history || (p->object.flags & UNINTERESTING)) {
+			if (!revs->simplify_history || !relevant_commit(p)) {
 				/* Even if a merge with an uninteresting
 				 * side branch brought the entire change
 				 * we are interested in, we do not want
diff --git a/t/t6111-rev-list-treesame.sh b/t/t6111-rev-list-treesame.sh
index 25cc8ad..88b84df 100755
--- a/t/t6111-rev-list-treesame.sh
+++ b/t/t6111-rev-list-treesame.sh
@@ -146,8 +146,8 @@ check_result '(LH)M (E)H (J)L (I)J (E)I' E..M --ancestry-path --simplify-merges
 # to G.
 check_result 'M L K J I H' G..M
 check_result 'M H L K J I' G..M --topo-order
-check_outcome failure 'M L H' G..M -- file # includes J I
-check_outcome failure '(LH)M (G)L (G)H' G..M --parents -- file # includes J I
+check_result 'M L H' G..M -- file
+check_result '(LH)M (G)L (G)H' G..M --parents -- file
 check_result 'M L J I H' G..M --full-history -- file
 check_result 'M L K J I H' G..M --full-history --parents -- file
 check_result 'M H L J I' G..M --simplify-merges -- file
@@ -161,8 +161,8 @@ check_result 'M H L J I' G..M --ancestry-path --simplify-merges -- file
 # But --full-history shouldn't drop D on its own - without simplification,
 # we can't decide if the merge from INTERESTING commit C was sensible.
 check_result 'F D C' B..F
-check_outcome failure 'F' B..F -- file # includes D
-check_outcome failure '(B)F' B..F --parents -- file # includes D
+check_result 'F' B..F -- file
+check_result '(B)F' B..F --parents -- file
 check_result 'F D' B..F --full-history -- file
 check_result '(D)F (BA)D' B..F --full-history --parents -- file
 check_result '(B)F' B..F --simplify-merges -- file
@@ -174,8 +174,8 @@ check_result 'F D' B..F --first-parent
 check_result 'F' B..F --first-parent -- file
 
 # E...F should be equivalent to E F ^B, and be able to drop D as above.
-check_outcome failure 'F' E F ^B -- file # includes D
-check_outcome failure 'F' E...F -- file # includes D
+check_result 'F' E F ^B -- file # includes D
+check_result 'F' E...F -- file # includes D
 
 # Any sort of full history of C..F should show D, as it's the connection to C,
 # and it differs from it.
-- 
1.8.3.rc0.28.g4b02ef5

      parent reply	other threads:[~2013-05-16 15:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-16 15:32 [PATCH v4 00/15] History traversal refinements Kevin Bracey
2013-05-16 15:32 ` [PATCH v4 01/15] decorate.c: compact table when growing Kevin Bracey
2013-05-16 15:32 ` [PATCH v4 02/15] t6019: test file dropped in -s ours merge Kevin Bracey
2013-05-16 15:32 ` [PATCH v4 03/15] t6111: new TREESAME test set Kevin Bracey
2013-05-16 15:32 ` [PATCH v4 04/15] t6111: allow checking the parents as well Kevin Bracey
2013-05-16 15:32 ` [PATCH v4 05/15] t6111: add parents to tests Kevin Bracey
2013-05-16 15:32 ` [PATCH v4 06/15] rev-list-options.txt: correct TREESAME for P Kevin Bracey
2013-05-16 15:32 ` [PATCH v4 07/15] Documentation: avoid "uninteresting" Kevin Bracey
2013-05-16 15:32 ` [PATCH v4 08/15] revision.c: Make --full-history consider more merges Kevin Bracey
2013-05-16 15:32 ` [PATCH v4 09/15] t6012: update test for tweaked full-history traversal Kevin Bracey
2013-05-16 15:32 ` [PATCH v4 10/15] simplify-merges: never remove all TREESAME parents Kevin Bracey
2013-05-16 15:32 ` [PATCH v4 11/15] simplify-merges: drop merge from irrelevant side branch Kevin Bracey
2013-05-16 15:32 ` [PATCH v4 12/15] revision.c: add BOTTOM flag for commits Kevin Bracey
2013-05-16 15:32 ` [PATCH v4 13/15] revision.c: discount side branches when computing TREESAME Kevin Bracey
2013-05-16 15:32 ` [PATCH v4 14/15] revision.c: don't show all merges for --parents Kevin Bracey
2013-05-16 15:32 ` Kevin Bracey [this message]

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=1368718361-27859-16-git-send-email-kevin@bracey.fi \
    --to=kevin@bracey.fi \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=torvalds@linux-foundation.org \
    /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).