git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] archive: fix misleading error message
@ 2024-10-03 15:51 René Scharfe
  2024-10-04 10:07 ` Martin Ågren
  0 siblings, 1 reply; 2+ messages in thread
From: René Scharfe @ 2024-10-03 15:51 UTC (permalink / raw)
  To: Git List; +Cc: Junio C Hamano

The error message added by 296743a7ca (archive: load index before
pathspec checks, 2024-09-21) is misleading: unpack_trees() is not
touching the working tree at all here, but just loading a tree into
the index.  Correct it.

Signed-off-by: René Scharfe <l.s.r@web.de>
---
Silly me, I stole the wrong message. :-/

 archive.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/archive.c b/archive.c
index 58f86bf75c..a7a92ff839 100644
--- a/archive.c
+++ b/archive.c
@@ -536,7 +536,8 @@ static void parse_treeish_arg(const char **argv,
 		opts.fn = oneway_merge;
 		init_tree_desc(&t, &tree->object.oid, tree->buffer, tree->size);
 		if (unpack_trees(1, &t, &opts))
-			die(_("unable to checkout working tree"));
+			die(_("failed to unpack tree object %s"),
+			    oid_to_hex(&tree->object.oid));

 		git_attr_set_direction(GIT_ATTR_INDEX);
 	}
--
2.46.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] archive: fix misleading error message
  2024-10-03 15:51 [PATCH] archive: fix misleading error message René Scharfe
@ 2024-10-04 10:07 ` Martin Ågren
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Ågren @ 2024-10-04 10:07 UTC (permalink / raw)
  To: René Scharfe; +Cc: Git List, Junio C Hamano

On Thu, 3 Oct 2024 at 17:51, René Scharfe <l.s.r@web.de> wrote:
>
> The error message added by 296743a7ca (archive: load index before
> pathspec checks, 2024-09-21) is misleading: unpack_trees() is not
> touching the working tree at all here, but just loading a tree into
> the index.  Correct it.

>                 init_tree_desc(&t, &tree->object.oid, tree->buffer, tree->size);
>                 if (unpack_trees(1, &t, &opts))
> -                       die(_("unable to checkout working tree"));
> +                       die(_("failed to unpack tree object %s"),
> +                           oid_to_hex(&tree->object.oid));

The existing instance of this message isn't translated, so it'll still
be a new string to translate. Anyway, it's good to use the same wording
here as elsewhere.

There's also a "failed to unpack trees", but here, we're indeed
unpacking *one* tree.

Good catch!

Martin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-04 10:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-03 15:51 [PATCH] archive: fix misleading error message René Scharfe
2024-10-04 10:07 ` Martin Ågren

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).