-
Notifications
You must be signed in to change notification settings - Fork 534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unbound (allow multiple) file matcher options #137
Conversation
914ed65
to
141d2b9
Compare
This would be really helpful ! |
rtyley#137 Squashed commit of the following: commit 141d2b9 Author: Brett Randall <javabrett@gmail.com> Date: Fri Apr 8 14:34:09 2016 +1000 Made -D/--delete-files and --delete-folders options accept multiple values. commit cbc8258 Author: Brett Randall <javabrett@gmail.com> Date: Fri Apr 8 14:33:47 2016 +1000 Removed blank lines from end of source file.
Hi @javabrett, I came here back going through the following query in the stack overflow, I am looking for removing multiple files(100+) from the git history using the BFG. |
@WalterObrain I think the option you are after is:
|
Thanks, @javabrett, but am looking for the scenario where we have a lot of files I would like to go with the files option instead of the --strip-blobs-with-ids |
Lets say in my scenario i have file1.txt,file3.txt,file23.sql,file24.csv like I was having 100+ files,
|
That is what this PR proposes. For complex file selection cases it has proved easiest to use external scripting to identify the blobs to delete then delete using that list. |
With the latest version of bfg jar, it seems the options to exclude multiple files does not work. Another option I tried is I checked out the code https://github.com/javabrett/bfg-repo-cleaner/tree/unbound-file-matcher-options and built it in my local using sbt compile, run, package and tried to use it but getting below error when I actually try to use the generated jar bfg-1.13.1-SNAPSHOT. |
This change allows multiple values to the four options (
--delete-files
,--delete-folders
,--filter-content-including
and--filter-content-excluding
) which use the file-matcher option. Currently these options only accept a single value, which can be cumbersome and discourage or prevent batch-cleaning in a single pass of bfg.I added some spec tests for delete files and folders. I couldn't see existing spec tests for the other two, nor a quick way of adding test-replacement assertions, although I'm sure that can be done. Also the filter glob options already had backing
Seq
s, they just were able to accept multiple values, so I expect they will work.I originally fell into a bad trap of trying to make the options themselves
Seq
s and usescopt
's comma-sep single-value parsing, but that falls-foul of any value containing a comma e.g. a regex glob, so breaks tests immediately. On reflection is it better not to allow this and just use single-value-unbounded-count options and collect them in aSeq
.