summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5b84f4d)
raw | patch | inline | side by side (parent: 5b84f4d)
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 07:13:38 +0000 (00:13 -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.
[jc: ported to the unified option structure by Linus]
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.
[jc: ported to the unified option structure by Linus]
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git.c | patch | blob | history | |
revision.c | patch | blob | history | |
revision.h | patch | blob | history |
index 9a89b0afbdb16f0c044741e2772066e73186c5c3..9e29ade2b4b7b92d6eb6a4ffad56db37642a3620 100644 (file)
--- a/git.c
+++ b/git.c
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;
{ "help", cmd_help },
{ "log", cmd_log },
{ "whatchanged", cmd_wc },
+ { "show", cmd_show },
};
int i;
diff --git a/revision.c b/revision.c
index 9693b6e4c7969307e2509e4e479b05a432a52186..f8fb02885589e3243b4b44692594861f98843d69 100644 (file)
--- 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;
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 6eaa9048a93ec152346a335de8af604aafa0faf5..7b854866b2fe43bf01d5453d4d580ffb2179d8a5 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,