From: Michael J Gruber <git@drmicha.warpmail.net>
To: git@vger.kernel.org
Subject: [RFD PATCH] revlist/rev-parse: Introduce --heads and --locals revision specifiers
Date: Sat, 1 May 2010 20:36:33 +0200 [thread overview]
Message-ID: <83fc6259c434cc63f8e64ddf9ac8f90bae0ab2eb.1272557175.git.git@drmicha.warpmail.net> (raw)
Due to the increasing usage of the ref namespace (e.g. notes, replace)
the revision specifier "--all" becomes decreasingly useful. But
"something like --all" is ineeded for getting a quick overview of
the development state of a repository.
Introduce --heads and --locals specifiers in order to help with that:
--heads == HEAD --branches --remotes
--locals = HEAD --branches --tags
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
RFD for several reasons:
- It's incredibly useful, I want it - do others? ;)
- names of the options (let the bikeshedding begin)
- should rev-parse include HEAD?
- tests and doc, of course
rev-parse does not include HEAD even with --all, but rev-list does.
The patch keeps with that tradition (the commit message does not quite
convey this). I don't feel it's a good one. Cleaning that up
requires more work, though.
builtin/rev-list.c | 2 ++
builtin/rev-parse.c | 12 ++++++++++++
revision.c | 12 ++++++++++++
3 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 51ceb19..fb8208c 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -20,7 +20,9 @@ static const char rev_list_usage[] =
" --all\n"
" --branches\n"
" --tags\n"
+" --locals\n"
" --remotes\n"
+" --heads\n"
" --stdin\n"
" --quiet\n"
" ordering output:\n"
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 8fbf9d0..c739479 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -44,6 +44,8 @@ static int is_rev_argument(const char *arg)
"--branches=",
"--branches",
"--header",
+ "--heads",
+ "--locals",
"--max-age=",
"--max-count=",
"--min-age=",
@@ -598,6 +600,11 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
for_each_tag_ref(show_reference, NULL);
continue;
}
+ if (!strcmp(arg, "--locals")) {
+ for_each_branch_ref(show_reference, NULL);
+ for_each_tag_ref(show_reference, NULL);
+ continue;
+ }
if (!prefixcmp(arg, "--glob=")) {
for_each_glob_ref(show_reference, arg + 7, NULL);
continue;
@@ -611,6 +618,11 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
for_each_remote_ref(show_reference, NULL);
continue;
}
+ if (!strcmp(arg, "--heads")) {
+ for_each_branch_ref(show_reference, NULL);
+ for_each_remote_ref(show_reference, NULL);
+ continue;
+ }
if (!strcmp(arg, "--show-toplevel")) {
const char *work_tree = get_git_work_tree();
if (work_tree)
diff --git a/revision.c b/revision.c
index f4b8b38..04f9be7 100644
--- a/revision.c
+++ b/revision.c
@@ -1399,10 +1399,22 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
handle_refs(revs, flags, for_each_tag_ref);
continue;
}
+ if (!strcmp(arg, "--locals")) {
+ handle_refs(revs, flags, for_each_branch_ref);
+ handle_refs(revs, flags, for_each_tag_ref);
+ handle_refs(revs, flags, head_ref);
+ continue;
+ }
if (!strcmp(arg, "--remotes")) {
handle_refs(revs, flags, for_each_remote_ref);
continue;
}
+ if (!strcmp(arg, "--heads")) {
+ handle_refs(revs, flags, for_each_remote_ref);
+ handle_refs(revs, flags, for_each_branch_ref);
+ handle_refs(revs, flags, head_ref);
+ continue;
+ }
if (!prefixcmp(arg, "--glob=")) {
struct all_refs_cb cb;
init_all_refs_cb(&cb, revs, flags);
--
1.7.1.328.g9993c
next reply other threads:[~2010-05-01 18:36 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-01 18:36 Michael J Gruber [this message]
2010-05-01 19:42 ` [RFD PATCH] revlist/rev-parse: Introduce --heads and --locals revision specifiers Jakub Narebski
2010-05-01 19:47 ` Michael J Gruber
2010-05-01 19:51 ` Jakub Narebski
2010-05-02 5:00 ` Jeff King
2010-05-02 13:43 ` Michael J Gruber
2010-05-05 3:35 ` Jeff King
2010-05-13 14:24 ` [PATCH 0/4] All is too much Michael J Gruber
2010-05-13 14:24 ` [PATCH 1/4] rev-parse: deprecate use as an option sifter Michael J Gruber
2010-05-14 15:41 ` Jakub Narebski
2010-05-14 18:52 ` Michael J Gruber
2010-05-14 19:01 ` Jakub Narebski
2010-05-14 19:22 ` Michael J Gruber
2010-05-17 14:26 ` Thomas Rast
2010-05-13 14:24 ` [PATCH 2/4] t6018: add tests for rev-list's --branches and --tags Michael J Gruber
2010-05-13 14:24 ` [PATCH 3/4] t6018: make sure all tested symbolic names are different revs Michael J Gruber
2010-05-13 14:24 ` [PATCH 4/4] revlist: Introduce --lrbranches and --locals revision specifiers Michael J Gruber
2010-05-14 6:06 ` [PATCH 0/4] All is too much Jeff King
2010-05-14 16:08 ` Michael J Gruber
2010-05-14 16:14 ` Git methodology question Akhbari, Farshad
2010-05-14 21:44 ` Chris Packham
2010-05-14 21:54 ` Avery Pennarun
2010-05-14 18:26 ` [PATCH v2 0/4] All is too much Michael J Gruber
2010-05-14 18:26 ` [PATCH v2 1/4] rev-parse: deprecate use as an option sifter Michael J Gruber
2010-05-14 18:26 ` [PATCH v2 2/4] t6018: add tests for rev-list's --branches and --tags Michael J Gruber
2010-05-14 18:26 ` [PATCH v2 3/4] t6018: make sure all tested symbolic names are different revs Michael J Gruber
2010-05-14 18:26 ` [PATCH v2 4/4] revlist: Introduce --lrbranches and --locals revision specifiers Michael J Gruber
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=83fc6259c434cc63f8e64ddf9ac8f90bae0ab2eb.1272557175.git.git@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
/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).