From 23f741872a31ee14cdbd35dd983dc1110bbc45a4 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 13 Oct 2008 10:36:41 -0700 Subject: [PATCH] Add --[no-]thin and --[no-]fsck optiosn to fetch command line tool This way users can force verification on the fly, such as when fetching from an untrusted URL pasted on the command line. Signed-off-by: Shawn O. Pearce Signed-off-by: Robin Rosenberg --- .../src/org/spearce/jgit/pgm/Fetch.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/Fetch.java b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/Fetch.java index e14e213e..ad7e08f6 100644 --- a/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/Fetch.java +++ b/org.spearce.jgit.pgm/src/org/spearce/jgit/pgm/Fetch.java @@ -54,6 +54,22 @@ class Fetch extends TextBuiltin { @Option(name = "--verbose", aliases = { "-v" }, usage = "be more verbose") private boolean verbose; + @Option(name = "--fsck", usage = "perform fsck style checks on receive") + private Boolean fsck; + + @Option(name = "--no-fsck") + void nofsck(final boolean ignored) { + fsck = Boolean.FALSE; + } + + @Option(name = "--thin", usage = "fetch thin pack") + private Boolean thin; + + @Option(name = "--no-thin") + void nothin(final boolean ignored) { + thin = Boolean.FALSE; + } + @Argument(index = 0, metaVar = "uri-ish") private String remote = "origin"; @@ -63,6 +79,10 @@ class Fetch extends TextBuiltin { @Override protected void run() throws Exception { final Transport tn = Transport.open(db, remote); + if (fsck != null) + tn.setCheckFetchedObjects(fsck.booleanValue()); + if (thin != null) + tn.setFetchThin(thin.booleanValue()); final FetchResult r; try { r = tn.fetch(new TextProgressMonitor(), toget); -- 2.11.4.GIT