git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Bug? git commit fileA tries to delete fileB and other oddities
@ 2019-12-14 10:39 Mikael Simonsson
  2019-12-15 21:09 ` Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Mikael Simonsson @ 2019-12-14 10:39 UTC (permalink / raw)
  To: git

Hi,

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.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: Bug? git commit fileA tries to delete fileB and other oddities
@ 2019-12-14 13:16 Mikael Simonsson
  0 siblings, 0 replies; 6+ messages in thread
From: Mikael Simonsson @ 2019-12-14 13:16 UTC (permalink / raw)
  To: git

Running git 1.9.5 against this repository seems to work without any
issues, so this looks like a bug in git 2.*.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-12-17 11:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).