git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: Junio C Hamano <gitster@pobox.com>
Cc: Brad King <brad.king@kitware.com>,
	Stefan Beller <sbeller@google.com>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Ronnie Sahlberg <ronniesahlberg@gmail.com>,
	git@vger.kernel.org, Michael Haggerty <mhagger@alum.mit.edu>
Subject: [PATCH 0/2] Fix a bug with update-ref "verify" and no oldvalue
Date: Thu, 11 Dec 2014 00:47:50 +0100	[thread overview]
Message-ID: <1418255272-5875-1-git-send-email-mhagger@alum.mit.edu> (raw)

Ever since the --stdin option was added to "git update-ref" in

    c750ba9519 update-ref: support multiple simultaneous updates (2013-09-09)

the "verify" command has been broken. If no <oldvalue> is specified,
the documentation says that the "verify" command will verify that the
reference doesn't currently exist. But in fact, it unconditionally
*deletes* the reference (!)

Hopefully this is not a common usage idiom, but this is nonetheless a
serious bug.

Add some tests for this and related functionality, then fix the bug.

These patches are also available from my GitHub repository [1] as
branch "update-ref-verify-fix-v1".

This fix applies to "maint", for which I think it is appropriate. It
also merges through to "master" with no conflicts, though it conflicts
trivially with "pu".

[1] https://github.com/mhagger/git

Michael Haggerty (2):
  t1400: add some more tests of "update-ref --stdin"'s verify command
  update-ref: fix "verify" command with missing <oldvalue>

 builtin/update-ref.c  | 14 +++-----
 t/t1400-update-ref.sh | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+), 9 deletions(-)

-- 
2.1.3

             reply	other threads:[~2014-12-10 23:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10 23:47 Michael Haggerty [this message]
2014-12-10 23:47 ` [PATCH 1/2] t1400: add some more tests of "update-ref --stdin"'s verify command Michael Haggerty
2014-12-11  0:10   ` Stefan Beller
2014-12-11 16:19   ` Brad King
2014-12-10 23:47 ` [PATCH 2/2] update-ref: fix "verify" command with missing <oldvalue> Michael Haggerty
2014-12-11  0:21   ` Stefan Beller
2014-12-11 16:19   ` Brad King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1418255272-5875-1-git-send-email-mhagger@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --cc=brad.king@kitware.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=ronniesahlberg@gmail.com \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).