From patchwork Tue May 16 17:55:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kristoffer Haugsbakk X-Patchwork-Id: 13243481 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3248BC77B75 for ; Tue, 16 May 2023 17:56:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232032AbjEPR4l (ORCPT ); Tue, 16 May 2023 13:56:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232039AbjEPR4h (ORCPT ); Tue, 16 May 2023 13:56:37 -0400 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B91E9272C for ; Tue, 16 May 2023 10:56:35 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 35FBB5C01C1; Tue, 16 May 2023 13:56:35 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 16 May 2023 13:56:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=khaugsbakk.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to; s=fm3; t=1684259795; x=1684346195; bh=HfdWM7fhrIi6lJ4mjm+Ay7PeK uIYlgz2OsqGLwcfRIY=; b=pJfz2j6glVZwuiSFvA+OOGP8XveoJPF61ufOfoTON /py9meWUURofqCWrEMw1jk1jk4g4aYyCkI0dLS9SZfObiNlZ3+9HR12tIwfGeYOp ajNaqM/oqS+7CZXbpNQQWyBm7lC4iENZMmRG50GXcbGJQ72FboExDItpB6C/eOnF R6trz78tTKvTO5wYGDUPTi5OTNUkROAV42JSKwb6dkX1TmqcSbhvQA4buU6UcW2N TrF+JNjV6DKrTDuybREDDCWrAKauqaaR+u+So8wnxUf/8ZA3plDtDi//0cnMddpR 7kS4wq1apGNiRX1MVN+L7Y6X3Qorp8v/tZr7ghdcNmrNw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1684259795; x=1684346195; bh=HfdWM7fhrIi6lJ4mjm+Ay7PeKuIYlgz2Osq GLwcfRIY=; b=iKfQjcFREG6sb5/zrgnMzQOyuPT+5h7ROn6bjBKP7yJ1boZ0bxD 6Ymgm/GlDEcHnaAL1380xri3cWhvWVRWGSDkl5uAnPUHFMsyju+UbmIqVpoPvdaP nkyFWXdO5Z1CeoNUphXWH6kekcFzusa2/2AJHsXHmbCDqnQpE6641IsuyjsCuOWT 9iuOkvVfXwHk7coKG18vF1odJyGzd0Goe70PdwdjzESHZavlSVWcMsMWTTe1/giY ONTl7i1aQg5ZT23nMr/YMPj82QuYlX4eH/g9W7rKcDSHon5QyIY93lyhD/D1O6/i yPMZ1eHehWzGoMb5yRXI8OsqUJgabvIEv6A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeehledguddukecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkofgjfhggtgfgse htkeertdertdejnecuhfhrohhmpefmrhhishhtohhffhgvrhcujfgruhhgshgsrghkkhcu oegtohguvgeskhhhrghughhssggrkhhkrdhnrghmvgeqnecuggftrfgrthhtvghrnhepue eiueffuefftefhhfefleelhfeuheettedtheevgeejteehgfevffeugffglefhnecuffho mhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpegtohguvgeskhhhrghughhssggrkhhkrdhnrghmvg X-ME-Proxy: Feedback-ID: i2671468f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 16 May 2023 13:56:34 -0400 (EDT) From: Kristoffer Haugsbakk To: git@vger.kernel.org Cc: peff@peff.net, gitster@pobox.com, Kristoffer Haugsbakk Subject: [PATCH v3 1/3] doc: tag: document `TAG_EDITMSG` Date: Tue, 16 May 2023 19:55:44 +0200 Message-Id: <882008e32a482d4b05d522430abf3419476f2302.1684258780.git.code@khaugsbakk.name> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Document `TAG_EDITMSG` which we have told the user about on unsuccessful command invocations since commit 3927bbe9a4 (tag: delete TAG_EDITMSG only on successful tag, 2008-12-06). Introduce this documentation since we are going to add tests for the lifetime of this file in the case of command failure and success. Use the documentation for `COMMIT_EDITMSG` from `git-commit.txt` as a template since these two files share the same purpose.[1] † 1: from commit 3927bbe9a4: “ This matches the behavior of COMMIT_EDITMSG, which stays around in case of error. Suggested-by: Junio C Hamano Signed-off-by: Kristoffer Haugsbakk --- Notes (series): § From v2 • I changed (from `COMMIT_EDITMSG`) “will be overwritten” to “may” since I don’t see the point in giving a guarantee • Unsure if I was going to put this before or after “NOTES” as there seems to be no precedence Suggested in: https://lore.kernel.org/git/xmqqy1lqaxln.fsf@gitster.g/T/#u Documentation/git-tag.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt index fdc72b5875a..46e56b02455 100644 --- a/Documentation/git-tag.txt +++ b/Documentation/git-tag.txt @@ -377,6 +377,16 @@ $ GIT_COMMITTER_DATE="2006-10-02 10:31" git tag -s v1.0.1 include::date-formats.txt[] +FILES +----- + +`$GIT_DIR/TAG_EDITMSG`:: + This file contains the message of an in-progress annotated + tag. If `git tag` exits due to an error before creating an + annotated tag then the tag message that has been provided by the + user in an editor session will be available in this file, but + may be overwritten by the next invocation of `git tag`. + NOTES ----- From patchwork Tue May 16 17:55:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kristoffer Haugsbakk X-Patchwork-Id: 13243482 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 907EAC77B75 for ; Tue, 16 May 2023 17:57:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232095AbjEPR46 (ORCPT ); Tue, 16 May 2023 13:56:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232085AbjEPR4t (ORCPT ); Tue, 16 May 2023 13:56:49 -0400 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5581CD3 for ; Tue, 16 May 2023 10:56:45 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id A6F465C00FF; Tue, 16 May 2023 13:56:44 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 16 May 2023 13:56:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=khaugsbakk.name; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1684259804; x= 1684346204; bh=QQfCK7xt0TQxzeQRmCOhBfHqdfVFQ3VIA+4jYkq1VSw=; b=a tyay+EKFsAq9ROWuA2iVSZaTAPhWmfbvgJhu20fDzajIpWgNvCd0eTkZ3JmshweM wnKs30fM9j3Lze3Eg8uM6tdCAUINmgi5grlQwsgFhAlBr1MOXseF3nbpIl1N9irB 8sg5hpNb7Q62Ft/Y2BxBmK3vn4Y0jpNWYNZ8N9sXV5RWspR5PEDhYBolZUSNo1Xk Ve3ttP2vhDyVhUHOzKbO1oBpdrpBOa3bjKS8x7/BPp3u/N0T5TXLHvWxxUjLbYUE f4deIIH/4V4U+MmdfNPOtk0CxUzOtPY8VLmkHEhGADcmVeFknqbEBx3Vlc2ZH8nO P42qOidSWzJHpi+m+JDGA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1684259804; x= 1684346204; bh=QQfCK7xt0TQxzeQRmCOhBfHqdfVFQ3VIA+4jYkq1VSw=; b=h JatWEAB6Z0uMaTf9YvLicY6HM3SoClh2klbep187iKQuM5GBGhf+RILlMdzy2GxV iF4ueupjy57OjGdzk2Lg9ole09305KFWWHE4bEEm2VNQsWwvIzdiNzVJOD7avQAl Ow47pAJs/gffFB6ET/neZe/BkL39qaLNeD7IAQQZUkA2yw4smxSKov/O3/bpbe/q If7W4mveLShFBXJacMN13mFMtQFg2Pth7fboFB5Lo6yFx33k0Z6dvvLfiVy7EPf2 MMxcwxCl/WQZxffUo/OuShUQYXZGHpFxAGhE31SxmYCnVI1H5K/VPXWwo29sMVeu M/s2Mo9g8g59iON7DdIpw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeehledguddujecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkofgjfhgggfestd ekredtredttdenucfhrhhomhepmfhrihhsthhofhhfvghrucfjrghughhssggrkhhkuceo tghouggvsehkhhgruhhgshgsrghkkhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpefhud evveejtddttedvhfelffeuuefhffeugeeluedtgfdtuefhtefhudelleekteenucffohhm rghinhepkhgvrhhnvghlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomheptghouggvsehkhhgruhhgshgsrghkkhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i2671468f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 16 May 2023 13:56:43 -0400 (EDT) From: Kristoffer Haugsbakk To: git@vger.kernel.org Cc: peff@peff.net, gitster@pobox.com, Kristoffer Haugsbakk Subject: [PATCH v3 2/3] t/t7004-tag: add regression test for successful tag creation Date: Tue, 16 May 2023 19:55:45 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The standard tag message file is unlinked if the tag is created. Signed-off-by: Kristoffer Haugsbakk --- Notes (series): See: https://lore.kernel.org/git/xmqq353x8de3.fsf@gitster.g/T/#m594378bc6fe2545e638ce2d5f9c11861d4e33082 > What you want to use is test_path_is_missing, without "!". t/t7004-tag.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 9aa1660651b..1cb738b00d2 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -2127,4 +2127,13 @@ test_expect_success 'Does --[no-]contains stop at commits? Yes!' ' test_cmp expected actual ' +test_expect_success 'If tag is created then tag message file is unlinked' ' + test_when_finished "git tag -d foo" && + write_script fakeeditor <<-\EOF && + echo Message >.git/TAG_EDITMSG + EOF + GIT_EDITOR=./fakeeditor git tag -a foo && + test_path_is_missing .git/TAG_EDITMSG +' + test_done From patchwork Tue May 16 17:55:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kristoffer Haugsbakk X-Patchwork-Id: 13243483 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 109CBC7EE25 for ; Tue, 16 May 2023 17:57:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229902AbjEPR5C (ORCPT ); Tue, 16 May 2023 13:57:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231997AbjEPR4v (ORCPT ); Tue, 16 May 2023 13:56:51 -0400 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 231CB10D8 for ; Tue, 16 May 2023 10:56:50 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 931F15C01BA; Tue, 16 May 2023 13:56:49 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 16 May 2023 13:56:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=khaugsbakk.name; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to; s=fm3; t=1684259809; x=1684346209; bh=aNZ+hGsot0PdGHcbyRna6L3AL 89Xsx8z3ZuH/tpxVP4=; b=y7UecfC1sa48I3YUFJKYIOR4Mcw9SsIdwM/PLHUEy BUTtSW/sbt+Ymyq2d3dT7X4qHOWDd3HaBSkDlGfess+uF0rLvXTrV6PAQf6X2BwS dJqVHwgJxbJP0uS/8hok7sJjyR8ubmW6C0JqorNDrPz0TG3Edt3DdHdvwd3s7cJA P4C5oGoCN1UGKF/VY4Nk1Dk3ns9AVRncFDfeg1IMwou1rkW5QL1hY8LBl76TyhV4 NNsxsxJSuTEpDC1ZMgBClC5E1Kj2QgLLX5OX1H0/0xMc93wTDvSCno9hbKlPB8xx oqI6JXqnf/jg6zIxiDOeW6G6qaDqNthcTO36iKGArMx3g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1684259809; x=1684346209; bh=aNZ+hGsot0PdGHcbyRna6L3AL89Xsx8z3Zu H/tpxVP4=; b=rISMunTmqkzkuNYvTeAlnKNe8nZH9VNHrl6qNXDpAQ7MRy5DF1N U0rYwbxYdoOvs5ss5R/mKXzPmhKGAC9V8VT5HzQ2qKdeNcsxgYCTIteUO/VLDfMf slfuQJlCH+/VVhkkqI0Uk/iegRmLSQqZtTToItYt8xsSBRIxM2himFL/win9pI5g 5HXqOXa2S1e0Zx2f4QgpUwGi1BmUOwwJ+ymPwCsTN66TswjCNbfuFHNLchXI3m2N 8fYt1K3/b6Hfb0W41W3z4CHurkZ3BYyDqbR7EHgs5H4ZV/lwjtRPp39bYEsLEzqR HuBfUmlgKiFZZd9zUMcy+IanyxeD3AYDh4w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeehledguddukecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvvefufffkofgjfhggtgfgse htkeertdertdejnecuhfhrohhmpefmrhhishhtohhffhgvrhcujfgruhhgshgsrghkkhcu oegtohguvgeskhhhrghughhssggrkhhkrdhnrghmvgeqnecuggftrfgrthhtvghrnhepve fgleevieekgeejieekueevhfelieduvdelgeefkeejtdekvedttefgffevtedtnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheptghouggvsehkhh gruhhgshgsrghkkhdrnhgrmhgv X-ME-Proxy: Feedback-ID: i2671468f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 16 May 2023 13:56:48 -0400 (EDT) From: Kristoffer Haugsbakk To: git@vger.kernel.org Cc: peff@peff.net, gitster@pobox.com, Kristoffer Haugsbakk Subject: [PATCH v3 3/3] tag: keep the message file in case ref transaction fails Date: Tue, 16 May 2023 19:55:46 +0200 Message-Id: <81bca0673d817067d6c2af9819d266abb69f6c82.1684258780.git.code@khaugsbakk.name> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The ref transaction can fail after the user has written their tag message. In particular, if there exists a tag `foo/bar` and `git tag -a foo` is said then the command will only fail once it tries to write `refs/tags/foo`, which is after the file has been unlinked. Hold on to the message file for a little longer so that it is not unlinked before the fatal error occurs. Signed-off-by: Kristoffer Haugsbakk --- Notes (series): § From v2 (Noting for other reviewers (after v2):) I duplicated this message (this isn’t obvious in the diff): fprintf(stderr, _("The tag message has been left in %s\n"), path); builtin/tag.c | 24 +++++++++++++++--------- t/t7004-tag.sh | 10 ++++++++++ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/builtin/tag.c b/builtin/tag.c index d428c45dc8d..7df9c143ac0 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -266,11 +266,10 @@ static const char message_advice_nested_tag[] = static void create_tag(const struct object_id *object, const char *object_ref, const char *tag, struct strbuf *buf, struct create_tag_options *opt, - struct object_id *prev, struct object_id *result) + struct object_id *prev, struct object_id *result, char *path) { enum object_type type; struct strbuf header = STRBUF_INIT; - char *path = NULL; type = oid_object_info(the_repository, object, NULL); if (type <= OBJ_NONE) @@ -294,7 +293,6 @@ static void create_tag(const struct object_id *object, const char *object_ref, int fd; /* write the template message before editing: */ - path = git_pathdup("TAG_EDITMSG"); fd = xopen(path, O_CREAT | O_TRUNC | O_WRONLY, 0600); if (opt->message_given) { @@ -336,10 +334,6 @@ static void create_tag(const struct object_id *object, const char *object_ref, path); exit(128); } - if (path) { - unlink_or_warn(path); - free(path); - } } static void create_reflog_msg(const struct object_id *oid, struct strbuf *sb) @@ -487,6 +481,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix) }; int ret = 0; const char *only_in_list = NULL; + char *path = NULL; setup_ref_filter_porcelain_msg(); @@ -621,7 +616,9 @@ int cmd_tag(int argc, const char **argv, const char *prefix) if (create_tag_object) { if (force_sign_annotate && !annotate) opt.sign = 1; - create_tag(&object, object_ref, tag, &buf, &opt, &prev, &object); + path = git_pathdup("TAG_EDITMSG"); + create_tag(&object, object_ref, tag, &buf, &opt, &prev, &object, + path); } transaction = ref_transaction_begin(&err); @@ -629,8 +626,17 @@ int cmd_tag(int argc, const char **argv, const char *prefix) ref_transaction_update(transaction, ref.buf, &object, &prev, create_reflog ? REF_FORCE_CREATE_REFLOG : 0, reflog_msg.buf, &err) || - ref_transaction_commit(transaction, &err)) + ref_transaction_commit(transaction, &err)) { + if (path) + fprintf(stderr, + _("The tag message has been left in %s\n"), + path); die("%s", err.buf); + } + if (path) { + unlink_or_warn(path); + free(path); + } ref_transaction_free(transaction); if (force && !is_null_oid(&prev) && !oideq(&prev, &object)) printf(_("Updated tag '%s' (was %s)\n"), tag, diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 1cb738b00d2..e6f9579cff7 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -2136,4 +2136,14 @@ test_expect_success 'If tag is created then tag message file is unlinked' ' test_path_is_missing .git/TAG_EDITMSG ' +test_expect_success 'If tag cannot be created then tag message file is not unlinked' ' + test_when_finished "git tag -d foo/bar && rm .git/TAG_EDITMSG" && + write_script fakeeditor <<-\EOF && + echo Message >.git/TAG_EDITMSG + EOF + git tag foo/bar && + test_must_fail env GIT_EDITOR=./fakeeditor git tag -a foo && + test_path_exists .git/TAG_EDITMSG +' + test_done