git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Git Mailing List <git@vger.kernel.org>,
	Paul Mackerras <paulus@samba.org>,
	Marco Costalba <mcostalba@yahoo.it>,
	Aneesh Kumar <aneesh.kumar@gmail.com>,
	Len Brown <len.brown@intel.com>
Subject: [PATCH] combine-diff: add safety check to --cc.
Date: Thu, 02 Feb 2006 01:34:34 -0800	[thread overview]
Message-ID: <7vvevyrtn9.fsf_-_@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <7voe1qtbr5.fsf_-_@assigned-by-dhcp.cox.net> (Junio C. Hamano's message of "Thu, 02 Feb 2006 00:18:06 -0800")

The earlier change implemented "only two version" check but
without checking if the change rewrites from all the parents.
This implements a check to make sure that a change introduced
by the merge from all the parents is caught to be interesting.

Signed-off-by: Junio C Hamano <junkio@cox.net>

---

 Junio C Hamano <junkio@cox.net> writes:

 >  Linus Torvalds <torvalds@osdl.org> writes:
 >
 >  > On Wed, 1 Feb 2006, Linus Torvalds wrote:
 >  >
 >  > Actually, I take that back.
 >
 >  I do not do that "result to match the final" check in this
 >  version yet.  I'll need to revisit it before placing this in
 >  the master, but I am going to bed.

 Well, I didn't ;-).

 combine-diff.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

43fef6678c8e925307197fb705e499a023bba838
diff --git a/combine-diff.c b/combine-diff.c
index 45f1822..69e19ed 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -397,7 +397,23 @@ static int make_hunks(struct sline *slin
 		hunk_end = j;
 
 		/* [i..hunk_end) are interesting.  Now is it really
-		 * interesting?
+		 * interesting?  We check if there are only two versions
+		 * and the result matches one of them.  That is, we look
+		 * at:
+		 *   (+) line, which records lines added to which parents;
+		 *       this line appears in the result.
+		 *   (-) line, which records from what parents the line
+		 *       was removed; this line does not appear in the result.
+		 * then check the set of parents the result has difference
+		 * from, from all lines.  If there are lines that has
+		 * different set of parents that the result has differences
+		 * from, that means we have more than two versions.
+		 *
+		 * Even when we have only two versions, if the result does
+		 * not match any of the parents, the it should be considered
+		 * interesting.  In such a case, we would have all '+' line.
+		 * After passing the above "two versions" test, that would
+		 * appear as "the same set of parents" to be "all parents".
 		 */
 		same_diff = 0;
 		has_interesting = 0;
@@ -429,7 +445,7 @@ static int make_hunks(struct sline *slin
 			}
 		}
 
-		if (!has_interesting) {
+		if (!has_interesting && same_diff != all_mask) {
 			/* This hunk is not that interesting after all */
 			for (j = hunk_begin; j < hunk_end; j++)
 				sline[j].flag &= ~mark;
-- 
1.1.6.g2672

  reply	other threads:[~2006-02-02  9:34 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-02  6:28 The merge from hell Linus Torvalds
2006-02-02  7:05 ` Junio C Hamano
2006-02-02  7:40   ` [PATCH] combine-diff: reuse diff from the same blob Junio C Hamano
2006-02-02  7:51   ` The merge from hell Linus Torvalds
2006-02-02  7:55     ` Linus Torvalds
2006-02-02  8:08       ` Linus Torvalds
2006-02-02  8:18         ` [PATCH] combine-diff: update --cc "uninteresting hunks" logic Junio C Hamano
2006-02-02  9:34           ` Junio C Hamano [this message]
2006-02-02 23:03             ` [PATCH] combine-diff: add safety check to --cc Linus Torvalds
2006-02-03  0:02               ` Junio C Hamano
2006-02-03  1:05                 ` Linus Torvalds
2006-02-03  5:49                 ` [Attn - repository browser authors] diff-tree combined format Junio C Hamano
2006-02-03 12:17                   ` Marco Costalba
2006-02-03 19:55                     ` Junio C Hamano
2006-02-03 21:35                     ` Junio C Hamano
2006-02-04 12:03                       ` Marco Costalba
2006-02-04 11:23                   ` Paul Mackerras
2006-02-03  5:28               ` [PATCH] combine-diff: add safety check to --cc Junio C Hamano
2006-02-04  5:38               ` Paul Mackerras
2006-02-04  6:12                 ` Junio C Hamano
2006-02-04 10:46   ` The merge from hell Paul Mackerras
2006-02-04 12:22     ` Junio C Hamano
2006-02-04 19:42     ` Linus Torvalds
2006-02-04 20:59       ` Linus Torvalds
2006-02-02  7:25 ` Marco Costalba
2006-02-02  8:02   ` Linus Torvalds
2006-02-02  8:07     ` Aneesh Kumar
2006-02-02  8:27       ` Junio C Hamano
2006-02-02  8:44       ` Linus Torvalds
2006-02-02 10:41         ` Junio C Hamano
2006-02-05 19:42           ` Linus Torvalds
2006-02-05 19:49             ` Add a "git show" command to show a commit Linus Torvalds
2006-02-05 19:58               ` Fix git-rev-parse over-eager errors Linus Torvalds
2006-02-05 20:11                 ` Junio C Hamano
2006-02-05 22:03                   ` Linus Torvalds
2006-02-06  6:20                     ` Junio C Hamano
2006-02-05 22:45               ` Add a "git show" command to show a commit Junio C Hamano
2006-02-05 22:55                 ` Linus Torvalds
2006-02-05 22:59                   ` Linus Torvalds
2006-02-06  0:25                     ` Junio C Hamano

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=7vvevyrtn9.fsf_-_@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=aneesh.kumar@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=len.brown@intel.com \
    --cc=mcostalba@yahoo.it \
    --cc=paulus@samba.org \
    --cc=torvalds@osdl.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).