@matheusbsbs / matheus-bagliano / commits / 78892e3261
Fork 0

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>

Linus Torvalds committed Nov 3, 2008 at 11:25 UTC 78892e32616f00bf173496ca0502aff2e523db31
2 files changed +28
revision.c
+27
@@ -11,6 +11,7 @@
11 #include "reflog-walk.h"
12 #include "patch-ids.h"
13 #include "decorate.h"
14 +#include "log-tree.h"
15
16 volatile show_early_output_fn_t show_early_output;
17
@@ -301,6 +302,24 @@ static int rev_compare_tree(struct rev_info *revs, struct commit *parent, struct
302
303 if (!t1)
304 return REV_TREE_NEW;
305 +
306 + if (revs->simplify_by_decoration) {
307 + /*
308 + * If we are simplifying by decoration, then the commit
309 + * is worth showing if it has a tag pointing at it.
310 + */
311 + if (lookup_decoration(&name_decoration, &commit->object))
312 + return REV_TREE_DIFFERENT;
313 + /*
314 + * A commit that is not pointed by a tag is uninteresting
315 + * if we are not limited by path. This means that you will
316 + * see the usual "commits that touch the paths" plus any
317 + * tagged commit by specifying both --simplify-by-decoration
318 + * and pathspec.
319 + */
320 + if (!revs->prune_data)
321 + return REV_TREE_SAME;
322 + }
323 if (!t2)
324 return REV_TREE_DIFFERENT;
325 tree_difference = REV_TREE_SAME;
@@ -1041,6 +1060,14 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
1060 revs->rewrite_parents = 1;
1061 revs->simplify_history = 0;
1062 revs->limited = 1;
1063 + } else if (!strcmp(arg, "--simplify-by-decoration")) {
1064 + revs->simplify_merges = 1;
1065 + revs->rewrite_parents = 1;
1066 + revs->simplify_history = 0;
1067 + revs->simplify_by_decoration = 1;
1068 + revs->limited = 1;
1069 + revs->prune = 1;
1070 + load_ref_decorations();
1071 } else if (!strcmp(arg, "--date-order")) {
1072 revs->lifo = 0;
1073 revs->topo_order = 1;
revision.h
+1
@@ -43,6 +43,7 @@ struct rev_info {
43 lifo:1,
44 topo_order:1,
45 simplify_merges:1,
46 + simplify_by_decoration:1,
47 tag_objects:1,
48 tree_objects:1,
49 blob_objects:1,