Skip to content

Commit 8e64006

Browse files
dschogitster
authored andcommitted
Teach revision machinery about --no-walk
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>
1 parent dfd05e3 commit 8e64006

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Documentation/git-rev-list.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ SYNOPSIS
3737
[ \--merge ]
3838
[ \--reverse ]
3939
[ \--walk-reflogs ]
40+
[ \--no-walk ] [ \--do-walk ]
4041
<commit>... [ \-- <paths>... ]
4142

4243
DESCRIPTION
@@ -398,6 +399,14 @@ These options are mostly targeted for packing of git repositories.
398399
Only useful with '--objects'; print the object IDs that are not
399400
in packs.
400401

402+
--no-walk::
403+
404+
Only show the given revs, but do not traverse their ancestors.
405+
406+
--do-walk::
407+
408+
Overrides a previous --no-walk.
409+
401410

402411
include::pretty-formats.txt[]
403412

revision.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,14 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
11911191
revs->reverse ^= 1;
11921192
continue;
11931193
}
1194+
if (!strcmp(arg, "--no-walk")) {
1195+
revs->no_walk = 1;
1196+
continue;
1197+
}
1198+
if (!strcmp(arg, "--do-walk")) {
1199+
revs->no_walk = 0;
1200+
continue;
1201+
}
11941202

11951203
opts = diff_opt_parse(&revs->diffopt, argv+i, argc-i);
11961204
if (opts > 0) {

0 commit comments

Comments
 (0)