Skip to content

Commit

Permalink
Merge branch 'kb/full-history-compute-treesame-carefully-2'
Browse files Browse the repository at this point in the history
Major update to the revision traversal logic to improve culling of
irrelevant parents while traversing a mergy history.

* kb/full-history-compute-treesame-carefully-2:
  revision.c: make default history consider bottom commits
  revision.c: don't show all merges for --parents
  revision.c: discount side branches when computing TREESAME
  revision.c: add BOTTOM flag for commits
  simplify-merges: drop merge from irrelevant side branch
  simplify-merges: never remove all TREESAME parents
  t6012: update test for tweaked full-history traversal
  revision.c: Make --full-history consider more merges
  Documentation: avoid "uninteresting"
  rev-list-options.txt: correct TREESAME for P
  t6111: add parents to tests
  t6111: allow checking the parents as well
  t6111: new TREESAME test set
  t6019: test file dropped in -s ours merge
  decorate.c: compact table when growing
  • Loading branch information
Junio C Hamano committed Jun 14, 2013
2 parents 91d34bc + 141efdb commit b27a79d
Show file tree
Hide file tree
Showing 7 changed files with 750 additions and 91 deletions.
42 changes: 25 additions & 17 deletions Documentation/rev-list-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ See also linkgit:git-reflog[1].

--boundary::

Output uninteresting commits at the boundary, which are usually
not shown.
Output excluded boundary commits. Boundary commits are
prefixed with `-`.

--

Expand Down Expand Up @@ -342,13 +342,13 @@ In the following, we will always refer to the same example history to
illustrate the differences between simplification settings. We assume
that you are filtering for a file `foo` in this commit graph:
-----------------------------------------------------------------------
.-A---M---N---O---P
/ / / / /
I B C D E
\ / / / /
`-------------'
.-A---M---N---O---P---Q
/ / / / / /
I B C D E Y
\ / / / / /
`-------------' X
-----------------------------------------------------------------------
The horizontal line of history A---P is taken to be the first parent of
The horizontal line of history A---Q is taken to be the first parent of
each merge. The commits are:

* `I` is the initial commit, in which `foo` exists with contents
Expand All @@ -367,8 +367,11 @@ each merge. The commits are:
`N` and `D` to "foobarbaz"; i.e., it is not TREESAME to any parent.

* `E` changes `quux` to "xyzzy", and its merge `P` combines the
strings to "quux xyzzy". Despite appearing interesting, `P` is
TREESAME to all parents.
strings to "quux xyzzy". `P` is TREESAME to `O`, but not to `E`.

* `X` is an indpendent root commit that added a new file `side`, and `Y`
modified it. `Y` is TREESAME to `X`. Its merge `Q` added `side` to `P`, and
`Q` is TREESAME to `P`, but not to `Y`.

'rev-list' walks backwards through history, including or excluding
commits based on whether '\--full-history' and/or parent rewriting
Expand Down Expand Up @@ -410,10 +413,10 @@ parent lines.
the example, we get
+
-----------------------------------------------------------------------
I A B N D O
I A B N D O P Q
-----------------------------------------------------------------------
+
`P` and `M` were excluded because they are TREESAME to a parent. `E`,
`M` was excluded because it is TREESAME to both parents. `E`,
`C` and `B` were all walked, but only `B` was !TREESAME, so the others
do not appear.
+
Expand All @@ -431,7 +434,7 @@ Along each parent, prune away commits that are not included
themselves. This results in
+
-----------------------------------------------------------------------
.-A---M---N---O---P
.-A---M---N---O---P---Q
/ / / / /
I B / D /
\ / / / /
Expand All @@ -441,7 +444,7 @@ themselves. This results in
Compare to '\--full-history' without rewriting above. Note that `E`
was pruned away because it is TREESAME, but the parent list of P was
rewritten to contain `E`'s parent `I`. The same happened for `C` and
`N`. Note also that `P` was included despite being TREESAME.
`N`, and `X`, `Y` and `Q`.

In addition to the above settings, you can change whether TREESAME
affects inclusion:
Expand Down Expand Up @@ -471,8 +474,9 @@ history according to the following rules:
* Set `C'` to `C`.
+
* Replace each parent `P` of `C'` with its simplification `P'`. In
the process, drop parents that are ancestors of other parents, and
remove duplicates.
the process, drop parents that are ancestors of other parents or that are
root commits TREESAME to an empty tree, and remove duplicates, but take care
to never drop all parents that we are TREESAME to.
+
* If after this parent rewriting, `C'` is a root or merge commit (has
zero or >1 parents), a boundary commit, or !TREESAME, it remains.
Expand All @@ -490,14 +494,18 @@ The effect of this is best shown by way of comparing to
`---------'
-----------------------------------------------------------------------
+
Note the major differences in `N` and `P` over '--full-history':
Note the major differences in `N`, `P` and `Q` over '--full-history':
+
--
* `N`'s parent list had `I` removed, because it is an ancestor of the
other parent `M`. Still, `N` remained because it is !TREESAME.
+
* `P`'s parent list similarly had `I` removed. `P` was then
removed completely, because it had one parent and is TREESAME.
+
* `Q`'s parent list had `Y` simplified to `X`. `X` was then removed, because it
was a TREESAME root. `Q` was then removed completely, because it had one
parent and is TREESAME.
--

Finally, there is a fifth simplification mode available:
Expand Down
2 changes: 1 addition & 1 deletion decorate.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static void grow_decoration(struct decoration *n)
const struct object *base = old_hash[i].base;
void *decoration = old_hash[i].decoration;

if (!base)
if (!decoration)
continue;
insert_decoration(n, base, decoration);
}
Expand Down
Loading

0 comments on commit b27a79d

Please sign in to comment.