microsoft / git

A fork of Git containing Microsoft-specific patches.
http://git-scm.com/
Other
789 stars 95 forks source link

Rebase to v2.47.0 #692

Closed dscho closed 1 month ago

dscho commented 1 month ago
Range-diff relative to vfs-2.46.2, part 1/2 * 2: 014e13a8692d6 = 1: a3d7a50364caf t: remove advice from some tests * 1: 1b91965713666 = 2: 394eed4843eb2 sparse-index.c: fix use of index hashes in expand_index * 11: 8b9f007542300 = 3: 7bcd46a8d6b7f t5300: confirm failure of git index-pack when non-idx suffix requested * 3: aa31f50888f85 = 4: f2db492cc6172 t1092: add test for untracked files and directories * 4: 0a63e54742a57 (upstream: 3a8cd93b061b3) < -: ------------- survey: stub in new experimental `git-survey` command * 5: 8b66a8babbc77 (upstream: 5bac1adb95a97) < -: ------------- survey: add command line opts to select references * 6: 3e4359389c070 < -: ------------- survey: collect the set of requested refs * 7: f984f7c156d04 < -: ------------- survey: calculate stats on refs and print results * 8: c9e2ad6a6fa5e < -: ------------- survey: stub in treewalk of reachable commits and objects * 9: 72491d74d8573 < -: ------------- survey: add traverse callback for commits * 13: 2371769d865c7 ! 5: 69b5eb8e25cf1 index-pack: disable rev-index if index file has non .idx suffix ``````diff @@ Commit message Signed-off-by: Jeff Hostetler ## builtin/index-pack.c ## -@@ builtin/index-pack.c: int cmd_index_pack(int argc, const char **argv, const char *prefix) +@@ builtin/index-pack.c: int cmd_index_pack(int argc, unsigned foreign_nr = 1; /* zero is a "good" value, assume bad */ int report_end_of_input = 0; int hash_algo = 0; @@ builtin/index-pack.c: int cmd_index_pack(int argc, const char **argv, const char /* * index-pack never needs to fetch missing objects except when -@@ builtin/index-pack.c: int cmd_index_pack(int argc, const char **argv, const char *prefix) +@@ builtin/index-pack.c: int cmd_index_pack(int argc, if (index_name || (i+1) >= argc) usage(index_pack_usage); index_name = argv[++i]; @@ builtin/index-pack.c: int cmd_index_pack(int argc, const char **argv, const char } else if (starts_with(arg, "--index-version=")) { char *c; opts.version = strtoul(arg + 16, &c, 10); -@@ builtin/index-pack.c: int cmd_index_pack(int argc, const char **argv, const char *prefix) +@@ builtin/index-pack.c: int cmd_index_pack(int argc, repo_set_hash_algo(the_repository, GIT_HASH_SHA1); opts.flags &= ~(WRITE_REV | WRITE_REV_VERIFY); `````` * 14: a6007ea55e1df = 6: fd1e3c24ad699 trace2: prefetch value of GIT_TRACE2_DST_DEBUG at startup * -: ------------- > 7: 7715abe8da26d survey: calculate more stats on refs * -: ------------- > 8: 00f402cea0e23 amend! survey: add --top= option and config * -: ------------- > 9: 01146de194e48 survey: show some commits/trees/blobs histograms * 10: 79f0a6bc3a3cf ! 10: 56703e74a3c3c survey: add vector of largest objects for various scaling dimensions ``````diff @@ Commit message Signed-off-by: Jeff Hostetler - ## Documentation/config.txt ## -@@ Documentation/config.txt: include::config/status.txt[] - - include::config/submodule.txt[] - -+include::config/survey.txt[] -+ - include::config/tag.txt[] - - include::config/tar.txt[] - - ## Documentation/config/survey.txt (new) ## -@@ -+survey.progress:: -+ Boolean to show/hide progress information. Defaults to -+ true when interactive (stderr is bound to a TTY). -+ -+survey.showBlobSizes:: -+ A non-negative integer value. Requests details on the -+ largest file blobs by size in bytes. Provides a default -+ value for `--blob-sizes=` in linkgit:git-survey[1]. -+ -+survey.showCommitParents:: -+ A non-negative integer value. Requests details on the -+ commits with the most number of parents. Provides a default -+ value for `--commit-parents=` in linkgit:git-survey[1]. -+ -+survey.showCommitSizes:: -+ A non-negative integer value. Requests details on the -+ largest commits by size in bytes. Generally, these are the -+ commits with the largest commit messages. Provides a default -+ value for `--commit-sizes=` in linkgit:git-survey[1]. -+ -+survey.showTreeEntries:: -+ A non-negative integer value. Requests details on the -+ trees (directories) with the most number of entries (files -+ and subdirectories). Provides a default value for -+ `--tree-entries=` in linkgit:git-survey[1]. -+ -+survey.showTreeSizes:: -+ A non-negative integer value. Requests details on the -+ largest trees (directories) by size in bytes. This will -+ set will usually be equal to the `survey.showTreeEntries` -+ set, but may be skewed by very long file or subdirectory -+ entry names. Provides a default value for -+ `--tree-sizes=` in linkgit:git-survey[1]. -+ -+survey.verbose:: -+ Boolean to show/hide verbose output. Default to false. + ## Documentation/config/survey.txt ## +@@ Documentation/config/survey.txt: survey.*:: + top:: + This integer value implies `--top=`, specifying the + number of entries in the detail tables. ++ showBlobSizes:: ++ A non-negative integer value. Requests details on the ++ largest file blobs by size in bytes. Provides a ++ default value for `--blob-sizes=` in ++ linkgit:git-survey[1]. ++ showCommitParents:: ++ A non-negative integer value. Requests details on the ++ commits with the most number of parents. Provides a ++ default value for `--commit-parents=` in ++ linkgit:git-survey[1]. ++ showCommitSizes:: ++ A non-negative integer value. Requests details on the ++ largest commits by size in bytes. Generally, these ++ are the commits with the largest commit messages. ++ Provides a default value for `--commit-sizes=` in ++ linkgit:git-survey[1]. ++ showTreeEntries:: ++ A non-negative integer value. Requests details on the ++ trees (directories) with the most number of entries ++ (files and subdirectories). Provides a default value ++ for `--tree-entries=` in linkgit:git-survey[1]. ++ showTreeSizes:: ++ A non-negative integer value. Requests details on the ++ largest trees (directories) by size in bytes. This ++ will set will usually be equal to the ++ `survey.showTreeEntries` set, but may be skewed by very ++ long file or subdirectory entry names. Provides a ++ default value for `--tree-sizes=` in ++ linkgit:git-survey[1]. + -- ## Documentation/git-survey.txt ## @@ Documentation/git-survey.txt: only refs for the given options are added. @@ Documentation/git-survey.txt: only refs for the given options are added. OUTPUT ------ - By default, `git survey` will print information about the repository in a - human-readable format that includes overviews and tables. +@@ Documentation/git-survey.txt: Reachable Object Summary + The reachable object summary shows the total number of each kind of Git + object, including tags, commits, trees, and blobs. +CONFIGURATION +------------- @@ Documentation/git-survey.txt: only refs for the given options are added. Part of the linkgit:git[1] suite ## builtin/survey.c ## -@@ builtin/survey.c: static struct survey_refs_wanted refs_if_unspecified = { +@@ builtin/survey.c: static struct survey_refs_wanted default_ref_options = { struct survey_opts { int verbose; int show_progress; @@ builtin/survey.c: static struct survey_refs_wanted refs_if_unspecified = { + + int show_largest_blobs_by_size_bytes; + + int top_nr; struct survey_refs_wanted refs; }; - -+#define DEFAULT_SHOW_LARGEST_VALUE (10) -+ - static struct survey_opts survey_opts = { - .verbose = 0, - .show_progress = -1, /* defaults to isatty(2) */ - -+ /* -+ * Show the largest `n` objects for some scaling dimension. -+ * We allow each to be requested independently. -+ */ -+ .show_largest_commits_by_nr_parents = DEFAULT_SHOW_LARGEST_VALUE, -+ .show_largest_commits_by_size_bytes = DEFAULT_SHOW_LARGEST_VALUE, -+ -+ .show_largest_trees_by_nr_entries = DEFAULT_SHOW_LARGEST_VALUE, -+ .show_largest_trees_by_size_bytes = DEFAULT_SHOW_LARGEST_VALUE, -+ -+ .show_largest_blobs_by_size_bytes = DEFAULT_SHOW_LARGEST_VALUE, -+ - .refs.want_all_refs = 0, - - .refs.want_branches = -1, /* default these to undefined */ -@@ builtin/survey.c: static struct option survey_options[] = { - OPT_BOOL_F(0, "detached", &survey_opts.refs.want_detached, N_("include detached HEAD"), PARSE_OPT_NONEG), - OPT_BOOL_F(0, "other", &survey_opts.refs.want_other, N_("include notes and stashes"), PARSE_OPT_NONEG), - -+ OPT_INTEGER_F(0, "commit-parents", &survey_opts.show_largest_commits_by_nr_parents, N_("show N largest commits by parent count"), PARSE_OPT_NONEG), -+ OPT_INTEGER_F(0, "commit-sizes", &survey_opts.show_largest_commits_by_size_bytes, N_("show N largest commits by size in bytes"), PARSE_OPT_NONEG), -+ -+ OPT_INTEGER_F(0, "tree-entries", &survey_opts.show_largest_trees_by_nr_entries, N_("show N largest trees by entry count"), PARSE_OPT_NONEG), -+ OPT_INTEGER_F(0, "tree-sizes", &survey_opts.show_largest_trees_by_size_bytes, N_("show N largest trees by size in bytes"), PARSE_OPT_NONEG), -+ -+ OPT_INTEGER_F(0, "blob-sizes", &survey_opts.show_largest_blobs_by_size_bytes, N_("show N largest blobs by size in bytes"), PARSE_OPT_NONEG), -+ - OPT_END(), - }; - -@@ builtin/survey.c: static int survey_load_config_cb(const char *var, const char *value, - return 0; - } - -+ if (!strcmp(var, "survey.showcommitparents")) { -+ survey_opts.show_largest_commits_by_nr_parents = git_config_ulong(var, value, ctx->kvi); -+ return 0; -+ } -+ if (!strcmp(var, "survey.showcommitsizes")) { -+ survey_opts.show_largest_commits_by_size_bytes = git_config_ulong(var, value, ctx->kvi); -+ return 0; -+ } -+ -+ if (!strcmp(var, "survey.showtreeentries")) { -+ survey_opts.show_largest_trees_by_nr_entries = git_config_ulong(var, value, ctx->kvi); -+ return 0; -+ } -+ if (!strcmp(var, "survey.showtreesizes")) { -+ survey_opts.show_largest_trees_by_size_bytes = git_config_ulong(var, value, ctx->kvi); -+ return 0; -+ } -+ -+ if (!strcmp(var, "survey.showblobsizes")) { -+ survey_opts.show_largest_blobs_by_size_bytes = git_config_ulong(var, value, ctx->kvi); -+ return 0; -+ } -+ - return git_default_config(var, value, ctx, pvoid); - } - @@ builtin/survey.c: static void incr_obj_hist_bin(struct obj_hist_bin *pbin, pbin->cnt_seen++; } @@ builtin/survey.c: static void incr_obj_hist_bin(struct obj_hist_bin *pbin, + +static void free_large_item_vec(struct large_item_vec *vec) +{ ++ if (!vec) ++ return; ++ + free(vec->dimension_label); + free(vec->item_label); + free(vec); @@ builtin/survey.c: struct survey_stats_trees { + * Keep a vector of the trees with the most number of entries. + * This gives us a feel for the width of a tree when there are + * gigantic directories. -+ */ + */ +- uint64_t max_entries; /* max(nr_entries) -- the width of the largest tree */ + struct large_item_vec *vec_largest_by_nr_entries; + + /* + * Keep a vector of the trees with the largest size in bytes. + * The contents of this may or may not match items in the other + * vector, since entryname length can alter the results. - */ -- uint64_t max_entries; /* max(nr_entries) -- the width of the largest tree */ ++ */ + struct large_item_vec *vec_largest_by_size_bytes; /* @@ builtin/survey.c: struct survey_stats_trees { + struct large_item_vec *vec_largest_by_size_bytes; }; - struct survey_stats { -@@ builtin/survey.c: static int fill_in_base_object(struct survey_stats_base_object *base, - static void traverse_commit_cb(struct commit *commit, void *data) - { - struct survey_stats_commits *psc = &survey_stats.commits; -+ unsigned long object_length; - unsigned k; - - if ((++survey_progress_total % 1000) == 0) - display_progress(survey_progress, survey_progress_total); - -- fill_in_base_object(&psc->base, &commit->object, OBJ_COMMIT, NULL, NULL); -+ fill_in_base_object(&psc->base, &commit->object, OBJ_COMMIT, &object_length, NULL); + struct survey_report_object_summary { +@@ builtin/survey.c: struct survey_context { - k = commit_list_count(commit->parents); -+ -+ maybe_insert_large_item(psc->vec_largest_by_nr_parents, k, &commit->object.oid); -+ maybe_insert_large_item(psc->vec_largest_by_size_bytes, object_length, &commit->object.oid); -+ - if (k >= PBIN_VEC_LEN) - k = PBIN_VEC_LEN - 1; -- - psc->parent_cnt_pbin[k]++; - } - -@@ builtin/survey.c: static void traverse_object_cb_tree(struct object *obj) - - pst->sum_entries += nr_entries; - -- if (nr_entries > pst->max_entries) -- pst->max_entries = nr_entries; -+ maybe_insert_large_item(pst->vec_largest_by_nr_entries, nr_entries, &obj->oid); -+ maybe_insert_large_item(pst->vec_largest_by_size_bytes, object_length, &obj->oid); - - qb = qbin(nr_entries); - incr_obj_hist_bin(&pst->entry_qbin[qb], object_length, disk_sizep); -@@ builtin/survey.c: static void traverse_object_cb_tree(struct object *obj) - static void traverse_object_cb_blob(struct object *obj) + static void clear_survey_context(struct survey_context *ctx) { - struct survey_stats_blobs *psb = &survey_stats.blobs; -+ unsigned long object_length; - -- fill_in_base_object(&psb->base, obj, OBJ_BLOB, NULL, NULL); -+ fill_in_base_object(&psb->base, obj, OBJ_BLOB, &object_length, NULL); -+ -+ maybe_insert_large_item(psb->vec_largest_by_size_bytes, object_length, &obj->oid); ++ free_large_item_vec(ctx->report.reachable_objects.commits.vec_largest_by_nr_parents); ++ free_large_item_vec(ctx->report.reachable_objects.commits.vec_largest_by_size_bytes); ++ free_large_item_vec(ctx->report.reachable_objects.trees.vec_largest_by_nr_entries); ++ free_large_item_vec(ctx->report.reachable_objects.trees.vec_largest_by_size_bytes); ++ free_large_item_vec(ctx->report.reachable_objects.blobs.vec_largest_by_size_bytes); ++ + ref_array_clear(&ctx->ref_array); + strvec_clear(&ctx->refs); } - - static void traverse_object_cb(struct object *obj, const char *name, void *data) -@@ builtin/survey.c: static void write_base_object_json(struct json_writer *jw, - write_hbin_json(jw, "dist_by_size", base->size_hbin); +@@ builtin/survey.c: static void survey_report_commit_parents(struct survey_context *ctx) + clear_table(&table); } -+static void write_large_item_vec_json(struct json_writer *jw, -+ struct large_item_vec *vec) ++static void survey_report_largest_vec(struct large_item_vec *vec) +{ ++ struct survey_table table = SURVEY_TABLE_INIT; ++ struct strbuf size = STRBUF_INIT; ++ + if (!vec || !vec->nr_items) + return; + -+ jw_object_inline_begin_array(jw, vec->dimension_label); -+ { -+ int k; -+ -+ for (k = 0; k < vec->nr_items; k++) { -+ struct large_item *pk = &vec->items[k]; -+ if (is_null_oid(&pk->oid)) -+ break; -+ -+ jw_array_inline_begin_object(jw); -+ { -+ jw_object_intmax(jw, vec->item_label, pk->size); -+ jw_object_string(jw, "oid", oid_to_hex(&pk->oid)); -+ } -+ jw_end(jw); ++ table.table_name = vec->dimension_label; ++ strvec_pushl(&table.header, "Size", "OID", NULL); ++ ++ for (int k = 0; k < vec->nr_items; k++) { ++ struct large_item *pk = &vec->items[k]; ++ if (!is_null_oid(&pk->oid)) { ++ strbuf_reset(&size); ++ strbuf_addf(&size, "%"PRIuMAX, (uintmax_t)pk->size); ++ ++ insert_table_rowv(&table, size.buf, oid_to_hex(&pk->oid), NULL); + } + } -+ jw_end(jw); ++ strbuf_release(&size); ++ ++ print_table_plaintext(&table); ++ clear_table(&table); +} + - static void json_commits_section(struct json_writer *jw_top, int pretty, int want_trace2) + static void survey_report_plaintext_refs(struct survey_context *ctx) { - struct survey_stats_commits *psc = &survey_stats.commits; -@@ builtin/survey.c: static void json_commits_section(struct json_writer *jw_top, int pretty, int wan - { - write_base_object_json(&jw_commits, &psc->base); + struct survey_report_ref_summary *refs = &ctx->report.refs; +@@ builtin/survey.c: static void survey_report_plaintext(struct survey_context *ctx) + &ctx->report.top_paths_by_inflate[REPORT_TYPE_TREE]); + survey_report_plaintext_sorted_size( + &ctx->report.top_paths_by_inflate[REPORT_TYPE_BLOB]); ++ ++ survey_report_largest_vec(ctx->report.reachable_objects.commits.vec_largest_by_nr_parents); ++ survey_report_largest_vec(ctx->report.reachable_objects.commits.vec_largest_by_size_bytes); ++ survey_report_largest_vec(ctx->report.reachable_objects.trees.vec_largest_by_nr_entries); ++ survey_report_largest_vec(ctx->report.reachable_objects.trees.vec_largest_by_size_bytes); ++ survey_report_largest_vec(ctx->report.reachable_objects.blobs.vec_largest_by_size_bytes); + } + + /* +@@ builtin/survey.c: static int survey_load_config_cb(const char *var, const char *value, + ctx->opts.show_progress = git_config_bool(var, value); + return 0; + } ++ if (!strcmp(var, "survey.showcommitparents")) { ++ ctx->opts.show_largest_commits_by_nr_parents = git_config_ulong(var, value, cctx->kvi); ++ return 0; ++ } ++ if (!strcmp(var, "survey.showcommitsizes")) { ++ ctx->opts.show_largest_commits_by_size_bytes = git_config_ulong(var, value, cctx->kvi); ++ return 0; ++ } ++ ++ if (!strcmp(var, "survey.showtreeentries")) { ++ ctx->opts.show_largest_trees_by_nr_entries = git_config_ulong(var, value, cctx->kvi); ++ return 0; ++ } ++ if (!strcmp(var, "survey.showtreesizes")) { ++ ctx->opts.show_largest_trees_by_size_bytes = git_config_ulong(var, value, cctx->kvi); ++ return 0; ++ } ++ if (!strcmp(var, "survey.showblobsizes")) { ++ ctx->opts.show_largest_blobs_by_size_bytes = git_config_ulong(var, value, cctx->kvi); ++ return 0; ++ } + if (!strcmp(var, "survey.top")) { + ctx->opts.top_nr = git_config_bool(var, value); + return 0; +@@ builtin/survey.c: static void increment_totals(struct survey_context *ctx, + + ctx->report.reachable_objects.commits.parent_cnt_pbin[k]++; + base = &ctx->report.reachable_objects.commits.base; ++ ++ maybe_insert_large_item(ctx->report.reachable_objects.commits.vec_largest_by_nr_parents, k, &commit->object.oid); ++ maybe_insert_large_item(ctx->report.reachable_objects.commits.vec_largest_by_size_bytes, object_length, &commit->object.oid); + break; + } + case OBJ_TREE: { +@@ builtin/survey.c: static void increment_totals(struct survey_context *ctx, -+ write_large_item_vec_json(&jw_commits, psc->vec_largest_by_nr_parents); -+ write_large_item_vec_json(&jw_commits, psc->vec_largest_by_size_bytes); -+ - jw_object_inline_begin_object(&jw_commits, "count_by_nr_parents"); - { - struct strbuf parent_key = STRBUF_INIT; -@@ builtin/survey.c: static void json_trees_section(struct json_writer *jw_top, int pretty, int want_ - { - write_base_object_json(&jw_trees, &pst->base); + pst->sum_entries += nr_entries; -- jw_object_intmax(&jw_trees, "max_entries", pst->max_entries); - jw_object_intmax(&jw_trees, "sum_entries", pst->sum_entries); +- if (nr_entries > pst->max_entries) +- pst->max_entries = nr_entries; ++ maybe_insert_large_item(pst->vec_largest_by_nr_entries, nr_entries, &tree->object.oid); ++ maybe_insert_large_item(pst->vec_largest_by_size_bytes, object_length, &tree->object.oid); -+ write_large_item_vec_json(&jw_trees, pst->vec_largest_by_nr_entries); -+ write_large_item_vec_json(&jw_trees, pst->vec_largest_by_size_bytes); + qb = qbin(nr_entries); + incr_obj_hist_bin(&pst->entry_qbin[qb], object_length, disk_sizep); +@@ builtin/survey.c: static void increment_totals(struct survey_context *ctx, + } + case OBJ_BLOB: + base = &ctx->report.reachable_objects.blobs.base; + - write_qbin_json(&jw_trees, "dist_by_nr_entries", pst->entry_qbin); - } - jw_end(&jw_trees); -@@ builtin/survey.c: static void json_blobs_section(struct json_writer *jw_top, int pretty, int want_ - jw_object_begin(&jw_blobs, pretty); - { - write_base_object_json(&jw_blobs, &psb->base); ++ maybe_insert_large_item(ctx->report.reachable_objects.blobs.vec_largest_by_size_bytes, object_length, &oids->oid[i]); + break; + default: + continue; +@@ builtin/survey.c: int cmd_survey(int argc, const char **argv, const char *prefix, struct repositor + OPT_BOOL_F(0, "detached", &ctx.opts.refs.want_detached, N_("include detached HEAD"), PARSE_OPT_NONEG), + OPT_BOOL_F(0, "other", &ctx.opts.refs.want_other, N_("include notes and stashes"), PARSE_OPT_NONEG), + ++ OPT_INTEGER_F(0, "commit-parents", &ctx.opts.show_largest_commits_by_nr_parents, N_("show N largest commits by parent count"), PARSE_OPT_NONEG), ++ OPT_INTEGER_F(0, "commit-sizes", &ctx.opts.show_largest_commits_by_size_bytes, N_("show N largest commits by size in bytes"), PARSE_OPT_NONEG), + -+ write_large_item_vec_json(&jw_blobs, psb->vec_largest_by_size_bytes); - } - jw_end(&jw_blobs); ++ OPT_INTEGER_F(0, "tree-entries", &ctx.opts.show_largest_trees_by_nr_entries, N_("show N largest trees by entry count"), PARSE_OPT_NONEG), ++ OPT_INTEGER_F(0, "tree-sizes", &ctx.opts.show_largest_trees_by_size_bytes, N_("show N largest trees by size in bytes"), PARSE_OPT_NONEG), ++ ++ OPT_INTEGER_F(0, "blob-sizes", &ctx.opts.show_largest_blobs_by_size_bytes, N_("show N largest blobs by size in bytes"), PARSE_OPT_NONEG), ++ + OPT_END(), + }; + +@@ builtin/survey.c: int cmd_survey(int argc, const char **argv, const char *prefix, struct repositor -@@ builtin/survey.c: int cmd_survey(int argc, const char **argv, const char *prefix) - survey_opts.show_progress = isatty(2); - fixup_refs_wanted(); + fixup_refs_wanted(&ctx); -+ if (survey_opts.show_largest_commits_by_nr_parents) -+ survey_stats.commits.vec_largest_by_nr_parents = ++ if (ctx.opts.show_largest_commits_by_nr_parents) ++ ctx.report.reachable_objects.commits.vec_largest_by_nr_parents = + alloc_large_item_vec( + "largest_commits_by_nr_parents", + "nr_parents", -+ survey_opts.show_largest_commits_by_nr_parents); -+ if (survey_opts.show_largest_commits_by_size_bytes) -+ survey_stats.commits.vec_largest_by_size_bytes = ++ ctx.opts.show_largest_commits_by_nr_parents); ++ if (ctx.opts.show_largest_commits_by_size_bytes) ++ ctx.report.reachable_objects.commits.vec_largest_by_size_bytes = + alloc_large_item_vec( + "largest_commits_by_size_bytes", + "size", -+ survey_opts.show_largest_commits_by_size_bytes); ++ ctx.opts.show_largest_commits_by_size_bytes); + -+ if (survey_opts.show_largest_trees_by_nr_entries) -+ survey_stats.trees.vec_largest_by_nr_entries = ++ if (ctx.opts.show_largest_trees_by_nr_entries) ++ ctx.report.reachable_objects.trees.vec_largest_by_nr_entries = + alloc_large_item_vec( + "largest_trees_by_nr_entries", + "nr_entries", -+ survey_opts.show_largest_trees_by_nr_entries); -+ if (survey_opts.show_largest_trees_by_size_bytes) -+ survey_stats.trees.vec_largest_by_size_bytes = ++ ctx.opts.show_largest_trees_by_nr_entries); ++ if (ctx.opts.show_largest_trees_by_size_bytes) ++ ctx.report.reachable_objects.trees.vec_largest_by_size_bytes = + alloc_large_item_vec( + "largest_trees_by_size_bytes", + "size", -+ survey_opts.show_largest_trees_by_size_bytes); ++ ctx.opts.show_largest_trees_by_size_bytes); + -+ if (survey_opts.show_largest_blobs_by_size_bytes) -+ survey_stats.blobs.vec_largest_by_size_bytes = ++ if (ctx.opts.show_largest_blobs_by_size_bytes) ++ ctx.report.reachable_objects.blobs.vec_largest_by_size_bytes = + alloc_large_item_vec( + "largest_blobs_by_size_bytes", + "size", -+ survey_opts.show_largest_blobs_by_size_bytes); ++ ctx.opts.show_largest_blobs_by_size_bytes); + - survey_phase_refs(the_repository); + survey_phase_refs(&ctx); - survey_emit_trace2(); - survey_print_json(); - - strvec_clear(&survey_vec_refs_wanted); -+ free_large_item_vec(survey_stats.commits.vec_largest_by_nr_parents); -+ free_large_item_vec(survey_stats.commits.vec_largest_by_size_bytes); -+ free_large_item_vec(survey_stats.trees.vec_largest_by_nr_entries); -+ free_large_item_vec(survey_stats.trees.vec_largest_by_size_bytes); -+ free_large_item_vec(survey_stats.blobs.vec_largest_by_size_bytes); - - return 0; - } + survey_phase_objects(&ctx); `````` * 12: ab094c405db33 < -: ------------- survey: add pathname of blob or tree to large_item_vec * 15: 9ea4cce60b431 < -: ------------- survey: add commit-oid to large_item detail * 16: 5330029f74e82 < -: ------------- survey: add commit name-rev lookup to each large_item * 17: 0d9f6ae78927b < -: ------------- survey: add --json option and setup for pretty output * 18: 50d22037857fa < -: ------------- survey: add pretty printing of stats * 19: acf0691e80510 < -: ------------- t8100: create test for git-survey * 20: 440477b72462b < -: ------------- survey: add --no-name-rev option * -: ------------- > 11: 6e58ef526fd06 survey: add pathname of blob or tree to large_item_vec * -: ------------- > 12: d012ace0925e9 survey: add commit-oid to large_item detail * -: ------------- > 13: 65e49550c2be8 survey: add commit name-rev lookup to each large_item * -: ------------- > 14: 9d157fdd4057f survey: add --no-name-rev option * 21: 31ecb35d3f1c7 ! 15: 36931e9e3c5db survey: started TODO list at bottom of source file ``````diff @@ Commit message survey: started TODO list at bottom of source file ## builtin/survey.c ## -@@ builtin/survey.c: int cmd_survey(int argc, const char **argv, const char *prefix) - +@@ builtin/survey.c: int cmd_survey(int argc, const char **argv, const char *prefix, struct repositor + clear_survey_context(&ctx); return 0; } + `````` * 22: 630e4a624609b ! 16: cbc68151b5214 survey: expanded TODO list at the bottom of the source file ``````diff @@ Commit message Signed-off-by: Jeff Hostetler ## builtin/survey.c ## -@@ builtin/survey.c: int cmd_survey(int argc, const char **argv, const char *prefix) +@@ builtin/survey.c: int cmd_survey(int argc, const char **argv, const char *prefix, struct repositor } /* `````` * 23: 458e9bc4f2b30 ! 17: 75357a35a1635 survey: expanded TODO with more notes ``````diff @@ Commit message Signed-off-by: Jeff Hostetler ## builtin/survey.c ## -@@ builtin/survey.c: int cmd_survey(int argc, const char **argv, const char *prefix) +@@ builtin/survey.c: int cmd_survey(int argc, const char **argv, const char *prefix, struct repositor * size of the set of "refs/tags/" that we visited while building * the `ref_info` and `ref_array` and not need to ask the remote. * `````` * 24: cb271c6ebe8ac < -: ------------- survey: clearly note the experimental nature in the output * 25: e45516e6866c1 = 18: 590aed4fd5c8d reset --stdin: trim carriage return from the paths * 26: 3da93cd6f70fb ! 19: 5e80a3ac4c3ec Identify microsoft/git via a distinct version suffix ``````diff @@ Commit message ## GIT-VERSION-GEN ## @@ GVF=GIT-VERSION-FILE - DEF_VER=v2.46.2 + DEF_VER=v2.47.0 +# Identify microsoft/git via a distinct version suffix +DEF_VER=$DEF_VER.vfs.0.0 `````` * 27: 17050de859675 = 20: a0ff4112b4139 gvfs: ensure that the version is based on a GVFS tag * 28: 4a42a9eb4de37 = 21: 6ef654049facb gvfs: add a GVFS-specific header file * 149: 2f54fc6533d7b ! 22: 030b553b912f5 git_config_set_multivar_in_file_gently(): add a lock timeout ``````diff @@ Documentation/config/core.txt: core.WSLCompat:: + locked. ## config.c ## -@@ config.c: int git_config_set_multivar_in_file_gently(const char *config_filename, - const char *comment, - unsigned flags) +@@ config.c: int repo_config_set_multivar_in_file_gently(struct repository *r, + const char *comment, + unsigned flags) { + static unsigned long timeout_ms = ULONG_MAX; int fd = -1, in_fd = -1; int ret; struct lock_file lock = LOCK_INIT; -@@ config.c: int git_config_set_multivar_in_file_gently(const char *config_filename, +@@ config.c: int repo_config_set_multivar_in_file_gently(struct repository *r, if (!config_filename) - config_filename = filename_buf = git_pathdup("config"); + config_filename = filename_buf = repo_git_path(r, "config"); + if ((long)timeout_ms < 0 && + git_config_get_ulong("core.configWriteLockTimeoutMS", &timeout_ms)) `````` * 152: e6eb3f7fbe04d ! 23: b73befa638613 scalar: set the config write-lock timeout to 150ms ``````diff @@ Commit message ## scalar.c ## @@ scalar.c: static int set_recommended_config(int reconfigure) - { "core.autoCRLF", "false" }, { "core.safeCRLF", "false" }, { "fetch.showForcedUpdates", "false" }, + { "push.usePathWalk", "true" }, + { "core.configWriteLockTimeoutMS", "150" }, { NULL, NULL }, }; `````` * 153: 4d7e22aad31eb = 24: d08111155aae0 scalar: add docs from microsoft/scalar * 154: 7c7c1ad235ae4 = 25: 7b212db5d3a14 scalar (Windows): use forward slashes as directory separators * 155: 781d148371284 = 26: 8521b1ad58762 scalar: add retry logic to run_git() * 156: 5fea241ab99d2 = 27: d97b7b28a4926 scalar: support the `config` command for backwards compatibility * 187: ded2fed1e5d9d = 28: a9de9d085a3fd sequencer: avoid progress when stderr is redirected * 29: 6240eb8bd20df ! 29: e3d9c14861fe0 gvfs: add the core.gvfs config setting ``````diff @@ environment.c: int grafts_keep_true_parents; unsigned long pack_size_limit_cfg; ## environment.h ## -@@ environment.h: int get_shared_repository(void); - void reset_shared_repository(void); +@@ environment.h: extern unsigned long pack_size_limit_cfg; + extern int max_allowed_tree_depth; extern int core_preload_index; +extern int core_gvfs; @@ gvfs.c (new) +static int core_gvfs_is_bool; + +static int early_core_gvfs_config(const char *var, const char *value, -+ const struct config_context *ctx, void *cb) ++ const struct config_context *ctx, void *cb UNUSED) +{ + if (!strcmp(var, "core.gvfs")) + core_gvfs = git_config_bool_or_int("core.gvfs", value, ctx->kvi, @@ gvfs.c (new) + struct key_value_info default_kvi = KVI_INIT; + core_gvfs = git_config_bool_or_int("core.gvfs", value, &default_kvi, &core_gvfs_is_bool); + } else if (startup_info->have_repository == 0) -+ read_early_config(early_core_gvfs_config, NULL); ++ read_early_config(the_repository, early_core_gvfs_config, NULL); + else + repo_config_get_bool_or_int(the_repository, "core.gvfs", + &core_gvfs_is_bool, &core_gvfs); `````` * 30: 3b84be3067ee8 ! 30: dd7004d1e2547 gvfs: add the feature to skip writing the index' SHA-1 ``````diff @@ gvfs.h ## repo-settings.c ## @@ + #include "repo-settings.h" + #include "repository.h" #include "midx.h" - #include "fsmonitor-ipc.h" - #include "fsmonitor-settings.h" +#include "gvfs.h" static void repo_cfg_bool(struct repository *r, const char *key, int *dest, `````` * 31: 7d85cdef26da6 ! 31: f9b8c1e11a508 gvfs: add the feature that blobs may be missing ``````diff @@ Documentation/config/core.txt: core.gvfs:: ## cache-tree.c ## @@ + #include "git-compat-util.h" - #include "environment.h" #include "hex.h" +#include "gvfs.h" #include "lockfile.h" `````` * 32: f17a9a5069be9 = 32: c7ee92640f210 gvfs: prevent files to be deleted outside the sparse checkout * 33: e2892a4e27928 = 33: d25865c8f5718 gvfs: optionally skip reachability checks/upload pack during fetch * 34: 0643eb6955382 = 34: 162137d9290db gvfs: ensure all filters and EOL conversions are blocked * 35: 8e96976e1c123 ! 35: 2516df27a52c2 gvfs: allow "virtualizing" objects ``````diff @@ environment.c: int core_gvfs; int precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */ unsigned long pack_size_limit_cfg; +int core_virtualize_objects; - enum log_refs_config log_all_ref_updates = LOG_REFS_UNSET; int max_allowed_tree_depth = #ifdef _MSC_VER + /* ## environment.h ## -@@ environment.h: struct strvec; - extern const char *comment_line_str; +@@ environment.h: extern const char *comment_line_str; + extern char *comment_line_str_to_free; extern int auto_comment_line_char; +extern int core_virtualize_objects; -+ - /* - * Wrapper of getenv() that returns a strdup value. This value is kept - * in argv to be freed later. + # endif /* USE_THE_REPOSITORY_VARIABLE */ + #endif /* ENVIRONMENT_H */ ## object-file.c ## @@ @@ object-file.c: void disable_obj_read_lock(void) pthread_mutex_destroy(&obj_read_mutex); } -+static int run_read_object_hook(const struct object_id *oid) ++static int run_read_object_hook(struct repository *r, const struct object_id *oid) +{ + struct run_hooks_opt opt = RUN_HOOKS_OPT_INIT; + int ret; @@ object-file.c: void disable_obj_read_lock(void) + + start = getnanotime(); + strvec_push(&opt.args, oid_to_hex(oid)); -+ ret = run_hooks_opt("read-object", &opt); ++ ret = run_hooks_opt(r, "read-object", &opt); + trace_performance_since(start, "run_read_object_hook"); + + return ret; @@ object-file.c: static int do_oid_object_info_extended(struct repository *r, break; + if (core_virtualize_objects && !tried_hook) { + tried_hook = 1; -+ if (!run_read_object_hook(oid)) ++ if (!run_read_object_hook(r, oid)) + goto retry; + } } `````` * 36: 8aee64bd07984 ! 36: 06584ba482fe2 Hydrate missing loose objects in check_and_freshen() ``````diff @@ object-file.c: int has_alt_odb(struct repository *r) + struct read_object_process *entry; + struct child_process *process; + struct strbuf status = STRBUF_INIT; -+ const char *cmd = find_hook("read-object"); ++ const char *cmd = find_hook(the_repository, "read-object"); + uint64_t start; + + start = getnanotime(); @@ object-file.c: void disable_obj_read_lock(void) pthread_mutex_destroy(&obj_read_mutex); } --static int run_read_object_hook(const struct object_id *oid) +-static int run_read_object_hook(struct repository *r, const struct object_id *oid) -{ - struct run_hooks_opt opt = RUN_HOOKS_OPT_INIT; - int ret; @@ object-file.c: void disable_obj_read_lock(void) - - start = getnanotime(); - strvec_push(&opt.args, oid_to_hex(oid)); -- ret = run_hooks_opt("read-object", &opt); +- ret = run_hooks_opt(r, "read-object", &opt); - trace_performance_since(start, "run_read_object_hook"); - - return ret; @@ object-file.c: static int do_oid_object_info_extended(struct repository *r, break; if (core_virtualize_objects && !tried_hook) { tried_hook = 1; -- if (!run_read_object_hook(oid)) +- if (!run_read_object_hook(r, oid)) + if (!read_object_process(oid)) goto retry; } `````` * 37: 95454ff7ca9a2 ! 37: f3f8f889f5a11 sha1_file: when writing objects, skip the read_object_hook ``````diff @@ object-file.c: int has_loose_object_nonlocal(const struct object_id *oid) static void mmap_limit_check(size_t length) @@ object-file.c: static int write_loose_object(const struct object_id *oid, char *hdr, - return finalize_object_file(tmp_file.buf, filename.buf); + FOF_SKIP_COLLISION_CHECK); } -static int freshen_loose_object(const struct object_id *oid) `````` * 38: 6d01c9de846f9 ! 38: ec080b04e3cd2 gvfs: add global command pre and post hook procs ``````diff @@ git.c: static int handle_alias(int *argcp, const char ***argv) +static int run_post_hook = 0; +static int exit_code = -1; + -+static int run_pre_command_hook(const char **argv) ++static int run_pre_command_hook(struct repository *r, const char **argv) +{ + char *lock; + int ret = 0; @@ git.c: static int handle_alias(int *argcp, const char ***argv) + /* call the hook proc */ + strvec_pushv(&sargv, argv); + strvec_pushv(&opt.args, sargv.v); -+ ret = run_hooks_opt("pre-command", &opt); ++ ret = run_hooks_opt(r, "pre-command", &opt); + + if (!ret) + run_post_hook = 1; + return ret; +} + -+static int run_post_command_hook(void) ++static int run_post_command_hook(struct repository *r) +{ + char *lock; + int ret = 0; @@ git.c: static int handle_alias(int *argcp, const char ***argv) + + strvec_pushv(&opt.args, sargv.v); + strvec_pushf(&opt.args, "--exit_code=%u", exit_code); -+ ret = run_hooks_opt("post-command", &opt); ++ ret = run_hooks_opt(r, "post-command", &opt); + + run_post_hook = 0; + strvec_clear(&sargv); @@ git.c: static int handle_alias(int *argcp, const char ***argv) + +static void post_command_hook_atexit(void) +{ -+ run_post_command_hook(); ++ run_post_command_hook(the_repository); +} + - static int run_builtin(struct cmd_struct *p, int argc, const char **argv) + static int run_builtin(struct cmd_struct *p, int argc, const char **argv, struct repository *repo) { int status, help; -@@ git.c: static int run_builtin(struct cmd_struct *p, int argc, const char **argv) +@@ git.c: static int run_builtin(struct cmd_struct *p, int argc, const char **argv, struct if (!help && p->option & NEED_WORK_TREE) setup_work_tree(); -+ if (run_pre_command_hook(argv)) ++ if (run_pre_command_hook(the_repository, argv)) + die("pre-command hook aborted command"); + trace_argv_printf(argv, "trace: built-in: git"); trace2_cmd_name(p->cmd); - validate_cache_entries(the_repository->index); -- status = p->fn(argc, argv, prefix); -+ exit_code = status = p->fn(argc, argv, prefix); - validate_cache_entries(the_repository->index); + validate_cache_entries(repo->index); +- status = p->fn(argc, argv, prefix, (p->option & RUN_SETUP)? repo : NULL); ++ exit_code = status = p->fn(argc, argv, prefix, (p->option & RUN_SETUP)? repo : NULL); + validate_cache_entries(repo->index); if (status) return status; -+ run_post_command_hook(); ++ run_post_command_hook(the_repository); + /* Somebody closed stdout? */ if (fstat(fileno(stdout), &st)) @@ git.c: static void execv_dashed_external(const char **argv) */ trace_argv_printf(cmd.args.v, "trace: exec:"); -+ if (run_pre_command_hook(cmd.args.v)) ++ if (run_pre_command_hook(the_repository, cmd.args.v)) + die("pre-command hook aborted command"); + /* @@ git.c: static void execv_dashed_external(const char **argv) else if (errno != ENOENT) exit(128); + -+ run_post_command_hook(); ++ run_post_command_hook(the_repository); } static int run_argv(int *argcp, const char ***argv) @@ git.c: int cmd_main(int argc, const char **argv) if (!argc) { /* The user didn't specify a command; give them help */ commit_pager_choice(); -+ if (run_pre_command_hook(argv)) ++ if (run_pre_command_hook(the_repository, argv)) + die("pre-command hook aborted command"); printf(_("usage: %s\n\n"), git_usage_string); list_common_cmds_help(); printf("\n%s\n", _(git_more_info_string)); - exit(1); + exit_code = 1; -+ run_post_command_hook(); ++ run_post_command_hook(the_repository); + exit(exit_code); } @@ git.c: int cmd_main(int argc, const char **argv) ## hook.c ## @@ ++#define USE_THE_REPOSITORY_VARIABLE ++ #include "git-compat-util.h" #include "abspath.h" +#include "environment.h" @@ hook.c #include "setup.h" +static int early_hooks_path_config(const char *var, const char *value, -+ const struct config_context *ctx, void *cb) ++ const struct config_context *ctx UNUSED, void *cb) +{ + if (!strcmp(var, "core.hookspath")) + return git_config_pathname((char **)cb, var, value); @@ hook.c + return NULL; + } + -+ read_early_config(early_hooks_path_config, &early_hooks_dir); ++ read_early_config(the_repository, early_hooks_path_config, &early_hooks_dir); + if (!early_hooks_dir) + strbuf_addf(&hooks_dir, "%s/hooks/", commondir.buf); + else { @@ hook.c + return result->buf; +} + - const char *find_hook(const char *name) + const char *find_hook(struct repository *r, const char *name) { static struct strbuf path = STRBUF_INIT; -@@ hook.c: const char *find_hook(const char *name) +@@ hook.c: const char *find_hook(struct repository *r, const char *name) int found_hook; strbuf_reset(&path); -- strbuf_git_path(&path, "hooks/%s", name); +- strbuf_repo_git_path(&path, r, "hooks/%s", name); + if (have_git_dir()) -+ strbuf_git_path(&path, "hooks/%s", name); ++ strbuf_repo_git_path(&path, r, "hooks/%s", name); + else if (!hook_path_early(name, &path)) + return NULL; + `````` * 39: 44d9df5666027 = 39: 348aec0307879 t0400: verify that the hook is called correctly from a subdirectory * 40: 0c9bf08df47eb ! 40: af565b2aed7da Pass PID of git process to hooks. ``````diff @@ Commit message Signed-off-by: Alejandro Pauly ## git.c ## -@@ git.c: static int run_pre_command_hook(const char **argv) +@@ git.c: static int run_pre_command_hook(struct repository *r, const char **argv) /* call the hook proc */ strvec_pushv(&sargv, argv); + strvec_pushf(&sargv, "--git-pid=%"PRIuMAX, (uintmax_t)getpid()); strvec_pushv(&opt.args, sargv.v); - ret = run_hooks_opt("pre-command", &opt); + ret = run_hooks_opt(r, "pre-command", &opt); ## t/t0400-pre-command-hook.sh ## `````` * 41: 517213cb91ddd ! 41: 0e0264ed9ab33 pre-command: always respect core.hooksPath ``````diff @@ Commit message Signed-off-by: Johannes Schindelin ## hook.c ## -@@ hook.c: const char *find_hook(const char *name) +@@ hook.c: const char *find_hook(struct repository *r, const char *name) int found_hook; strbuf_reset(&path); @@ hook.c: const char *find_hook(const char *name) + forced_config = 1; + } + - strbuf_git_path(&path, "hooks/%s", name); + strbuf_repo_git_path(&path, r, "hooks/%s", name); - else if (!hook_path_early(name, &path)) + } else if (!hook_path_early(name, &path)) return NULL; `````` * 42: 3248536ab9aab = 42: 2b67c6a74a1e2 sparse-checkout: update files with a modify/delete conflict * 43: a7cbc6b0e0a4f = 43: 3191f6e48959f sparse-checkout: avoid writing entries with the skip-worktree bit * 44: e227ef3893fd9 = 44: 481bff49749f6 Do not remove files outside the sparse-checkout * 45: f074ddd69e68b = 45: 31d7cc7855e21 send-pack: do not check for sha1 file when GVFS_MISSING_OK set * 46: 32c6f9d5f45ec = 46: d24c5ab140e9f cache-tree: remove use of strbuf_addf in update_one * 47: a5121b24cb003 ! 47: f681e1a6814a9 gvfs: block unsupported commands when running in a GVFS repo ``````diff @@ Commit message ## builtin/gc.c ## @@ + #include "date.h" #include "environment.h" #include "hex.h" - #include "repository.h" +#include "gvfs.h" #include "config.h" #include "tempfile.h" #include "lockfile.h" -@@ builtin/gc.c: int cmd_gc(int argc, const char **argv, const char *prefix) +@@ builtin/gc.c: struct repository *repo UNUSED) if (quiet) strvec_push(&repack, "-q"); -+ if ((!opts.auto_flag || (opts.auto_flag && gc_auto_threshold > 0)) && gvfs_config_is_set(GVFS_BLOCK_COMMANDS)) ++ if ((!opts.auto_flag || (opts.auto_flag && cfg.gc_auto_threshold > 0)) && gvfs_config_is_set(GVFS_BLOCK_COMMANDS)) + die(_("'git gc' is not supported on a GVFS repo")); + if (opts.auto_flag) { - /* - * Auto-gc should be least intrusive as possible. + if (cfg.detach_auto && opts.detach < 0) + opts.detach = 1; ## builtin/update-index.c ## @@ */ - + #define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "gvfs.h" #include "bulk-checkin.h" #include "config.h" #include "environment.h" -@@ builtin/update-index.c: int cmd_update_index(int argc, const char **argv, const char *prefix) +@@ builtin/update-index.c: int cmd_update_index(int argc, argc = parse_options_end(&ctx); getline_fn = nul_term_line ? strbuf_getline_nul : strbuf_getline_lf; @@ builtin/update-index.c: int cmd_update_index(int argc, const char **argv, const if (preferred_index_format < 0) { printf(_("%d\n"), the_repository->index->version); } else if (preferred_index_format < INDEX_FORMAT_LB || -@@ builtin/update-index.c: int cmd_update_index(int argc, const char **argv, const char *prefix) +@@ builtin/update-index.c: int cmd_update_index(int argc, end_odb_transaction(); if (split_index > 0) { + if (gvfs_config_is_set(GVFS_BLOCK_COMMANDS)) + die(_("split index is not supported on a GVFS repo")); + - if (git_config_get_split_index() == 0) + if (repo_config_get_split_index(the_repository) == 0) warning(_("core.splitIndex is set to false; " "remove or change it, if you really want to " @@ git.c struct cmd_struct { const char *cmd; -@@ git.c: static int run_builtin(struct cmd_struct *p, int argc, const char **argv) +@@ git.c: static int run_builtin(struct cmd_struct *p, int argc, const char **argv, struct if (!help && p->option & NEED_WORK_TREE) setup_work_tree(); + if (!help && p->option & BLOCK_ON_GVFS_REPO && gvfs_config_is_set(GVFS_BLOCK_COMMANDS)) + die("'git %s' is not supported on a GVFS repo", p->cmd); + - if (run_pre_command_hook(argv)) + if (run_pre_command_hook(the_repository, argv)) die("pre-command hook aborted command"); @@ git.c: static struct cmd_struct commands[] = { `````` * 48: 83b685634e9ee ! 48: 46eca79c7e8e8 worktree: allow in Scalar repositories ``````diff @@ builtin/worktree.c #include "checkout.h" #include "config.h" #include "copy.h" -@@ builtin/worktree.c: int cmd_worktree(int ac, const char **av, const char *prefix) +@@ builtin/worktree.c: int cmd_worktree(int ac, git_config(git_worktree_config, NULL); `````` To Be Continued...
dscho commented 1 month ago

This range-diff broke GitHub: I ran into the 64kB limit of PR comments. So here goes...

Range-diff relative to vfs-2.46.2, part 2/2 Continuing... * 49: 0b755a3022be0 = 49: 04634cf2eab54 gvfs: allow overriding core.gvfs * 50: 001f00143d708 = 50: 8289b81d14e55 BRANCHES.md: Add explanation of branches and using forks * 51: 4075e54d0bf68 ! 51: b8f54a17882ef Add virtual file system settings and hook proc ``````diff @@ config.c: int git_default_core_config(const char *var, const char *value, return 0; } -@@ config.c: int git_config_get_max_percent_split_change(void) +@@ config.c: int repo_config_get_max_percent_split_change(struct repository *r) return -1; /* default value */ } -+int git_config_get_virtualfilesystem(void) ++int repo_config_get_virtualfilesystem(struct repository *r) +{ + /* Run only once. */ + static int virtual_filesystem_result = -1; + if (virtual_filesystem_result >= 0) + return virtual_filesystem_result; + -+ if (git_config_get_pathname("core.virtualfilesystem", &core_virtualfilesystem)) ++ if (repo_config_get_pathname(r, "core.virtualfilesystem", &core_virtualfilesystem)) + core_virtualfilesystem = getenv("GIT_VIRTUALFILESYSTEM_TEST"); + + if (core_virtualfilesystem && !*core_virtualfilesystem) @@ config.c: int git_config_get_max_percent_split_change(void) + return 0; +} + - int git_config_get_index_threads(int *dest) + int repo_config_get_index_threads(struct repository *r, int *dest) { int is_bool, val; ## config.h ## -@@ config.h: int git_config_get_pathname(const char *key, char **dest); - int git_config_get_index_threads(int *dest); - int git_config_get_split_index(void); - int git_config_get_max_percent_split_change(void); -+int git_config_get_virtualfilesystem(void); +@@ config.h: int repo_config_get_index_threads(struct repository *r, int *dest); + int repo_config_get_split_index(struct repository *r); + int repo_config_get_max_percent_split_change(struct repository *r); ++int repo_config_get_virtualfilesystem(struct repository *r); ++ /* This dies if the configured or default date is in the future */ - int git_config_get_expiry(const char *key, const char **output); + int repo_config_get_expiry(struct repository *r, const char *key, char **output); + ## dir.c ## @@ @@ environment.c: int core_apply_sparse_checkout; unsigned long pack_size_limit_cfg; ## environment.h ## -@@ environment.h: int get_shared_repository(void); - void reset_shared_repository(void); +@@ environment.h: extern unsigned long pack_size_limit_cfg; + extern int max_allowed_tree_depth; extern int core_preload_index; +extern char *core_virtualfilesystem; @@ unpack-trees.c: int unpack_trees(unsigned len, struct tree_desc *t, struct unpac ## virtualfilesystem.c (new) ## @@ ++#define USE_THE_REPOSITORY_VARIABLE ++ +#include "git-compat-util.h" +#include "environment.h" +#include "gettext.h" @@ virtualfilesystem.c (new) +static unsigned int(*vfshash)(const void *buf, size_t len); +static int(*vfscmp)(const char *a, const char *b, size_t len); + -+static int vfs_hashmap_cmp(const void *unused_cmp_data, ++static int vfs_hashmap_cmp(const void *cmp_data UNUSED, + const struct hashmap_entry *he1, + const struct hashmap_entry *he2, -+ const void *key) ++ const void *key UNUSED) +{ + const struct virtualfilesystem *vfs1 = + container_of(he1, const struct virtualfilesystem, ent); @@ virtualfilesystem.c (new) + return vfscmp(vfs1->pattern, vfs2->pattern, vfs1->patternlen); +} + -+static void get_virtual_filesystem_data(struct strbuf *vfs_data) ++static void get_virtual_filesystem_data(struct repository *r, struct strbuf *vfs_data) +{ + struct child_process cp = CHILD_PROCESS_INIT; + int err; @@ virtualfilesystem.c (new) + strvec_push(&cp.args, core_virtualfilesystem); + strvec_pushf(&cp.args, "%d", HOOK_INTERFACE_VERSION); + cp.use_shell = 1; -+ cp.dir = get_git_work_tree(); ++ cp.dir = repo_get_work_tree(r); + + err = capture_command(&cp, vfs_data, 1024); + if (err) @@ virtualfilesystem.c (new) + char *buf, *entry; + int i; + -+ if (!git_config_get_virtualfilesystem()) ++ if (!repo_config_get_virtualfilesystem(istate->repo)) + return; + + if (!virtual_filesystem_data.len) -+ get_virtual_filesystem_data(&virtual_filesystem_data); ++ get_virtual_filesystem_data(istate->repo, &virtual_filesystem_data); + + /* set CE_SKIP_WORKTREE bit on all entries */ + for (i = 0; i < istate->cache_nr; i++) `````` * 52: a2db7b506bb3d ! 52: b09c255d3050d virtualfilesystem: don't run the virtual file system hook if the index has been redirected ``````diff @@ Commit message Signed-off-by: Ben Peart ## config.c ## -@@ config.c: int git_config_get_virtualfilesystem(void) +@@ config.c: int repo_config_get_virtualfilesystem(struct repository *r) if (core_virtualfilesystem && !*core_virtualfilesystem) core_virtualfilesystem = NULL; `````` * 53: 00f813ba3ff19 = 53: dcb6eeed77eda virtualfilesystem: check if directory is included * 54: 200f719eb0851 ! 54: f2621e5cccebc backwards-compatibility: support the post-indexchanged hook ``````diff @@ Commit message allow any `post-indexchanged` hook to run instead (if it exists). ## hook.c ## -@@ hook.c: int run_hooks_opt(const char *hook_name, struct run_hooks_opt *options) +@@ hook.c: int run_hooks_opt(struct repository *r, const char *hook_name, .hook_name = hook_name, .options = options, }; -- const char *const hook_path = find_hook(hook_name); -+ const char *hook_path = find_hook(hook_name); +- const char *const hook_path = find_hook(r, hook_name); ++ const char *hook_path = find_hook(r, hook_name); int ret = 0; const struct run_process_parallel_opts opts = { .tr2_category = "hook", -@@ hook.c: int run_hooks_opt(const char *hook_name, struct run_hooks_opt *options) +@@ hook.c: int run_hooks_opt(struct repository *r, const char *hook_name, .data = &cb_data, }; @@ hook.c: int run_hooks_opt(const char *hook_name, struct run_hooks_opt *options) + * already-existing checkouts). + */ + if (!hook_path && !strcmp(hook_name, "post-index-change")) -+ hook_path = find_hook("post-indexchanged"); ++ hook_path = find_hook(r, "post-indexchanged"); + if (!options) BUG("a struct run_hooks_opt must be provided to run_hooks"); `````` * 55: 4534f6d2cf011 = 55: 5e58e1f1199d6 gvfs: verify that the built-in FSMonitor is disabled * 56: f431829059693 = 56: ce2abce41c0fd wt-status: add trace2 data for sparse-checkout percentage * 57: 3bb4d01aa93c9 = 57: 7821224ee6a8b wt-status: add VFS hydration percentage to normal `git status` output * 58: 5815d28cf81d4 ! 58: 326915f7a9563 status: add status serialization mechanism ``````diff @@ builtin/commit.c: static int opt_parse_porcelain(const struct option *opt, const + * The input source can come from stdin or a path given here -- or be + * inherited from the config settings. + */ -+static int opt_parse_deserialize(const struct option *opt, const char *arg, int unset) ++static int opt_parse_deserialize(const struct option *opt UNUSED, const char *arg, int unset) +{ + if (unset) { + do_implicit_deserialize = 0; @@ builtin/commit.c: static int git_status_config(const char *k, const char *v, if (!strcmp(k, "status.showuntrackedfiles")) { enum untracked_status_type u; -@@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix) +@@ builtin/commit.c: struct repository *repo UNUSED) static const char *rename_score_arg = (const char *)-1; static struct wt_status s; unsigned int progress_flag = 0; @@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix struct object_id oid; static struct option builtin_status_options[] = { OPT__VERBOSE(&verbose, N_("be verbose")), -@@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix) +@@ builtin/commit.c: struct repository *repo UNUSED) OPT_CALLBACK_F(0, "porcelain", &status_format, N_("version"), N_("machine-readable output"), PARSE_OPT_OPTARG, opt_parse_porcelain), @@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix OPT_SET_INT(0, "long", &status_format, N_("show status in long format (default)"), STATUS_FORMAT_LONG), -@@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix) +@@ builtin/commit.c: struct repository *repo UNUSED) s.show_untracked_files == SHOW_NO_UNTRACKED_FILES) die(_("Unsupported combination of ignored and untracked-files arguments")); @@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix enable_fscache(0); if (status_format != STATUS_FORMAT_PORCELAIN && status_format != STATUS_FORMAT_PORCELAIN_V2) -@@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix) +@@ builtin/commit.c: struct repository *repo UNUSED) else fd = -1; @@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix s.is_initial = repo_get_oid(the_repository, s.reference, &oid) ? 1 : 0; if (!s.is_initial) oidcpy(&s.oid_commit, &oid); -@@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix) +@@ builtin/commit.c: struct repository *repo UNUSED) s.rename_score = parse_rename_score(&rename_score_arg); } @@ wt-status-deserialize.c (new) + * + * If they are the same, we continue trying to use the cache. + */ -+static int my_validate_index(const struct cache_time *mtime_reported) ++static int my_validate_index(const char *path, const struct cache_time *mtime_reported) +{ -+ const char *path = get_index_file(); + struct stat st; + struct cache_time mtime_observed_on_disk; + @@ wt-status-deserialize.c (new) + return DESERIALIZE_ERR; + } + -+ return my_validate_index(&index_mtime); ++ return my_validate_index(s->index_file, &index_mtime); +} + +/* + * Build a string-list of (count) lines from the input. + */ -+static int wt_deserialize_v1_changed_items(struct wt_status *s, int fd, int count) ++static int wt_deserialize_v1_changed_items(struct wt_status *s, int fd, int count UNUSED) +{ + struct wt_status_serialize_data *sd; + char *p; @@ wt-status-deserialize.c (new) + +static int wt_deserialize_v1_untracked_items(struct wt_status *s, + int fd, -+ int count, ++ int count UNUSED, + enum deserialize_parse_strategy strategy) +{ + int line_len; @@ wt-status-deserialize.c (new) + +static int wt_deserialize_v1_ignored_items(struct wt_status *s, + int fd, -+ int count, ++ int count UNUSED, + enum deserialize_parse_strategy strategy) +{ + int line_len; @@ wt-status-serialize.c (new) + * We ALWAYS write a final LF to the packet-line (for debugging) + * even though Linux pathnames allow LFs. + */ -+static inline void wt_serialize_v1_changed(struct wt_status *s, int fd, ++static inline void wt_serialize_v1_changed(struct wt_status *s UNUSED, int fd, + struct string_list_item *item) +{ + struct wt_status_change_data *d = item->util; @@ wt-status-serialize.c (new) + * even though Linux pathnames allows LFs. That is, deserialization + * should use the packet-line length and omit the final LF. + */ -+static inline void wt_serialize_v1_untracked(struct wt_status *s, int fd, ++static inline void wt_serialize_v1_untracked(struct wt_status *s UNUSED, int fd, + struct string_list_item *item) +{ + packet_write_fmt(fd, "%s\n", item->string); @@ wt-status-serialize.c (new) + * We ALWAYS write a final LF to the packet-line (for debugging) + * even though Linux pathnames allows LFs. + */ -+static inline void wt_serialize_v1_ignored(struct wt_status *s, int fd, ++static inline void wt_serialize_v1_ignored(struct wt_status *s UNUSED, int fd, + struct string_list_item *item) +{ + packet_write_fmt(fd, "%s\n", item->string); `````` * 59: e3f91fbd691a3 = 59: 315f2e18831b7 Teach ahead-behind and serialized status to play nicely together * 60: 7d3f3d46c826c ! 60: 0ff0247948d10 status: serialize to path ``````diff @@ builtin/commit.c: static int opt_parse_porcelain(const struct option *opt, const if (do_explicit_deserialize) die("cannot mix --serialize and --deserialize"); -@@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix) +@@ builtin/commit.c: struct repository *repo UNUSED) N_("version"), N_("machine-readable output"), PARSE_OPT_OPTARG, opt_parse_porcelain), { OPTION_CALLBACK, 0, "serialize", &status_format, @@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix PARSE_OPT_OPTARG | PARSE_OPT_NONEG, opt_parse_serialize }, { OPTION_CALLBACK, 0, "deserialize", NULL, N_("path"), N_("deserialize raw status data from file"), -@@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix) +@@ builtin/commit.c: struct repository *repo UNUSED) if (s.relative_paths) s.prefix = prefix; @@ t/t7522-serialized-status.sh: test_expect_success 'verify no-ahead-behind and se test_done ## wt-status-serialize.c ## -@@ wt-status-serialize.c: static inline void wt_serialize_v1_ignored(struct wt_status *s, int fd, +@@ wt-status-serialize.c: static inline void wt_serialize_v1_ignored(struct wt_status *s UNUSED, int fd, } /* @@ wt-status-serialize.c: static inline void wt_serialize_v1_ignored(struct wt_stat * is to just serialize the key fields in wt_status so that a * later command can rebuilt it and do the printing. * -@@ wt-status-serialize.c: static inline void wt_serialize_v1_ignored(struct wt_status *s, int fd, +@@ wt-status-serialize.c: static inline void wt_serialize_v1_ignored(struct wt_status *s UNUSED, int fd, * is relatively quick for the status consumer to compute * as necessary. */ `````` * 61: cad41b3073eca ! 61: 5fe3d3ddd61fa status: reject deserialize in V2 and conflicts ``````diff @@ wt-status-deserialize.c: static int wt_deserialize_v1_header(struct wt_status *s /* * Build a string-list of (count) lines from the input. */ --static int wt_deserialize_v1_changed_items(struct wt_status *s, int fd, int count) +-static int wt_deserialize_v1_changed_items(struct wt_status *s, int fd, int count UNUSED) +static int wt_deserialize_v1_changed_items(const struct wt_status *cmd_s, -+ struct wt_status *s, int fd, int count) ++ struct wt_status *s, int fd, int count UNUSED) { struct wt_status_serialize_data *sd; char *p; `````` * 62: aa6ef5b1882f6 ! 62: fe9f2d8233fb4 serialize-status: serialize global and repo-local exclude file metadata ``````diff @@ wt-status-deserialize.c static struct trace_key trace_deserialize = TRACE_KEY_INIT(DESERIALIZE); -@@ wt-status-deserialize.c: static int my_validate_index(const struct cache_time *mtime_reported) +@@ wt-status-deserialize.c: static int my_validate_index(const char *path, const struct cache_time *mtime_re return DESERIALIZE_OK; } @@ wt-status-deserialize.c: static int wt_deserialize_v1_header(struct wt_status *s + return DESERIALIZE_ERR; + } + - return my_validate_index(&index_mtime); + return my_validate_index(s->index_file, &index_mtime); } ## wt-status-serialize.c ## @@ ++#define USE_THE_REPOSITORY_VARIABLE ++ #include "git-compat-util.h" +#include "environment.h" #include "hex.h" `````` * 63: 10f3e9bd0ab91 ! 63: 377714581fff4 status: deserialization wait ``````diff @@ builtin/commit.c: static int do_implicit_deserialize = 0; /* * --serialize | --serialize= * -@@ builtin/commit.c: static int opt_parse_deserialize(const struct option *opt, const char *arg, int +@@ builtin/commit.c: static int opt_parse_deserialize(const struct option *opt UNUSED, const char *ar return 0; } @@ builtin/commit.c: static int opt_parse_deserialize(const struct option *opt, con + return tenths; +} + -+static int opt_parse_deserialize_wait(const struct option *opt, ++static int opt_parse_deserialize_wait(const struct option *opt UNUSED, + const char *arg, + int unset) +{ @@ builtin/commit.c: static int git_status_config(const char *k, const char *v, if (!strcmp(k, "status.showuntrackedfiles")) { enum untracked_status_type u; -@@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix) +@@ builtin/commit.c: struct repository *repo UNUSED) { OPTION_CALLBACK, 0, "deserialize", NULL, N_("path"), N_("deserialize raw status data from file"), PARSE_OPT_OPTARG, opt_parse_deserialize }, @@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix OPT_SET_INT(0, "long", &status_format, N_("show status in long format (default)"), STATUS_FORMAT_LONG), -@@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix) +@@ builtin/commit.c: struct repository *repo UNUSED) } if (try_deserialize) { @@ t/t7522-serialized-status.sh: test_expect_success 'verify new --serialize=path m # create a merge conflict. ## wt-status-deserialize.c ## -@@ wt-status-deserialize.c: static int my_validate_index(const struct cache_time *mtime_reported) +@@ wt-status-deserialize.c: static int my_validate_index(const char *path, const struct cache_time *mtime_re mtime_observed_on_disk.nsec = ST_MTIME_NSEC(st); if ((mtime_observed_on_disk.sec != mtime_reported->sec) || (mtime_observed_on_disk.nsec != mtime_reported->nsec)) { `````` * 64: 0380fe490a911 = 64: 2f09a38fe2307 merge-recursive: avoid confusing logic in was_dirty() * 65: 711bc7360b3ef = 65: de4dcad3a316b merge-recursive: add some defensive coding to was_dirty() * 66: 2ec87171eeb2e = 66: eccf80179b322 merge-recursive: teach was_dirty() about the virtualfilesystem * 67: e5886152f74e0 = 67: 1e410a610d2f2 status: deserialize with -uno does not print correct hint * 68: e1cc0a83e88b6 = 68: a1eee567b9751 fsmonitor: check CE_FSMONITOR_VALID in ce_uptodate * 69: 4c43cb6c46023 = 69: b0d651c5b27da fsmonitor: add script for debugging and update script for tests * 70: c3e357e392802 ! 70: d9b0c4de9d792 status: disable deserialize when verbose output requested. ``````diff @@ builtin/commit.c static const char * const builtin_commit_usage[] = { N_("git commit [-a | --interactive | --patch] [-s] [-v] [-u] [--amend]\n" -@@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix) +@@ builtin/commit.c: struct repository *repo UNUSED) */ try_deserialize = (!do_serialize && (do_implicit_deserialize || do_explicit_deserialize)); `````` * 71: 0e76b259d6408 = 71: 7ebc9cfe25793 t7524: add test for verbose status deserialzation * 72: 6e000d0be4bbe ! 72: 894c6fa4dd87f deserialize-status: silently fallback if we cannot read cache file ``````diff @@ Commit message Signed-off-by: Derrick Stolee ## builtin/commit.c ## -@@ builtin/commit.c: static int opt_parse_deserialize(const struct option *opt, const char *arg, int +@@ builtin/commit.c: static int opt_parse_deserialize(const struct option *opt UNUSED, const char *ar free(deserialize_path); deserialize_path = xstrdup(arg); } `````` * 73: a4af4625b9ca5 = 73: 1518949888eb6 gvfs:trace2:data: add trace2 tracing around read_object_process * 74: fd0a957bf85bb ! 74: 059147588e8fc gvfs:trace2:data: status deserialization information ``````diff @@ builtin/commit.c: static int opt_parse_porcelain(const struct option *opt, const static int do_implicit_deserialize = 0; static int do_explicit_deserialize = 0; static char *deserialize_path = NULL; -@@ builtin/commit.c: static int opt_parse_deserialize(const struct option *opt, const char *arg, int +@@ builtin/commit.c: static int opt_parse_deserialize(const struct option *opt UNUSED, const char *ar } if (!deserialize_path || !*deserialize_path) do_explicit_deserialize = 1; /* read stdin */ @@ builtin/commit.c: static int git_status_config(const char *k, const char *v, } return 0; } -@@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix) +@@ builtin/commit.c: struct repository *repo UNUSED) if (try_deserialize) goto skip_init; @@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix enable_fscache(0); if (status_format != STATUS_FORMAT_PORCELAIN && -@@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix) +@@ builtin/commit.c: struct repository *repo UNUSED) if (s.relative_paths) s.prefix = prefix; @@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix result = wt_status_deserialize(&s, deserialize_path, dw); if (result == DESERIALIZE_OK) return 0; -@@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix) +@@ builtin/commit.c: struct repository *repo UNUSED) fd = -1; } @@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix wt_status_collect(&s); if (0 <= fd) -@@ builtin/commit.c: int cmd_status(int argc, const char **argv, const char *prefix) +@@ builtin/commit.c: struct repository *repo UNUSED) if (fd_serialize < 0) die_errno(_("could not serialize to '%s'"), serialize_path); @@ wt-status-deserialize.c static struct trace_key trace_deserialize = TRACE_KEY_INIT(DESERIALIZE); -@@ wt-status-deserialize.c: static int my_validate_index(const struct cache_time *mtime_reported) +@@ wt-status-deserialize.c: static int my_validate_index(const char *path, const struct cache_time *mtime_re struct cache_time mtime_observed_on_disk; if (lstat(path, &st)) { @@ wt-status-deserialize.c: static int my_validate_index(const struct cache_time *m trace_printf_key(&trace_deserialize, "could not stat index"); return DESERIALIZE_ERR; } -@@ wt-status-deserialize.c: static int my_validate_index(const struct cache_time *mtime_reported) +@@ wt-status-deserialize.c: static int my_validate_index(const char *path, const struct cache_time *mtime_re mtime_observed_on_disk.nsec = ST_MTIME_NSEC(st); if ((mtime_observed_on_disk.sec != mtime_reported->sec) || (mtime_observed_on_disk.nsec != mtime_reported->nsec)) { `````` * 75: e96d2ad266a25 ! 75: d7543276acb73 gvfs:trace2:data: status serialization ``````diff @@ Commit message Signed-off-by: Jeff Hostetler ## wt-status-serialize.c ## -@@ -+#define USE_THE_REPOSITORY_VARIABLE - #include "git-compat-util.h" - #include "environment.h" - #include "hex.h" @@ #include "trace.h" #include "read-cache-ll.h" `````` * 76: 1c1310eb444a9 ! 76: b05adb373d08b gvfs:trace2:data: add vfs stats ``````diff @@ Commit message ## virtualfilesystem.c ## @@ -+#define USE_THE_REPOSITORY_VARIABLE #include "git-compat-util.h" #include "environment.h" #include "gettext.h" @@ virtualfilesystem.c: void apply_virtualfilesystem(struct index_state *istate) + int nr_bulk_skip = 0; + int nr_explicit_skip = 0; - if (!git_config_get_virtualfilesystem()) + if (!repo_config_get_virtualfilesystem(istate->repo)) return; @@ virtualfilesystem.c: void apply_virtualfilesystem(struct index_state *istate) if (buf[i] == '\0') { `````` * 77: 3fcf5905e741b = 77: 9f20d58a465b5 trace2: refactor setting process starting time * 78: 5f9233cc48068 = 78: 4728e1652dc62 trace2:gvfs:experiment: clear_ce_flags_1 * 79: 960852b651e7d ! 79: e5c9e72e26862 trace2:gvfs:experiment: report_tracking ``````diff @@ builtin/checkout.c: static void update_refs_for_switch(const struct checkout_opt + } } - static int add_pending_uninteresting_ref(const char *refname, + static int add_pending_uninteresting_ref(const char *refname, const char *referent UNUSED, `````` * 80: f48ec624ecff7 = 80: 310ca5b76c9b6 trace2:gvfs:experiment: read_cache: annotate thread usage in read-cache * 81: ee669c7362e0d ! 81: dc05480ae7b8e trace2:gvfs:experiment: read-cache: time read/write of cache-tree extension ``````diff @@ read-cache.c: static int read_index_extension(struct index_state *istate, istate->resolve_undo = resolve_undo_read(data, sz); @@ read-cache.c: static int do_write_index(struct index_state *istate, struct tempfile *tempfile, !drop_cache_tree && istate->cache_tree) { - struct strbuf sb = STRBUF_INIT; + strbuf_reset(&sb); + trace2_region_enter("index", "write/extension/cache_tree", NULL); cache_tree_write(&sb, istate->cache_tree); @@ read-cache.c: static int do_write_index(struct index_state *istate, struct tempf + trace2_data_intmax("index", NULL, "write/extension/cache_tree/bytes", (intmax_t)sb.len); + trace2_region_leave("index", "write/extension/cache_tree", NULL); + - strbuf_release(&sb); - /* - * NEEDSWORK: write_index_ext_header() never returns a failure, + if (err) { + ret = -1; + goto out; `````` * 82: 01f4d47f7e0f2 ! 82: 41289c2257657 trace2:gvfs:experiment: add region to apply_virtualfilesystem() ``````diff @@ Commit message ## virtualfilesystem.c ## @@ virtualfilesystem.c: void apply_virtualfilesystem(struct index_state *istate) - if (!git_config_get_virtualfilesystem()) + if (!repo_config_get_virtualfilesystem(istate->repo)) return; + trace2_region_enter("vfs", "apply", the_repository); + if (!virtual_filesystem_data.len) - get_virtual_filesystem_data(&virtual_filesystem_data); + get_virtual_filesystem_data(istate->repo, &virtual_filesystem_data); @@ virtualfilesystem.c: void apply_virtualfilesystem(struct index_state *istate) trace2_data_intmax("vfs", the_repository, "apply/nr_bulk_skip", nr_bulk_skip); `````` * 83: 777285c725393 = 83: a0f0ff0958b9b trace2:gvfs:experiment: add region around unpack_trees() * 84: 5ef245ad55d6d = 84: 98907cad07b6d trace2:gvfs:experiment: add region to cache_tree_fully_valid() * 85: 2db38c686d9ee = 85: a3ae6c2ef5bec trace2:gvfs:experiment: add unpack_entry() counter to unpack_trees() and report_tracking() * 86: 72c890b7e7b03 = 86: aeaecb8496c9e trace2:gvfs:experiment: increase default event depth for unpack-tree data * 87: 5d02713f55d36 = 87: bc6777b5a7260 trace2:gvfs:experiment: add data for check_updates() in unpack_trees() * 88: b50d3ed9e5233 = 88: 97677e8cdad0c Trace2:gvfs:experiment: capture more 'tracking' details * 89: 5b083bcbae60a = 89: 63867c1efc8cb credential: set trace2_child_class for credential manager children * 90: e7c4a23b2a45e = 90: eebba67be87e3 sub-process: do not borrow cmd pointer from caller * 91: 636b8e5b16844 = 91: 5c5978f7b3fc9 sub-process: add subprocess_start_argv() * 92: f94912f1e5f32 = 92: e29fc35683e5f sha1-file: add function to update existing loose object cache * 93: 00670b469a479 = 93: 3f933ea8fc283 packfile: add install_packed_git_and_mru() * 94: 21bfa5693a16f = 94: 84be3acef23c1 index-pack: avoid immediate object fetch while parsing packfile * 95: f9821d34ab563 ! 95: c01af59c9f6cc gvfs-helper: create tool to fetch objects using the GVFS Protocol ``````diff @@ gvfs-helper.c (new) + * + * Print the received server configuration (as the raw JSON string). + */ -+static enum gh__error_code do_sub_cmd__config(int argc, const char **argv) ++static enum gh__error_code do_sub_cmd__config(int argc UNUSED, const char **argv UNUSED) +{ + struct gh__response_status status = GH__RESPONSE_STATUS_INIT; + struct strbuf config_data = STRBUF_INIT; `````` * 96: b8d363750f093 = 96: 18880aedfbff2 sha1-file: create shared-cache directory if it doesn't exist * 97: f703137d63553 = 97: 97241c535219a gvfs-helper: better handling of network errors * 98: 5024531e9dd48 = 98: 767101453ca68 gvfs-helper-client: properly update loose cache with fetched OID * 99: 32cf85c8ff527 ! 99: 498965dd01d20 gvfs-helper: V2 robust retry and throttling ``````diff @@ gvfs-helper.c: static void gh__response_status__set_from_slot( - else if (status->response_code == 401) { - strbuf_addstr(&status->error_message, "401 Not Authorized"); - status->ec = GH__ERROR_CODE__HTTP_401; -+ gh__response_status__normalize_odd_codes(params, status); - +- - } else if (status->response_code == 404) { - strbuf_addstr(&status->error_message, "404 Not Found"); - status->ec = GH__ERROR_CODE__HTTP_404; @@ gvfs-helper.c: static void gh__response_status__set_from_slot( - strbuf_addf(&status->error_message, "%s (curl)", - curl_easy_strerror(status->curl_code)); - status->ec = GH__ERROR_CODE__CURL_ERROR; -- ++ gh__response_status__normalize_odd_codes(params, status); + - trace2_data_string("gvfs-helper", NULL, - "error/curl", status->error_message.buf); - } else { @@ gvfs-helper.c: static void select_odb(void) + */ + strbuf_setlen(¶ms->temp_path_pack, 0); + strbuf_addf(¶ms->temp_path_pack, "%s.pack", buf.buf); - -- return tempfile; ++ + strbuf_setlen(¶ms->temp_path_idx, 0); + strbuf_addf(¶ms->temp_path_idx, "%s.idx", buf.buf); -+ + +- return tempfile; + /* + * Later, if all goes well, we will install them as: + * @@ gvfs-helper.c: static void gh_http_cleanup(void) + * TODO of some type? + */ +static void do_throttle_wait(struct gh__request_params *params, -+ struct gh__response_status *status) ++ struct gh__response_status *status UNUSED) +{ + struct gh__azure_throttle *azure = + &gh__global_throttle[params->server_type]; `````` * 100: befdc177cd85a ! 100: c26c30ca9c5ad gvfs-helper: expose gvfs/objects GET and POST semantics ``````diff @@ gvfs-helper.c: static void do__packfile__gvfs_objects(struct gh__response_status } /* -@@ gvfs-helper.c: static enum gh__error_code do_sub_cmd__config(int argc, const char **argv) +@@ gvfs-helper.c: static enum gh__error_code do_sub_cmd__config(int argc UNUSED, const char **argv finish_init(0); @@ gvfs-helper.c: static enum gh__error_code do_sub_cmd__config(int argc, const cha ec = status.ec; if (ec == GH__ERROR_CODE__OK) -@@ gvfs-helper.c: static enum gh__error_code do_sub_cmd__config(int argc, const char **argv) +@@ gvfs-helper.c: static enum gh__error_code do_sub_cmd__config(int argc UNUSED, const char **argv } /* `````` * 101: 7c17f5b6fc841 = 101: e848049384a23 gvfs-helper: dramatically reduce progress noise * 102: 5d6188b77296c = 102: a0660a86c75eb gvfs-helper-client.h: define struct object_id * 103: 01d14e7f91e59 = 103: 7ca6622f2f635 gvfs-helper: handle pack-file after single POST request * 104: 7b434ec567bf4 ! 104: 489690cad23cf test-gvfs-prococol, t5799: tests for gvfs-helper ``````diff @@ t/helper/test-gvfs-protocol.c (new) + add_child(&cld, addr, addrlen); +} + -+static void child_handler(int signo) ++static void child_handler(int signo UNUSED) +{ + /* + * Otherwise empty handler because systemcalls will get interrupted `````` * 105: 0775a95e7a2ce = 105: fa345912a6d3d gvfs-helper: move result-list construction into install functions * 106: 8e04cbea927db = 106: 89eee0907c447 t5799: add support for POST to return either a loose object or packfile * 107: 6579f08433048 = 107: 79d9ca3e10a52 t5799: cleanup wc-l and grep-c lines * 108: bfcfecb8b8615 = 108: 0b1bb6b984938 gvfs-helper: verify loose objects after write * 109: 7bae689ec67e6 = 109: 825246de4e92e t7599: create corrupt blob test * 110: f662ced27d2d6 ! 110: bcf41328fb947 gvfs-helper: add prefetch support ``````diff @@ gvfs-helper.c: static int create_loose_pathname_in_odb(struct strbuf *buf_path, -static void create_tempfile_for_loose( - struct gh__request_params *params, - struct gh__response_status *status) -+static void my_run_index_pack(struct gh__request_params *params, ++static void my_run_index_pack(struct gh__request_params *params UNUSED, + struct gh__response_status *status, + const struct strbuf *temp_path_pack, + const struct strbuf *temp_path_idx, @@ gvfs-helper.c: static void do__http_post__gvfs_objects(struct gh__response_statu + int nr_files; +}; + -+static void cb_find_last(const char *full_path, size_t full_path_len, ++static void cb_find_last(const char *full_path UNUSED, size_t full_path_len UNUSED, + const char *file_path, void *void_data) +{ + struct find_last_data *data = void_data; @@ t/helper/test-gvfs-protocol.c: static enum worker_result do__gvfs_objects__post( + data->alloc = 0; +} + -+static void cb_ct_pack(const char *full_path, size_t full_path_len, ++static void cb_ct_pack(const char *full_path, size_t full_path_len UNUSED, + const char *file_path, void *void_data) +{ + struct ct_pack_data *data = void_data; @@ t/helper/test-gvfs-protocol.c: static enum worker_result do__gvfs_objects__post( + } + trace2_printf("%s: prefetch/since %"PRItime, TR2_CAT, last_timestamp); + -+ for_each_file_in_pack_dir(get_object_directory(), cb_ct_pack, &data); ++ for_each_file_in_pack_dir(repo_get_object_directory(the_repository), cb_ct_pack, &data); + QSORT(data.items, data.nr, ct_pack_sort_compare); + + wr = send_multipack(&data, last_timestamp); `````` * 111: 93eff03a1b08e ! 111: b09134e91f8ba gvfs-helper: add prefetch .keep file for last packfile ``````diff @@ Commit message Signed-off-by: Jeff Hostetler ## gvfs-helper.c ## -@@ gvfs-helper.c: static void my_run_index_pack(struct gh__request_params *params, +@@ gvfs-helper.c: static void my_run_index_pack(struct gh__request_params *params UNUSED, static void my_finalize_packfile(struct gh__request_params *params, struct gh__response_status *status, @@ gvfs-helper.c: static void extract_packfile_from_multipack( + struct string_list *keep_files; +}; + -+static void cb_keep_files(const char *full_path, size_t full_path_len, ++static void cb_keep_files(const char *full_path, size_t full_path_len UNUSED, + const char *file_path, void *void_data) +{ + struct keep_files_data *data = void_data; @@ gvfs-helper.c: static void extract_packfile_from_multipack( +} + +static void delete_stale_keep_files( -+ struct gh__request_params *params, -+ struct gh__response_status *status) ++ struct gh__request_params *params UNUSED, ++ struct gh__response_status *status UNUSED) +{ + struct string_list keep_files = STRING_LIST_INIT_DUP; + struct keep_files_data data = { 0, 0, &keep_files }; `````` * 112: 7cf41b9db05bf = 112: 310ecd2977bd6 gvfs-helper: do one read in my_copy_fd_len_tail() * 113: b7ede6bf4f270 = 113: d0434d9a17a57 gvfs-helper: move content-type warning for prefetch packs * 114: 7d5b86701331a ! 114: fc04f4e4e9a85 fetch: use gvfs-helper prefetch under config ``````diff @@ builtin/fetch.c #include "run-command.h" #include "parse-options.h" #include "sigchain.h" -@@ builtin/fetch.c: int cmd_fetch(int argc, const char **argv, const char *prefix) +@@ builtin/fetch.c: int cmd_fetch(int argc, } string_list_remove_duplicates(&list, 0); `````` * 115: 79daed3a1088d = 115: 2f45c5cf2b2f3 gvfs-helper: better support for concurrent packfile fetches * 116: 2985ef0e0e320 = 116: 74be43646dd01 remote-curl: do not call fetch-pack when using gvfs-helper * 117: c5f51bcbb2adc ! 117: 1bd9618f7631c fetch: reprepare packs before checking connectivity ``````diff @@ builtin/fetch.c: static int store_updated_refs(struct display_state *display_sta + reprepare_packed_git(the_repository); + if (check_connected(iterate_ref_map, &rm, &opt)) { - rc = error(_("%s did not send all necessary objects\n"), + rc = error(_("%s did not send all necessary objects"), display_state->url); `````` * 118: acded1909ccff = 118: ab1bf56b24c79 gvfs-helper: retry when creating temp files * 119: f83c74993d537 = 119: 7c508fdd9c508 sparse: avoid warnings about known cURL issues in gvfs-helper.c * 120: 1d9c1e9520e42 = 120: 3c21eb82069b0 gvfs-helper: add --max-retries to prefetch verb * 121: 15eb9dde858ad = 121: d926ead804cf0 t5799: add tests to detect corrupt pack/idx files in prefetch * 122: d50498ad98ca5 = 122: 7187cdc550295 gvfs-helper: ignore .idx files in prefetch multi-part responses * 123: 84d2766149df6 = 123: c8e85f07b1465 t5799: explicitly test gvfs-helper --fallback and --no-fallback * 124: d051973d40881 = 124: f33f9164bdb72 gvfs-helper: don't fallback with new config * 126: b92f2ca7485c3 = 125: b277bb52b78c0 test-gvfs-protocol: add cache_http_503 to mayhem * 125: de58eefc03dad ! 126: d2a392bfd7bbb maintenance: care about gvfs.sharedCache config ``````diff @@ builtin/gc.c: static int pack_loose(struct maintenance_run_opts *opts) NULL, NULL, @@ builtin/gc.c: static int maintenance_run(int argc, const char **argv, const char *prefix) - { int i; - struct maintenance_run_opts opts; + struct maintenance_run_opts opts = MAINTENANCE_RUN_OPTS_INIT; + struct gc_config cfg = GC_CONFIG_INIT; + const char *tmp_obj_dir = NULL; struct option builtin_maintenance_run_options[] = { OPT_BOOL(0, "auto", &opts.auto_flag, N_("run tasks based on the state of the repository")), @@ builtin/gc.c: static int maintenance_run(int argc, const char **argv, const char *prefix) - if (argc != 0) usage_with_options(builtin_maintenance_run_usage, builtin_maintenance_run_options); -+ + + /* + * To enable the VFS for Git/Scalar shared object cache, use + * the gvfs.sharedcache config option to redirect the @@ builtin/gc.c: static int maintenance_run(int argc, const char **argv, const char + setenv(DB_ENVIRONMENT, object_dir, 1); + } + - return maintenance_run_tasks(&opts); - } - + ret = maintenance_run_tasks(&opts, &cfg); + gc_config_release(&cfg); + return ret; `````` * 128: 95d06e2b7f3a4 = 127: fdbe46e89281d t5799: add unit tests for new `gvfs.fallback` config setting * 127: a206b58495601 ! 128: d4809ce58a370 unpack-trees:virtualfilesystem: Improve efficiency of clear_ce_flags ``````diff @@ virtualfilesystem.c: int is_excluded_from_virtualfilesystem(const char *pathname - int nr_bulk_skip = 0; - int nr_explicit_skip = 0; - -- if (!git_config_get_virtualfilesystem()) +- if (!repo_config_get_virtualfilesystem(istate->repo)) - return; - - trace2_region_enter("vfs", "apply", the_repository); if (!virtual_filesystem_data.len) - get_virtual_filesystem_data(&virtual_filesystem_data); + get_virtual_filesystem_data(istate->repo, &virtual_filesystem_data); - /* set CE_SKIP_WORKTREE bit on all entries */ - for (i = 0; i < istate->cache_nr; i++) @@ virtualfilesystem.c: int is_excluded_from_virtualfilesystem(const char *pathname + int i; + struct apply_virtual_filesystem_stats stats = {0}; + -+ if (!git_config_get_virtualfilesystem()) ++ if (!repo_config_get_virtualfilesystem(istate->repo)) + return; + + trace2_region_enter("vfs", "apply", the_repository); `````` * 129: a5c517dabd8e1 = 129: c5baf20a1edd3 homebrew: add GitHub workflow to release Cask * 130: 2eb7a61f12c60 = 130: bb18f1540af14 Adding winget workflows * 131: 30280b504bd35 = 131: f18e4e939ba51 Disable the `monitor-components` workflow in msft-git * 132: 59dcbd6d1fa60 = 132: d4f8fd73f34df .github: enable windows builds on microsoft fork * 133: a2822c6d12261 = 133: e431fc0c35724 release: create initial Windows installer build workflow * 134: 4727ea2cf71e5 = 134: a328f56f6903a help: special-case HOST_CPU `universal` * 135: 856ebb51e2c95 = 135: c4755a1204d9d release: add Mac OSX installer build * 136: e813360838caf = 136: a06b3afbdb763 release: build unsigned Ubuntu .deb package * 137: 1ac5a78f4a102 = 137: 1b62d305edb55 release: add signing step for .deb package * 138: af7ad78e46e55 = 138: 22d8700e801b9 release: create draft GitHub release with packages & installers * 139: fcf9c7d8ddb4b = 139: a53c6429dfe50 build-git-installers: publish gpg public key * 140: 2815c83a2aa72 = 140: 824cd31474258 release: continue pestering until user upgrades * 141: ee9e836ef158a = 141: 527d7929b6dc1 Makefile: allow specifying GIT_BUILT_FROM_COMMIT * 146: 8bc6b5ec92966 = 142: e837cb1b4ec63 dist: archive HEAD instead of HEAD^{tree} * 148: 2f4cb358422d9 = 143: a7a9fccc0cbb7 release: include GIT_BUILT_FROM_COMMIT in MacOS build * 142: bb44a96631848 ! 144: 35b06f4fcce27 update-microsoft-git: create barebones builtin ``````diff @@ Makefile: BUILTIN_OBJS += builtin/tag.o BUILTIN_OBJS += builtin/upload-archive.o ## builtin.h ## -@@ builtin.h: int cmd_tag(int argc, const char **argv, const char *prefix); - int cmd_unpack_file(int argc, const char **argv, const char *prefix); - int cmd_unpack_objects(int argc, const char **argv, const char *prefix); - int cmd_update_index(int argc, const char **argv, const char *prefix); -+int cmd_update_microsoft_git(int argc, const char **argv, const char *prefix); - int cmd_update_ref(int argc, const char **argv, const char *prefix); - int cmd_update_server_info(int argc, const char **argv, const char *prefix); - int cmd_upload_archive(int argc, const char **argv, const char *prefix); +@@ builtin.h: int cmd_tag(int argc, const char **argv, const char *prefix, struct repository * + int cmd_unpack_file(int argc, const char **argv, const char *prefix, struct repository *repo); + int cmd_unpack_objects(int argc, const char **argv, const char *prefix, struct repository *repo); + int cmd_update_index(int argc, const char **argv, const char *prefix, struct repository *repo); ++int cmd_update_microsoft_git(int argc, const char **argv, const char *prefix, struct repository *repo); + int cmd_update_ref(int argc, const char **argv, const char *prefix, struct repository *repo); + int cmd_update_server_info(int argc, const char **argv, const char *prefix, struct repository *repo); + int cmd_upload_archive(int argc, const char **argv, const char *prefix, struct repository *repo); ## builtin/update-microsoft-git.c (new) ## @@ @@ builtin/update-microsoft-git.c (new) +static const char builtin_update_microsoft_git_usage[] = + N_("git update-microsoft-git"); + -+int cmd_update_microsoft_git(int argc, const char **argv, const char *prefix) ++int cmd_update_microsoft_git(int argc, const char **argv, const char *prefix UNUSED, struct repository *repo UNUSED) +{ + if (argc == 2 && !strcmp(argv[1], "-h")) + usage(builtin_update_microsoft_git_usage); `````` * 151: ef80584d19d16 = 145: b417e25f00af9 release: add installer validation * 143: 3dcc799c32e89 = 146: 9124c6d9e4922 update-microsoft-git: Windows implementation * 144: bc01181f001c4 = 147: ba18ed88c7690 update-microsoft-git: use brew on macOS * 145: 652e163825151 = 148: 3a503aa600181 .github: update ISSUE_TEMPLATE.md for microsoft/git * 147: 67fd8b4aa077c = 149: a95050df0acca .github: update PULL_REQUEST_TEMPLATE.md * 150: 30562dbc54127 = 150: 58aeae275e752 Adjust README.md for microsoft/git * 157: ad6eab08617fe = 151: 9c6101e4dc4db scalar: implement a minimal JSON parser * 158: 11bb71f467dcb ! 152: eac9b6465c881 scalar clone: support GVFS-enabled remote repositories ``````diff @@ scalar.c: static int set_config(const char *fmt, ...) @@ scalar.c: static int cmd_clone(int argc, const char **argv) const char *branch = NULL; int full_clone = 0, single_branch = 0, show_progress = isatty(2); - int src = 1; + int src = 1, tags = 1; + const char *cache_server_url = NULL; + char *default_cache_server_url = NULL; struct option clone_options[] = { OPT_STRING('b', "branch", &branch, N_(""), N_("branch to checkout after clone")), @@ scalar.c: static int cmd_clone(int argc, const char **argv) - "be checked out")), - OPT_BOOL(0, "src", &src, N_("create repository within 'src' directory")), + OPT_BOOL(0, "tags", &tags, + N_("specify if tags should be fetched during clone")), + OPT_STRING(0, "cache-server-url", &cache_server_url, + N_(""), + N_("the url or friendly name of the cache server")), @@ scalar.c: static int cmd_clone(int argc, const char **argv) res = error(_("could not configure remote in '%s'"), dir); goto cleanup; } +@@ scalar.c: static int cmd_clone(int argc, const char **argv) + goto cleanup; + } + if (set_config("credential.https://dev.azure.com.useHttpPath=true")) { + res = error(_("could not configure credential.useHttpPath")); @@ scalar.c: static int cmd_clone(int argc, const char **argv) (res = run_git("sparse-checkout", "init", "--cone", NULL))) goto cleanup; @@ scalar.c: static int cmd_clone(int argc, const char **argv) - if ((res = run_git("fetch", "--quiet", - show_progress ? "--progress" : "--no-progress", - "origin", NULL))) { + "origin", + (tags ? NULL : "--no-tags"), + NULL))) { + if (gvfs_protocol) { + res = error(_("failed to prefetch commits and trees")); + goto cleanup; `````` * 159: 3ff0e002bfd1c = 153: f14c7d8f8d997 test-gvfs-protocol: also serve smart protocol * 160: 93bb95594c500 ! 154: c7f3e70bdca48 gvfs-helper: add the `endpoint` command ``````diff @@ gvfs-helper.c: static void do__http_get__gvfs_config(struct gh__response_status static void setup_gvfs_objects_progress(struct gh__request_params *params, unsigned long num, unsigned long den) { -@@ gvfs-helper.c: static enum gh__error_code do_sub_cmd__config(int argc, const char **argv) +@@ gvfs-helper.c: static enum gh__error_code do_sub_cmd__config(int argc UNUSED, const char **argv return ec; } `````` * 161: f2bbd02641802 = 155: c5f64c9018535 dir_inside_of(): handle directory separators correctly * 162: f022633978ad8 = 156: 753c4cc43ff5e scalar: disable authentication in unattended mode * 163: 66d10f43417e4 ! 157: a19292ddb5dab scalar: do initialize `gvfs.sharedCache` ``````diff @@ scalar.c: static int supports_gvfs_protocol(const char *url, char **cache_server static char *remote_default_branch(const char *url) { struct child_process cp = CHILD_PROCESS_INIT; -@@ scalar.c: void load_builtin_commands(const char *prefix, struct cmdnames *cmds) +@@ scalar.c: void load_builtin_commands(const char *prefix UNUSED, die("not implemented"); } @@ scalar.c: void load_builtin_commands(const char *prefix, struct cmdnames *cmds) { const char *branch = NULL; int full_clone = 0, single_branch = 0, show_progress = isatty(2); - int src = 1; + int src = 1, tags = 1; - const char *cache_server_url = NULL; - char *default_cache_server_url = NULL; + const char *cache_server_url = NULL, *local_cache_root = NULL; `````` * 164: cbfe6049b3265 = 158: 67c83f5b6bd56 scalar diagnose: include shared cache info * 165: 30846064a4da5 = 159: 20265b8b61f09 scalar: only try GVFS protocol on https:// URLs * 166: c236b82aa9e93 = 160: b189c539247b0 scalar: verify that we can use a GVFS-enabled repository * 167: 996498c8bcefb = 161: d9857f437dc11 scalar: add the `cache-server` command * 168: f5bedc611cb85 = 162: ef291fc7aefd4 scalar: add a test toggle to skip accessing the vsts/info endpoint * 169: d075285be5189 = 163: 9fe3bbd4c42d4 scalar: adjust documentation to the microsoft/git fork * 170: 4f0a5e1f8e8c5 = 164: 837148a306a5d scalar: enable untracked cache unconditionally * 171: 1d0996ecd35cb ! 165: 434b5831faaa0 scalar: parse `clone --no-fetch-commits-and-trees` for backwards compatibility ``````diff @@ scalar.c: static int init_shared_object_cache(const char *url, + int dummy = 0; const char *branch = NULL; int full_clone = 0, single_branch = 0, show_progress = isatty(2); - int src = 1; + int src = 1, tags = 1; @@ scalar.c: static int cmd_clone(int argc, const char **argv) OPT_STRING(0, "local-cache-path", &local_cache_root, N_(""), `````` * 172: fc91983273b7d ! 166: 47281def886f7 scalar: make GVFS Protocol a forced choice ``````diff @@ Documentation/scalar.txt: clone), and `~/.scalarCache` on macOS. ## scalar.c ## @@ scalar.c: static int cmd_clone(int argc, const char **argv) - int src = 1; + int src = 1, tags = 1; const char *cache_server_url = NULL, *local_cache_root = NULL; char *default_cache_server_url = NULL, *local_cache_root_abs = NULL; + int gvfs_protocol = -1; @@ scalar.c: static int cmd_clone(int argc, const char **argv) OPT_STRING('b', "branch", &branch, N_(""), N_("branch to checkout after clone")), @@ scalar.c: static int cmd_clone(int argc, const char **argv) - "be checked out")), - OPT_BOOL(0, "src", &src, N_("create repository within 'src' directory")), + OPT_BOOL(0, "tags", &tags, + N_("specify if tags should be fetched during clone")), + OPT_BOOL(0, "gvfs-protocol", &gvfs_protocol, + N_("force enable (or disable) the GVFS Protocol")), OPT_STRING(0, "cache-server-url", &cache_server_url, `````` * 173: 24947c7a74521 = 167: 8ee6ef5b0d94e scalar diagnose: accommodate Scalar's Functional Tests * 174: 42c88dcf2b829 = 168: 276988411868c ci: run Scalar's Functional Tests * 175: 90d4293a363f2 = 169: 0d0fe292e8959 scalar: upgrade to newest FSMonitor config setting * 176: 37b15e95882c6 (upstream: 719399b57b3db) < -: ------------- credential: add new interactive config option * 177: 937190d12b63c (upstream: 4f5551957ddd6) < -: ------------- maintenance: add custom config to background jobs * 179: c952c7b4f1e22 = 170: 053aae863e711 abspath: make strip_last_path_component() global * 178: 3c6cd1fb63bba (upstream: b9183b0a02c59) ! 171: 5c9af56d34122 scalar: configure maintenance during 'reconfigure' ``````diff @@ scalar.c: static int cmd_reconfigure(int argc, const char **argv) succeeded = 1; the_repository = old_repo; - - ## t/t9210-scalar.sh ## -@@ t/t9210-scalar.sh: test_expect_success 'scalar reconfigure' ' - scalar reconfigure one && - test true = "$(git -C one/src config core.preloadIndex)" && - git -C one/src config core.preloadIndex false && -- scalar reconfigure -a && -- test true = "$(git -C one/src config core.preloadIndex)" -+ rm one/src/cron.txt && -+ GIT_TRACE2_EVENT="$(pwd)/reconfigure" scalar reconfigure -a && -+ test_path_is_file one/src/cron.txt && -+ test true = "$(git -C one/src config core.preloadIndex)" && -+ test_subcommand git maintenance start name, the_repository->index))) + !path_in_sparse_checkout(ce->name, repo->index))) continue; -@@ builtin/add.c: static int refresh(int verbose, const struct pathspec *pathspec) +@@ builtin/add.c: static int refresh(struct repository *repo, int verbose, const struct pathspec * if (!seen[i]) { const char *path = pathspec->items[i].original; - if (matches_skip_worktree(pathspec, i, &skip_worktree_seen) || -- !path_in_sparse_checkout(path, the_repository->index)) { +- !path_in_sparse_checkout(path, repo->index)) { + if (!core_virtualfilesystem && + (matches_skip_worktree(pathspec, i, &skip_worktree_seen) || -+ !path_in_sparse_checkout(path, the_repository->index))) { ++ !path_in_sparse_checkout(path, repo->index))) { string_list_append(&only_match_skip_worktree, pathspec->items[i].original); } else { -@@ builtin/add.c: static int refresh(int verbose, const struct pathspec *pathspec) +@@ builtin/add.c: static int refresh(struct repository *repo, int verbose, const struct pathspec * } } @@ builtin/add.c: static int refresh(int verbose, const struct pathspec *pathspec) advise_on_updating_sparse_paths(&only_match_skip_worktree); ret = 1; } -@@ builtin/add.c: int cmd_add(int argc, const char **argv, const char *prefix) +@@ builtin/add.c: int cmd_add(int argc, if (seen[i]) continue; @@ builtin/add.c: int cmd_add(int argc, const char **argv, const char *prefix) matches_skip_worktree(&pathspec, i, &skip_worktree_seen)) { string_list_append(&only_match_skip_worktree, pathspec.items[i].original); -@@ builtin/add.c: int cmd_add(int argc, const char **argv, const char *prefix) +@@ builtin/add.c: int cmd_add(int argc, } } @@ builtin/add.c: int cmd_add(int argc, const char **argv, const char *prefix) ## builtin/rm.c ## @@ */ - + #define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "environment.h" #include "advice.h" #include "config.h" #include "lockfile.h" -@@ builtin/rm.c: int cmd_rm(int argc, const char **argv, const char *prefix) +@@ builtin/rm.c: int cmd_rm(int argc, for (i = 0; i < the_repository->index->cache_nr; i++) { const struct cache_entry *ce = the_repository->index->cache[i]; @@ builtin/rm.c: int cmd_rm(int argc, const char **argv, const char *prefix) (ce_skip_worktree(ce) || !path_in_sparse_checkout(ce->name, the_repository->index))) continue; -@@ builtin/rm.c: int cmd_rm(int argc, const char **argv, const char *prefix) +@@ builtin/rm.c: int cmd_rm(int argc, *original ? original : "."); } `````` * 182: 00197309c14ef = 174: 7bab9eebb354a sparse-checkout: add config to disable deleting dirs * 183: 801bc28f1a855 = 175: cb1e3547b3e9a diff: ignore sparse paths in diffstat * 184: 660d08e244b5e ! 176: 137bd5e8ee49c repo-settings: enable sparse index by default ``````diff @@ Commit message ## repo-settings.c ## @@ repo-settings.c: void prepare_repo_settings(struct repository *r) - /* Boolean config or default, does not cascade (simple) */ repo_cfg_bool(r, "pack.usesparse", &r->settings.pack_use_sparse, 1); + repo_cfg_bool(r, "pack.usepathwalk", &r->settings.pack_use_path_walk, 0); repo_cfg_bool(r, "core.multipackindex", &r->settings.core_multi_pack_index, 1); - repo_cfg_bool(r, "index.sparse", &r->settings.sparse_index, 0); + repo_cfg_bool(r, "index.sparse", &r->settings.sparse_index, 1); `````` * 185: 631778721de1f = 177: 679341858edd5 diff(sparse-index): verify with partially-sparse * 186: 20363ab557eb5 = 178: 8f74178486a75 stash: expand testing for `git stash -u` * 188: dd9c2a7858ac0 = 179: 362625bae1673 sparse: add vfs-specific precautions * 189: dc24488c7c522 = 180: 44b0cdb1fc4f0 reset: fix mixed reset when using virtual filesystem
dscho commented 1 month ago

This is admittedly a huge range-diff. The biggest parts of it are:

derrickstolee commented 1 month ago

Also be sure to cherry-pick 61385345280d713dc9d94dddd8ba27c23bb4a1aa from git-for-windows/git#5198 or else all scalar clone commands will fail when git maintenance start segfaults.

derrickstolee commented 1 month ago

Also be sure to cherry-pick 6138534 from git-for-windows#5198 or else all scalar clone commands will fail when git maintenance start segfaults.

Of course, that commit doesn't pass the test on Windows. One option would be to cut the test from the patch and let upstream work out that test. Update: I figured out a way to make the test not run on macOS and Windows. See the PR for details.