git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v8 6/7] update-ref and tag: add --create-reflog arg

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Jul 21, 2015, 13:46 UTC
Message-ID
<55AE4D1C.1010308@alum.mit.edu>
In-Reply-To
<1436482260-28088-7-git-send-email-dturner@twopensource.com>
On 07/09/2015 03:50 PM, David Turner wrote:
Show 45 quoted lines
> Allow the creation of a ref (e.g. stash) with a reflog already in
> place. For most refs (e.g. those under refs/heads), this happens
> automatically, but for others, we need this option.
> 
> Currently, git does this by pre-creating the reflog, but alternate ref
> backends might store reflogs somewhere other than .git/logs.  Code
> that now directly manipulates .git/logs should instead use git
> plumbing commands.
> 
> I also added --create-reflog to git tag, just for completeness.
> 
> In a moment, we will use this argument to make git stash work with
> alternate ref backends.
> 
> Signed-off-by: David Turner <dturner@twopensource.com>
> ---
>  Documentation/git-tag.txt        |  5 ++++-
>  Documentation/git-update-ref.txt |  5 ++++-
>  builtin/tag.c                    |  5 ++++-
>  builtin/update-ref.c             | 14 +++++++++++---
>  t/t1400-update-ref.sh            | 38 ++++++++++++++++++++++++++++++++++++++
>  t/t7004-tag.sh                   | 14 +++++++++++++-
>  6 files changed, 74 insertions(+), 7 deletions(-)
> 
> [...]
> diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
> index d1ff5c9..75423ab 100755
> --- a/t/t7004-tag.sh
> +++ b/t/t7004-tag.sh
> @@ -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 creates reflog on failure' '
s/creates/create/
> +	test_must_fail git tag --create-reflog mytag &&
> +	test_must_fail git reflog exists refs/tags/tag_with_reflog
Shouldn't this be
	test_must_fail git reflog exists refs/tags/mytag
?
> [...]
Michael
-- 
Michael Haggerty
mhagger@alum.mit.edu
Previous: David TurnerNext: David Turner
Message 10 of 14 in “ref backend preamble”
  1. 0/7 ref backend preambleDavid Turner, Jul 9, 2015
  2. 1/7 refs.c: add err arguments to reflog functionsDavid Turner, Jul 9, 2015
  3. Michael HaggertyJul 21, 2015
  4. 2/7 refs: Break out check for reflog autocreationDavid Turner, Jul 9, 2015
  5. 3/7 refs: new public ref function: safe_create_reflogDavid Turner, Jul 9, 2015
  6. 4/7 git-reflog: add exists commandDavid Turner, Jul 9, 2015
  7. Michael HaggertyJul 21, 2015
  8. 5/7 refs: add REF_FORCE_CREATE_REFLOG flagDavid Turner, Jul 9, 2015
  9. 6/7 update-ref and tag: add --create-reflog argDavid Turner, Jul 9, 2015
  10. Michael HaggertyJul 21, 2015
  11. 7/7 git-stash: use update-ref --create-reflog instead of creating filesDavid Turner, Jul 9, 2015
  12. Philip OakleyJul 10, 2015
  13. David TurnerJul 10, 2015
  14. Michael HaggertyJul 21, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.