Teach revision machinery about --no-walk
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>
Mon, 23 Jul 2007 23:38:40 +0000 (00:38 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 24 Jul 2007 06:57:50 +0000 (23:57 -0700)
The flag "no_walk" is present in struct rev_info since a long time, but
so far has been in use exclusively by "git show".

With this flag, you can see all your refs, ordered by date of the last
commit:

$ git log --abbrev-commit --pretty=oneline --decorate --all --no-walk

which is extremely helpful if you have to juggle with a lot topic
branches, and do not remember in which one you introduced that uber
debug option, or simply want to get an overview what is cooking.

(Note that the "git log" invocation above does not output the same as

 $ git show --abbrev-commit --pretty=oneline --decorate --all --quiet

 since "git show" keeps the alphabetic order that "--all" returns the
 refs in, even if the option "--date-order" was passed.)

For good measure, this also adds the "--do-walk" option which overrides
"--no-walk".

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-rev-list.txt
revision.c

index 0430139093ddfc3bf9742eab279acc7afaa8951b..1c1978140f68a5e21dec6ea8d6715b58666f8b7c 100644 (file)
@@ -37,6 +37,7 @@ SYNOPSIS
             [ \--merge ]
             [ \--reverse ]
             [ \--walk-reflogs ]
+            [ \--no-walk ] [ \--do-walk ]
             <commit>... [ \-- <paths>... ]
 
 DESCRIPTION
@@ -398,6 +399,14 @@ These options are mostly targeted for packing of git repositories.
        Only useful with '--objects'; print the object IDs that are not
        in packs.
 
+--no-walk::
+
+       Only show the given revs, but do not traverse their ancestors.
+
+--do-walk::
+
+       Overrides a previous --no-walk.
+
 
 include::pretty-formats.txt[]
 
index 00b75bc10b53b0c64b14fc1d9111d5f4e1db3af5..16f35c7c18713aab991f04f6dcb787a73d15957d 100644 (file)
@@ -1191,6 +1191,14 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
                                revs->reverse ^= 1;
                                continue;
                        }
+                       if (!strcmp(arg, "--no-walk")) {
+                               revs->no_walk = 1;
+                               continue;
+                       }
+                       if (!strcmp(arg, "--do-walk")) {
+                               revs->no_walk = 0;
+                               continue;
+                       }
 
                        opts = diff_opt_parse(&revs->diffopt, argv+i, argc-i);
                        if (opts > 0) {