Browse Source

Add a setting for fsck to check connectivity only

The object checks may take a long time and sometimes we are only
interested in connectivity check.

This is similar to 'git fsck --connectivity-only'.

Change-Id: I654e8fdccdb16d796f920088429d188cc96734bc
Signed-off-by: Zhen Chen <czhen@google.com>
stable-4.10
Zhen Chen 7 years ago
parent
commit
c93c653ccf
  1. 13
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsFsck.java

13
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsFsck.java

@ -69,6 +69,7 @@ public class DfsFsck {
private final DfsRepository repo;
private final DfsObjDatabase objdb;
private ObjectChecker objChecker = new ObjectChecker();
private boolean connectivityOnly;
/**
* Initialize DFS fsck.
@ -97,7 +98,9 @@ public class DfsFsck {
}
FsckError errors = new FsckError();
if (!connectivityOnly) {
checkPacks(pm, errors);
}
checkConnectivity(pm, errors);
return errors;
}
@ -174,4 +177,14 @@ public class DfsFsck {
public void setObjectChecker(ObjectChecker objChecker) {
this.objChecker = objChecker;
}
/**
* @param connectivityOnly
* whether fsck should bypass object validity and integrity
* checks and only check connectivity. The default is
* {@code false}, meaning to run all checks.
*/
public void setConnectivityOnly(boolean connectivityOnly) {
this.connectivityOnly = connectivityOnly;
}
}

Loading…
Cancel
Save