git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 1/3] fetch.fsckobjects: verify downloaded objects
Date: Sun,  4 Sep 2011 19:21:35 -0700	[thread overview]
Message-ID: <1315189297-19497-2-git-send-email-gitster@pobox.com> (raw)
In-Reply-To: <1315189297-19497-1-git-send-email-gitster@pobox.com>

This corresponds to receive.fsckobjects configuration variable added (a
lot) earlier in 20dc001 (receive-pack: allow using --strict mode for
unpacking objects, 2008-02-25).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/config.txt |    6 ++++++
 builtin/fetch-pack.c     |    8 ++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 664de6b..4cbc4b9 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -820,6 +820,12 @@ diff.wordRegex::
 	sequences that match the regular expression are "words", all other
 	characters are *ignorable* whitespace.
 
+fetch.fsckObjects::
+	If it is set to true, git-fetch-pack will check all fetched
+	objects. It will abort in the case of a malformed object or a
+	broken link. The result of an abort are only dangling objects.
+	Defaults to false.
+
 fetch.unpackLimit::
 	If the number of objects fetched over the git native
 	transfer is below this
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index dbd8b7b..df6a8dc 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -14,6 +14,7 @@ static int transfer_unpack_limit = -1;
 static int fetch_unpack_limit = -1;
 static int unpack_limit = 100;
 static int prefer_ofs_delta = 1;
+static int fetch_fsck_objects;
 static struct fetch_pack_args args = {
 	/* .uploadpack = */ "git-upload-pack",
 };
@@ -663,6 +664,8 @@ static int get_pack(int xd[2], char **pack_lockfile)
 	}
 	if (*hdr_arg)
 		*av++ = hdr_arg;
+	if (fetch_fsck_objects)
+		*av++ = "--strict";
 	*av++ = NULL;
 
 	cmd.in = demux.out;
@@ -776,6 +779,11 @@ static int fetch_pack_config(const char *var, const char *value, void *cb)
 		return 0;
 	}
 
+	if (!strcmp(var, "fetch.fsckobjects")) {
+		fetch_fsck_objects = git_config_bool(var, value);
+		return 0;
+	}
+
 	return git_default_config(var, value, cb);
 }
 
-- 
1.7.7.rc0.175.gb3212

  reply	other threads:[~2011-09-05  2:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-01 17:53 Funnies with "git fetch" Junio C Hamano
2011-09-01 22:42 ` Junio C Hamano
2011-09-01 23:31   ` Jeff King
2011-09-02  3:09     ` Junio C Hamano
2011-09-02  3:28       ` Junio C Hamano
2011-09-02  5:03       ` Jeff King
2011-09-01 22:43 ` [PATCH 0/3] Verify the objects fetch obtained before updating ref Junio C Hamano
2011-09-01 22:43   ` [PATCH 1/3] list-objects: pass callback data to show_objects() Junio C Hamano
2011-09-01 22:43   ` [PATCH 2/3] rev-list --verify-object Junio C Hamano
2011-09-01 22:43   ` [PATCH 3/3] fetch: verify we have everything we need before updating our ref Junio C Hamano
2011-09-02  3:55     ` Nguyen Thai Ngoc Duy
2011-09-02  4:25       ` Junio C Hamano
2011-09-02 23:14         ` Junio C Hamano
2011-09-04 19:15 ` Funnies with "git fetch" Junio C Hamano
2011-09-05  2:21   ` [PATCH 0/3] Add fetch.fsckobjects Junio C Hamano
2011-09-05  2:21     ` Junio C Hamano [this message]
2011-09-05  2:21     ` [PATCH 2/3] transfer.fsckobjects: unify fetch/receive.fsckobjects Junio C Hamano
2011-09-05  2:21     ` [PATCH 3/3] test: fetch/receive with fsckobjects Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1315189297-19497-2-git-send-email-gitster@pobox.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).