Teach git-rev-parse and git-show-ref to show notes by adding a '--notes' option. The '--notes' option is analogous to the '--tags' option for the respective commands. Signed-off-by: Johan Herland <johan@xxxxxxxxxxx> --- builtin-rev-parse.c | 5 +++++ builtin-show-ref.c | 16 +++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c index 37addb2..4ab88af 100644 --- a/builtin-rev-parse.c +++ b/builtin-rev-parse.c @@ -43,6 +43,7 @@ static int is_rev_argument(const char *arg) "--max-count=", "--min-age=", "--no-merges", + "--notes", "--objects", "--objects-edge", "--parents", @@ -310,6 +311,10 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) for_each_tag_ref(show_reference, NULL); continue; } + if (!strcmp(arg, "--notes")) { + for_each_note_ref(show_reference, NULL); + continue; + } if (!strcmp(arg, "--remotes")) { for_each_remote_ref(show_reference, NULL); continue; diff --git a/builtin-show-ref.c b/builtin-show-ref.c index 9463ff0..8a7d0e7 100644 --- a/builtin-show-ref.c +++ b/builtin-show-ref.c @@ -4,10 +4,11 @@ #include "tag.h" #include "path-list.h" -static const char show_ref_usage[] = "git show-ref [-q|--quiet] [--verify] [-h|--head] [-d|--dereference] [-s|--hash[=<length>]] [--abbrev[=<length>]] [--tags] [--heads] [--] [pattern*] < ref-list"; +static const char show_ref_usage[] = "git show-ref [-q|--quiet] [--verify] [-h|--head] [-d|--dereference] [-s|--hash[=<length>]] [--abbrev[=<length>]] [--tags] [--heads] [--notes] [--] [pattern*] < ref-list"; static int deref_tags = 0, show_head = 0, tags_only = 0, heads_only = 0, - found_match = 0, verify = 0, quiet = 0, hash_only = 0, abbrev = 0; + notes_only = 0, found_match = 0, verify = 0, quiet = 0, hash_only = 0, + abbrev = 0; static const char **pattern; static void show_one(const char *refname, const unsigned char *sha1) @@ -25,11 +26,12 @@ static int show_ref(const char *refname, const unsigned char *sha1, int flag, vo const char *hex; unsigned char peeled[20]; - if (tags_only || heads_only) { + if (tags_only || heads_only || notes_only) { int match; - match = heads_only && !prefixcmp(refname, "refs/heads/"); - match |= tags_only && !prefixcmp(refname, "refs/tags/"); + match = heads_only && !prefixcmp(refname, "refs/heads/"); + match |= tags_only && !prefixcmp(refname, "refs/tags/"); + match |= notes_only && !prefixcmp(refname, "refs/notes/"); if (!match) return 0; } @@ -213,6 +215,10 @@ int cmd_show_ref(int argc, const char **argv, const char *prefix) heads_only = 1; continue; } + if (!strcmp(arg, "--notes")) { + notes_only = 1; + continue; + } if (!strcmp(arg, "--exclude-existing")) return exclude_existing(NULL); if (!prefixcmp(arg, "--exclude-existing=")) -- 1.5.2.101.gee49f - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html