Re: [BUG] spurious failure when adding tracked file in ignored directory

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

 



On Sun, 27 Oct 2024 at 14:45, Johannes Sixt <j6t@xxxxxxxx> wrote:
> I cannot reproduce your claim "despite actually adding the file": the
> file is not added. So, everything works as intended. What does `git
> status` tell after `git add`?

Here is the example with modifications before the add.

git init
mkdir dir
touch dir/file
git add dir/file
echo dir >.gitignore
echo content >dir/file

Output of git status:
> On branch main
>
> No commits yet
>
> Changes to be committed:
>   (use "git rm --cached <file>..." to unstage)
> new file:   dir/file

> Changes not staged for commit:
>   (use "git add <file>..." to update what will be committed)
>   (use "git restore <file>..." to discard changes in working directory)
> modified:   dir/file

> Untracked files:
>   (use "git add <file>..." to include in what will be committed)
> .gitignore

git add dir/file  # fails with warning and exit code 1

Output of git status:
> On branch main
>
> No commits yet
>
> Changes to be committed:
>   (use "git rm --cached <file>..." to unstage)
> new file:   dir/file

> Untracked files:
>   (use "git add <file>..." to include in what will be committed)
> .gitignore




[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