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

Re: Git issue report

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 19, 2018, 05:33 UTC
Message-ID
<xmqqbmefep6b.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<-tc3xop-8i635uwx53zom190jcbwyrl587bgic1u7ogu-h5ta7c-vg7tsu-9tjre9eq72we-wflfrt-v7y1d7-7ekgia-gbrcn9of96to-6fxlag-u56rt19q40x9-ved85k-25erwyma9au4-fjthm4-fwargr.1524108608363@email.android.com>
"xfswindy@163.com" <xfswindy@163.com> writes:
Show 8 quoted lines
> 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.

Previous: xfswindy@163.com
Message 2 of 2 in “Git issue report”
  1. xfswindy@163.comApr 19, 2018
  2. Junio C HamanoApr 19, 2018

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.