git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robin Rosenberg <robin.rosenberg@dewire.com>
To: spearce@spearce.org
Cc: git@vger.kernel.org, Robin Rosenberg <robin.rosenberg@dewire.com>
Subject: [EGIT PATCH] Avoid breaking the walk prematurely
Date: Tue, 25 Nov 2008 00:45:48 +0100	[thread overview]
Message-ID: <1227570348-20092-1-git-send-email-robin.rosenberg@dewire.com> (raw)

The optimization broke the walk when all changes we adds, assuming
the parent was an empty tree. This assumption was wrong. The tree does
not have to bee empty, it can contain other trees and blobs.

http://code.google.com/p/egit/issues/detail?id=46

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../spearce/jgit/revwalk/RewriteTreeFilter.java    |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

We could introduce a fixed version later on if we supply an option to select
whether to optimize the walk this way. The problem with doing it without an
option is that imports from legacy SCMs do not necessarily record file moves
as add/removes in direct sucession, but other events may happen in beteens
for various reasons.

-- robin 

diff --git a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RewriteTreeFilter.java b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RewriteTreeFilter.java
index 587d6d2..a5edbf0 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/revwalk/RewriteTreeFilter.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/revwalk/RewriteTreeFilter.java
@@ -118,13 +118,6 @@ public boolean include(final RevWalk walker, final RevCommit c)
 				//
 				c.flags |= REWRITE;
 				return false;
-			} else if (chgs == adds) {
-				// We added everything, so the parent may as well just
-				// be an empty tree. Kill our parent, we can assume
-				// it did not supply interesting changes.
-				//
-				c.parents = RevCommit.NO_PARENTS;
-				return true;
 			} else {
 				// We have interesting items, but neither of the special
 				// cases denoted above.
-- 
1.6.0.3.640.g6331a

             reply	other threads:[~2008-11-24 23:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-24 23:45 Robin Rosenberg [this message]
2008-11-25  0:12 ` [EGIT PATCH] Avoid breaking the walk prematurely Shawn O. Pearce

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=1227570348-20092-1-git-send-email-robin.rosenberg@dewire.com \
    --to=robin.rosenberg@dewire.com \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.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).