git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[JGIT PATCH 2/3] Add --[no-]thin and --[no-]fsck optiosn to fetch command line tool

From
Shawn O. Pearce <spearce@spearce.org>
Date
Oct 30, 2008, 17:46 UTC
Message-ID
<1225388785-26818-3-git-send-email-spearce@spearce.org>
In-Reply-To
<1225388785-26818-2-git-send-email-spearce@spearce.org>

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 <spearce@spearce.org>
---
 .../src/org/spearce/jgit/pgm/Fetch.java            |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
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 e14e213..ad7e08f 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 @@
 	@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 @@
 	@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);
-- 
1.6.0.3.756.gb776d
Previous: Shawn O. PearceNext: Shawn O. Pearce
Message 3 of 6 in “Improved object validation”
  1. 0/3 Improved object validationShawn O. Pearce, Oct 30, 2008
  2. 1/3 Check object connectivity during fetch if fsck is enabledShawn O. Pearce, Oct 30, 2008
  3. 2/3 Add --[no-]thin and --[no-]fsck optiosn to fetch command line toolShawn O. Pearce, Oct 30, 2008
  4. 3/3 Don't permit '.' or '..' in tree entriesShawn O. Pearce, Oct 30, 2008
  5. Robin RosenbergOct 31, 2008
  6. Shawn O. PearceOct 31, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.