git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@linux-m68k.org>
To: "Torsten Bögershausen" <tboegi@web.de>
Cc: Jeff King <peff@peff.net>,
	Arthur Milchior <arthur.milchior@gmail.com>,
	git@vger.kernel.org
Subject: Re: Misleading error message on a failed `git mv`
Date: Thu, 12 Jan 2023 00:25:46 +0100	[thread overview]
Message-ID: <87sfggfybp.fsf@igel.home> (raw)
In-Reply-To: <20230111214337.ybrmiyeius5xzalf@tb-raspi4> ("Torsten Bögershausen"'s message of "Wed, 11 Jan 2023 22:43:37 +0100")

On Jan 11 2023, Torsten Bögershausen wrote:

> diff --git a/builtin/mv.c b/builtin/mv.c
> index 19790ce38f..58e24889c0 100644
> --- a/builtin/mv.c
> +++ b/builtin/mv.c
> @@ -452,8 +452,12 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
>  		if (!(mode & (INDEX | SPARSE | SKIP_WORKTREE_DIR)) &&
>  		    !(dst_mode & (SKIP_WORKTREE_DIR | SPARSE)) &&
>  		    rename(src, dst) < 0) {
> +			struct stat st;
>  			if (ignore_errors)
>  				continue;
> +			if (!lstat(src, &st)) {
> +				die_errno(_("moving '%s' into destination '%s' failed"), src, dst);
> +			}

That will lose errno, though.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

      reply	other threads:[~2023-01-11 23:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11  4:19 Misleading error message on a failed `git mv` Arthur Milchior
2023-01-11 19:07 ` Jeff King
2023-01-11 21:43   ` Torsten Bögershausen
2023-01-11 23:25     ` Andreas Schwab [this message]

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=87sfggfybp.fsf@igel.home \
    --to=schwab@linux-m68k.org \
    --cc=arthur.milchior@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=tboegi@web.de \
    /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).