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

Re: `git mv` has ambiguous error message for non-existing target

From
PLPatrick Lehner <lehner.patrick@gmx.de>
Date
Nov 16, 2012, 07:10 UTC
Message-ID
<50A5E6D2.5060609@gmx.de>
In-Reply-To
<7vehju8h5j.fsf@alter.siamese.dyndns.org>

But just because mv's error essage isnt very good, does that mean git mv's error message mustn't be better? That would strike me as an odd bit of reasoning.

On Fr 16 Nov 2012 02:34:32 CET, Junio C Hamano wrote:
Show 26 quoted lines
> Patrick Lehner <lehner.patrick@gmx.de> writes:
>
>> To reproduce:
>> - cd into a git repo
>> - assuming "filea.txt" is an existing file in the CWD, and "dirb" is
>> neither a file nor a directory in the CWD, use the command "git mv
>> filea.txt dirb/filea.txt"
>> - this will produce an error message like `fatal: renaming 'filea.sh'
>> failed: No such file or directory`
>>
>> It does not mention that the problem is, in fact, the target directory
>> not existing. This seems to be mostly a problem for users unfamiliar
>> with bash/*nix console commands. Although it is documented that git mv
>> will not create intermediate folders (which is fine, because neither
>> does mv), the error message might lead to believe a problem exists
>> with the source file.
>
>      $ rm -fr xxx
>      $ >yyy
>      $ mv yyy xxx/yyy
>      mv: cannot move `yyy' to `xxx/yyy': No such file or directory
>
> It doesn't mention that the problem is with 'xxx' and not 'yyy'
> either.
>
>
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 5 in “`git mv` has ambiguous error message for non-existing target”
  1. Patrick LehnerNov 15, 2012
  2. Junio C HamanoNov 16, 2012
  3. Patrick LehnerNov 16, 2012
  4. Junio C HamanoNov 17, 2012
  5. Patrick LehnerNov 19, 2012

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.