revision traversal: '--simplify-by-decoration'
With this, you can simplify history not by the contents of the tree, but whether a commit has been named (ie it's referred to by some branch or tag) or not. This makes it possible to see the relationship between different named commits, without actually seeing any of the details. When used with pathspec, you would get the usual view that is limited to the commits that change the contents of the tree plus commits that are named. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
d467a525da
commit
78892e3261
27
revision.c
27
revision.c
@ -11,6 +11,7 @@
|
|||||||
#include "reflog-walk.h"
|
#include "reflog-walk.h"
|
||||||
#include "patch-ids.h"
|
#include "patch-ids.h"
|
||||||
#include "decorate.h"
|
#include "decorate.h"
|
||||||
|
#include "log-tree.h"
|
||||||
|
|
||||||
volatile show_early_output_fn_t show_early_output;
|
volatile show_early_output_fn_t show_early_output;
|
||||||
|
|
||||||
@ -301,6 +302,24 @@ static int rev_compare_tree(struct rev_info *revs, struct commit *parent, struct
|
|||||||
|
|
||||||
if (!t1)
|
if (!t1)
|
||||||
return REV_TREE_NEW;
|
return REV_TREE_NEW;
|
||||||
|
|
||||||
|
if (revs->simplify_by_decoration) {
|
||||||
|
/*
|
||||||
|
* If we are simplifying by decoration, then the commit
|
||||||
|
* is worth showing if it has a tag pointing at it.
|
||||||
|
*/
|
||||||
|
if (lookup_decoration(&name_decoration, &commit->object))
|
||||||
|
return REV_TREE_DIFFERENT;
|
||||||
|
/*
|
||||||
|
* A commit that is not pointed by a tag is uninteresting
|
||||||
|
* if we are not limited by path. This means that you will
|
||||||
|
* see the usual "commits that touch the paths" plus any
|
||||||
|
* tagged commit by specifying both --simplify-by-decoration
|
||||||
|
* and pathspec.
|
||||||
|
*/
|
||||||
|
if (!revs->prune_data)
|
||||||
|
return REV_TREE_SAME;
|
||||||
|
}
|
||||||
if (!t2)
|
if (!t2)
|
||||||
return REV_TREE_DIFFERENT;
|
return REV_TREE_DIFFERENT;
|
||||||
tree_difference = REV_TREE_SAME;
|
tree_difference = REV_TREE_SAME;
|
||||||
@ -1041,6 +1060,14 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
|
|||||||
revs->rewrite_parents = 1;
|
revs->rewrite_parents = 1;
|
||||||
revs->simplify_history = 0;
|
revs->simplify_history = 0;
|
||||||
revs->limited = 1;
|
revs->limited = 1;
|
||||||
|
} else if (!strcmp(arg, "--simplify-by-decoration")) {
|
||||||
|
revs->simplify_merges = 1;
|
||||||
|
revs->rewrite_parents = 1;
|
||||||
|
revs->simplify_history = 0;
|
||||||
|
revs->simplify_by_decoration = 1;
|
||||||
|
revs->limited = 1;
|
||||||
|
revs->prune = 1;
|
||||||
|
load_ref_decorations();
|
||||||
} else if (!strcmp(arg, "--date-order")) {
|
} else if (!strcmp(arg, "--date-order")) {
|
||||||
revs->lifo = 0;
|
revs->lifo = 0;
|
||||||
revs->topo_order = 1;
|
revs->topo_order = 1;
|
||||||
|
@ -43,6 +43,7 @@ struct rev_info {
|
|||||||
lifo:1,
|
lifo:1,
|
||||||
topo_order:1,
|
topo_order:1,
|
||||||
simplify_merges:1,
|
simplify_merges:1,
|
||||||
|
simplify_by_decoration:1,
|
||||||
tag_objects:1,
|
tag_objects:1,
|
||||||
tree_objects:1,
|
tree_objects:1,
|
||||||
blob_objects:1,
|
blob_objects:1,
|
||||||
|
Loading…
Reference in New Issue
Block a user