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

[PATCH v4 1/6] midx: add MIDX_PROGRESS flag

From
WGWilliam Baker via GitGitGadget <gitgitgadget@gmail.com>
Date
Oct 21, 2019, 18:39 UTC
Message-ID
<e7b1cc633bc8f5dbdb4f113456d20f1f11476662.1571683203.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.337.v4.git.1571683203.gitgitgadget@gmail.com>
From: William Baker <William.Baker@microsoft.com>

Add the MIDX_PROGRESS flag and update the write|verify|expire|repack functions in midx.h to accept a flags parameter. The MIDX_PROGRESS flag indicates whether the caller of the function would like progress information to be displayed. This patch only changes the method prototypes and does not change the functionality. The functionality change will be handled by a later patch.

Signed-off-by: William Baker <William.Baker@microsoft.com>
---
 builtin/multi-pack-index.c |  8 ++++----
 builtin/repack.c           |  2 +-
 midx.c                     |  8 ++++----
 midx.h                     | 10 ++++++----
 4 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
index b1ea1a6aa1..e86b8cd17d 100644
--- a/builtin/multi-pack-index.c
+++ b/builtin/multi-pack-index.c
@@ -47,16 +47,16 @@ int cmd_multi_pack_index(int argc, const char **argv,
 	trace2_cmd_mode(argv[0]);
 
 	if (!strcmp(argv[0], "repack"))
-		return midx_repack(the_repository, opts.object_dir, (size_t)opts.batch_size);
+		return midx_repack(the_repository, opts.object_dir, (size_t)opts.batch_size, 0);
 	if (opts.batch_size)
 		die(_("--batch-size option is only for 'repack' subcommand"));
 
 	if (!strcmp(argv[0], "write"))
-		return write_midx_file(opts.object_dir);
+		return write_midx_file(opts.object_dir, 0);
 	if (!strcmp(argv[0], "verify"))
-		return verify_midx_file(the_repository, opts.object_dir);
+		return verify_midx_file(the_repository, opts.object_dir, 0);
 	if (!strcmp(argv[0], "expire"))
-		return expire_midx_packs(the_repository, opts.object_dir);
+		return expire_midx_packs(the_repository, opts.object_dir, 0);
 
 	die(_("unrecognized subcommand: %s"), argv[0]);
 }
diff --git a/builtin/repack.c b/builtin/repack.c
index 094c2f8ea4..397081d568 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -562,7 +562,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
 	remove_temporary_files();
 
 	if (git_env_bool(GIT_TEST_MULTI_PACK_INDEX, 0))
-		write_midx_file(get_object_directory());
+		write_midx_file(get_object_directory(), 0);
 
 	string_list_clear(&names, 0);
 	string_list_clear(&rollback, 0);
diff --git a/midx.c b/midx.c
index f29afc0d2d..f169a681dd 100644
--- a/midx.c
+++ b/midx.c
@@ -1016,7 +1016,7 @@ static int write_midx_internal(const char *object_dir, struct multi_pack_index *
 	return result;
 }
 
-int write_midx_file(const char *object_dir)
+int write_midx_file(const char *object_dir, unsigned flags)
 {
 	return write_midx_internal(object_dir, NULL, NULL);
 }
@@ -1076,7 +1076,7 @@ static int compare_pair_pos_vs_id(const void *_a, const void *_b)
 			display_progress(progress, _n); \
 	} while (0)
 
-int verify_midx_file(struct repository *r, const char *object_dir)
+int verify_midx_file(struct repository *r, const char *object_dir, unsigned flags)
 {
 	struct pair_pos_vs_id *pairs = NULL;
 	uint32_t i;
@@ -1183,7 +1183,7 @@ int verify_midx_file(struct repository *r, const char *object_dir)
 	return verify_midx_error;
 }
 
-int expire_midx_packs(struct repository *r, const char *object_dir)
+int expire_midx_packs(struct repository *r, const char *object_dir, unsigned flags)
 {
 	uint32_t i, *count, result = 0;
 	struct string_list packs_to_drop = STRING_LIST_INIT_DUP;
@@ -1315,7 +1315,7 @@ static int fill_included_packs_batch(struct repository *r,
 	return 0;
 }
 
-int midx_repack(struct repository *r, const char *object_dir, size_t batch_size)
+int midx_repack(struct repository *r, const char *object_dir, size_t batch_size, unsigned flags)
 {
 	int result = 0;
 	uint32_t i;
diff --git a/midx.h b/midx.h
index f0ae656b5d..e6fa356b5c 100644
--- a/midx.h
+++ b/midx.h
@@ -37,6 +37,8 @@ struct multi_pack_index {
 	char object_dir[FLEX_ARRAY];
 };
 
+#define MIDX_PROGRESS     (1 << 0)
+
 struct multi_pack_index *load_multi_pack_index(const char *object_dir, int local);
 int prepare_midx_pack(struct repository *r, struct multi_pack_index *m, uint32_t pack_int_id);
 int bsearch_midx(const struct object_id *oid, struct multi_pack_index *m, uint32_t *result);
@@ -47,11 +49,11 @@ int fill_midx_entry(struct repository *r, const struct object_id *oid, struct pa
 int midx_contains_pack(struct multi_pack_index *m, const char *idx_or_pack_name);
 int prepare_multi_pack_index_one(struct repository *r, const char *object_dir, int local);
 
-int write_midx_file(const char *object_dir);
+int write_midx_file(const char *object_dir, unsigned flags);
 void clear_midx_file(struct repository *r);
-int verify_midx_file(struct repository *r, const char *object_dir);
-int expire_midx_packs(struct repository *r, const char *object_dir);
-int midx_repack(struct repository *r, const char *object_dir, size_t batch_size);
+int verify_midx_file(struct repository *r, const char *object_dir, unsigned flags);
+int expire_midx_packs(struct repository *r, const char *object_dir, unsigned flags);
+int midx_repack(struct repository *r, const char *object_dir, size_t batch_size, unsigned flags);
 
 void close_midx(struct multi_pack_index *m);
 
-- 
gitgitgadget
Previous: William Baker via GitGitGadgetNext: William Baker via GitGitGadget
Message 54 of 58 in “multi-pack-index: add --no-progress”
  1. 0/1 multi-pack-index: add --no-progressWilliam Baker via GitGitGadget, Sep 11, 2019
  2. 1/1 multi-pack-index: add --no-progress Add --no-progress option to git multi-pack-index. The progress feature was added in 144d703 ("multi-pack-index: report progress during 'verify'", 2018-09-13) but the ability to opt-out was overlooked.William Baker via GitGitGadget, Sep 11, 2019
  3. Junio C HamanoSep 12, 2019
  4. William BakerSep 13, 2019
  5. Junio C HamanoSep 13, 2019
  6. William BakerSep 16, 2019
  7. Derrick StoleeSep 11, 2019
  8. 0/6 multi-pack-index: add --no-progressWilliam Baker via GitGitGadget, Sep 20, 2019
  9. 1/6 midx: add MIDX_PROGRESS flag Add the MIDX_PROGRESS flag and update the write|verify|expire|repack functions in midx.h to accept a flags parameter. The MIDX_PROGRESS flag indicates whether the caller of the function would like progress information to be displayed. This patch only changes the method prototypes and does not change the functionality. The functionality change will be handled by a later patch.William Baker via GitGitGadget, Sep 20, 2019
  10. Junio C HamanoSep 20, 2019
  11. Junio C HamanoSep 20, 2019
  12. SZEDER GáborSep 21, 2019
  13. William BakerSep 23, 2019
  14. Junio C HamanoSep 28, 2019
  15. William BakerSep 30, 2019
  16. Junio C HamanoOct 2, 2019
  17. Junio C HamanoOct 2, 2019
  18. Junio C HamanoOct 2, 2019
  19. William BakerOct 2, 2019
  20. SZEDER GáborOct 7, 2019
  21. SZEDER GáborOct 7, 2019
  22. Junio C HamanoOct 8, 2019
  23. William BakerOct 8, 2019
  24. SZEDER GáborOct 9, 2019
  25. SZEDER GáborOct 9, 2019
  26. William BakerOct 15, 2019
  27. Junio C HamanoOct 16, 2019
  28. William BakerOct 16, 2019
  29. William BakerOct 18, 2019
  30. 5/6 midx: honor the MIDX_PROGRESS flag in midx_repack Update midx_repack to only display progress when the MIDX_PROGRESS flag is set.William Baker via GitGitGadget, Sep 20, 2019
  31. Junio C HamanoSep 20, 2019
  32. 4/6 midx: honor the MIDX_PROGRESS flag in verify_midx_file Update verify_midx_file to only display progress when the MIDX_PROGRESS flag is set.William Baker via GitGitGadget, Sep 20, 2019
  33. 2/6 midx: add progress to write_midx_file Add progress to write_midx_file. Progress is displayed when the MIDX_PROGRESS flag is set.William Baker via GitGitGadget, Sep 20, 2019
  34. Junio C HamanoSep 20, 2019
  35. William BakerSep 23, 2019
  36. Junio C HamanoSep 28, 2019
  37. William BakerSep 30, 2019
  38. 3/6 midx: add progress to expire_midx_packs Add progress to expire_midx_packs. Progress is displayed when the MIDX_PROGRESS flag is set.William Baker via GitGitGadget, Sep 20, 2019
  39. 6/6 multi-pack-index: add [--[no-]progress] option. Add the --[no-]progress option to git multi-pack-index. Pass the MIDX_PROGRESS flag to the subcommand functions when progress should be displayed by multi-pack-index. The progress feature was added to 'verify' in 144d703 ("multi-pack-index: report progress during 'verify'", 2018-09-13) but some subcommands were not updated to display progress, and the ability to opt-out was overlooked.William Baker via GitGitGadget, Sep 20, 2019
  40. Junio C HamanoSep 20, 2019
  41. William BakerSep 20, 2019
  42. Philip OakleySep 20, 2019
  43. William BakerSep 20, 2019
  44. 0/6 multi-pack-index: add --no-progressWilliam Baker via GitGitGadget, Oct 3, 2019
  45. 1/6 midx: add MIDX_PROGRESS flagWilliam Baker via GitGitGadget, Oct 3, 2019
  46. 3/6 midx: add progress to expire_midx_packsWilliam Baker via GitGitGadget, Oct 3, 2019
  47. 2/6 midx: add progress to write_midx_fileWilliam Baker via GitGitGadget, Oct 3, 2019
  48. 5/6 midx: honor the MIDX_PROGRESS flag in midx_repackWilliam Baker via GitGitGadget, Oct 3, 2019
  49. 4/6 midx: honor the MIDX_PROGRESS flag in verify_midx_fileWilliam Baker via GitGitGadget, Oct 3, 2019
  50. 6/6 multi-pack-index: add [--[no-]progress] option.William Baker via GitGitGadget, Oct 3, 2019
  51. Junio C HamanoOct 3, 2019
  52. 0/6 multi-pack-index: add --no-progressWilliam Baker via GitGitGadget, Oct 21, 2019
  53. 3/6 midx: add progress to expire_midx_packsWilliam Baker via GitGitGadget, Oct 21, 2019
  54. 1/6 midx: add MIDX_PROGRESS flagWilliam Baker via GitGitGadget, Oct 21, 2019
  55. 5/6 midx: honor the MIDX_PROGRESS flag in midx_repackWilliam Baker via GitGitGadget, Oct 21, 2019
  56. 4/6 midx: honor the MIDX_PROGRESS flag in verify_midx_fileWilliam Baker via GitGitGadget, Oct 21, 2019
  57. 6/6 multi-pack-index: add [--[no-]progress] option.William Baker via GitGitGadget, Oct 21, 2019
  58. 2/6 midx: add progress to write_midx_fileWilliam Baker via GitGitGadget, Oct 21, 2019

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.