From: "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: avarab@gmail.com, Junio C Hamano <gitster@pobox.com>,
Derrick Stolee <dstolee@microsoft.com>
Subject: [PATCH v2 01/11] multi-pack-index: add 'verify' verb
Date: Thu, 13 Sep 2018 11:02:13 -0700 (PDT) [thread overview]
Message-ID: <d8ffd84d67471e6fbb658beedf4491e12ca50311.1536861730.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.34.v2.git.gitgitgadget@gmail.com>
From: Derrick Stolee <dstolee@microsoft.com>
The multi-pack-index builtin writes multi-pack-index files, and
uses a 'write' verb to do so. Add a 'verify' verb that checks this
file matches the contents of the pack-indexes it replaces.
The current implementation is a no-op, but will be extended in
small increments in later commits.
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
Documentation/git-multi-pack-index.txt | 10 ++++++++++
builtin/multi-pack-index.c | 4 +++-
midx.c | 13 +++++++++++++
midx.h | 1 +
t/t5319-multi-pack-index.sh | 8 ++++++++
5 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/Documentation/git-multi-pack-index.txt b/Documentation/git-multi-pack-index.txt
index 1f97e79912..f7778a2c85 100644
--- a/Documentation/git-multi-pack-index.txt
+++ b/Documentation/git-multi-pack-index.txt
@@ -27,6 +27,10 @@ write::
When given as the verb, write a new MIDX file to
`<dir>/packs/multi-pack-index`.
+verify::
+ When given as the verb, verify the contents of the MIDX file
+ at `<dir>/packs/multi-pack-index`.
+
EXAMPLES
--------
@@ -43,6 +47,12 @@ $ git multi-pack-index write
$ git multi-pack-index --object-dir <alt> write
-----------------------------------------------
+* Verify the MIDX file for the packfiles in the current .git folder.
++
+-----------------------------------------------
+$ git multi-pack-index verify
+-----------------------------------------------
+
SEE ALSO
--------
diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
index 2633efd95d..fca70f8e4f 100644
--- a/builtin/multi-pack-index.c
+++ b/builtin/multi-pack-index.c
@@ -5,7 +5,7 @@
#include "midx.h"
static char const * const builtin_multi_pack_index_usage[] = {
- N_("git multi-pack-index [--object-dir=<dir>] write"),
+ N_("git multi-pack-index [--object-dir=<dir>] (write|verify)"),
NULL
};
@@ -42,6 +42,8 @@ int cmd_multi_pack_index(int argc, const char **argv,
if (!strcmp(argv[0], "write"))
return write_midx_file(opts.object_dir);
+ if (!strcmp(argv[0], "verify"))
+ return verify_midx_file(opts.object_dir);
die(_("unrecognized verb: %s"), argv[0]);
}
diff --git a/midx.c b/midx.c
index f3e8dbc108..b253bed517 100644
--- a/midx.c
+++ b/midx.c
@@ -928,3 +928,16 @@ void clear_midx_file(const char *object_dir)
free(midx);
}
+
+int verify_midx_error;
+
+int verify_midx_file(const char *object_dir)
+{
+ struct multi_pack_index *m = load_multi_pack_index(object_dir, 1);
+ verify_midx_error = 0;
+
+ if (!m)
+ return 0;
+
+ return verify_midx_error;
+}
diff --git a/midx.h b/midx.h
index a210f1af2a..ce80b91c68 100644
--- a/midx.h
+++ b/midx.h
@@ -43,5 +43,6 @@ int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, i
int write_midx_file(const char *object_dir);
void clear_midx_file(const char *object_dir);
+int verify_midx_file(const char *object_dir);
#endif
diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
index 6f56b38674..1c4e0e6d31 100755
--- a/t/t5319-multi-pack-index.sh
+++ b/t/t5319-multi-pack-index.sh
@@ -150,6 +150,10 @@ test_expect_success 'write midx with twelve packs' '
compare_results_with_midx "twelve packs"
+test_expect_success 'verify multi-pack-index success' '
+ git multi-pack-index verify --object-dir=$objdir
+'
+
test_expect_success 'repack removes multi-pack-index' '
test_path_is_file $objdir/pack/multi-pack-index &&
git repack -adf &&
@@ -214,4 +218,8 @@ test_expect_success 'force some 64-bit offsets with pack-objects' '
midx_read_expect 1 63 5 objects64 " large-offsets"
'
+test_expect_success 'verify multi-pack-index with 64-bit offsets' '
+ git multi-pack-index verify --object-dir=objects64
+'
+
test_done
--
gitgitgadget
next prev parent reply other threads:[~2018-09-13 18:02 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-05 14:46 [PATCH 00/11] Add 'git multi-pack-index verify' command Derrick Stolee via GitGitGadget
2018-09-05 14:46 ` [PATCH 01/11] multi-pack-index: add 'verify' verb Derrick Stolee via GitGitGadget
2018-09-05 18:59 ` Eric Sunshine
2018-09-05 19:37 ` Derrick Stolee
2018-09-05 14:46 ` [PATCH 02/11] multi-pack-index: verify bad header Derrick Stolee via GitGitGadget
2018-09-07 0:27 ` Eric Sunshine
2018-09-05 14:46 ` [PATCH 03/11] multi-pack-index: verify corrupt chunk lookup table Derrick Stolee via GitGitGadget
2018-09-05 14:46 ` [PATCH 04/11] multi-pack-index: verify packname order Derrick Stolee via GitGitGadget
2018-09-05 18:15 ` Stefan Beller
2018-09-05 19:11 ` Derrick Stolee
2018-09-05 19:14 ` Stefan Beller
2018-09-05 19:28 ` Derrick Stolee
2018-09-05 14:46 ` [PATCH 05/11] multi-pack-index: verify missing pack Derrick Stolee via GitGitGadget
2018-09-05 14:46 ` [PATCH 06/11] multi-pack-index: verify oid fanout order Derrick Stolee via GitGitGadget
2018-09-05 14:46 ` [PATCH 07/11] multi-pack-index: verify oid lookup order Derrick Stolee via GitGitGadget
2018-09-05 14:46 ` [PATCH 08/11] multi-pack-index: fix 32-bit vs 64-bit size check Derrick Stolee via GitGitGadget
2018-09-05 14:46 ` [PATCH 09/11] multi-pack-index: verify object offsets Derrick Stolee via GitGitGadget
2018-09-07 0:34 ` Eric Sunshine
2018-09-07 13:10 ` Derrick Stolee
2018-09-05 14:46 ` [PATCH 10/11] multi-pack-index: report progress during 'verify' Derrick Stolee via GitGitGadget
2018-09-05 14:46 ` [PATCH 11/11] fsck: verify multi-pack-index Derrick Stolee via GitGitGadget
2018-09-13 18:02 ` [PATCH v2 00/11] Add 'git multi-pack-index verify' command Derrick Stolee via GitGitGadget
2018-09-13 18:02 ` Derrick Stolee via GitGitGadget [this message]
2018-09-13 18:02 ` [PATCH v2 02/11] multi-pack-index: verify bad header Derrick Stolee via GitGitGadget
2018-09-13 18:02 ` [PATCH v2 03/11] multi-pack-index: verify corrupt chunk lookup table Derrick Stolee via GitGitGadget
2018-09-13 18:02 ` [PATCH v2 04/11] multi-pack-index: verify packname order Derrick Stolee via GitGitGadget
2018-09-13 18:02 ` [PATCH v2 05/11] multi-pack-index: verify missing pack Derrick Stolee via GitGitGadget
2018-09-13 18:02 ` [PATCH v2 06/11] multi-pack-index: verify oid fanout order Derrick Stolee via GitGitGadget
2018-09-13 18:02 ` [PATCH v2 07/11] multi-pack-index: verify oid lookup order Derrick Stolee via GitGitGadget
2018-09-13 18:02 ` [PATCH v2 08/11] multi-pack-index: fix 32-bit vs 64-bit size check Derrick Stolee via GitGitGadget
2018-09-13 18:02 ` [PATCH v2 09/11] multi-pack-index: verify object offsets Derrick Stolee via GitGitGadget
2018-09-13 18:02 ` [PATCH v2 10/11] multi-pack-index: report progress during 'verify' Derrick Stolee via GitGitGadget
2018-09-13 19:02 ` Ævar Arnfjörð Bjarmason
2018-09-13 18:02 ` [PATCH v2 11/11] fsck: verify multi-pack-index Derrick Stolee via GitGitGadget
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d8ffd84d67471e6fbb658beedf4491e12ca50311.1536861730.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=avarab@gmail.com \
--cc=dstolee@microsoft.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).