Re: Misleading error message on a failed `git mv`
On Jan 11 2023, Torsten Bögershausen wrote:
Show 14 quoted lines
> 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."