git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, lilinchao@oschina.cn,
	Elijah Newren <newren@gmail.com>,
	jerry@skydio.com
Subject: Re: [PATCH v2] apply: resolve trivial merge without hitting ll-merge with "--3way"
Date: Mon, 06 Sep 2021 23:59:42 +0200	[thread overview]
Message-ID: <87pmtlnyu7.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <20210905190657.2906699-1-gitster@pobox.com>


On Sun, Sep 05 2021, Junio C Hamano wrote:

> +	if (!image->buf || type != OBJ_BLOB)
> +		die("unable to read blob object %s", oid_to_hex(result_id));

This die() message seems to only be applicable to the first condition
here, shouldn't this be:

    if (!image->buf)
        die(_("unable to read blob object %s"), oid_to_hex(result_id));
    if (type != OBJ_BLOB)
        die(_("object %s is %s, expected blob"), oid_to_hex(result_id), type_name(type));

Also as shown there, missing _() for marking the translation.

> [...]
> +test_expect_success 'apply binary file patch' '
> +	git reset --hard main &&

Partly this is cleaning up a mess after an existing test, but here
there's no reason we can't use test_when_finished() for all the new
tests to make them clean up after themselves:

diff --git a/t/t4108-apply-threeway.sh b/t/t4108-apply-threeway.sh
index cc3aa3314a3..c3c9b52e30d 100755
--- a/t/t4108-apply-threeway.sh
+++ b/t/t4108-apply-threeway.sh
@@ -232,6 +232,8 @@ test_expect_success 'apply with --3way --cached and conflicts' '
 
 test_expect_success 'apply binary file patch' '
 	git reset --hard main &&
+	test_when_finished "git reset --hard main" &&
+
 	cp "$TEST_DIRECTORY/test-binary-1.png" bin.png &&
 	git add bin.png &&
 	git commit -m "add binary file" &&
@@ -246,7 +248,8 @@ test_expect_success 'apply binary file patch' '
 '
 
 test_expect_success 'apply binary file patch with 3way' '
-	git reset --hard main &&
+	test_when_finished "git reset --hard main" &&
+
 	cp "$TEST_DIRECTORY/test-binary-1.png" bin.png &&
 	git add bin.png &&
 	git commit -m "add binary file" &&
@@ -261,7 +264,8 @@ test_expect_success 'apply binary file patch with 3way' '
 '
 
 test_expect_success 'apply full-index patch with 3way' '
-	git reset --hard main &&
+	test_when_finished "git reset --hard main" &&
+
 	cp "$TEST_DIRECTORY/test-binary-1.png" bin.png &&
 	git add bin.png &&
 	git commit -m "add binary file" &&

  parent reply	other threads:[~2021-09-06 22:06 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28  2:44 [PATCH] git-apply: fix --3way with binary patch Jerry Zhang
2021-07-28  4:29 ` Junio C Hamano
2021-07-28  4:30 ` Junio C Hamano
2021-07-28 17:55   ` [PATCH] ll-merge: teach ll_binary_merge() a trivial three-way merge Junio C Hamano
2021-07-28 23:49     ` Elijah Newren
2021-07-29  1:06       ` Junio C Hamano
2021-09-05 19:06         ` [PATCH v2] apply: resolve trivial merge without hitting ll-merge with "--3way" Junio C Hamano
2021-09-06 18:57           ` Elijah Newren
2021-09-06 21:59           ` Ævar Arnfjörð Bjarmason [this message]
2021-09-07  2:32             ` Junio C Hamano
2021-09-07 20:15             ` Junio C Hamano
2021-07-28 19:38   ` [PATCH] git-apply: fix --3way with binary patch Jerry Zhang
2021-07-28 20:04     ` Jerry Zhang
2021-07-28 20:08     ` Junio C Hamano
2021-07-28 20:37       ` Jerry Zhang
2021-07-28 21:01         ` Junio C Hamano

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=87pmtlnyu7.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jerry@skydio.com \
    --cc=lilinchao@oschina.cn \
    --cc=newren@gmail.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).