Re: Possible minor bug in Git

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Torsten,

Thank you so much for getting back to me.

Unfortunately, I believe there is a misunderstanding, as I may have
explained what I found to be a possible bug incorrectly.
The file that is originally added (and then later modified) is never
renamed or moved.
As you will see below, when a user attempts to add a file, but with
the incorrect case, the Git CLI responds the same way it would if a
file was correctly added (i.e., by displaying nothing).
However, in the above case, when you enter "git status", you find that
the file was never actually added, and remains unstaged.
A possible solution to this can be a simple error message similar to
attempting to add a file with its name misspelt.

Using your example, I have illustrated this in the text below:

    C:\Example>git init
    Initialized empty Git repository in C:/Example/.git/

    C:\Example>echo AAA > AA.txt

    C:\Example>git add AA.txt

    C:\Example>git commit -m AA.txt
    [master (root-commit) d550af0] AA.txt
     1 file changed, 1 insertion(+)
     create mode 100644 AA.txt

    C:\Example>echo BB > AA.txt

    C:\Example>git status
    On branch master
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git checkout -- <file>..." to discard changes in working directory)

            modified:   AA.txt

    no changes added to commit (use "git add" and/or "git commit -a")

    C:\Example>git add Aa.txt

    C:\Example>git status
    On branch master
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git checkout -- <file>..." to discard changes in working directory)

            modified:   AA.txt

    no changes added to commit (use "git add" and/or "git commit -a")

    C:\Example>git add A.txt
    fatal: pathspec 'A.txt' did not match any files

    C:\Example>git add AA.txt

    C:\Example>git status
    On branch master
    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)

            modified:   AA.txt

I am looking forward to hearing from you again.

Kind regards,
Angelo Melonas

On Thu, Jan 31, 2019 at 10:34 PM Torsten Bögershausen <tboegi@xxxxxx> wrote:
>
> On Thu, Jan 31, 2019 at 09:29:28AM +0200, Angelo Melonas wrote:
> > Just to clarify, I made a mistake above. Instead of "untracked", I
> > meant "unstaged".
> > I apologise for the confusion.
> >
> > On Thu, Jan 31, 2019 at 9:01 AM Angelo Melonas <angelomelonas@xxxxxxxxx> wrote:
> > >
> > > Good day,
> > >
> > > I found a potential bug in Git for Windows. The bug can be reproduced
> > > as follows:
> > >
> > > 1. Modify a file so that it shows up as "untracked" when executing the
> > > "git status" command.
> > > 2. Attempt to "git add" the file, but change the case of a single
> > > letter. The command executes but no warning or error is displayed.
> > > 3. Execute "git status" again and it still shows the file as "untracked".
> > >
> > > Please let me know if I am mistaken. I also have a screenshot
> > > demonstrating the "bug" which I cannot attach to this email, but which
> > > can be requested.
> > >
> > > Have a great day.
> > >
> > > Kind regards,
> > > Angelo Melonas
>
> See the example below, Git tracks AA.txt, so you must run
> git add AA.txt
>
> After a commit, you can tell Git that the file was renamed:
> git mv AA.txt Aa.txt
> (and then a commit)
>
>
>
> ------------------------------
>
> user@mac:/tmp/tt2> git init
> Initialized empty Git repository in /private/tmp/tt2/.git/
> user@mac:/tmp/tt2> echo AAA > AA.txt
> user@mac:/tmp/tt2> git add AA.txt
> user@mac:/tmp/tt2> git commit -m AA.txt
> [master (root-commit) f102760] AA.txt
>  1 file changed, 1 insertion(+)
>   create mode 100644 AA.txt
>   user@mac:/tmp/tt2> echo BB >AA.txt
>   user@mac:/tmp/tt2> mv AA.txt  Aa.txt
>   user@mac:/tmp/tt2> git status
>   On branch master
>   Changes not staged for commit:
>     (use "git add <file>..." to update what will be committed)
>       (use "git checkout -- <file>..." to discard changes in working directory)
>
>         modified:   AA.txt
>
> no changes added to commit (use "git add" and/or "git commit -a")
> user@mac:/tmp/tt2> git add AA.txt
> user@mac:/tmp/tt2> git status
> On branch master
> Changes to be committed:
>   (use "git reset HEAD <file>..." to unstage)
>
>         modified:   AA.txt
>
> user@mac:/tmp/tt2>




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux