"[email protected]" <[email protected]> writes:
> Hi,
> I met a issue when using git.
> I cannot delete the file by the commond 'git rm'.
> The file name is a little diff from common file.
> I accidentally named the file "filename\r", display such as filename^M. Then
> I commit the file by 'git add .'.
> After I find this mistake, I remove the file, then try to use commond "git
> rm" to delete the file, but failed.
>
> My git version is 1.7.9.5.
The following works fine with v1.7.9.5 (I have separate installs of
various versions of Git and use "rungit $version" to choose from
them, so just read "rungit v1.7.9.5" below as if it is "git").
$ rungit v1.7.9.5 init
$ N=$(printf "filename\015")
$ echo >"$N"
$ /bin/ls fil* | od -cx
0000000 f i l e n a m e \r \n
6966 656c 616e 656d 0a0d
0000012
$ rungit v1.7.9.5 add .
$ rungit v1.7.9.5 ls-files
"filename\r"
$ rm filename*
$ rungit v1.7.9.5 rm filename*
$ rungit v1.7.9.5 ls-files
$ /bin/ls
$ exit
and I do not think of any reason why we would have broken it since.
FYI, you do not have to do a separate "rm filename*" in the above
sequence; "git rm filename*" would remove it from both the working
tree and from the index. I did it in the above illustration in two
separate steps only because you said you removed and then did "git
rm" and I wanted to emulate it.
> Is this issue reported?
I do not recall hearing about it, but you must have looked for one
hard already and I haven't, so...
> If this issue is solved, could you tell me which version I should get.
It appears to me that such an issue did not exist in the first
place.