summaryrefslogtreecommitdiff
path: root/notes.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-02 22:58:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-05-02 22:58:50 (GMT)
commit23f536cf6236bf2a29026fea52c6bf7624b6485d (patch)
tree2738ba07faa16941f0d0d5dbc19ec39821920754 /notes.c
parenta75c3523d35144934e97f2660401e05b36ef8083 (diff)
parent3925b575687f64d49bd777ba6f64557a56b838b6 (diff)
downloadgit-23f536cf6236bf2a29026fea52c6bf7624b6485d.zip
git-23f536cf6236bf2a29026fea52c6bf7624b6485d.tar.gz
git-23f536cf6236bf2a29026fea52c6bf7624b6485d.tar.bz2
Merge branch 'jk/notes-ui-updates'
* jk/notes-ui-updates: contrib/completion: --notes, --no-notes log/pretty-options: Document --[no-]notes and deprecate old notes options revision.c: make --no-notes reset --notes list revision.c: support --notes command-line option notes: refactor display notes default handling notes: refactor display notes extra refs field revision.c: refactor notes ref expansion notes: make expand_notes_ref globally accessible
Diffstat (limited to 'notes.c')
-rw-r--r--notes.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/notes.c b/notes.c
index a013c1b..f6ce848 100644
--- a/notes.c
+++ b/notes.c
@@ -1053,7 +1053,8 @@ void init_display_notes(struct display_notes_opt *opt)
assert(!display_notes_trees);
- if (!opt || !opt->suppress_default_notes) {
+ if (!opt || opt->use_default_notes > 0 ||
+ (opt->use_default_notes == -1 && !opt->extra_notes_refs.nr)) {
string_list_append(&display_notes_refs, default_notes_ref());
display_ref_env = getenv(GIT_NOTES_DISPLAY_REF_ENVIRONMENT);
if (display_ref_env) {
@@ -1066,9 +1067,9 @@ void init_display_notes(struct display_notes_opt *opt)
git_config(notes_display_config, &load_config_refs);
- if (opt && opt->extra_notes_refs) {
+ if (opt) {
struct string_list_item *item;
- for_each_string_list_item(item, opt->extra_notes_refs)
+ for_each_string_list_item(item, &opt->extra_notes_refs)
string_list_add_refs_by_glob(&display_notes_refs,
item->string);
}
@@ -1285,3 +1286,13 @@ int copy_note(struct notes_tree *t,
return 0;
}
+
+void expand_notes_ref(struct strbuf *sb)
+{
+ if (!prefixcmp(sb->buf, "refs/notes/"))
+ return; /* we're happy */
+ else if (!prefixcmp(sb->buf, "notes/"))
+ strbuf_insert(sb, 0, "refs/", 5);
+ else
+ strbuf_insert(sb, 0, "refs/notes/", 11);
+}