git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Mikael Simonsson <m@mikaelsimonsson.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: git@vger.kernel.org
Subject: Re: Bug? git commit fileA tries to delete fileB and other oddities
Date: Mon, 16 Dec 2019 09:50:33 +0000	[thread overview]
Message-ID: <CA+PLxnWLWckpZdjy8XQLbO0EVJ1khiyUYi1T=Mcy_rBkvbLpZA@mail.gmail.com> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.1912152209020.46@tvgsbejvaqbjf.bet>

Hi Johannes,

I will try to recreate the problem with a new repository.

So far I think I've narrowed it down to a bug introduced in git 2.20.0.

Not buggy:
1.9.5
2.7.1
2.11.0
2.15.0
2.18.0
2.19.0
2.19.2
2.19.3

Buggy:
2.20.0
2.21.1
2.23.0 (Mac)
2.24.0
2.24.1

The buggy versions all try to delete fileX when running "git commit fileA":

% git commit fileA

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Your branch is up to date with 'origin/master'.
#
# Changes to be committed:
#       deleted:    fileX
#       modified:   fileA
#
# Changes not staged for commit:


Kind regards,
Mikael


On Sun, Dec 15, 2019 at 9:10 PM Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
>
> Hi Mikael,
>
> On Sat, 14 Dec 2019, Mikael Simonsson wrote:
>
> > I have the following problems with a local repository:
> >
> > * git commit fileA tries to delete fileX (fileX still exists).
> >
> > * git restore --staged fileX doesn't work, the file remains staged.
> >
> > * A commit from a few days back deleted 2 random files that I haven't
> > touched or staged in months and pulled in staged changes I didn't ask
> > for.
> >
> > git version: 2.24.0 and 2.24.1 (OS: FreeBSD 12)
> >
> > How can this happen? The repository has a local remote (on the same
> > filesystem) that is pushed to only. I tarred the project and copied it
> > to a Mac with git 2.23.0 and the problem persists.
>
> It would be good if you could come up with a minimal list of commands to
> recreate that problem. That way, we can turn it into a regression test and
> fix the problem.
>
> Ciao,
> Johannes
>
> >
> > For example (I've only changed the filenames):
> >
> > % git status
> > On branch master
> > Your branch is up to date with 'origin/master'.
> >
> > Changes to be committed:
> >   (use "git restore --staged <file>..." to unstage)
> >         modified:   fileA
> >         modified:   fileB
> >         modified:   fileC
> >
> > Changes not staged for commit:
> >   (use "git add/rm <file>..." to update what will be committed)
> >   (use "git restore <file>..." to discard changes in working directory)
> >         ...
> >
> >
> > % git commit fileA
> >
> > # Please enter the commit message for your changes. Lines starting
> > # with '#' will be ignored, and an empty message aborts the commit.
> > #
> > # On branch master
> > # Your branch is up to date with 'origin/master'.
> > #
> > # Changes to be committed:
> > #       deleted:    fileX
> > #       modified:   fileA
> > #
> > # Changes not staged for commit:
> >
> >
> > % git stash
> > Saved working directory and index state WIP on master: 488e7081 ...
> >
> >
> > % git status
> > On branch master
> > Your branch is up to date with 'origin/master'.
> >
> > Changes to be committed:
> >   (use "git restore --staged <file>..." to unstage)
> >         deleted:    fileX
> >
> > Untracked files:
> >
> >
> > % git restore --staged fileX
> >
> >
> > % git status
> > On branch master
> > Your branch is up to date with 'origin/master'.
> >
> > Changes to be committed:
> >   (use "git restore --staged <file>..." to unstage)
> >         deleted:    fileX
> >
> > Untracked files:
> >   (use "git add <file>..." to include in what will be committed)
> >
> >
> > Thanks,
> > Mikael
> >

  reply	other threads:[~2019-12-16  9:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-14 10:39 Bug? git commit fileA tries to delete fileB and other oddities Mikael Simonsson
2019-12-15 21:09 ` Johannes Schindelin
2019-12-16  9:50   ` Mikael Simonsson [this message]
2019-12-17  7:33     ` Jeff King
2019-12-17 11:04       ` Mikael Simonsson
  -- strict thread matches above, loose matches on Subject: below --
2019-12-14 13:16 Mikael Simonsson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+PLxnWLWckpZdjy8XQLbO0EVJ1khiyUYi1T=Mcy_rBkvbLpZA@mail.gmail.com' \
    --to=m@mikaelsimonsson.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).