Skip to content

Commit 58ec102

Browse files
committed
default to old behavior of including hidden files/folders
1 parent 98080c2 commit 58ec102

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

src/main/java/gov/loc/repository/bagit/BagFactory.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package gov.loc.repository.bagit;
22

3+
import java.io.File;
4+
import java.util.List;
5+
36
import gov.loc.repository.bagit.Bag.BagConstants;
47
import gov.loc.repository.bagit.Bag.BagPartFactory;
58
import gov.loc.repository.bagit.filesystem.FileSystemNodeFilter;
6-
import gov.loc.repository.bagit.filesystem.filter.NotHiddenFileSystemNodeFilter;
79
import gov.loc.repository.bagit.impl.PreBagImpl;
810

9-
import java.io.File;
10-
import java.util.List;
11-
1211
/**
1312
* <p>Provides all methods for instantiating new {@link Bag} objects, as well
1413
* as reading bags from disk and serializations. You should not create a
@@ -88,7 +87,7 @@ public static Version valueOfString(String versionString) {
8887
* Creates an instance of a bag factory.
8988
*/
9089
public BagFactory() {
91-
this.defaultNodeFilter = new NotHiddenFileSystemNodeFilter();
90+
this.defaultNodeFilter = null;
9291
}
9392

9493
public BagFactory(FileSystemNodeFilter defaultNodeFilter) {

src/main/java/gov/loc/repository/bagit/driver/CommandLineBagDriver.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public class CommandLineBagDriver {
145145
public static final String PARAM_FAIL_MODE = "failmode";
146146
public static final String PARAM_COMPRESSION_LEVEL = "compressionlevel";
147147
public static final String PARAM_MOVE = "move";
148-
public static final String PARAM_INCLUDE_HIDDEN = "includehiddenfiles";
148+
public static final String PARAM_EXCLUDE_HIDDEN = "excludehiddenfiles";
149149

150150
public static final String VALUE_WRITER_FILESYSTEM = Format.FILESYSTEM.name().toLowerCase();
151151
public static final String VALUE_WRITER_ZIP = Format.ZIP.name().toLowerCase();
@@ -374,7 +374,7 @@ private void addOperation(String name, String help, Parameter[] params, String[]
374374
jsap.registerParameter(new Switch( PARAM_HELP, JSAP.NO_SHORTFLAG, PARAM_HELP, "Prints help." ));
375375
jsap.registerParameter(new Switch(PARAM_VERBOSE, JSAP.NO_SHORTFLAG, PARAM_VERBOSE, "Reports progress of the operation to the console."));
376376
jsap.registerParameter(new Switch(PARAM_LOG_VERBOSE, JSAP.NO_SHORTFLAG, PARAM_LOG_VERBOSE, "Reports progress of the operation to the log."));
377-
jsap.registerParameter(new Switch( PARAM_INCLUDE_HIDDEN, JSAP.NO_SHORTFLAG, PARAM_INCLUDE_HIDDEN, "Include hidden files." ));
377+
jsap.registerParameter(new Switch( PARAM_EXCLUDE_HIDDEN, JSAP.NO_SHORTFLAG, PARAM_EXCLUDE_HIDDEN, "Exclude hidden files." ));
378378

379379
this.operationMap.put(name, new Operation(name, jsap, help, examples));
380380
}
@@ -616,12 +616,11 @@ private int performOperation(Operation operation, JSAPResult config) {
616616
}
617617

618618
BagFactory bagFactory = null;
619-
if (config.getBoolean(PARAM_INCLUDE_HIDDEN)) {
619+
if (config.getBoolean(PARAM_EXCLUDE_HIDDEN)) {
620+
bagFactory = new BagFactory(new NotHiddenFileSystemNodeFilter());
621+
} else {
620622
// null filter will include all nodes, including hidden ones
621623
bagFactory = new BagFactory(null);
622-
} else {
623-
// The default should filter out hidden files
624-
bagFactory = new BagFactory(new NotHiddenFileSystemNodeFilter());
625624
}
626625

627626
Writer writer = null;

0 commit comments

Comments
 (0)