diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-05-02 15:58:50 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-05-02 15:58:50 -0700 |
commit | 23f536cf6236bf2a29026fea52c6bf7624b6485d (patch) | |
tree | 2738ba07faa16941f0d0d5dbc19ec39821920754 /notes.c | |
parent | a75c3523d35144934e97f2660401e05b36ef8083 (diff) | |
parent | 3925b575687f64d49bd777ba6f64557a56b838b6 (diff) | |
download | git-23f536cf6236bf2a29026fea52c6bf7624b6485d.tar.gz |
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.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -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); +} |