git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>
Cc: Kyle Meyer <kyle@kyleam.com>, git@vger.kernel.org
Subject: [PATCH v2 2/4] update-ref: pass reflog message to delete_ref()
Date: Mon, 20 Feb 2017 20:10:33 -0500	[thread overview]
Message-ID: <20170221011035.847-3-kyle@kyleam.com> (raw)
In-Reply-To: <20170221011035.847-1-kyle@kyleam.com>

Now that delete_ref() accepts a reflog message, pass the user-provided
message to delete_ref() rather than silently dropping it.

Signed-off-by: Kyle Meyer <kyle@kyleam.com>
---
 builtin/update-ref.c  |  2 +-
 t/t1400-update-ref.sh | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/builtin/update-ref.c b/builtin/update-ref.c
index 86d006d36..0b2ecf41a 100644
--- a/builtin/update-ref.c
+++ b/builtin/update-ref.c
@@ -433,7 +433,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)
 		 * For purposes of backwards compatibility, we treat
 		 * NULL_SHA1 as "don't care" here:
 		 */
-		return delete_ref(NULL, refname,
+		return delete_ref(msg, refname,
 				  (oldval && !is_null_sha1(oldsha1)) ? oldsha1 : NULL,
 				  flags);
 	else
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index b0ffc0b57..6e112fb5f 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -85,6 +85,24 @@ test_expect_success "delete $m (by HEAD)" '
 '
 rm -f .git/$m
 
+test_expect_success "deleting current branch adds message to HEAD's log" '
+	git update-ref $m $A &&
+	git symbolic-ref HEAD $m &&
+	git update-ref -m delete-$m -d $m &&
+	! test -f .git/$m &&
+	grep "delete-$m$" .git/logs/HEAD
+'
+rm -f .git/$m
+
+test_expect_success "deleting by HEAD adds message to HEAD's log" '
+	git update-ref $m $A &&
+	git symbolic-ref HEAD $m &&
+	git update-ref -m delete-by-head -d HEAD &&
+	! test -f .git/$m &&
+	grep "delete-by-head$" .git/logs/HEAD
+'
+rm -f .git/$m
+
 test_expect_success 'update-ref does not create reflogs by default' '
 	test_when_finished "git update-ref -d $outside" &&
 	git update-ref $outside $A &&
-- 
2.11.1


  parent reply	other threads:[~2017-02-21  1:10 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-16 23:17 HEAD's reflog entry for a renamed branch Kyle Meyer
2017-01-26 21:12 ` Jeff King
2017-01-26 21:30   ` Junio C Hamano
2017-01-26 21:53     ` Jeff King
2017-02-17  3:57   ` [PATCH 0/3] delete_ref(): support reflog messages Kyle Meyer
2017-02-17  3:57     ` [PATCH 1/3] delete_refs(): accept a reflog message argument Kyle Meyer
2017-02-17  8:12       ` Jeff King
2017-02-17 17:05         ` Junio C Hamano
2017-02-17 23:35           ` Kyle Meyer
2017-02-17  3:57     ` [PATCH 2/3] update-ref: pass reflog message argument to delete_refs Kyle Meyer
2017-02-17  8:22       ` Jeff King
2017-02-17 17:11         ` Junio C Hamano
2017-02-17 23:40         ` Kyle Meyer
2017-02-17 23:41           ` Jeff King
2017-02-17  3:58     ` [PATCH 3/3] rename_ref: replace empty deletion message in HEAD's log Kyle Meyer
2017-02-17  8:31       ` Jeff King
2017-02-17 17:50         ` Junio C Hamano
2017-02-17 19:43           ` Jeff King
2017-02-17 19:55             ` Jeff King
2017-02-17 22:18               ` Junio C Hamano
2017-02-17 23:42               ` Kyle Meyer
2017-02-17 23:41           ` Kyle Meyer
2017-02-17 23:53             ` Junio C Hamano
2017-02-17 23:53             ` Jeff King
2017-02-17  8:17     ` [PATCH 0/3] delete_ref(): support reflog messages Jeff King
2017-02-21  1:10     ` [PATCH v2 0/4] delete_ref: " Kyle Meyer
2017-02-21  1:10       ` [PATCH v2 1/4] delete_ref: accept a reflog message argument Kyle Meyer
2017-02-23  9:33         ` Duy Nguyen
2017-02-23 22:29           ` Junio C Hamano
2017-02-25  3:05           ` Kyle Meyer
2017-02-21  1:10       ` Kyle Meyer [this message]
2017-02-21  1:10       ` [PATCH v2 3/4] rename_ref: replace empty message in HEAD's log Kyle Meyer
2017-02-21  1:10       ` [PATCH v2 4/4] branch: record creation of renamed branch " Kyle Meyer
2017-02-21  7:12       ` [PATCH v2 0/4] delete_ref: support reflog messages Jeff King
2017-02-21  7:18       ` Junio C Hamano
2017-02-21 16:45         ` Kyle Meyer

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20170221011035.847-3-kyle@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).