In preparation for allowing different "backends" to store the refs
in a way different from the traditional "one ref per file in $GIT_DIR
or in a $GIT_DIR/packed-refs file" filesystem storage, reduce
direct filesystem access to ref-like things like CHERRY_PICK_HEAD
from scripts and programs.
* dt/refs-backend-preamble:
git-stash: use update-ref --create-reflog instead of creating files
update-ref and tag: add --create-reflog arg
refs: add REF_FORCE_CREATE_REFLOG flag
git-reflog: add exists command
refs: new public ref function: safe_create_reflog
refs: break out check for reflog autocreation
refs.c: add err arguments to reflog functions
@ -23,6 +23,7 @@ depending on the subcommand:
@@ -23,6 +23,7 @@ depending on the subcommand:
[--dry-run] [--verbose] [--all | <refs>...]
'git reflog delete' [--rewrite] [--updateref]
[--dry-run] [--verbose] ref@\{specifier\}...
'git reflog exists' <ref>
Reference logs, or "reflogs", record when the tips of branches and
other references were updated in the local repository. Reflogs are
@ -52,6 +53,9 @@ argument must be an _exact_ entry (e.g. "`git reflog delete
@@ -52,6 +53,9 @@ argument must be an _exact_ entry (e.g. "`git reflog delete
master@{2}`"). This subcommand is also typically not used directly by
end users.
The "exists" subcommand checks whether a ref has a reflog. It exits
with zero status if the reflog exists, and non-zero status if it does
@ -142,6 +142,9 @@ This option is only applicable when listing tags without annotation lines.
@@ -142,6 +142,9 @@ This option is only applicable when listing tags without annotation lines.
all, 'whitespace' removes just leading/trailing whitespace lines and
'strip' removes both whitespace and commentary.
--create-reflog::
Create a reflog for the tag.
<tagname>::
The name of the tag to create, delete, or describe.
@ -8,7 +8,7 @@ git-update-ref - Update the object name stored in a ref safely
@@ -8,7 +8,7 @@ git-update-ref - Update the object name stored in a ref safely
@ -67,6 +67,9 @@ performs all modifications together. Specify commands of the form:
@@ -67,6 +67,9 @@ performs all modifications together. Specify commands of the form:
verify SP <ref> [SP <oldvalue>] LF
option SP <opt> LF
With `--create-reflog`, update-ref will create a reflog for each ref
even if one would not ordinarily be created.
Quote fields containing whitespace as if they were strings in C source
code; i.e., surrounded by double-quotes and with backslash escapes.
Use 40 "0" characters or the empty string to specify a zero value. To
@ -51,7 +51,19 @@ test_expect_success 'creating a tag using default HEAD should succeed' '
@@ -51,7 +51,19 @@ test_expect_success 'creating a tag using default HEAD should succeed' '
echo foo >foo &&
git add foo &&
git commit -m Foo &&
git tag mytag
git tag mytag &&
test_must_fail git reflog exists refs/tags/mytag
'
test_expect_success 'creating a tag with --create-reflog should create reflog' '
test_when_finished "git tag -d tag_with_reflog" &&
git tag --create-reflog tag_with_reflog &&
git reflog exists refs/tags/tag_with_reflog
'
test_expect_success '--create-reflog does not create reflog on failure' '
test_must_fail git tag --create-reflog mytag &&
test_must_fail git reflog exists refs/tags/mytag
'
test_expect_success 'listing all tags if one exists should succeed' '