* [EGIT PATCH] Avoid breaking the walk prematurely
@ 2008-11-24 23:45 Robin Rosenberg
2008-11-25 0:12 ` Shawn O. Pearce
0 siblings, 1 reply; 2+ messages in thread
From: Robin Rosenberg @ 2008-11-24 23:45 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [EGIT PATCH] Avoid breaking the walk prematurely
2008-11-24 23:45 [EGIT PATCH] Avoid breaking the walk prematurely Robin Rosenberg
@ 2008-11-25 0:12 ` Shawn O. Pearce
0 siblings, 0 replies; 2+ messages in thread
From: Shawn O. Pearce @ 2008-11-25 0:12 UTC (permalink / raw)
To: Robin Rosenberg; +Cc: git
Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
> 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.
This is a fairly useful optimization in git. Most people use it,
because most people don't pass "--full-history" when they run
"git log -- path". So I think we really want to do it by default
in jgit.
Enabling this optimization again probably requires adding a new
method to TreeFilter which allows the filter graph to return only
nodes which select paths by name, and then do something like:
else if (chgs == adds && isPathSetEmpty(c.getTree())) {
c.parents = RevCommit.NO_PARENTS;
return true;
}
where isPathSetEmpty runs a second TreeWalk iteration but uses the
new (smaller) filter graph that only matches on paths.
I'm not going to write that out today. But I thought I'd at least
write an email while the idea was fresh in my head.
--
Shawn.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-11-25 0:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-24 23:45 [EGIT PATCH] Avoid breaking the walk prematurely Robin Rosenberg
2008-11-25 0:12 ` Shawn O. Pearce
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).