diff options
-rw-r--r-- | git.c | 18 | ||||
-rw-r--r-- | revision.c | 5 | ||||
-rw-r--r-- | revision.h | 1 |
3 files changed, 24 insertions, 0 deletions
@@ -354,6 +354,23 @@ static int cmd_wc(int argc, const char **argv, char **envp) return cmd_log_wc(argc, argv, envp, &rev); } +static int cmd_show(int argc, const char **argv, char **envp) +{ + struct rev_info rev; + + init_revisions(&rev); + rev.diff = 1; + rev.ignore_merges = 0; + rev.combine_merges = 1; + rev.dense_combined_merges = 1; + rev.abbrev = DEFAULT_ABBREV; + rev.commit_format = CMIT_FMT_DEFAULT; + rev.diffopt.recursive = 1; + rev.no_walk = 1; + argc = setup_revisions(argc, argv, &rev, "HEAD"); + return cmd_log_wc(argc, argv, envp, &rev); +} + static int cmd_log(int argc, const char **argv, char **envp) { struct rev_info rev; @@ -377,6 +394,7 @@ static void handle_internal_command(int argc, const char **argv, char **envp) { "help", cmd_help }, { "log", cmd_log }, { "whatchanged", cmd_wc }, + { "show", cmd_show }, }; int i; diff --git a/revision.c b/revision.c index 9693b6e4c7..f8fb028855 100644 --- a/revision.c +++ b/revision.c @@ -380,6 +380,9 @@ static void add_parents_to_list(struct rev_info *revs, struct commit *commit, st if (revs->prune_fn) revs->prune_fn(revs, commit); + if (revs->no_walk) + return; + parent = commit->parents; while (parent) { struct commit *p = parent->item; @@ -816,6 +819,8 @@ void prepare_revision_walk(struct rev_info *revs) list = list->next; } + if (revs->no_walk) + return; if (revs->limited) limit_list(revs); if (revs->topo_order) diff --git a/revision.h b/revision.h index 6eaa9048a9..7b854866b2 100644 --- a/revision.h +++ b/revision.h @@ -26,6 +26,7 @@ struct rev_info { /* Traversal flags */ unsigned int dense:1, no_merges:1, + no_walk:1, remove_empty_trees:1, lifo:1, topo_order:1, |