Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

"Undo Last Discard" restores files with same name with content of one of the files #2172

@HenriDeh

Description

@HenriDeh

Prerequisites

Description

I encountered a bug that made me lose tons of work (see this thread). I am new to git, but this is probably not a desired behavior, espacially that the manipulation I did is typically something you would do when you discover Git. I did it using Atom so I will describe the steps to reproduce it on Atom. However, I don't think that's related to Atom. Here is how to reproduce it:

Steps to Reproduce

Step 1. Create a new project in Atom (My Project)

Step 2. In the project create a folder (Folder 1)

Step 3. In that project create a source file (aFile.jl) and write "This is the file in folder 1" in it, save

Step 4. Duplicate Folder 1 twice, name the new folders Folder 2 and Folder 3 respectively.

Step 5. Change the text in Folder 2/aFile.jl to "This is the file in folder 2", save. Do the same in folder 3 but with a 3.

Step 6. In the Git tab, initialize a new repository. Your project tree should now look like this:

> My Project
    > .git
    > Folder 1
        - aFile.jl
    > Folder 2
        - aFile.jl
    > Folder 3
        - aFile.jl

Step 7. In the Git tab, the three files should be awaiting in unstaged changes. Click on the ... next to it and discard all changes. If you now check the tree the "aFile.jl" files disapeared.

Step 8. In the Git tab, click on the same ... and undo last discard. This will bring back the files.

Expected behavior:

Files have their original (different) content.

Actual behavior:

However, if you check their contents, the "aFile.jl" files now have the same content. Which means that the undo picked a single file and wrote it in every folder. I know that Step 7. is stupid, but I that's not how this should have behaved.

Reproduces how often:

100%

Versions

macOS 10.12.6 with 1.39.0-nightly19.

Additional Information

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions