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

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:55:18

Patrick Lehner [off-list ref] 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.

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

From: Patrick Lehner <hidden>
Date: 2016-06-15 22:55:18

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:
Patrick Lehner [off-list ref] writes:
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help