summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4947367)
raw | patch | inline | side by side (parent: 4947367)
author | Junio C Hamano <gitster@pobox.com> | |
Thu, 1 Sep 2011 22:43:34 +0000 (15:43 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 1 Sep 2011 22:46:13 +0000 (15:46 -0700) |
Often we want to verify everything reachable from a given set of commits
are present in our repository and connected without a gap to the tips of
our refs. We used to do this for this purpose:
$ rev-list --objects $commits_to_be_tested --not --all
Even though this is good enough for catching missing commits and trees,
we show the object name but do not verify their existence, let alone their
well-formedness, for the blob objects at the leaf level.
Add a new "--verify-object" option so that we can catch missing and broken
blobs as well.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
are present in our repository and connected without a gap to the tips of
our refs. We used to do this for this purpose:
$ rev-list --objects $commits_to_be_tested --not --all
Even though this is good enough for catching missing commits and trees,
we show the object name but do not verify their existence, let alone their
well-formedness, for the blob objects at the leaf level.
Add a new "--verify-object" option so that we can catch missing and broken
blobs as well.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/rev-list.c | patch | blob | history | |
revision.c | patch | blob | history | |
revision.h | patch | blob | history |
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 920b91c0c3483dd7e00be812f4ed0281dbdc3701..ab3be7ca82ea36fbb1e98f8b899970a6748981c6 100644 (file)
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
const struct name_path *path, const char *component,
void *cb_data)
{
+ struct rev_info *info = cb_data;
+
finish_object(obj, path, component, cb_data);
+ if (info->verify_objects && !obj->parsed && obj->type != OBJ_COMMIT)
+ parse_object(obj->sha1);
show_object_with_name(stdout, obj, path, component);
}
diff --git a/revision.c b/revision.c
index 072ddac4703058ff245b01488e36b190f8590f82..5ef498b304aeb1bf4a80750331923164c64f4371 100644 (file)
--- a/revision.c
+++ b/revision.c
@@ -1383,6 +1383,11 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
revs->tree_objects = 1;
revs->blob_objects = 1;
revs->edge_hint = 1;
+ } else if (!strcmp(arg, "--verify-objects")) {
+ revs->tag_objects = 1;
+ revs->tree_objects = 1;
+ revs->blob_objects = 1;
+ revs->verify_objects = 1;
} else if (!strcmp(arg, "--unpacked")) {
revs->unpacked = 1;
} else if (!prefixcmp(arg, "--unpacked=")) {
diff --git a/revision.h b/revision.h
index da00a58fa5ff600e4c47f698d51db5bb7d4d5e5b..648876b35d8cfc273fecf39fc52feb7affeb6d5d 100644 (file)
--- a/revision.h
+++ b/revision.h
tag_objects:1,
tree_objects:1,
blob_objects:1,
+ verify_objects:1,
edge_hint:1,
limited:1,
unpacked:1,