git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Andreas Schwab <schwab@linux-m68k.org>
Date
Jan 11, 2023, 23:25 UTC
Message-ID
<87sfggfybp.fsf@igel.home>
In-Reply-To
<20230111214337.ybrmiyeius5xzalf@tb-raspi4>
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."
Previous: Torsten Bögershausen
Message 4 of 4 in “Misleading error message on a failed `git mv`”
  1. Arthur MilchiorJan 11, 2023
  2. Jeff KingJan 11, 2023
  3. Torsten BögershausenJan 11, 2023
  4. Andreas SchwabJan 11, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.