summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1fc70b6)
raw | patch | inline | side by side (parent: 1fc70b6)
author | Linus Torvalds <torvalds@osdl.org> | |
Sat, 15 Apr 2006 19:09:56 +0000 (12:09 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Sun, 16 Apr 2006 01:17:15 +0000 (18:17 -0700) |
This uses the "--no-walk" flag that I never actually implemented (but I'm
sure I mentioned it) to make "git show" be essentially the same thing as
"git whatchanged --no-walk".
It just refuses to add more interesting parents to the revision walking
history, so you don't actually get any history, you just get the commit
you asked for.
I was going to add "--no-walk" as a real argument flag to git-rev-list
too, but I'm not sure anybody actually needs it. Although it might be
useful for porcelain, so I left the door open.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
sure I mentioned it) to make "git show" be essentially the same thing as
"git whatchanged --no-walk".
It just refuses to add more interesting parents to the revision walking
history, so you don't actually get any history, you just get the commit
you asked for.
I was going to add "--no-walk" as a real argument flag to git-rev-list
too, but I'm not sure anybody actually needs it. Although it might be
useful for porcelain, so I left the door open.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git.c | patch | blob | history | |
log-tree.c | patch | blob | history | |
revision.c | patch | blob | history | |
revision.h | patch | blob | history |
index 939a34caf935b8cdb7ea6b3340f5657fddd8dd89..c87accfa1af6368801975718a19f3fef47568d03 100644 (file)
--- a/git.c
+++ b/git.c
return cmd_log_wc(ac, av, ep, &wcopt);
}
+static int cmd_show(int ac, const char **av, char **ep)
+{
+ struct whatchanged_opt wcopt;
+
+ memset(&wcopt, 0, sizeof(wcopt));
+ wcopt.do_diff = 1;
+ init_log_tree_opt(&wcopt.logopt);
+ wcopt.logopt.ignore_merges = 0;
+ wcopt.logopt.combine_merges = 1;
+ wcopt.logopt.dense_combined_merges = 1;
+ wcopt.logopt.diffopt.recursive = 1;
+ return cmd_log_wc(ac, av, ep, &wcopt);
+}
+
static void handle_internal_command(int argc, const char **argv, char **envp)
{
const char *cmd = argv[0];
{ "version", cmd_version },
{ "help", cmd_help },
{ "log", cmd_log },
+ { "show", cmd_show },
{ "whatchanged", cmd_whatchanged },
};
int i;
diff --git a/log-tree.c b/log-tree.c
index cb0d0b15e711eb74afe6a48c4b6cedcf40de763f..17e976a63753c11bb4e33565437cbfa118b01d62 100644 (file)
--- a/log-tree.c
+++ b/log-tree.c
@@ -182,6 +182,8 @@ int parse_whatchanged_opt(int ac, const char **av, struct whatchanged_opt *wcopt
int left = 1;
ac = setup_revisions(ac, av, rev, "HEAD");
+ if (!strcmp(av[0], "show"))
+ rev->no_walk = 1;
while (1 < ac) {
const char *arg = av[1];
if (!strncmp(arg, "--pretty", 8)) {
diff --git a/revision.c b/revision.c
index 0505f3f455151ac2fafc7fe2df2e6fd147d20f08..0c3c392fde4e05893ef47e4f5dd6d253d8f84910 100644 (file)
--- a/revision.c
+++ b/revision.c
@@ -375,6 +375,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;
@@ -714,6 +717,8 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
void prepare_revision_walk(struct rev_info *revs)
{
+ if (revs->no_walk)
+ return;
sort_by_date(&revs->commits);
if (revs->limited)
limit_list(revs);
diff --git a/revision.h b/revision.h
index 8970b57e3c7e2ca8d213258f1befb84ac06e3a13..ff2a13ea87cb46383b37b0e21e0d028da6db4c0a 100644 (file)
--- a/revision.h
+++ b/revision.h
/* Traversal flags */
unsigned int dense:1,
no_merges:1,
+ no_walk:1,
remove_empty_trees:1,
lifo:1,
topo_order:1,