Re: Misleading error message on a failed `git mv`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux