git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Bill Lear <rael@zopyra.com>
Cc: git@vger.kernel.org
Subject: [PATCH] Teach revision machinery about --no-walk
Date: Tue, 24 Jul 2007 00:38:40 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0707240011500.14781@racer.site> (raw)
In-Reply-To: <17929.44659.574482.637805@lisa.zopyra.com>


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>
---

	On Tue, 27 Mar 2007, Bill Lear wrote:

	> On Wednesday, March 28, 2007 at 01:03:57 (+0200) Johannes Schindelin writes:
	> >...
	> >	This is only lightly tested, and I will not have time to work any 
	> >	more on this. So, if this does not what you want, you will have to
	> >	fix it yourself.
	> 
	> Well, thank you kindly for your quick reply.  I will patch this in to my 
	> git source tree, test it out and see if I can fix anything that comes 
	> up.

	Actually, I tested this a lot in recent times, especially since I 
	started to use topic branches a lot more, to keep Junio happy.

	And then I had an idea: Much better to let "git log" do the work, 
	since it already sorts the commits it shows by date.  There is a 
	flag in the revision machinery, named "no_walk" which would tell 
	it to not traverse all ancestors.

	Since I can make this an alias, it does not matter very much that 
	the command line is so long.  However, since you can use different 
	pretty formats, this might be much more useful than the 
	--sort-by-date option for "git branch".

 Documentation/git-rev-list.txt |    9 +++++++++
 revision.c                     |    8 ++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt
index 0430139..1c19781 100644
--- a/Documentation/git-rev-list.txt
+++ b/Documentation/git-rev-list.txt
@@ -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[]
 
diff --git a/revision.c b/revision.c
index 00b75bc..16f35c7 100644
--- a/revision.c
+++ b/revision.c
@@ -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) {
-- 
1.5.3.rc2.31.gf7d7-dirty

  reply	other threads:[~2007-07-23 23:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-27 21:52 Listing of branch creation time? Bill Lear
2007-03-27 23:03 ` [PATCH] git-branch: add --sort-by-date option Johannes Schindelin
2007-03-27 23:53   ` Bill Lear
2007-07-23 23:38     ` Johannes Schindelin [this message]
2007-03-27 23:35 ` Listing of branch creation time? Jeff King
2007-03-28  0:00   ` Bill Lear
     [not found]     ` <2007032 8000149.GA12808@coredump.intra.peff.net>
2007-03-28  0:01     ` Jeff King
2007-03-28  0:08       ` Bill Lear
2007-03-28  0:10         ` Jeff King
2007-03-28  0:14           ` Bill Lear
2007-03-27 23:51             ` David Lang
2007-03-28  0:21               ` Jeff King
2007-03-28  1:29         ` Nicolas Pitre
2007-03-28  1:25       ` Nicolas Pitre
2007-03-28  1:06   ` Linus Torvalds
2007-03-28  2:04     ` Junio C Hamano
2007-03-28  2:52     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0707240011500.14781@racer.site \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=rael@zopyra.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).