Bfg-repo-cleaner: Deleting files using wildcards sometimes won't work

Created on 30 Jan 2015  路  6Comments  路  Source: rtyley/bfg-repo-cleaner

Faced this issue when cleaning my repo from binaries and excess files.
Deleting with parameter "*.dsk" didn't work as if there were no such files. But deleting with direct filename did work.
I tried running prune before invoking delete but the situation didn't change

D:\Project>bfg -D *.dsk

Using repo : D:\Project\.git

Found 91 objects to protect
Found 12 commit-pointing refs : HEAD, refs/heads/asy_ver, refs/heads/db_ver, ...


Protected commits
-----------------

These are your protected commits, and so their contents will NOT be altered:

 * commit 02cdb101 (protected by 'HEAD')

Cleaning
--------

Found 478 commits
Cleaning commits:       100% (478/478)
Cleaning commits completed in 429 ms.

BFG aborting: No refs to update - no dirty commits found??
D:\Project>bfg -D FileDec.dsk

Using repo : D:\Project\.git

Found 91 objects to protect
Found 12 commit-pointing refs : HEAD, refs/heads/asy_ver, refs/heads/db_ver, ...


Protected commits
-----------------

These are your protected commits, and so their contents will NOT be altered:

 * commit 02cdb101 (protected by 'HEAD')

Cleaning
--------

Found 478 commits
Cleaning commits:       100% (478/478)
Cleaning commits completed in 917 ms.

Updating 10 Refs
----------------

        Ref                                 Before     After
        -------------------------------------------------------
        refs/heads/asy_ver                | 47f1fc38 | 71e2ea73
        refs/heads/db_ver                 | 83cbb25a | f5cbfeeb
        refs/heads/logudf_socket          | 34af02d0 | 5252be41
        refs/heads/master                 | 02cdb101 | 1a91d4ec
        refs/heads/remote/db_ver          | e9c785aa | 20750aa3
        refs/original/refs/heads/master   | 83b5c559 | fde1abbb
        refs/remotes/backup/asy_ver       | 47f1fc38 | 71e2ea73
        refs/remotes/backup/db_ver        | 83cbb25a | f5cbfeeb
        refs/remotes/backup/master        | 85e5b630 | 090c11b8
        refs/remotes/backup/remote/db_ver | e9c785aa | 20750aa3

Updating references:    100% (10/10)
...Ref update completed in 39 ms.

Commit Tree-Dirt History
------------------------

        Earliest                                              Latest
        |                                                          |
        DDDDmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

        D = dirty commits (file tree fixed)
        m = modified commits (commit message or parents changed)
        . = clean commits (no changes to file tree)

                                Before     After
        -------------------------------------------
        First modified commit | 82053f4e | 1e13a9bf
        Last dirty commit     | 00f106ad | 7471858f

Deleted files
-------------

        Filename      Git id

        ------------------------------------------------------------------------

        FileDec.dsk | 268677c2 (10,2 KB), a3072fd2 (10,4 KB), 88ed2c97 (10,2 KB)



In total, 508 object ids were changed. Full details are logged here:

        D:\Project.bfg-report\2015-01-30\17-23-57

BFG run is complete! When ready, run: git reflog expire --expire=now --all && gi
t gc --prune=now --aggressive

Should be added that

  1. Partial wildcards worked: Link*.dsk removed two matching files
  2. Files to delete were located in folders (\ProjName\ProjName.dsk)

Most helpful comment

FYI I have the same issue on Windows 10. I use git bash to run BJG and I try :

  • *.jar
  • '*.jar'
  • "*.jar"

It doesn't work. So I saw this topic and I tested with msdos (cmd).

Only the "*.jar" works !

Maybe you can add an hint on the main BFG page.

All 6 comments

Having this exact same issue. For me it's with jar files.

bfg -D *.jar mirror-repo.git

Won't find anything, however

bfg -D d*.jar mirror-repo.git

Will work just fine.

This is on Windows 7 64, using bfg-1.12.12.jar

C:\WS\repos>java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Does bfg -D '*.jar' mirror-repo.git work any better (quoted the glob)?

No luck with the quotes and it actually stops stuff that would normally work from working

So bfg -D 'd*.jar' mirror-repo.git doesn't work either

On a whim you inspired me to try double-quotes, and that actually worked! :tada:

bfg -D "*.jar" mirror-repo.git did the trick.

Nice, sorry I am so used to working in Linux I did not notice you were on Windows, and suggested the wrong quotes. Either way, they are needed to stop the shell from pre-expanding that glob.

They are quoted in the usage output, but single-quotes are used there i.e. not platform/shell-specific.

FYI I have the same issue on Windows 10. I use git bash to run BJG and I try :

  • *.jar
  • '*.jar'
  • "*.jar"

It doesn't work. So I saw this topic and I tested with msdos (cmd).

Only the "*.jar" works !

Maybe you can add an hint on the main BFG page.

I am using bfg-1.13.0.jar with Windows 10 but I got an opposite to nicolas-albert. Well, a little bit different.
The command with * would work some time using Command Prompt (msdos) whereas under git bash it is doing the job.
...and I used double quotes (")in both cases

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TharosTheDragon picture TharosTheDragon  路  5Comments

dpopiashvili picture dpopiashvili  路  5Comments

notslang picture notslang  路  5Comments

kforner picture kforner  路  9Comments

mitchellkrogza picture mitchellkrogza  路  5Comments