Skip to content

Git clean on a specific file does nothing #2499

Closed
@joaomoreno

Description

@joaomoreno
  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

git version 2.25.0.windows.1
cpu: x86_64
built from commit: 7c71c859c97853ed057da5cbab12f3c13b5554df
sizeof-long: 4
sizeof-size_t: 8
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.18363.592]
  • What options did you set as part of the installation? Or did you choose the
    defaults?

Portable Git

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

CMD

First, let's create a repo with a file inside a folder:

mkdir repro
cd repro
git init
mkdir folder
touch folder\file

Then, place the following bug.js node.js script at the root of the repo:

const cp = require('child_process');
const path = require('path');
const filePath = path.join(__dirname, 'folder', 'file');

// replace this with wherever you have git 2.25
const git = 'C:\\Users\\joao\\Downloads\\PortableGit-2.25\\bin\\git.exe';

cp.spawnSync(git, ['clean', '-f', '-q', '--', filePath], { cwd: __dirname });

Then simply run it:

node bug.js

Just like @eamodio in #2478, I am shelling out to git via spawn. This works on 2.24. Doesn't work any more on 2.25.

Can't repro if the target file is at the root of the repository.

  • What did you expect to occur after running these commands?

I expect the file to be deleted from disk.

  • What actually happened instead?

Nothing happens.

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