]> git.ipfire.org Git - thirdparty/git.git/commit - notes-utils.c
notes: allow treeish expressions as notes ref
authorMike Hommey <mh@glandium.org>
Thu, 8 Oct 2015 02:54:43 +0000 (11:54 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 12 Jan 2016 23:10:01 +0000 (15:10 -0800)
commitee76f92fe883305c1260952f5b325b0503311fc9
tree6cea77bd1955070b9f56832d803ac0b70448f59f
parent754884255bb580df159e58defa81cdd30b5c430c
notes: allow treeish expressions as notes ref

init_notes() is the main point of entry to the notes API. It ensures
that the input can be used as ref, because it needs a ref to update to
store notes tree after modifying it.

There however are many use cases where notes tree is only read, e.g.
"git log --notes=...".  Any notes-shaped treeish could be used for such
purpose, but it is not allowed due to existing restriction.

Allow treeish expressions to be used in the case the notes tree is going
to be used without write "permissions".  Add a flag to distinguish
whether the notes tree is intended to be used read-only, or will be
updated.

With this change, operations that use notes read-only can be fed any
notes-shaped tree-ish can be used, e.g. git log --notes=notes@{1}.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/pretty-options.txt
builtin/notes.c
notes-cache.c
notes-utils.c
notes.c
notes.h
t/t3301-notes.sh