From 41771fa435a44ff8be3f23753bde0309a2a65b03 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Fri, 24 Feb 2023 00:09:27 +0000 Subject: cache.h: remove dependence on hex.h; make other files include it explicitly Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- commit-graph.c | 1 + 1 file changed, 1 insertion(+) (limited to 'commit-graph.c') diff --git a/commit-graph.c b/commit-graph.c index c11b59f28b..5e6098ff35 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "config.h" +#include "hex.h" #include "lockfile.h" #include "pack.h" #include "packfile.h" -- cgit 1.2.3-korg From 368d19b0b7fa780d84918cf4ed4a31a410ed865d Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Mon, 20 Mar 2023 11:26:49 +0000 Subject: commit-graph: refactor compute_topological_levels() This patch extracts the common code used to compute topological levels and corrected committer dates into a common routine, compute_reachable_generation_numbers(). For ease of reading, it only modifies compute_topological_levels() to use this new routine, leaving compute_generation_numbers() to be modified in the next change. This new routine dispatches to call the necessary functions to get and set the generation number for a given commit through a vtable (the compute_generation_info struct). Computing the generation number itself is done in compute_generation_from_max(), which dispatches its implementation based on the generation version requested, or issuing a BUG() for unrecognized generation versions. This does not use a vtable because the logic depends only on the generation number version, not where the data is being loaded from or being stored to. This is a subtle point that will make more sense in a future change that modifies the in-memory generation values instead of just preparing values for writing to a commit-graph file. This change looks like it adds a lot of new code. However, two upcoming changes will be quite small due to the work being done in this change. Co-authored-by: Taylor Blau Signed-off-by: Taylor Blau Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- commit-graph.c | 106 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 83 insertions(+), 23 deletions(-) (limited to 'commit-graph.c') diff --git a/commit-graph.c b/commit-graph.c index c11b59f28b..4356c8c1f4 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1446,24 +1446,52 @@ static void close_reachable(struct write_commit_graph_context *ctx) stop_progress(&ctx->progress); } -static void compute_topological_levels(struct write_commit_graph_context *ctx) +struct compute_generation_info { + struct repository *r; + struct packed_commit_list *commits; + struct progress *progress; + int progress_cnt; + + timestamp_t (*get_generation)(struct commit *c, void *data); + void (*set_generation)(struct commit *c, timestamp_t gen, void *data); + void *data; +}; + +static timestamp_t compute_generation_from_max(struct commit *c, + timestamp_t max_gen, + int generation_version) +{ + switch (generation_version) { + case 1: /* topological levels */ + if (max_gen > GENERATION_NUMBER_V1_MAX - 1) + max_gen = GENERATION_NUMBER_V1_MAX - 1; + return max_gen + 1; + + case 2: /* corrected commit date */ + if (c->date && c->date > max_gen) + max_gen = c->date - 1; + return max_gen + 1; + + default: + BUG("attempting unimplemented version"); + } +} + +static void compute_reachable_generation_numbers( + struct compute_generation_info *info, + int generation_version) { int i; struct commit_list *list = NULL; - if (ctx->report_progress) - ctx->progress = start_delayed_progress( - _("Computing commit graph topological levels"), - ctx->commits.nr); - for (i = 0; i < ctx->commits.nr; i++) { - struct commit *c = ctx->commits.list[i]; - uint32_t level; - - repo_parse_commit(ctx->r, c); - level = *topo_level_slab_at(ctx->topo_levels, c); + for (i = 0; i < info->commits->nr; i++) { + struct commit *c = info->commits->list[i]; + timestamp_t gen; + repo_parse_commit(info->r, c); + gen = info->get_generation(c, info->data); + display_progress(info->progress, info->progress_cnt + 1); - display_progress(ctx->progress, i + 1); - if (level != GENERATION_NUMBER_ZERO) + if (gen != GENERATION_NUMBER_ZERO && gen != GENERATION_NUMBER_INFINITY) continue; commit_list_insert(c, &list); @@ -1471,31 +1499,63 @@ static void compute_topological_levels(struct write_commit_graph_context *ctx) struct commit *current = list->item; struct commit_list *parent; int all_parents_computed = 1; - uint32_t max_level = 0; + uint32_t max_gen = 0; for (parent = current->parents; parent; parent = parent->next) { - repo_parse_commit(ctx->r, parent->item); - level = *topo_level_slab_at(ctx->topo_levels, parent->item); + repo_parse_commit(info->r, parent->item); + gen = info->get_generation(parent->item, info->data); - if (level == GENERATION_NUMBER_ZERO) { + if (gen == GENERATION_NUMBER_ZERO) { all_parents_computed = 0; commit_list_insert(parent->item, &list); break; } - if (level > max_level) - max_level = level; + if (gen > max_gen) + max_gen = gen; } if (all_parents_computed) { pop_commit(&list); - - if (max_level > GENERATION_NUMBER_V1_MAX - 1) - max_level = GENERATION_NUMBER_V1_MAX - 1; - *topo_level_slab_at(ctx->topo_levels, current) = max_level + 1; + gen = compute_generation_from_max( + current, max_gen, + generation_version); + info->set_generation(current, gen, info->data); } } } +} + +static timestamp_t get_topo_level(struct commit *c, void *data) +{ + struct write_commit_graph_context *ctx = data; + return *topo_level_slab_at(ctx->topo_levels, c); +} + +static void set_topo_level(struct commit *c, timestamp_t t, void *data) +{ + struct write_commit_graph_context *ctx = data; + *topo_level_slab_at(ctx->topo_levels, c) = (uint32_t)t; +} + +static void compute_topological_levels(struct write_commit_graph_context *ctx) +{ + struct compute_generation_info info = { + .r = ctx->r, + .commits = &ctx->commits, + .get_generation = get_topo_level, + .set_generation = set_topo_level, + .data = ctx, + }; + + if (ctx->report_progress) + info.progress = ctx->progress + = start_delayed_progress( + _("Computing commit graph topological levels"), + ctx->commits.nr); + + compute_reachable_generation_numbers(&info, 1); + stop_progress(&ctx->progress); } -- cgit 1.2.3-korg From 80c928d947c257ef4d9f13c358117d0c1914f71f Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Mon, 20 Mar 2023 11:26:50 +0000 Subject: commit-graph: simplify compute_generation_numbers() The previous change introduced the generic algorithm compute_reachable_generation_numbers() and used it as the core functionality of compute_topological_levels(). Now, use it as the core functionality of compute_generation_numbers(). The main difference here is that we use generation version 2, which is used in to toggle the logic in compute_generation_from_max() for computing the corrected commit date based on the corrected commit dates of the parent commits (and the commit date of the current commit). It also uses different methods for (get|set)_generation in the vtable in order to store and access the value in the correct places. Co-authored-by: Taylor Blau Signed-off-by: Taylor Blau Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- commit-graph.c | 64 +++++++++++++++++++--------------------------------------- 1 file changed, 21 insertions(+), 43 deletions(-) (limited to 'commit-graph.c') diff --git a/commit-graph.c b/commit-graph.c index 4356c8c1f4..d1c98681e8 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1559,13 +1559,31 @@ static void compute_topological_levels(struct write_commit_graph_context *ctx) stop_progress(&ctx->progress); } +static timestamp_t get_generation_from_graph_data(struct commit *c, void *data) +{ + return commit_graph_data_at(c)->generation; +} + +static void set_generation_v2(struct commit *c, timestamp_t t, void *data) +{ + struct commit_graph_data *g = commit_graph_data_at(c); + g->generation = (uint32_t)t; +} + static void compute_generation_numbers(struct write_commit_graph_context *ctx) { int i; - struct commit_list *list = NULL; + struct compute_generation_info info = { + .r = ctx->r, + .commits = &ctx->commits, + .get_generation = get_generation_from_graph_data, + .set_generation = set_generation_v2, + .data = ctx, + }; if (ctx->report_progress) - ctx->progress = start_delayed_progress( + info.progress = ctx->progress + = start_delayed_progress( _("Computing commit graph generation numbers"), ctx->commits.nr); @@ -1577,47 +1595,7 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx) } } - for (i = 0; i < ctx->commits.nr; i++) { - struct commit *c = ctx->commits.list[i]; - timestamp_t corrected_commit_date; - - repo_parse_commit(ctx->r, c); - corrected_commit_date = commit_graph_data_at(c)->generation; - - display_progress(ctx->progress, i + 1); - if (corrected_commit_date != GENERATION_NUMBER_ZERO) - continue; - - commit_list_insert(c, &list); - while (list) { - struct commit *current = list->item; - struct commit_list *parent; - int all_parents_computed = 1; - timestamp_t max_corrected_commit_date = 0; - - for (parent = current->parents; parent; parent = parent->next) { - repo_parse_commit(ctx->r, parent->item); - corrected_commit_date = commit_graph_data_at(parent->item)->generation; - - if (corrected_commit_date == GENERATION_NUMBER_ZERO) { - all_parents_computed = 0; - commit_list_insert(parent->item, &list); - break; - } - - if (corrected_commit_date > max_corrected_commit_date) - max_corrected_commit_date = corrected_commit_date; - } - - if (all_parents_computed) { - pop_commit(&list); - - if (current->date && current->date > max_corrected_commit_date) - max_corrected_commit_date = current->date - 1; - commit_graph_data_at(current)->generation = max_corrected_commit_date + 1; - } - } - } + compute_reachable_generation_numbers(&info, 2); for (i = 0; i < ctx->commits.nr; i++) { struct commit *c = ctx->commits.list[i]; -- cgit 1.2.3-korg From 2ee11f7261cc7ac386ec683f774472b0309dcc82 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Mon, 20 Mar 2023 11:26:51 +0000 Subject: commit-graph: return generation from memory The commit_graph_generation() method used to report a value of GENERATION_NUMBER_INFINITY if the commit_graph_data_slab had an instance for the given commit but the graph_pos indicated the commit was not in the commit-graph file. However, an upcoming change will introduce the ability to set generation values in-memory without writing the commit-graph file. Thus, we can no longer trust 'graph_pos' to indicate whether or not the generation member can be trusted. Instead, trust the 'generation' member if the commit has a value in the slab _and_ the 'generation' member is non-zero. Otherwise, treat it as GENERATION_NUMBER_INFINITY. This only makes a difference for a very old case for the commit-graph: the very first Git release to write commit-graph files wrote zeroes in the topological level positions. If we are parsing a commit-graph with all zeroes, those commits will now appear to have GENERATION_NUMBER_INFINITY (as if they were not parsed from the commit-graph). I attempted several variations to work around the need for providing an uninitialized 'generation' member, but this was the best one I found. It does require a change to a verification test in t5318 because it reports a different error than the one about non-zero generation numbers. Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- commit-graph.c | 8 +++----- t/t5318-commit-graph.sh | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'commit-graph.c') diff --git a/commit-graph.c b/commit-graph.c index d1c98681e8..63a56483cf 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -116,12 +116,10 @@ timestamp_t commit_graph_generation(const struct commit *c) struct commit_graph_data *data = commit_graph_data_slab_peek(&commit_graph_data_slab, c); - if (!data) - return GENERATION_NUMBER_INFINITY; - else if (data->graph_pos == COMMIT_NOT_FROM_GRAPH) - return GENERATION_NUMBER_INFINITY; + if (data && data->generation) + return data->generation; - return data->generation; + return GENERATION_NUMBER_INFINITY; } static struct commit_graph_data *commit_graph_data_at(const struct commit *c) diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh index 049c5fc8ea..b6e1211578 100755 --- a/t/t5318-commit-graph.sh +++ b/t/t5318-commit-graph.sh @@ -630,7 +630,7 @@ test_expect_success 'detect incorrect generation number' ' test_expect_success 'detect incorrect generation number' ' corrupt_graph_and_verify $GRAPH_BYTE_COMMIT_GENERATION "\01" \ - "non-zero generation number" + "commit-graph generation for commit" ' test_expect_success 'detect incorrect commit date' ' -- cgit 1.2.3-korg From c08645b353514fe14dbd62cf52afd49d0e88146b Mon Sep 17 00:00:00 2001 From: Taylor Blau Date: Mon, 20 Mar 2023 11:26:52 +0000 Subject: commit-graph: introduce `ensure_generations_valid()` Use the just-introduced compute_reachable_generation_numbers_1() to implement a function which dynamically computes topological levels (or corrected commit dates) for out-of-graph commits. This will be useful for the ahead-behind algorithm we are about to introduce, which needs accurate topological levels on _all_ commits reachable from the tips in order to avoid over-counting. Co-authored-by: Derrick Stolee Signed-off-by: Taylor Blau Signed-off-by: Derrick Stolee Signed-off-by: Junio C Hamano --- commit-graph.c | 29 +++++++++++++++++++++++++++++ commit-graph.h | 8 ++++++++ 2 files changed, 37 insertions(+) (limited to 'commit-graph.c') diff --git a/commit-graph.c b/commit-graph.c index 63a56483cf..172e679db1 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1604,6 +1604,35 @@ static void compute_generation_numbers(struct write_commit_graph_context *ctx) stop_progress(&ctx->progress); } +static void set_generation_in_graph_data(struct commit *c, timestamp_t t, + void *data) +{ + commit_graph_data_at(c)->generation = t; +} + +/* + * After this method, all commits reachable from those in the given + * list will have non-zero, non-infinite generation numbers. + */ +void ensure_generations_valid(struct repository *r, + struct commit **commits, size_t nr) +{ + int generation_version = get_configured_generation_version(r); + struct packed_commit_list list = { + .list = commits, + .alloc = nr, + .nr = nr, + }; + struct compute_generation_info info = { + .r = r, + .commits = &list, + .get_generation = get_generation_from_graph_data, + .set_generation = set_generation_in_graph_data, + }; + + compute_reachable_generation_numbers(&info, generation_version); +} + static void trace2_bloom_filter_write_statistics(struct write_commit_graph_context *ctx) { trace2_data_intmax("commit-graph", ctx->r, "filter-computed", diff --git a/commit-graph.h b/commit-graph.h index 37faee6b66..73e182ab2d 100644 --- a/commit-graph.h +++ b/commit-graph.h @@ -190,4 +190,12 @@ struct commit_graph_data { */ timestamp_t commit_graph_generation(const struct commit *); uint32_t commit_graph_position(const struct commit *); + +/* + * After this method, all commits reachable from those in the given + * list will have non-zero, non-infinite generation numbers. + */ +void ensure_generations_valid(struct repository *r, + struct commit **commits, size_t nr); + #endif -- cgit 1.2.3-korg From f394e093df10f1867d9bb2180b3789ee61124aed Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Tue, 21 Mar 2023 06:25:54 +0000 Subject: treewide: be explicit about dependence on gettext.h Dozens of files made use of gettext functions, without explicitly including gettext.h. This made it more difficult to find which files could remove a dependence on cache.h. Make C files explicitly include gettext.h if they are using it. However, while compat/fsmonitor/fsm-ipc-darwin.c should also gain an include of gettext.h, it was left out to avoid conflicting with an in-flight topic. Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- add-interactive.c | 1 + add-patch.c | 1 + apply.c | 1 + archive-tar.c | 1 + archive-zip.c | 1 + archive.c | 1 + attr.c | 1 + bisect.c | 1 + blame.c | 1 + branch.c | 1 + builtin/add.c | 1 + builtin/am.c | 1 + builtin/apply.c | 1 + builtin/archive.c | 1 + builtin/bisect.c | 1 + builtin/blame.c | 1 + builtin/branch.c | 1 + builtin/bugreport.c | 1 + builtin/bundle.c | 1 + builtin/cat-file.c | 1 + builtin/check-attr.c | 1 + builtin/check-ignore.c | 1 + builtin/check-mailmap.c | 1 + builtin/checkout--worker.c | 1 + builtin/checkout-index.c | 1 + builtin/checkout.c | 1 + builtin/clean.c | 1 + builtin/clone.c | 1 + builtin/column.c | 1 + builtin/commit-graph.c | 1 + builtin/commit-tree.c | 1 + builtin/commit.c | 1 + builtin/config.c | 1 + builtin/count-objects.c | 1 + builtin/credential-cache--daemon.c | 1 + builtin/credential-cache.c | 1 + builtin/credential-store.c | 1 + builtin/describe.c | 1 + builtin/diagnose.c | 1 + builtin/diff-tree.c | 1 + builtin/diff.c | 1 + builtin/difftool.c | 1 + builtin/fast-export.c | 1 + builtin/fast-import.c | 1 + builtin/fetch-pack.c | 1 + builtin/fetch.c | 1 + builtin/fmt-merge-msg.c | 1 + builtin/for-each-ref.c | 1 + builtin/for-each-repo.c | 1 + builtin/fsck.c | 1 + builtin/fsmonitor--daemon.c | 1 + builtin/gc.c | 1 + builtin/grep.c | 1 + builtin/hash-object.c | 1 + builtin/help.c | 1 + builtin/hook.c | 1 + builtin/index-pack.c | 1 + builtin/init-db.c | 1 + builtin/interpret-trailers.c | 1 + builtin/log.c | 1 + builtin/ls-files.c | 1 + builtin/ls-remote.c | 1 + builtin/ls-tree.c | 1 + builtin/mailinfo.c | 1 + builtin/mailsplit.c | 1 + builtin/merge-base.c | 1 + builtin/merge-file.c | 1 + builtin/merge-recursive.c | 1 + builtin/merge-tree.c | 1 + builtin/merge.c | 1 + builtin/mktag.c | 1 + builtin/mktree.c | 1 + builtin/multi-pack-index.c | 1 + builtin/mv.c | 1 + builtin/name-rev.c | 1 + builtin/notes.c | 1 + builtin/pack-objects.c | 1 + builtin/pack-redundant.c | 1 + builtin/pack-refs.c | 1 + builtin/patch-id.c | 1 + builtin/prune-packed.c | 1 + builtin/prune.c | 1 + builtin/pull.c | 1 + builtin/push.c | 1 + builtin/range-diff.c | 1 + builtin/read-tree.c | 1 + builtin/rebase.c | 1 + builtin/receive-pack.c | 1 + builtin/reflog.c | 1 + builtin/remote.c | 1 + builtin/repack.c | 1 + builtin/replace.c | 1 + builtin/rerere.c | 1 + builtin/reset.c | 1 + builtin/rev-list.c | 1 + builtin/rev-parse.c | 1 + builtin/revert.c | 1 + builtin/rm.c | 1 + builtin/shortlog.c | 1 + builtin/show-branch.c | 1 + builtin/show-index.c | 1 + builtin/show-ref.c | 1 + builtin/sparse-checkout.c | 1 + builtin/stash.c | 1 + builtin/stripspace.c | 1 + builtin/submodule--helper.c | 1 + builtin/symbolic-ref.c | 1 + builtin/tag.c | 1 + builtin/unpack-objects.c | 1 + builtin/update-index.c | 1 + builtin/update-ref.c | 1 + builtin/update-server-info.c | 1 + builtin/upload-pack.c | 1 + builtin/verify-commit.c | 1 + builtin/verify-pack.c | 1 + builtin/verify-tag.c | 1 + builtin/worktree.c | 1 + builtin/write-tree.c | 1 + bulk-checkin.c | 1 + bundle-uri.c | 1 + bundle.c | 1 + chunk-format.c | 1 + color.c | 1 + commit-graph.c | 1 + commit.c | 1 + common-main.c | 1 + compat/disk.h | 1 + compat/fsmonitor/fsm-health-win32.c | 1 + compat/fsmonitor/fsm-listen-darwin.c | 1 + compat/fsmonitor/fsm-listen-win32.c | 1 + compat/fsmonitor/fsm-path-utils-darwin.c | 1 + compat/fsmonitor/fsm-path-utils-win32.c | 1 + compat/mingw.c | 1 + compat/precompose_utf8.c | 1 + compat/simple-ipc/ipc-unix-socket.c | 1 + compat/simple-ipc/ipc-win32.c | 1 + compat/terminal.c | 1 + config.c | 1 + connect.c | 1 + connected.c | 1 + convert.c | 1 + credential.c | 1 + date.c | 1 + delta-islands.c | 1 + diagnose.c | 1 + diff-lib.c | 1 + diff-no-index.c | 1 + diff.c | 1 + dir.c | 1 + editor.c | 1 + entry.c | 1 + environment.c | 1 + exec-cmd.c | 1 + fetch-pack.c | 1 + fsmonitor-ipc.c | 1 + git.c | 1 + gpg-interface.c | 1 + grep.c | 1 + http-fetch.c | 1 + imap-send.c | 1 + list-objects-filter-options.h | 1 + list-objects-filter.c | 1 + list-objects.c | 1 + lockfile.c | 1 + ls-refs.c | 1 + merge-ort-wrappers.c | 1 + merge-ort.c | 1 + merge-recursive.c | 1 + merge.c | 1 + midx.c | 1 + name-hash.c | 1 + notes-merge.c | 1 + notes-utils.c | 1 + object-file.c | 1 + object-name.c | 1 + object.c | 1 + pack-bitmap-write.c | 1 + pack-bitmap.c | 1 + pack-mtimes.c | 1 + pack-revindex.c | 1 + pack-write.c | 1 + packfile.c | 1 + parallel-checkout.c | 1 + parse-options-cb.c | 1 + parse-options.c | 1 + parse-options.h | 2 ++ path.c | 1 + pathspec.c | 1 + pkt-line.c | 1 + preload-index.c | 1 + pretty.c | 1 + promisor-remote.c | 1 + prune-packed.c | 1 + range-diff.c | 1 + reachable.c | 1 + read-cache.c | 1 + rebase-interactive.c | 1 + ref-filter.c | 1 + ref-filter.h | 1 + reflog.c | 1 + refs.c | 1 + refs/files-backend.c | 1 + refs/packed-backend.c | 1 + remote-curl.c | 1 + remote.c | 1 + replace-object.c | 1 + rerere.c | 1 + rerere.h | 1 + reset.c | 1 + revision.c | 1 + run-command.c | 1 + send-pack.c | 1 + sequencer.c | 1 + setup.c | 1 + sideband.c | 1 + sparse-index.c | 1 + split-index.c | 1 + strbuf.c | 1 + submodule-config.c | 1 + submodule.c | 1 + symlinks.c | 1 + t/helper/test-cache-tree.c | 1 + t/helper/test-fast-rebase.c | 1 + t/helper/test-reach.c | 1 + t/helper/test-serve-v2.c | 1 + trailer.c | 1 + transport-helper.c | 1 + tree-walk.c | 1 + unpack-trees.c | 1 + upload-pack.c | 1 + usage.c | 2 +- walker.c | 1 + worktree.c | 1 + wrapper.c | 1 + wt-status.c | 1 + 235 files changed, 236 insertions(+), 1 deletion(-) (limited to 'commit-graph.c') diff --git a/add-interactive.c b/add-interactive.c index ae25ec50bc..b750543bd8 100644 --- a/add-interactive.c +++ b/add-interactive.c @@ -3,6 +3,7 @@ #include "color.h" #include "config.h" #include "diffcore.h" +#include "gettext.h" #include "hex.h" #include "revision.h" #include "refs.h" diff --git a/add-patch.c b/add-patch.c index e6c34b9c38..4c803a5f4d 100644 --- a/add-patch.c +++ b/add-patch.c @@ -1,6 +1,7 @@ #include "cache.h" #include "add-interactive.h" #include "alloc.h" +#include "gettext.h" #include "strbuf.h" #include "run-command.h" #include "strvec.h" diff --git a/apply.c b/apply.c index 8776ab939a..e0bdd43a68 100644 --- a/apply.c +++ b/apply.c @@ -15,6 +15,7 @@ #include "delta.h" #include "diff.h" #include "dir.h" +#include "gettext.h" #include "hex.h" #include "xdiff-interface.h" #include "ll-merge.h" diff --git a/archive-tar.c b/archive-tar.c index ee27fa0b39..16ee133bbf 100644 --- a/archive-tar.c +++ b/archive-tar.c @@ -4,6 +4,7 @@ #include "git-compat-util.h" #include "alloc.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "tar.h" #include "archive.h" diff --git a/archive-zip.c b/archive-zip.c index c5d1f72eb8..c02dc33e40 100644 --- a/archive-zip.c +++ b/archive-zip.c @@ -4,6 +4,7 @@ #include "cache.h" #include "config.h" #include "archive.h" +#include "gettext.h" #include "hex.h" #include "streaming.h" #include "utf8.h" diff --git a/archive.c b/archive.c index 1c2ca78e52..2c3da1cff3 100644 --- a/archive.c +++ b/archive.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "alloc.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "refs.h" #include "object-store.h" diff --git a/attr.c b/attr.c index 657ee52229..48e2d64618 100644 --- a/attr.c +++ b/attr.c @@ -12,6 +12,7 @@ #include "exec-cmd.h" #include "attr.h" #include "dir.h" +#include "gettext.h" #include "utf8.h" #include "quote.h" #include "revision.h" diff --git a/bisect.c b/bisect.c index 1409150c5c..5a3a8182d8 100644 --- a/bisect.c +++ b/bisect.c @@ -2,6 +2,7 @@ #include "config.h" #include "commit.h" #include "diff.h" +#include "gettext.h" #include "hex.h" #include "revision.h" #include "refs.h" diff --git a/blame.c b/blame.c index e45d8a3bf9..b7cd849bb6 100644 --- a/blame.c +++ b/blame.c @@ -5,6 +5,7 @@ #include "mergesort.h" #include "diff.h" #include "diffcore.h" +#include "gettext.h" #include "hex.h" #include "tag.h" #include "blame.h" diff --git a/branch.c b/branch.c index eacef62b7c..66d32c6856 100644 --- a/branch.c +++ b/branch.c @@ -2,6 +2,7 @@ #include "cache.h" #include "config.h" #include "branch.h" +#include "gettext.h" #include "hex.h" #include "refs.h" #include "refspec.h" diff --git a/builtin/add.c b/builtin/add.c index 61dd386d10..f12054d9be 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -9,6 +9,7 @@ #include "builtin.h" #include "lockfile.h" #include "dir.h" +#include "gettext.h" #include "pathspec.h" #include "exec-cmd.h" #include "cache-tree.h" diff --git a/builtin/am.c b/builtin/am.c index 5e6b237c42..cc1fdf4f75 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -8,6 +8,7 @@ #include "config.h" #include "builtin.h" #include "exec-cmd.h" +#include "gettext.h" #include "hex.h" #include "parse-options.h" #include "dir.h" diff --git a/builtin/apply.c b/builtin/apply.c index 555219de40..fe72c0ec3e 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -1,5 +1,6 @@ #include "cache.h" #include "builtin.h" +#include "gettext.h" #include "parse-options.h" #include "apply.h" diff --git a/builtin/archive.c b/builtin/archive.c index d0a583ea95..d13934f1a8 100644 --- a/builtin/archive.c +++ b/builtin/archive.c @@ -5,6 +5,7 @@ #include "cache.h" #include "builtin.h" #include "archive.h" +#include "gettext.h" #include "transport.h" #include "parse-options.h" #include "pkt-line.h" diff --git a/builtin/bisect.c b/builtin/bisect.c index c64c8d715a..09188e554b 100644 --- a/builtin/bisect.c +++ b/builtin/bisect.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "cache.h" +#include "gettext.h" #include "hex.h" #include "parse-options.h" #include "bisect.h" diff --git a/builtin/blame.c b/builtin/blame.c index fdd9f0c0fc..21f6b523a6 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -10,6 +10,7 @@ #include "config.h" #include "color.h" #include "builtin.h" +#include "gettext.h" #include "hex.h" #include "repository.h" #include "commit.h" diff --git a/builtin/branch.c b/builtin/branch.c index f63fd45edb..a67a8334d5 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -11,6 +11,7 @@ #include "refs.h" #include "commit.h" #include "builtin.h" +#include "gettext.h" #include "remote.h" #include "parse-options.h" #include "branch.h" diff --git a/builtin/bugreport.c b/builtin/bugreport.c index 5bc254be80..b61cfa9464 100644 --- a/builtin/bugreport.c +++ b/builtin/bugreport.c @@ -1,4 +1,5 @@ #include "builtin.h" +#include "gettext.h" #include "parse-options.h" #include "strbuf.h" #include "help.h" diff --git a/builtin/bundle.c b/builtin/bundle.c index 666f01bccd..de3898ffa4 100644 --- a/builtin/bundle.c +++ b/builtin/bundle.c @@ -1,4 +1,5 @@ #include "builtin.h" +#include "gettext.h" #include "strvec.h" #include "parse-options.h" #include "cache.h" diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 9e7e03ade4..9f1bf8f0e9 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -9,6 +9,7 @@ #include "config.h" #include "builtin.h" #include "diff.h" +#include "gettext.h" #include "hex.h" #include "ident.h" #include "parse-options.h" diff --git a/builtin/check-attr.c b/builtin/check-attr.c index d7a40e674c..ad27255e2c 100644 --- a/builtin/check-attr.c +++ b/builtin/check-attr.c @@ -3,6 +3,7 @@ #include "cache.h" #include "config.h" #include "attr.h" +#include "gettext.h" #include "quote.h" #include "parse-options.h" diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c index ab776061c7..a45d001e35 100644 --- a/builtin/check-ignore.c +++ b/builtin/check-ignore.c @@ -3,6 +3,7 @@ #include "cache.h" #include "config.h" #include "dir.h" +#include "gettext.h" #include "quote.h" #include "pathspec.h" #include "parse-options.h" diff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c index 96db3ddb4b..fa86fd9423 100644 --- a/builtin/check-mailmap.c +++ b/builtin/check-mailmap.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "config.h" +#include "gettext.h" #include "ident.h" #include "mailmap.h" #include "parse-options.h" diff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c index 0a7d762573..2120dd1d30 100644 --- a/builtin/checkout--worker.c +++ b/builtin/checkout--worker.c @@ -2,6 +2,7 @@ #include "alloc.h" #include "config.h" #include "entry.h" +#include "gettext.h" #include "parallel-checkout.h" #include "parse-options.h" #include "pkt-line.h" diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c index cf6fba97ba..828c0363f8 100644 --- a/builtin/checkout-index.c +++ b/builtin/checkout-index.c @@ -8,6 +8,7 @@ #include "builtin.h" #include "config.h" #include "dir.h" +#include "gettext.h" #include "lockfile.h" #include "quote.h" #include "cache-tree.h" diff --git a/builtin/checkout.c b/builtin/checkout.c index 734d730980..47d4c369a1 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -9,6 +9,7 @@ #include "config.h" #include "diff.h" #include "dir.h" +#include "gettext.h" #include "hex.h" #include "hook.h" #include "ll-merge.h" diff --git a/builtin/clean.c b/builtin/clean.c index 10aaa8c603..46c51029ab 100644 --- a/builtin/clean.c +++ b/builtin/clean.c @@ -11,6 +11,7 @@ #include "cache.h" #include "config.h" #include "dir.h" +#include "gettext.h" #include "parse-options.h" #include "string-list.h" #include "quote.h" diff --git a/builtin/clone.c b/builtin/clone.c index 462c286274..d605fcafa0 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -11,6 +11,7 @@ #define USE_THE_INDEX_VARIABLE #include "builtin.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "lockfile.h" #include "parse-options.h" diff --git a/builtin/column.c b/builtin/column.c index 158fdf53d9..de623a16c2 100644 --- a/builtin/column.c +++ b/builtin/column.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "cache.h" #include "config.h" +#include "gettext.h" #include "strbuf.h" #include "parse-options.h" #include "string-list.h" diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c index d3be7f3b31..311e010681 100644 --- a/builtin/commit-graph.c +++ b/builtin/commit-graph.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "config.h" #include "dir.h" +#include "gettext.h" #include "hex.h" #include "lockfile.h" #include "parse-options.h" diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c index e805da5bb1..0ef55d83d4 100644 --- a/builtin/commit-tree.c +++ b/builtin/commit-tree.c @@ -5,6 +5,7 @@ */ #include "cache.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "object-store.h" #include "repository.h" diff --git a/builtin/commit.c b/builtin/commit.c index f71ed41bf5..25575435ad 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -16,6 +16,7 @@ #include "diff.h" #include "diffcore.h" #include "commit.h" +#include "gettext.h" #include "revision.h" #include "wt-status.h" #include "run-command.h" diff --git a/builtin/config.c b/builtin/config.c index 49d832d409..33b17b40b4 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -2,6 +2,7 @@ #include "alloc.h" #include "config.h" #include "color.h" +#include "gettext.h" #include "ident.h" #include "parse-options.h" #include "urlmatch.h" diff --git a/builtin/count-objects.c b/builtin/count-objects.c index bb21bc43e4..48edc86c24 100644 --- a/builtin/count-objects.c +++ b/builtin/count-objects.c @@ -7,6 +7,7 @@ #include "cache.h" #include "config.h" #include "dir.h" +#include "gettext.h" #include "repository.h" #include "builtin.h" #include "parse-options.h" diff --git a/builtin/credential-cache--daemon.c b/builtin/credential-cache--daemon.c index 6e509d02c3..0f00ba4d74 100644 --- a/builtin/credential-cache--daemon.c +++ b/builtin/credential-cache--daemon.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "alloc.h" +#include "gettext.h" #include "parse-options.h" #ifndef NO_UNIX_SOCKETS diff --git a/builtin/credential-cache.c b/builtin/credential-cache.c index 78c02ad531..25f2f71c21 100644 --- a/builtin/credential-cache.c +++ b/builtin/credential-cache.c @@ -1,4 +1,5 @@ #include "builtin.h" +#include "gettext.h" #include "parse-options.h" #ifndef NO_UNIX_SOCKETS diff --git a/builtin/credential-store.c b/builtin/credential-store.c index 62a4f3c265..da32cfd89e 100644 --- a/builtin/credential-store.c +++ b/builtin/credential-store.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "config.h" +#include "gettext.h" #include "lockfile.h" #include "credential.h" #include "string-list.h" diff --git a/builtin/describe.c b/builtin/describe.c index 5b5930f5c8..fcacdf8a69 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -1,6 +1,7 @@ #define USE_THE_INDEX_VARIABLE #include "cache.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "lockfile.h" #include "commit.h" diff --git a/builtin/diagnose.c b/builtin/diagnose.c index d52015c67a..5b12d1fb96 100644 --- a/builtin/diagnose.c +++ b/builtin/diagnose.c @@ -1,4 +1,5 @@ #include "builtin.h" +#include "gettext.h" #include "parse-options.h" #include "diagnose.h" diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c index a393efa4f0..385c2d0230 100644 --- a/builtin/diff-tree.c +++ b/builtin/diff-tree.c @@ -3,6 +3,7 @@ #include "config.h" #include "diff.h" #include "commit.h" +#include "gettext.h" #include "hex.h" #include "log-tree.h" #include "builtin.h" diff --git a/builtin/diff.c b/builtin/diff.c index 26f1e532c6..20bdb6e6ce 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -11,6 +11,7 @@ #include "color.h" #include "commit.h" #include "blob.h" +#include "gettext.h" #include "tag.h" #include "diff.h" #include "diff-merges.h" diff --git a/builtin/difftool.c b/builtin/difftool.c index 01681d0fb8..f7380dd1cc 100644 --- a/builtin/difftool.c +++ b/builtin/difftool.c @@ -17,6 +17,7 @@ #include "builtin.h" #include "run-command.h" #include "exec-cmd.h" +#include "gettext.h" #include "hex.h" #include "parse-options.h" #include "strvec.h" diff --git a/builtin/fast-export.c b/builtin/fast-export.c index 78493c6d2b..9ab2e34ef0 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -6,6 +6,7 @@ #include "builtin.h" #include "cache.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "refs.h" #include "refspec.h" diff --git a/builtin/fast-import.c b/builtin/fast-import.c index f7548ff4a3..f3635c7aef 100644 --- a/builtin/fast-import.c +++ b/builtin/fast-import.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "cache.h" +#include "gettext.h" #include "hex.h" #include "repository.h" #include "config.h" diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index 702c9a3397..60e5a10ffc 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "alloc.h" +#include "gettext.h" #include "hex.h" #include "pkt-line.h" #include "fetch-pack.h" diff --git a/builtin/fetch.c b/builtin/fetch.c index 7221e57f35..990f81f6d1 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -3,6 +3,7 @@ */ #include "cache.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "repository.h" #include "refs.h" diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c index 8d8fd393f8..0f9855b680 100644 --- a/builtin/fmt-merge-msg.c +++ b/builtin/fmt-merge-msg.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "config.h" #include "fmt-merge-msg.h" +#include "gettext.h" #include "parse-options.h" static const char * const fmt_merge_msg_usage[] = { diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index 6f62f40d12..7a8ff5902c 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "cache.h" #include "config.h" +#include "gettext.h" #include "refs.h" #include "object.h" #include "parse-options.h" diff --git a/builtin/for-each-repo.c b/builtin/for-each-repo.c index 6aeac37148..27425c2fc9 100644 --- a/builtin/for-each-repo.c +++ b/builtin/for-each-repo.c @@ -1,6 +1,7 @@ #include "cache.h" #include "config.h" #include "builtin.h" +#include "gettext.h" #include "parse-options.h" #include "run-command.h" #include "string-list.h" diff --git a/builtin/fsck.c b/builtin/fsck.c index c4a633c032..1375e32d2a 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "cache.h" +#include "gettext.h" #include "hex.h" #include "repository.h" #include "config.h" diff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c index cae804a190..215e3813d7 100644 --- a/builtin/fsmonitor--daemon.c +++ b/builtin/fsmonitor--daemon.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "alloc.h" #include "config.h" +#include "gettext.h" #include "parse-options.h" #include "fsmonitor.h" #include "fsmonitor-ipc.h" diff --git a/builtin/gc.c b/builtin/gc.c index c58fe8c936..32cabad7cf 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -32,6 +32,7 @@ #include "refs.h" #include "remote.h" #include "exec-cmd.h" +#include "gettext.h" #include "hook.h" #define FAILED_RUN "failed to run %s" diff --git a/builtin/grep.c b/builtin/grep.c index c590fcb19d..3c9c6b3803 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -5,6 +5,7 @@ */ #include "cache.h" #include "alloc.h" +#include "gettext.h" #include "hex.h" #include "repository.h" #include "config.h" diff --git a/builtin/hash-object.c b/builtin/hash-object.c index 1848768b97..f233eda759 100644 --- a/builtin/hash-object.c +++ b/builtin/hash-object.c @@ -6,6 +6,7 @@ */ #include "builtin.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "object-store.h" #include "blob.h" diff --git a/builtin/help.c b/builtin/help.c index 53f2812dfb..3fde5c4fd3 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -5,6 +5,7 @@ #include "config.h" #include "builtin.h" #include "exec-cmd.h" +#include "gettext.h" #include "parse-options.h" #include "run-command.h" #include "config-list.h" diff --git a/builtin/hook.c b/builtin/hook.c index f95b7965c5..88051795c7 100644 --- a/builtin/hook.c +++ b/builtin/hook.c @@ -1,6 +1,7 @@ #include "cache.h" #include "builtin.h" #include "config.h" +#include "gettext.h" #include "hook.h" #include "parse-options.h" #include "strbuf.h" diff --git a/builtin/index-pack.c b/builtin/index-pack.c index b451755f40..bae5b05403 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -2,6 +2,7 @@ #include "alloc.h" #include "config.h" #include "delta.h" +#include "gettext.h" #include "hex.h" #include "pack.h" #include "csum-file.h" diff --git a/builtin/init-db.c b/builtin/init-db.c index dcaaf102ea..e182bc7e83 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -5,6 +5,7 @@ */ #include "cache.h" #include "config.h" +#include "gettext.h" #include "refs.h" #include "builtin.h" #include "exec-cmd.h" diff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c index e58627c72a..107ac28f0e 100644 --- a/builtin/interpret-trailers.c +++ b/builtin/interpret-trailers.c @@ -7,6 +7,7 @@ #include "cache.h" #include "builtin.h" +#include "gettext.h" #include "parse-options.h" #include "string-list.h" #include "trailer.h" diff --git a/builtin/log.c b/builtin/log.c index bc204ea76f..e702cf126e 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -7,6 +7,7 @@ #include "git-compat-util.h" #include "alloc.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "refs.h" #include "object-store.h" diff --git a/builtin/ls-files.c b/builtin/ls-files.c index a03b559eca..09deb752ab 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -11,6 +11,7 @@ #include "quote.h" #include "dir.h" #include "builtin.h" +#include "gettext.h" #include "strbuf.h" #include "tree.h" #include "cache-tree.h" diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c index 2dfbd8ed9b..11d9424804 100644 --- a/builtin/ls-remote.c +++ b/builtin/ls-remote.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "cache.h" +#include "gettext.h" #include "hex.h" #include "transport.h" #include "ref-filter.h" diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c index 64d8e54318..b4835f1d4c 100644 --- a/builtin/ls-tree.c +++ b/builtin/ls-tree.c @@ -5,6 +5,7 @@ */ #include "cache.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "object-store.h" #include "blob.h" diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c index 01d16ef9e5..e8bb011cfb 100644 --- a/builtin/mailinfo.c +++ b/builtin/mailinfo.c @@ -4,6 +4,7 @@ */ #include "cache.h" #include "builtin.h" +#include "gettext.h" #include "utf8.h" #include "strbuf.h" #include "mailinfo.h" diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c index 73509f651b..b08069ce60 100644 --- a/builtin/mailsplit.c +++ b/builtin/mailsplit.c @@ -6,6 +6,7 @@ */ #include "cache.h" #include "builtin.h" +#include "gettext.h" #include "string-list.h" #include "strbuf.h" diff --git a/builtin/merge-base.c b/builtin/merge-base.c index be8f3b221c..e0995f3219 100644 --- a/builtin/merge-base.c +++ b/builtin/merge-base.c @@ -2,6 +2,7 @@ #include "cache.h" #include "config.h" #include "commit.h" +#include "gettext.h" #include "hex.h" #include "refs.h" #include "diff.h" diff --git a/builtin/merge-file.c b/builtin/merge-file.c index c923bbf2ab..ae45f523b9 100644 --- a/builtin/merge-file.c +++ b/builtin/merge-file.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "cache.h" #include "config.h" +#include "gettext.h" #include "xdiff/xdiff.h" #include "xdiff-interface.h" #include "parse-options.h" diff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c index b9acbf5d34..a49fab9bcb 100644 --- a/builtin/merge-recursive.c +++ b/builtin/merge-recursive.c @@ -1,6 +1,7 @@ #include "cache.h" #include "builtin.h" #include "commit.h" +#include "gettext.h" #include "tag.h" #include "merge-recursive.h" #include "xdiff-interface.h" diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index e782518164..89b807388a 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -3,6 +3,7 @@ #include "tree-walk.h" #include "xdiff-interface.h" #include "help.h" +#include "gettext.h" #include "hex.h" #include "commit.h" #include "commit-reach.h" diff --git a/builtin/merge.c b/builtin/merge.c index 19c31d4ff4..a90ae5d2dd 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -10,6 +10,7 @@ #include "cache.h" #include "alloc.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "parse-options.h" #include "builtin.h" diff --git a/builtin/mktag.c b/builtin/mktag.c index 42c2457c70..e93aee7225 100644 --- a/builtin/mktag.c +++ b/builtin/mktag.c @@ -1,4 +1,5 @@ #include "builtin.h" +#include "gettext.h" #include "hex.h" #include "parse-options.h" #include "tag.h" diff --git a/builtin/mktree.c b/builtin/mktree.c index 848c7b4747..09a7bd5c5c 100644 --- a/builtin/mktree.c +++ b/builtin/mktree.c @@ -5,6 +5,7 @@ */ #include "builtin.h" #include "alloc.h" +#include "gettext.h" #include "hex.h" #include "quote.h" #include "tree.h" diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c index 9a18a82b05..e6757a4447 100644 --- a/builtin/multi-pack-index.c +++ b/builtin/multi-pack-index.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "cache.h" #include "config.h" +#include "gettext.h" #include "parse-options.h" #include "midx.h" #include "trace2.h" diff --git a/builtin/mv.c b/builtin/mv.c index 8129050377..c02dddb72b 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -7,6 +7,7 @@ #include "builtin.h" #include "alloc.h" #include "config.h" +#include "gettext.h" #include "pathspec.h" #include "lockfile.h" #include "dir.h" diff --git a/builtin/name-rev.c b/builtin/name-rev.c index 723ba616a8..6977a5f580 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "alloc.h" +#include "gettext.h" #include "hex.h" #include "repository.h" #include "config.h" diff --git a/builtin/notes.c b/builtin/notes.c index 75ce7f3f57..8e9be33ddb 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -10,6 +10,7 @@ #include "cache.h" #include "config.h" #include "builtin.h" +#include "gettext.h" #include "hex.h" #include "notes.h" #include "object-store.h" diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 545b8bddc8..1ca800c7c5 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "alloc.h" +#include "gettext.h" #include "hex.h" #include "repository.h" #include "config.h" diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c index 82115c5808..3451971b56 100644 --- a/builtin/pack-redundant.c +++ b/builtin/pack-redundant.c @@ -7,6 +7,7 @@ */ #include "builtin.h" +#include "gettext.h" #include "hex.h" #include "repository.h" #include "packfile.h" diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c index 27c2ca06ac..9833815fb3 100644 --- a/builtin/pack-refs.c +++ b/builtin/pack-refs.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "config.h" +#include "gettext.h" #include "parse-options.h" #include "refs.h" #include "repository.h" diff --git a/builtin/patch-id.c b/builtin/patch-id.c index 338b15cd7b..9d5585d3a7 100644 --- a/builtin/patch-id.c +++ b/builtin/patch-id.c @@ -2,6 +2,7 @@ #include "builtin.h" #include "config.h" #include "diff.h" +#include "gettext.h" #include "hex.h" #include "parse-options.h" diff --git a/builtin/prune-packed.c b/builtin/prune-packed.c index da3273a268..ca3578e158 100644 --- a/builtin/prune-packed.c +++ b/builtin/prune-packed.c @@ -1,4 +1,5 @@ #include "builtin.h" +#include "gettext.h" #include "parse-options.h" #include "prune-packed.h" diff --git a/builtin/prune.c b/builtin/prune.c index 119a253a2a..ff62a0adb8 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -1,6 +1,7 @@ #include "cache.h" #include "commit.h" #include "diff.h" +#include "gettext.h" #include "hex.h" #include "revision.h" #include "builtin.h" diff --git a/builtin/pull.c b/builtin/pull.c index 56f679d94a..1a1a89af05 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -9,6 +9,7 @@ #include "cache.h" #include "config.h" #include "builtin.h" +#include "gettext.h" #include "hex.h" #include "parse-options.h" #include "exec-cmd.h" diff --git a/builtin/push.c b/builtin/push.c index 12a402aea3..2d76fa6837 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -4,6 +4,7 @@ #include "cache.h" #include "branch.h" #include "config.h" +#include "gettext.h" #include "refs.h" #include "refspec.h" #include "run-command.h" diff --git a/builtin/range-diff.c b/builtin/range-diff.c index aecfae12d3..97724fd0ed 100644 --- a/builtin/range-diff.c +++ b/builtin/range-diff.c @@ -1,5 +1,6 @@ #include "cache.h" #include "builtin.h" +#include "gettext.h" #include "parse-options.h" #include "range-diff.h" #include "config.h" diff --git a/builtin/read-tree.c b/builtin/read-tree.c index 11759c415f..ec66008d07 100644 --- a/builtin/read-tree.c +++ b/builtin/read-tree.c @@ -7,6 +7,7 @@ #define USE_THE_INDEX_VARIABLE #include "cache.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "lockfile.h" #include "object.h" diff --git a/builtin/rebase.c b/builtin/rebase.c index dd31d5ab91..a2c68b8ff7 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -6,6 +6,7 @@ #define USE_THE_INDEX_VARIABLE #include "builtin.h" +#include "gettext.h" #include "hex.h" #include "run-command.h" #include "exec-cmd.h" diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 6a24ab4f45..006565f851 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "repository.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "lockfile.h" #include "pack.h" diff --git a/builtin/reflog.c b/builtin/reflog.c index 270681dcdf..0879d4d224 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "config.h" +#include "gettext.h" #include "revision.h" #include "reachable.h" #include "worktree.h" diff --git a/builtin/remote.c b/builtin/remote.c index 729f6f3643..2074d6be28 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "config.h" +#include "gettext.h" #include "parse-options.h" #include "transport.h" #include "remote.h" diff --git a/builtin/repack.c b/builtin/repack.c index 87f73c8923..771ca01527 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -2,6 +2,7 @@ #include "alloc.h" #include "config.h" #include "dir.h" +#include "gettext.h" #include "hex.h" #include "parse-options.h" #include "run-command.h" diff --git a/builtin/replace.c b/builtin/replace.c index 71d8e949e3..cf85e590d9 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -11,6 +11,7 @@ #include "cache.h" #include "config.h" #include "builtin.h" +#include "gettext.h" #include "hex.h" #include "refs.h" #include "parse-options.h" diff --git a/builtin/rerere.c b/builtin/rerere.c index 94ffb8c21a..24c7875572 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -2,6 +2,7 @@ #include "cache.h" #include "config.h" #include "dir.h" +#include "gettext.h" #include "parse-options.h" #include "string-list.h" #include "rerere.h" diff --git a/builtin/reset.c b/builtin/reset.c index 24b04aeecb..4335c1a6e1 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -10,6 +10,7 @@ #define USE_THE_INDEX_VARIABLE #include "builtin.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "lockfile.h" #include "tag.h" diff --git a/builtin/rev-list.c b/builtin/rev-list.c index 85e522dff8..f2f6a0d3e6 100644 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@ -2,6 +2,7 @@ #include "config.h" #include "commit.h" #include "diff.h" +#include "gettext.h" #include "hex.h" #include "revision.h" #include "list-objects.h" diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index e1fa9c6348..5a932a861b 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -8,6 +8,7 @@ #include "alloc.h" #include "config.h" #include "commit.h" +#include "gettext.h" #include "hex.h" #include "refs.h" #include "quote.h" diff --git a/builtin/revert.c b/builtin/revert.c index 62986a7b1b..dd6587a99d 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -4,6 +4,7 @@ #include "builtin.h" #include "parse-options.h" #include "diff.h" +#include "gettext.h" #include "revision.h" #include "rerere.h" #include "dir.h" diff --git a/builtin/rm.c b/builtin/rm.c index dc198f7908..5982c3d812 100644 --- a/builtin/rm.c +++ b/builtin/rm.c @@ -11,6 +11,7 @@ #include "lockfile.h" #include "dir.h" #include "cache-tree.h" +#include "gettext.h" #include "tree-walk.h" #include "parse-options.h" #include "string-list.h" diff --git a/builtin/shortlog.c b/builtin/shortlog.c index 27a87167e1..d8c4379ea1 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -3,6 +3,7 @@ #include "config.h" #include "commit.h" #include "diff.h" +#include "gettext.h" #include "string-list.h" #include "revision.h" #include "utf8.h" diff --git a/builtin/show-branch.c b/builtin/show-branch.c index 8342b68aef..8d56962972 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -1,5 +1,6 @@ #include "cache.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "pretty.h" #include "refs.h" diff --git a/builtin/show-index.c b/builtin/show-index.c index 98ec40ddf4..d4bbbbcd6c 100644 --- a/builtin/show-index.c +++ b/builtin/show-index.c @@ -1,5 +1,6 @@ #include "builtin.h" #include "cache.h" +#include "gettext.h" #include "hex.h" #include "pack.h" #include "parse-options.h" diff --git a/builtin/show-ref.c b/builtin/show-ref.c index 1f28d7fe4b..a5df7587d5 100644 --- a/builtin/show-ref.c +++ b/builtin/show-ref.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "cache.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "refs.h" #include "object-store.h" diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c index 8d5ae6f2a6..3976d8e86b 100644 --- a/builtin/sparse-checkout.c +++ b/builtin/sparse-checkout.c @@ -2,6 +2,7 @@ #include "cache.h" #include "config.h" #include "dir.h" +#include "gettext.h" #include "parse-options.h" #include "pathspec.h" #include "repository.h" diff --git a/builtin/stash.c b/builtin/stash.c index 6a12fed271..65817d0b76 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -1,6 +1,7 @@ #define USE_THE_INDEX_VARIABLE #include "builtin.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "parse-options.h" #include "refs.h" diff --git a/builtin/stripspace.c b/builtin/stripspace.c index 1e34cf2beb..d8e6145933 100644 --- a/builtin/stripspace.c +++ b/builtin/stripspace.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "cache.h" #include "config.h" +#include "gettext.h" #include "parse-options.h" #include "strbuf.h" diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index d05d1a8462..a4bdd44daa 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -1,6 +1,7 @@ #define USE_THE_INDEX_VARIABLE #include "builtin.h" #include "alloc.h" +#include "gettext.h" #include "hex.h" #include "repository.h" #include "cache.h" diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c index e00768a8b7..10198a74fa 100644 --- a/builtin/symbolic-ref.c +++ b/builtin/symbolic-ref.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "config.h" #include "cache.h" +#include "gettext.h" #include "refs.h" #include "parse-options.h" diff --git a/builtin/tag.c b/builtin/tag.c index adcaa547b0..c2ea89c475 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -9,6 +9,7 @@ #include "cache.h" #include "config.h" #include "builtin.h" +#include "gettext.h" #include "hex.h" #include "refs.h" #include "object-store.h" diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c index 1908dcfcff..f7c4b53107 100644 --- a/builtin/unpack-objects.c +++ b/builtin/unpack-objects.c @@ -2,6 +2,7 @@ #include "cache.h" #include "bulk-checkin.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "object-store.h" #include "object.h" diff --git a/builtin/update-index.c b/builtin/update-index.c index 11dc135271..ef78b2d28e 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -7,6 +7,7 @@ #include "cache.h" #include "bulk-checkin.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "lockfile.h" #include "quote.h" diff --git a/builtin/update-ref.c b/builtin/update-ref.c index a84e7b47a2..fdf51495b5 100644 --- a/builtin/update-ref.c +++ b/builtin/update-ref.c @@ -1,5 +1,6 @@ #include "cache.h" #include "config.h" +#include "gettext.h" #include "refs.h" #include "builtin.h" #include "parse-options.h" diff --git a/builtin/update-server-info.c b/builtin/update-server-info.c index d2239c9ef4..e7bff27ae4 100644 --- a/builtin/update-server-info.c +++ b/builtin/update-server-info.c @@ -1,6 +1,7 @@ #include "cache.h" #include "config.h" #include "builtin.h" +#include "gettext.h" #include "parse-options.h" static const char * const update_server_info_usage[] = { diff --git a/builtin/upload-pack.c b/builtin/upload-pack.c index 7a3c68720f..beb9dd0861 100644 --- a/builtin/upload-pack.c +++ b/builtin/upload-pack.c @@ -1,6 +1,7 @@ #include "cache.h" #include "builtin.h" #include "exec-cmd.h" +#include "gettext.h" #include "pkt-line.h" #include "parse-options.h" #include "protocol.h" diff --git a/builtin/verify-commit.c b/builtin/verify-commit.c index 7aedf10e85..22e5afc069 100644 --- a/builtin/verify-commit.c +++ b/builtin/verify-commit.c @@ -8,6 +8,7 @@ #include "cache.h" #include "config.h" #include "builtin.h" +#include "gettext.h" #include "object-store.h" #include "repository.h" #include "commit.h" diff --git a/builtin/verify-pack.c b/builtin/verify-pack.c index 27d6f75fd8..190fd69540 100644 --- a/builtin/verify-pack.c +++ b/builtin/verify-pack.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "cache.h" #include "config.h" +#include "gettext.h" #include "run-command.h" #include "parse-options.h" diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c index 5c00b0b0f7..850e1a11c7 100644 --- a/builtin/verify-tag.c +++ b/builtin/verify-tag.c @@ -8,6 +8,7 @@ #include "cache.h" #include "config.h" #include "builtin.h" +#include "gettext.h" #include "tag.h" #include "run-command.h" #include "parse-options.h" diff --git a/builtin/worktree.c b/builtin/worktree.c index 80d05e246d..ed89b7e972 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -3,6 +3,7 @@ #include "config.h" #include "builtin.h" #include "dir.h" +#include "gettext.h" #include "hex.h" #include "parse-options.h" #include "strvec.h" diff --git a/builtin/write-tree.c b/builtin/write-tree.c index 7ad0d05945..7eec4e3cbd 100644 --- a/builtin/write-tree.c +++ b/builtin/write-tree.c @@ -7,6 +7,7 @@ #include "builtin.h" #include "cache.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "tree.h" #include "cache-tree.h" diff --git a/bulk-checkin.c b/bulk-checkin.c index d64cd5c52d..778ca1e0f4 100644 --- a/bulk-checkin.c +++ b/bulk-checkin.c @@ -4,6 +4,7 @@ #include "git-compat-util.h" #include "alloc.h" #include "bulk-checkin.h" +#include "gettext.h" #include "hex.h" #include "lockfile.h" #include "repository.h" diff --git a/bundle-uri.c b/bundle-uri.c index 177c181040..2cc7d159bd 100644 --- a/bundle-uri.c +++ b/bundle-uri.c @@ -1,6 +1,7 @@ #include "cache.h" #include "bundle-uri.h" #include "bundle.h" +#include "gettext.h" #include "object-store.h" #include "refs.h" #include "run-command.h" diff --git a/bundle.c b/bundle.c index 99d7de97f6..f5b3643b17 100644 --- a/bundle.c +++ b/bundle.c @@ -1,6 +1,7 @@ #include "cache.h" #include "lockfile.h" #include "bundle.h" +#include "gettext.h" #include "hex.h" #include "object-store.h" #include "repository.h" diff --git a/chunk-format.c b/chunk-format.c index f65e9a1e42..6d1071729d 100644 --- a/chunk-format.c +++ b/chunk-format.c @@ -2,6 +2,7 @@ #include "alloc.h" #include "chunk-format.h" #include "csum-file.h" +#include "gettext.h" /* * When writing a chunk-based file format, collect the chunks in diff --git a/color.c b/color.c index 6b577ce0a7..672dcbb73a 100644 --- a/color.c +++ b/color.c @@ -1,6 +1,7 @@ #include "cache.h" #include "config.h" #include "color.h" +#include "gettext.h" #include "hex.h" static int git_use_color_default = GIT_COLOR_AUTO; diff --git a/commit-graph.c b/commit-graph.c index 5e6098ff35..8f21a0a0c2 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "lockfile.h" #include "pack.h" diff --git a/commit.c b/commit.c index 7b63d3b0e1..3fdfb32511 100644 --- a/commit.c +++ b/commit.c @@ -2,6 +2,7 @@ #include "tag.h" #include "commit.h" #include "commit-graph.h" +#include "gettext.h" #include "hex.h" #include "repository.h" #include "object-store.h" diff --git a/common-main.c b/common-main.c index 0a22861f1c..184d1534d2 100644 --- a/common-main.c +++ b/common-main.c @@ -1,5 +1,6 @@ #include "cache.h" #include "exec-cmd.h" +#include "gettext.h" #include "attr.h" /* diff --git a/compat/disk.h b/compat/disk.h index 50a32e3d8a..a04a8d294a 100644 --- a/compat/disk.h +++ b/compat/disk.h @@ -2,6 +2,7 @@ #define COMPAT_DISK_H #include "git-compat-util.h" +#include "gettext.h" static int get_disk_info(struct strbuf *out) { diff --git a/compat/fsmonitor/fsm-health-win32.c b/compat/fsmonitor/fsm-health-win32.c index 2ea08c1d4e..fe11bdd9ce 100644 --- a/compat/fsmonitor/fsm-health-win32.c +++ b/compat/fsmonitor/fsm-health-win32.c @@ -3,6 +3,7 @@ #include "fsmonitor.h" #include "fsm-health.h" #include "fsmonitor--daemon.h" +#include "gettext.h" /* * Every minute wake up and test our health. diff --git a/compat/fsmonitor/fsm-listen-darwin.c b/compat/fsmonitor/fsm-listen-darwin.c index 97a55a6f0a..5eb6402ab8 100644 --- a/compat/fsmonitor/fsm-listen-darwin.c +++ b/compat/fsmonitor/fsm-listen-darwin.c @@ -28,6 +28,7 @@ #include "fsm-listen.h" #include "fsmonitor--daemon.h" #include "fsmonitor-path-utils.h" +#include "gettext.h" struct fsm_listen_data { diff --git a/compat/fsmonitor/fsm-listen-win32.c b/compat/fsmonitor/fsm-listen-win32.c index 03df8d951b..7b07b74ba5 100644 --- a/compat/fsmonitor/fsm-listen-win32.c +++ b/compat/fsmonitor/fsm-listen-win32.c @@ -3,6 +3,7 @@ #include "fsmonitor.h" #include "fsm-listen.h" #include "fsmonitor--daemon.h" +#include "gettext.h" /* * The documentation of ReadDirectoryChangesW() states that the maximum diff --git a/compat/fsmonitor/fsm-path-utils-darwin.c b/compat/fsmonitor/fsm-path-utils-darwin.c index ce5a8febe0..45eb4a9b9e 100644 --- a/compat/fsmonitor/fsm-path-utils-darwin.c +++ b/compat/fsmonitor/fsm-path-utils-darwin.c @@ -1,5 +1,6 @@ #include "fsmonitor.h" #include "fsmonitor-path-utils.h" +#include "gettext.h" #include #include #include diff --git a/compat/fsmonitor/fsm-path-utils-win32.c b/compat/fsmonitor/fsm-path-utils-win32.c index 0d95bbb416..4024baafb9 100644 --- a/compat/fsmonitor/fsm-path-utils-win32.c +++ b/compat/fsmonitor/fsm-path-utils-win32.c @@ -1,6 +1,7 @@ #include "cache.h" #include "fsmonitor.h" #include "fsmonitor-path-utils.h" +#include "gettext.h" /* * Check remote working directory protocol. diff --git a/compat/mingw.c b/compat/mingw.c index 3afbde7894..a9e5570288 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -11,6 +11,7 @@ #include "win32/lazyload.h" #include "../config.h" #include "dir.h" +#include "gettext.h" #define SECURITY_WIN32 #include diff --git a/compat/precompose_utf8.c b/compat/precompose_utf8.c index cce1d57a46..56d36cdf22 100644 --- a/compat/precompose_utf8.c +++ b/compat/precompose_utf8.c @@ -7,6 +7,7 @@ #include "cache.h" #include "config.h" +#include "gettext.h" #include "utf8.h" #include "precompose_utf8.h" diff --git a/compat/simple-ipc/ipc-unix-socket.c b/compat/simple-ipc/ipc-unix-socket.c index 28a79289d4..152db60a31 100644 --- a/compat/simple-ipc/ipc-unix-socket.c +++ b/compat/simple-ipc/ipc-unix-socket.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" #include "simple-ipc.h" #include "strbuf.h" #include "pkt-line.h" diff --git a/compat/simple-ipc/ipc-win32.c b/compat/simple-ipc/ipc-win32.c index 20ea7b65e0..f011e5cead 100644 --- a/compat/simple-ipc/ipc-win32.c +++ b/compat/simple-ipc/ipc-win32.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" #include "simple-ipc.h" #include "strbuf.h" #include "pkt-line.h" diff --git a/compat/terminal.c b/compat/terminal.c index ea490a7ced..afebe6b249 100644 --- a/compat/terminal.c +++ b/compat/terminal.c @@ -1,5 +1,6 @@ #include "cache.h" #include "compat/terminal.h" +#include "gettext.h" #include "sigchain.h" #include "strbuf.h" #include "run-command.h" diff --git a/config.c b/config.c index 983c45fc37..f30a6d8e68 100644 --- a/config.c +++ b/config.c @@ -11,6 +11,7 @@ #include "branch.h" #include "config.h" #include "environment.h" +#include "gettext.h" #include "ident.h" #include "repository.h" #include "lockfile.h" diff --git a/connect.c b/connect.c index 000865bc33..f3b159bf44 100644 --- a/connect.c +++ b/connect.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "cache.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "pkt-line.h" #include "quote.h" diff --git a/connected.c b/connected.c index 39cb1e1074..a4c0aece75 100644 --- a/connected.c +++ b/connected.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" #include "hex.h" #include "object-store.h" #include "run-command.h" diff --git a/convert.c b/convert.c index 349c7e4af1..2bd54244b5 100644 --- a/convert.c +++ b/convert.c @@ -1,5 +1,6 @@ #include "cache.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "object-store.h" #include "attr.h" diff --git a/credential.c b/credential.c index ea40a2a410..5244f3c12c 100644 --- a/credential.c +++ b/credential.c @@ -1,6 +1,7 @@ #include "cache.h" #include "config.h" #include "credential.h" +#include "gettext.h" #include "string-list.h" #include "run-command.h" #include "url.h" diff --git a/date.c b/date.c index 6f45eeb356..1fb2cd1b53 100644 --- a/date.c +++ b/date.c @@ -6,6 +6,7 @@ #include "cache.h" #include "date.h" +#include "gettext.h" /* * This is like mktime, but without normalization of tm_wday and tm_yday. diff --git a/delta-islands.c b/delta-islands.c index fe12c93005..1222b6a6cd 100644 --- a/delta-islands.c +++ b/delta-islands.c @@ -4,6 +4,7 @@ #include "object.h" #include "blob.h" #include "commit.h" +#include "gettext.h" #include "hex.h" #include "tag.h" #include "tree.h" diff --git a/diagnose.c b/diagnose.c index 5b398f0cff..169a55407f 100644 --- a/diagnose.c +++ b/diagnose.c @@ -4,6 +4,7 @@ #include "archive.h" #include "dir.h" #include "help.h" +#include "gettext.h" #include "hex.h" #include "strvec.h" #include "object-store.h" diff --git a/diff-lib.c b/diff-lib.c index 70b3578b90..a7e0400987 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -6,6 +6,7 @@ #include "commit.h" #include "diff.h" #include "diffcore.h" +#include "gettext.h" #include "hex.h" #include "revision.h" #include "cache-tree.h" diff --git a/diff-no-index.c b/diff-no-index.c index a3cf358baf..287a113bad 100644 --- a/diff-no-index.c +++ b/diff-no-index.c @@ -11,6 +11,7 @@ #include "tag.h" #include "diff.h" #include "diffcore.h" +#include "gettext.h" #include "revision.h" #include "log-tree.h" #include "parse-options.h" diff --git a/diff.c b/diff.c index 00d47281a1..00746f2f86 100644 --- a/diff.c +++ b/diff.c @@ -4,6 +4,7 @@ #include "cache.h" #include "alloc.h" #include "config.h" +#include "gettext.h" #include "tempfile.h" #include "quote.h" #include "diff.h" diff --git a/dir.c b/dir.c index d5bb199f4b..46f1bb6e5b 100644 --- a/dir.c +++ b/dir.c @@ -9,6 +9,7 @@ #include "alloc.h" #include "config.h" #include "dir.h" +#include "gettext.h" #include "object-store.h" #include "attr.h" #include "refs.h" diff --git a/editor.c b/editor.c index 008c04fe2f..58e790548d 100644 --- a/editor.c +++ b/editor.c @@ -1,5 +1,6 @@ #include "cache.h" #include "config.h" +#include "gettext.h" #include "strbuf.h" #include "strvec.h" #include "run-command.h" diff --git a/entry.c b/entry.c index c97cfa833b..acb76a61ac 100644 --- a/entry.c +++ b/entry.c @@ -2,6 +2,7 @@ #include "blob.h" #include "object-store.h" #include "dir.h" +#include "gettext.h" #include "hex.h" #include "streaming.h" #include "submodule.h" diff --git a/environment.c b/environment.c index 89d89110e4..82a1fc17d0 100644 --- a/environment.c +++ b/environment.c @@ -10,6 +10,7 @@ #include "cache.h" #include "branch.h" #include "environment.h" +#include "gettext.h" #include "repository.h" #include "config.h" #include "refs.h" diff --git a/exec-cmd.c b/exec-cmd.c index 0232bbc990..282d95af08 100644 --- a/exec-cmd.c +++ b/exec-cmd.c @@ -1,5 +1,6 @@ #include "cache.h" #include "exec-cmd.h" +#include "gettext.h" #include "quote.h" #include "strvec.h" diff --git a/fetch-pack.c b/fetch-pack.c index 4ddabb4ec7..359dce6afe 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -2,6 +2,7 @@ #include "alloc.h" #include "repository.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "lockfile.h" #include "refs.h" diff --git a/fsmonitor-ipc.c b/fsmonitor-ipc.c index 19d772f0f3..866828e299 100644 --- a/fsmonitor-ipc.c +++ b/fsmonitor-ipc.c @@ -1,5 +1,6 @@ #include "cache.h" #include "fsmonitor.h" +#include "gettext.h" #include "simple-ipc.h" #include "fsmonitor-ipc.h" #include "run-command.h" diff --git a/git.c b/git.c index ae2134f29a..22ce4f14b6 100644 --- a/git.c +++ b/git.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "config.h" #include "exec-cmd.h" +#include "gettext.h" #include "help.h" #include "run-command.h" #include "alias.h" diff --git a/gpg-interface.c b/gpg-interface.c index 855970bb93..632265691e 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -1,6 +1,7 @@ #include "cache.h" #include "commit.h" #include "config.h" +#include "gettext.h" #include "run-command.h" #include "strbuf.h" #include "dir.h" diff --git a/grep.c b/grep.c index 68e9328dfd..febb076a7e 100644 --- a/grep.c +++ b/grep.c @@ -1,5 +1,6 @@ #include "cache.h" #include "config.h" +#include "gettext.h" #include "grep.h" #include "hex.h" #include "object-store.h" diff --git a/http-fetch.c b/http-fetch.c index 8db35b9767..454933351b 100644 --- a/http-fetch.c +++ b/http-fetch.c @@ -1,6 +1,7 @@ #include "cache.h" #include "config.h" #include "exec-cmd.h" +#include "gettext.h" #include "hex.h" #include "http.h" #include "walker.h" diff --git a/imap-send.c b/imap-send.c index 93e9018439..c65a27219c 100644 --- a/imap-send.c +++ b/imap-send.c @@ -25,6 +25,7 @@ #include "config.h" #include "credential.h" #include "exec-cmd.h" +#include "gettext.h" #include "run-command.h" #include "parse-options.h" #if defined(NO_OPENSSL) && !defined(HAVE_OPENSSL_CSPRNG) diff --git a/list-objects-filter-options.h b/list-objects-filter-options.h index ef03b45132..65c6119e9d 100644 --- a/list-objects-filter-options.h +++ b/list-objects-filter-options.h @@ -1,6 +1,7 @@ #ifndef LIST_OBJECTS_FILTER_OPTIONS_H #define LIST_OBJECTS_FILTER_OPTIONS_H +#include "gettext.h" #include "object.h" #include "parse-options.h" #include "string-list.h" diff --git a/list-objects-filter.c b/list-objects-filter.c index 5d7b331660..298ca08711 100644 --- a/list-objects-filter.c +++ b/list-objects-filter.c @@ -1,6 +1,7 @@ #include "cache.h" #include "alloc.h" #include "dir.h" +#include "gettext.h" #include "hex.h" #include "tag.h" #include "commit.h" diff --git a/list-objects.c b/list-objects.c index ab5745bbfe..3906ac442d 100644 --- a/list-objects.c +++ b/list-objects.c @@ -1,6 +1,7 @@ #include "cache.h" #include "tag.h" #include "commit.h" +#include "gettext.h" #include "hex.h" #include "tree.h" #include "blob.h" diff --git a/lockfile.c b/lockfile.c index cc9a4b8428..ab6490a391 100644 --- a/lockfile.c +++ b/lockfile.c @@ -3,6 +3,7 @@ */ #include "cache.h" +#include "gettext.h" #include "lockfile.h" /* diff --git a/ls-refs.c b/ls-refs.c index 8091b0cca8..ae38889bf0 100644 --- a/ls-refs.c +++ b/ls-refs.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" #include "hex.h" #include "repository.h" #include "refs.h" diff --git a/merge-ort-wrappers.c b/merge-ort-wrappers.c index 748924a69b..c00dfbab1c 100644 --- a/merge-ort-wrappers.c +++ b/merge-ort-wrappers.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" #include "merge-ort.h" #include "merge-ort-wrappers.h" diff --git a/merge-ort.c b/merge-ort.c index 4c5be8ed91..a26cad5f91 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -26,6 +26,7 @@ #include "diff.h" #include "diffcore.h" #include "dir.h" +#include "gettext.h" #include "hex.h" #include "entry.h" #include "ll-merge.h" diff --git a/merge-recursive.c b/merge-recursive.c index 89731f4090..0b0255ebc8 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -17,6 +17,7 @@ #include "diff.h" #include "diffcore.h" #include "dir.h" +#include "gettext.h" #include "hex.h" #include "ll-merge.h" #include "lockfile.h" diff --git a/merge.c b/merge.c index 2c8b845684..da7fa652c2 100644 --- a/merge.c +++ b/merge.c @@ -1,6 +1,7 @@ #include "cache.h" #include "diff.h" #include "diffcore.h" +#include "gettext.h" #include "hex.h" #include "lockfile.h" #include "commit.h" diff --git a/midx.c b/midx.c index 47989f7ea7..e132ef250e 100644 --- a/midx.c +++ b/midx.c @@ -3,6 +3,7 @@ #include "config.h" #include "csum-file.h" #include "dir.h" +#include "gettext.h" #include "hex.h" #include "lockfile.h" #include "packfile.h" diff --git a/name-hash.c b/name-hash.c index cd009c7c8a..bb9eae55ac 100644 --- a/name-hash.c +++ b/name-hash.c @@ -6,6 +6,7 @@ * Copyright (C) 2008 Linus Torvalds */ #include "cache.h" +#include "gettext.h" #include "thread-utils.h" #include "trace2.h" #include "sparse-index.h" diff --git a/notes-merge.c b/notes-merge.c index 5b1a9ff13f..c8d0020b1a 100644 --- a/notes-merge.c +++ b/notes-merge.c @@ -1,5 +1,6 @@ #include "cache.h" #include "commit.h" +#include "gettext.h" #include "refs.h" #include "object-store.h" #include "repository.h" diff --git a/notes-utils.c b/notes-utils.c index d7d18e30f5..da08e2e8e5 100644 --- a/notes-utils.c +++ b/notes-utils.c @@ -1,6 +1,7 @@ #include "cache.h" #include "config.h" #include "commit.h" +#include "gettext.h" #include "refs.h" #include "notes-utils.h" #include "repository.h" diff --git a/object-file.c b/object-file.c index 8fab8dbe80..39660d49db 100644 --- a/object-file.c +++ b/object-file.c @@ -9,6 +9,7 @@ #include "git-compat-util.h" #include "alloc.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "string-list.h" #include "lockfile.h" diff --git a/object-name.c b/object-name.c index 69db1ec498..2c927bbded 100644 --- a/object-name.c +++ b/object-name.c @@ -1,5 +1,6 @@ #include "cache.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "tag.h" #include "commit.h" diff --git a/object.c b/object.c index 609fed1b73..45c9721b8c 100644 --- a/object.c +++ b/object.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" #include "hex.h" #include "object.h" #include "replace-object.h" diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index 891d9d2772..7dc7f0ba55 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "alloc.h" +#include "gettext.h" #include "hex.h" #include "object-store.h" #include "commit.h" diff --git a/pack-bitmap.c b/pack-bitmap.c index ca7c81b5c9..241ac9166c 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "alloc.h" #include "commit.h" +#include "gettext.h" #include "hex.h" #include "strbuf.h" #include "tag.h" diff --git a/pack-mtimes.c b/pack-mtimes.c index cd92fc1d86..afed632190 100644 --- a/pack-mtimes.c +++ b/pack-mtimes.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" #include "pack-mtimes.h" #include "object-store.h" #include "packfile.h" diff --git a/pack-revindex.c b/pack-revindex.c index 08dc160167..03c7e81f9d 100644 --- a/pack-revindex.c +++ b/pack-revindex.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" #include "pack-revindex.h" #include "object-store.h" #include "packfile.h" diff --git a/pack-write.c b/pack-write.c index 041e573bc1..87156f89d2 100644 --- a/pack-write.c +++ b/pack-write.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" #include "hex.h" #include "pack.h" #include "csum-file.h" diff --git a/packfile.c b/packfile.c index 2023df1b75..3290fde15a 100644 --- a/packfile.c +++ b/packfile.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "alloc.h" +#include "gettext.h" #include "hex.h" #include "list.h" #include "pack.h" diff --git a/parallel-checkout.c b/parallel-checkout.c index 2455aa356d..38c4dc665d 100644 --- a/parallel-checkout.c +++ b/parallel-checkout.c @@ -2,6 +2,7 @@ #include "alloc.h" #include "config.h" #include "entry.h" +#include "gettext.h" #include "hex.h" #include "parallel-checkout.h" #include "pkt-line.h" diff --git a/parse-options-cb.c b/parse-options-cb.c index d346dbe210..fbf4b01019 100644 --- a/parse-options-cb.c +++ b/parse-options-cb.c @@ -4,6 +4,7 @@ #include "cache.h" #include "commit.h" #include "color.h" +#include "gettext.h" #include "string-list.h" #include "strvec.h" #include "oid-array.h" diff --git a/parse-options.c b/parse-options.c index 6dd4c090e0..084b4f1062 100644 --- a/parse-options.c +++ b/parse-options.c @@ -4,6 +4,7 @@ #include "config.h" #include "commit.h" #include "color.h" +#include "gettext.h" #include "utf8.h" static int disallow_abbreviated_options; diff --git a/parse-options.h b/parse-options.h index 50d852f299..d57868eff9 100644 --- a/parse-options.h +++ b/parse-options.h @@ -1,6 +1,8 @@ #ifndef PARSE_OPTIONS_H #define PARSE_OPTIONS_H +#include "gettext.h" + /** * Refer to Documentation/technical/api-parse-options.txt for the API doc. */ diff --git a/path.c b/path.c index 632a051809..3f2702cbe4 100644 --- a/path.c +++ b/path.c @@ -2,6 +2,7 @@ * Utilities for paths and pathnames */ #include "cache.h" +#include "gettext.h" #include "hex.h" #include "repository.h" #include "strbuf.h" diff --git a/pathspec.c b/pathspec.c index ab70fcbe61..868b4d280c 100644 --- a/pathspec.c +++ b/pathspec.c @@ -1,6 +1,7 @@ #include "cache.h" #include "config.h" #include "dir.h" +#include "gettext.h" #include "pathspec.h" #include "attr.h" #include "strvec.h" diff --git a/pkt-line.c b/pkt-line.c index 1ea7f8600e..c8b90b2242 100644 --- a/pkt-line.c +++ b/pkt-line.c @@ -1,5 +1,6 @@ #include "cache.h" #include "pkt-line.h" +#include "gettext.h" #include "hex.h" #include "run-command.h" diff --git a/preload-index.c b/preload-index.c index 100f7a374d..4b45e1d691 100644 --- a/preload-index.c +++ b/preload-index.c @@ -5,6 +5,7 @@ #include "pathspec.h" #include "dir.h" #include "fsmonitor.h" +#include "gettext.h" #include "config.h" #include "progress.h" #include "thread-utils.h" diff --git a/pretty.c b/pretty.c index 05b557d096..9d7922dcc6 100644 --- a/pretty.c +++ b/pretty.c @@ -2,6 +2,7 @@ #include "alloc.h" #include "config.h" #include "commit.h" +#include "gettext.h" #include "hex.h" #include "utf8.h" #include "diff.h" diff --git a/promisor-remote.c b/promisor-remote.c index 1db566982e..a8dbb788e8 100644 --- a/promisor-remote.c +++ b/promisor-remote.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" #include "hex.h" #include "object-store.h" #include "promisor-remote.h" diff --git a/prune-packed.c b/prune-packed.c index e02f466c2e..cff5ad569c 100644 --- a/prune-packed.c +++ b/prune-packed.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" #include "object-store.h" #include "packfile.h" #include "progress.h" diff --git a/range-diff.c b/range-diff.c index 4bd65ab749..1bfc612e27 100644 --- a/range-diff.c +++ b/range-diff.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" #include "range-diff.h" #include "string-list.h" #include "run-command.h" diff --git a/reachable.c b/reachable.c index c9dab2a66b..b0f85046e9 100644 --- a/reachable.c +++ b/reachable.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" #include "hex.h" #include "refs.h" #include "tag.h" diff --git a/read-cache.c b/read-cache.c index 1bcf673271..63789ea5e2 100644 --- a/read-cache.c +++ b/read-cache.c @@ -18,6 +18,7 @@ #include "tree.h" #include "commit.h" #include "blob.h" +#include "gettext.h" #include "resolve-undo.h" #include "run-command.h" #include "strbuf.h" diff --git a/rebase-interactive.c b/rebase-interactive.c index 7407c59319..649c94e69a 100644 --- a/rebase-interactive.c +++ b/rebase-interactive.c @@ -1,5 +1,6 @@ #include "cache.h" #include "commit.h" +#include "gettext.h" #include "sequencer.h" #include "rebase-interactive.h" #include "strbuf.h" diff --git a/ref-filter.c b/ref-filter.c index 38141bce8d..9a830bedef 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -1,5 +1,6 @@ #include "cache.h" #include "alloc.h" +#include "gettext.h" #include "hex.h" #include "parse-options.h" #include "refs.h" diff --git a/ref-filter.h b/ref-filter.h index aa0eea4ecf..cc811c2cad 100644 --- a/ref-filter.h +++ b/ref-filter.h @@ -1,6 +1,7 @@ #ifndef REF_FILTER_H #define REF_FILTER_H +#include "gettext.h" #include "oid-array.h" #include "refs.h" #include "commit.h" diff --git a/reflog.c b/reflog.c index 04630f56ec..d1c3937431 100644 --- a/reflog.c +++ b/reflog.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" #include "object-store.h" #include "reflog.h" #include "refs.h" diff --git a/refs.c b/refs.c index 4e5cc73fb1..8684f4610f 100644 --- a/refs.c +++ b/refs.c @@ -6,6 +6,7 @@ #include "alloc.h" #include "config.h" #include "hashmap.h" +#include "gettext.h" #include "hex.h" #include "lockfile.h" #include "iterator.h" diff --git a/refs/files-backend.c b/refs/files-backend.c index 31bc5c45ee..de3628ff3f 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1,5 +1,6 @@ #include "../cache.h" #include "../config.h" +#include "../gettext.h" #include "../hex.h" #include "../refs.h" #include "refs-internal.h" diff --git a/refs/packed-backend.c b/refs/packed-backend.c index 6f97518599..3334c07003 100644 --- a/refs/packed-backend.c +++ b/refs/packed-backend.c @@ -1,6 +1,7 @@ #include "../cache.h" #include "../alloc.h" #include "../config.h" +#include "../gettext.h" #include "../hex.h" #include "../refs.h" #include "refs-internal.h" diff --git a/remote-curl.c b/remote-curl.c index ed7e3a043a..943cd6fe6c 100644 --- a/remote-curl.c +++ b/remote-curl.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "alloc.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "remote.h" #include "connect.h" diff --git a/remote.c b/remote.c index 2daddb85cb..edb1e07497 100644 --- a/remote.c +++ b/remote.c @@ -1,6 +1,7 @@ #include "cache.h" #include "alloc.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "remote.h" #include "urlmatch.h" diff --git a/replace-object.c b/replace-object.c index 0cf056c4fb..9e30e0362b 100644 --- a/replace-object.c +++ b/replace-object.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" #include "hex.h" #include "oidmap.h" #include "object-store.h" diff --git a/rerere.c b/rerere.c index a67abaab07..9428cbca7b 100644 --- a/rerere.c +++ b/rerere.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "alloc.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "lockfile.h" #include "string-list.h" diff --git a/rerere.h b/rerere.h index c32d79c3bd..7899dc2174 100644 --- a/rerere.h +++ b/rerere.h @@ -1,6 +1,7 @@ #ifndef RERERE_H #define RERERE_H +#include "gettext.h" #include "string-list.h" struct pathspec; diff --git a/reset.c b/reset.c index 58b3829ff7..604d9325b7 100644 --- a/reset.c +++ b/reset.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "cache-tree.h" +#include "gettext.h" #include "hex.h" #include "lockfile.h" #include "refs.h" diff --git a/revision.c b/revision.c index e4c066e90b..7423e23327 100644 --- a/revision.c +++ b/revision.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "alloc.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "object-store.h" #include "tag.h" diff --git a/run-command.c b/run-command.c index ba617655b2..2c8b4cd9bf 100644 --- a/run-command.c +++ b/run-command.c @@ -1,6 +1,7 @@ #include "cache.h" #include "run-command.h" #include "exec-cmd.h" +#include "gettext.h" #include "sigchain.h" #include "strvec.h" #include "thread-utils.h" diff --git a/send-pack.c b/send-pack.c index 423a5cfe22..f531cb4821 100644 --- a/send-pack.c +++ b/send-pack.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "config.h" #include "commit.h" +#include "gettext.h" #include "hex.h" #include "refs.h" #include "object-store.h" diff --git a/sequencer.c b/sequencer.c index 3be23d7ca2..0df5172630 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1,6 +1,7 @@ #include "cache.h" #include "alloc.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "lockfile.h" #include "dir.h" diff --git a/setup.c b/setup.c index cefd5f63c4..8a4ccee4c2 100644 --- a/setup.c +++ b/setup.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" #include "repository.h" #include "config.h" #include "dir.h" diff --git a/sideband.c b/sideband.c index 85bddfdcd4..4905cf9b32 100644 --- a/sideband.c +++ b/sideband.c @@ -1,6 +1,7 @@ #include "cache.h" #include "color.h" #include "config.h" +#include "gettext.h" #include "sideband.h" #include "help.h" #include "pkt-line.h" diff --git a/sparse-index.c b/sparse-index.c index 63216b3e57..fdae9011b8 100644 --- a/sparse-index.c +++ b/sparse-index.c @@ -1,5 +1,6 @@ #include "cache.h" #include "alloc.h" +#include "gettext.h" #include "repository.h" #include "sparse-index.h" #include "tree.h" diff --git a/split-index.c b/split-index.c index 95ecfa5319..c98807c655 100644 --- a/split-index.c +++ b/split-index.c @@ -1,5 +1,6 @@ #include "cache.h" #include "alloc.h" +#include "gettext.h" #include "split-index.h" #include "ewah/ewok.h" diff --git a/strbuf.c b/strbuf.c index 8800830ebf..15209777d5 100644 --- a/strbuf.c +++ b/strbuf.c @@ -1,5 +1,6 @@ #include "cache.h" #include "alloc.h" +#include "gettext.h" #include "hex.h" #include "refs.h" #include "string-list.h" diff --git a/submodule-config.c b/submodule-config.c index 89a7bf0a93..38663801aa 100644 --- a/submodule-config.c +++ b/submodule-config.c @@ -1,6 +1,7 @@ #include "cache.h" #include "alloc.h" #include "dir.h" +#include "gettext.h" #include "hex.h" #include "repository.h" #include "config.h" diff --git a/submodule.c b/submodule.c index 0baf97cf77..8b551e5327 100644 --- a/submodule.c +++ b/submodule.c @@ -7,6 +7,7 @@ #include "dir.h" #include "diff.h" #include "commit.h" +#include "gettext.h" #include "hex.h" #include "revision.h" #include "run-command.h" diff --git a/symlinks.c b/symlinks.c index c667baa949..c35c8d4408 100644 --- a/symlinks.c +++ b/symlinks.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" static int threaded_check_leading_path(struct cache_def *cache, const char *name, int len, int warn_on_lstat_err); diff --git a/t/helper/test-cache-tree.c b/t/helper/test-cache-tree.c index 615e648e55..8b7a8fce1e 100644 --- a/t/helper/test-cache-tree.c +++ b/t/helper/test-cache-tree.c @@ -1,6 +1,7 @@ #define USE_THE_INDEX_VARIABLE #include "test-tool.h" #include "cache.h" +#include "gettext.h" #include "hex.h" #include "tree.h" #include "cache-tree.h" diff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c index 1e975df904..68bbc41b33 100644 --- a/t/helper/test-fast-rebase.c +++ b/t/helper/test-fast-rebase.c @@ -15,6 +15,7 @@ #include "cache.h" #include "cache-tree.h" #include "commit.h" +#include "gettext.h" #include "hex.h" #include "lockfile.h" #include "merge-ort.h" diff --git a/t/helper/test-reach.c b/t/helper/test-reach.c index 05d56267a9..09c711038c 100644 --- a/t/helper/test-reach.c +++ b/t/helper/test-reach.c @@ -4,6 +4,7 @@ #include "commit.h" #include "commit-reach.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "parse-options.h" #include "ref-filter.h" diff --git a/t/helper/test-serve-v2.c b/t/helper/test-serve-v2.c index 824e5c0a95..497d72058d 100644 --- a/t/helper/test-serve-v2.c +++ b/t/helper/test-serve-v2.c @@ -1,5 +1,6 @@ #include "test-tool.h" #include "cache.h" +#include "gettext.h" #include "parse-options.h" #include "serve.h" diff --git a/trailer.c b/trailer.c index 72c3fed5c6..9eb1b76119 100644 --- a/trailer.c +++ b/trailer.c @@ -1,6 +1,7 @@ #include "cache.h" #include "alloc.h" #include "config.h" +#include "gettext.h" #include "string-list.h" #include "run-command.h" #include "commit.h" diff --git a/transport-helper.c b/transport-helper.c index 82ac63e260..105bb801c2 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -4,6 +4,7 @@ #include "run-command.h" #include "commit.h" #include "diff.h" +#include "gettext.h" #include "hex.h" #include "revision.h" #include "remote.h" diff --git a/tree-walk.c b/tree-walk.c index 0e2f5ceb71..38b6556478 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -2,6 +2,7 @@ #include "tree-walk.h" #include "alloc.h" #include "dir.h" +#include "gettext.h" #include "hex.h" #include "object-store.h" #include "tree.h" diff --git a/unpack-trees.c b/unpack-trees.c index a75fb9f05b..84e0d2e8af 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -3,6 +3,7 @@ #include "repository.h" #include "config.h" #include "dir.h" +#include "gettext.h" #include "hex.h" #include "tree.h" #include "tree-walk.h" diff --git a/upload-pack.c b/upload-pack.c index 41b9362cf1..eea9e6a6e8 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -1,5 +1,6 @@ #include "cache.h" #include "config.h" +#include "gettext.h" #include "hex.h" #include "refs.h" #include "pkt-line.h" diff --git a/usage.c b/usage.c index 5a7c6c346c..40a1c5a433 100644 --- a/usage.c +++ b/usage.c @@ -3,8 +3,8 @@ * * Copyright (C) Linus Torvalds, 2005 */ -#include "git-compat-util.h" #include "cache.h" +#include "gettext.h" static void vreportf(const char *prefix, const char *err, va_list params) { diff --git a/walker.c b/walker.c index c046936378..b642fd2c3b 100644 --- a/walker.c +++ b/walker.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "gettext.h" #include "hex.h" #include "walker.h" #include "repository.h" diff --git a/worktree.c b/worktree.c index cbb0db2d7c..09eb522e5a 100644 --- a/worktree.c +++ b/worktree.c @@ -1,5 +1,6 @@ #include "cache.h" #include "alloc.h" +#include "gettext.h" #include "repository.h" #include "refs.h" #include "strbuf.h" diff --git a/wrapper.c b/wrapper.c index 299d6489a6..0d4ceba6fc 100644 --- a/wrapper.c +++ b/wrapper.c @@ -3,6 +3,7 @@ */ #include "cache.h" #include "config.h" +#include "gettext.h" static intmax_t count_fsync_writeout_only; static intmax_t count_fsync_hardware_flush; diff --git a/wt-status.c b/wt-status.c index 90525bd26f..d15f2b0e7e 100644 --- a/wt-status.c +++ b/wt-status.c @@ -4,6 +4,7 @@ #include "dir.h" #include "commit.h" #include "diff.h" +#include "gettext.h" #include "hex.h" #include "revision.h" #include "diffcore.h" -- cgit 1.2.3-korg From d5ebb50dcb2bae27cf9f233088f7258f21e72be7 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Tue, 21 Mar 2023 06:26:01 +0000 Subject: wrapper.h: move declarations for wrapper.c functions from cache.h Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- apply.c | 1 + builtin/am.c | 1 + builtin/bisect.c | 1 + builtin/branch.c | 1 + builtin/bugreport.c | 2 +- builtin/config.c | 1 + builtin/credential-cache.c | 1 + builtin/difftool.c | 1 + builtin/fast-import.c | 1 + builtin/fmt-merge-msg.c | 1 + builtin/gc.c | 1 + builtin/get-tar-commit-id.c | 1 + builtin/index-pack.c | 1 + builtin/init-db.c | 1 + builtin/merge.c | 1 + builtin/pack-objects.c | 1 + builtin/rebase.c | 1 + builtin/receive-pack.c | 1 + builtin/rerere.c | 1 + builtin/unpack-file.c | 1 + builtin/worktree.c | 1 + cache.h | 32 -------------------------------- commit-graph.c | 1 + compat/mingw.c | 1 + compat/terminal.c | 1 + config.c | 1 + convert.c | 1 + copy.c | 1 + csum-file.c | 1 + daemon.c | 1 + diff.c | 1 + dir.c | 1 + entry.c | 1 + environment.c | 1 + fetch-pack.c | 1 + gpg-interface.c | 1 + http-backend.c | 1 + imap-send.c | 1 + ll-merge.c | 1 + merge-recursive.c | 1 + notes-merge.c | 1 + object-file.c | 1 + packfile.c | 1 + parallel-checkout.c | 1 + pkt-line.c | 1 + read-cache.c | 1 + rebase-interactive.c | 1 + refs.c | 1 + refs/files-backend.c | 3 ++- rerere.c | 1 + sequencer.c | 1 + server-info.c | 1 + shallow.c | 1 + strbuf.c | 1 + streaming.c | 1 + t/helper/test-delta.c | 1 + t/helper/test-fsmonitor-client.c | 1 + t/helper/test-read-cache.c | 1 + tag.c | 1 + tempfile.c | 1 + trace.c | 1 + transport-helper.c | 1 + transport.c | 1 + usage.c | 1 + worktree.c | 1 + wrapper.c | 1 + wrapper.h | 36 ++++++++++++++++++++++++++++++++++++ write-or-die.c | 1 + 68 files changed, 103 insertions(+), 34 deletions(-) create mode 100644 wrapper.h (limited to 'commit-graph.c') diff --git a/apply.c b/apply.c index e5e11b8579..373565a7ba 100644 --- a/apply.c +++ b/apply.c @@ -26,6 +26,7 @@ #include "rerere.h" #include "apply.h" #include "entry.h" +#include "wrapper.h" struct gitdiff_data { struct strbuf *root; diff --git a/builtin/am.c b/builtin/am.c index 14347ecf9a..37f82b3eb4 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -38,6 +38,7 @@ #include "packfile.h" #include "repository.h" #include "pretty.h" +#include "wrapper.h" /** * Returns the length of the first line of msg. diff --git a/builtin/bisect.c b/builtin/bisect.c index 09188e554b..31cc57e45b 100644 --- a/builtin/bisect.c +++ b/builtin/bisect.c @@ -11,6 +11,7 @@ #include "prompt.h" #include "quote.h" #include "revision.h" +#include "wrapper.h" static GIT_PATH_FUNC(git_path_bisect_terms, "BISECT_TERMS") static GIT_PATH_FUNC(git_path_bisect_expected_rev, "BISECT_EXPECTED_REV") diff --git a/builtin/branch.c b/builtin/branch.c index 56dbee97d2..98475ea532 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -26,6 +26,7 @@ #include "worktree.h" #include "help.h" #include "commit-reach.h" +#include "wrapper.h" static const char * const builtin_branch_usage[] = { N_("git branch [] [-r | -a] [--merged] [--no-merged]"), diff --git a/builtin/bugreport.c b/builtin/bugreport.c index b5dfad4e12..160590e4ef 100644 --- a/builtin/bugreport.c +++ b/builtin/bugreport.c @@ -8,7 +8,7 @@ #include "hook.h" #include "hook-list.h" #include "diagnose.h" - +#include "wrapper.h" static void get_system_info(struct strbuf *sys_info) { diff --git a/builtin/config.c b/builtin/config.c index 42e6b8d348..1c1e006ff3 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -9,6 +9,7 @@ #include "urlmatch.h" #include "quote.h" #include "worktree.h" +#include "wrapper.h" static const char *const builtin_config_usage[] = { N_("git config []"), diff --git a/builtin/credential-cache.c b/builtin/credential-cache.c index 25f2f71c21..af56a44923 100644 --- a/builtin/credential-cache.c +++ b/builtin/credential-cache.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "gettext.h" #include "parse-options.h" +#include "wrapper.h" #ifndef NO_UNIX_SOCKETS diff --git a/builtin/difftool.c b/builtin/difftool.c index ed06db1208..59465c39f1 100644 --- a/builtin/difftool.c +++ b/builtin/difftool.c @@ -27,6 +27,7 @@ #include "object-store.h" #include "dir.h" #include "entry.h" +#include "wrapper.h" static int trust_exit_code; diff --git a/builtin/fast-import.c b/builtin/fast-import.c index 7307c4657f..3300b7f30f 100644 --- a/builtin/fast-import.c +++ b/builtin/fast-import.c @@ -23,6 +23,7 @@ #include "commit-reach.h" #include "khash.h" #include "date.h" +#include "wrapper.h" #define PACK_ID_BITS 16 #define MAX_PACK_ID ((1<] [--log[=] | --no-log] [--file ]"), diff --git a/builtin/gc.c b/builtin/gc.c index ef063fc828..2107e3d1f2 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -35,6 +35,7 @@ #include "exec-cmd.h" #include "gettext.h" #include "hook.h" +#include "wrapper.h" #define FAILED_RUN "failed to run %s" diff --git a/builtin/get-tar-commit-id.c b/builtin/get-tar-commit-id.c index 491af9202d..6745796998 100644 --- a/builtin/get-tar-commit-id.c +++ b/builtin/get-tar-commit-id.c @@ -6,6 +6,7 @@ #include "tar.h" #include "builtin.h" #include "quote.h" +#include "wrapper.h" static const char builtin_get_tar_commit_id_usage[] = "git get-tar-commit-id"; diff --git a/builtin/index-pack.c b/builtin/index-pack.c index bae5b05403..2393897cb8 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -19,6 +19,7 @@ #include "object-store.h" #include "replace-object.h" #include "promisor-remote.h" +#include "wrapper.h" static const char index_pack_usage[] = "git index-pack [-v] [-o ] [--keep | --keep=] [--[no-]rev-index] [--verify] [--strict] ( | --stdin [--fix-thin] [])"; diff --git a/builtin/init-db.c b/builtin/init-db.c index 6f724f694f..a5d4f5c8ec 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -12,6 +12,7 @@ #include "exec-cmd.h" #include "parse-options.h" #include "worktree.h" +#include "wrapper.h" #ifndef DEFAULT_GIT_TEMPLATE_DIR #define DEFAULT_GIT_TEMPLATE_DIR "/usr/share/git-core/templates" diff --git a/builtin/merge.c b/builtin/merge.c index 38243e55c5..f4f4a220f3 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -49,6 +49,7 @@ #include "commit-reach.h" #include "wt-status.h" #include "commit-graph.h" +#include "wrapper.h" #define DEFAULT_TWOHEAD (1<<0) #define DEFAULT_OCTOPUS (1<<1) diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 1ca800c7c5..8b55a088a7 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -40,6 +40,7 @@ #include "shallow.h" #include "promisor-remote.h" #include "pack-mtimes.h" +#include "wrapper.h" /* * Objects we are going to pack are collected in the `to_pack` structure. diff --git a/builtin/rebase.c b/builtin/rebase.c index a3f8be8888..d2f8f703d6 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -32,6 +32,7 @@ #include "rebase-interactive.h" #include "reset.h" #include "hook.h" +#include "wrapper.h" static char const * const builtin_rebase_usage[] = { N_("git rebase [-i] [options] [--exec ] " diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index aec5ee930b..ae49ea8c2a 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -33,6 +33,7 @@ #include "commit-reach.h" #include "worktree.h" #include "shallow.h" +#include "wrapper.h" static const char * const receive_pack_usage[] = { N_("git receive-pack "), diff --git a/builtin/rerere.c b/builtin/rerere.c index 24c7875572..d4a03707b1 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -6,6 +6,7 @@ #include "parse-options.h" #include "string-list.h" #include "rerere.h" +#include "wrapper.h" #include "xdiff/xdiff.h" #include "xdiff-interface.h" #include "pathspec.h" diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c index e9b105a539..4cbb403929 100644 --- a/builtin/unpack-file.c +++ b/builtin/unpack-file.c @@ -2,6 +2,7 @@ #include "config.h" #include "hex.h" #include "object-store.h" +#include "wrapper.h" static char *create_temp_file(struct object_id *oid) { diff --git a/builtin/worktree.c b/builtin/worktree.c index ed614ffddc..1533b4ab43 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -16,6 +16,7 @@ #include "submodule.h" #include "utf8.h" #include "worktree.h" +#include "wrapper.h" #include "quote.h" #define BUILTIN_WORKTREE_ADD_USAGE \ diff --git a/cache.h b/cache.h index 705c41992b..31c722533f 100644 --- a/cache.h +++ b/cache.h @@ -1085,10 +1085,6 @@ const char *repo_find_unique_abbrev(struct repository *r, const struct object_id int repo_find_unique_abbrev_r(struct repository *r, char *hex, const struct object_id *oid, int len); #define find_unique_abbrev_r(hex, oid, len) repo_find_unique_abbrev_r(the_repository, hex, oid, len) -/* set default permissions by passing mode arguments to open(2) */ -int git_mkstemps_mode(char *pattern, int suffix_len, int mode); -int git_mkstemp_mode(char *pattern, int mode); - /* * NOTE NOTE NOTE!! * @@ -1423,31 +1419,6 @@ static inline int batch_fsync_enabled(enum fsync_component component) return (fsync_components & component) && (fsync_method == FSYNC_METHOD_BATCH); } -ssize_t read_in_full(int fd, void *buf, size_t count); -ssize_t write_in_full(int fd, const void *buf, size_t count); -ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset); - -static inline ssize_t write_str_in_full(int fd, const char *str) -{ - return write_in_full(fd, str, strlen(str)); -} - -/** - * Open (and truncate) the file at path, write the contents of buf to it, - * and close it. Dies if any errors are encountered. - */ -void write_file_buf(const char *path, const char *buf, size_t len); - -/** - * Like write_file_buf(), but format the contents into a buffer first. - * Additionally, write_file() will append a newline if one is not already - * present, making it convenient to write text files: - * - * write_file(path, "counter: %d", ctr); - */ -__attribute__((format (printf, 2, 3))) -void write_file(const char *path, const char *fmt, ...); - /* pager.c */ void setup_pager(void); int pager_in_use(void); @@ -1571,7 +1542,4 @@ int versioncmp(const char *s1, const char *s2); */ int print_sha1_ellipsis(void); -/* Return 1 if the file is empty or does not exists, 0 otherwise. */ -int is_empty_or_missing_file(const char *filename); - #endif /* CACHE_H */ diff --git a/commit-graph.c b/commit-graph.c index 8f21a0a0c2..5481736c76 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -22,6 +22,7 @@ #include "json-writer.h" #include "trace2.h" #include "chunk-format.h" +#include "wrapper.h" void git_test_write_commit_graph_or_die(void) { diff --git a/compat/mingw.c b/compat/mingw.c index cbcd03aea9..d48899bf7b 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -11,6 +11,7 @@ #include "../alloc.h" #include "win32/lazyload.h" #include "../config.h" +#include "../wrapper.h" #include "dir.h" #include "gettext.h" #define SECURITY_WIN32 diff --git a/compat/terminal.c b/compat/terminal.c index afebe6b249..ed2b30b38f 100644 --- a/compat/terminal.c +++ b/compat/terminal.c @@ -6,6 +6,7 @@ #include "run-command.h" #include "string-list.h" #include "hashmap.h" +#include "wrapper.h" #if defined(HAVE_DEV_TTY) || defined(GIT_WINDOWS_NATIVE) diff --git a/config.c b/config.c index 6815919ec3..5b1a5d5205 100644 --- a/config.c +++ b/config.c @@ -28,6 +28,7 @@ #include "replace-object.h" #include "refs.h" #include "worktree.h" +#include "wrapper.h" struct config_source { struct config_source *prev; diff --git a/convert.c b/convert.c index 2bd54244b5..da06e2f51c 100644 --- a/convert.c +++ b/convert.c @@ -11,6 +11,7 @@ #include "sub-process.h" #include "utf8.h" #include "ll-merge.h" +#include "wrapper.h" /* * convert.c - convert a file when checking it out and checking it in. diff --git a/copy.c b/copy.c index 4de6a110f0..c3250f0822 100644 --- a/copy.c +++ b/copy.c @@ -1,4 +1,5 @@ #include "cache.h" +#include "wrapper.h" int copy_fd(int ifd, int ofd) { diff --git a/csum-file.c b/csum-file.c index cce13c0f04..2d22f80d90 100644 --- a/csum-file.c +++ b/csum-file.c @@ -10,6 +10,7 @@ #include "cache.h" #include "progress.h" #include "csum-file.h" +#include "wrapper.h" static void verify_buffer_or_die(struct hashfile *f, const void *buf, diff --git a/daemon.c b/daemon.c index bb795ca3ca..e35604e194 100644 --- a/daemon.c +++ b/daemon.c @@ -6,6 +6,7 @@ #include "run-command.h" #include "strbuf.h" #include "string-list.h" +#include "wrapper.h" #ifdef NO_INITGROUPS #define initgroups(x, y) (0) /* nothing */ diff --git a/diff.c b/diff.c index 1b0be99c06..1b0b24c21c 100644 --- a/diff.c +++ b/diff.c @@ -33,6 +33,7 @@ #include "promisor-remote.h" #include "dir.h" #include "strmap.h" +#include "wrapper.h" #ifdef NO_FAST_WORKING_DIRECTORY #define FAST_WORKING_DIRECTORY 0 diff --git a/dir.c b/dir.c index c72481c60e..b57c770e68 100644 --- a/dir.c +++ b/dir.c @@ -21,6 +21,7 @@ #include "ewah/ewok.h" #include "fsmonitor.h" #include "submodule-config.h" +#include "wrapper.h" /* * Tells read_directory_recursive how a file or directory should be treated. diff --git a/entry.c b/entry.c index acb76a61ac..70212af260 100644 --- a/entry.c +++ b/entry.c @@ -10,6 +10,7 @@ #include "fsmonitor.h" #include "entry.h" #include "parallel-checkout.h" +#include "wrapper.h" static void create_directories(const char *path, int path_len, const struct checkout *state) diff --git a/environment.c b/environment.c index c69571f0b2..bf02f3cf48 100644 --- a/environment.c +++ b/environment.c @@ -23,6 +23,7 @@ #include "tmp-objdir.h" #include "chdir-notify.h" #include "shallow.h" +#include "wrapper.h" int trust_executable_bit = 1; int trust_ctime = 1; diff --git a/fetch-pack.c b/fetch-pack.c index 359dce6afe..c119080140 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -30,6 +30,7 @@ #include "commit-graph.h" #include "sigchain.h" #include "mergesort.h" +#include "wrapper.h" static int transfer_unpack_limit = -1; static int fetch_unpack_limit = -1; diff --git a/gpg-interface.c b/gpg-interface.c index f9c5b6c3f5..6644701fda 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -10,6 +10,7 @@ #include "sigchain.h" #include "tempfile.h" #include "alias.h" +#include "wrapper.h" static int git_gpg_config(const char *, const char *, void *); diff --git a/http-backend.c b/http-backend.c index 7e7c19e66b..42e6c2596e 100644 --- a/http-backend.c +++ b/http-backend.c @@ -16,6 +16,7 @@ #include "object-store.h" #include "protocol.h" #include "date.h" +#include "wrapper.h" static const char content_type[] = "Content-Type"; static const char content_length[] = "Content-Length"; diff --git a/imap-send.c b/imap-send.c index c65a27219c..aa5b2f252d 100644 --- a/imap-send.c +++ b/imap-send.c @@ -28,6 +28,7 @@ #include "gettext.h" #include "run-command.h" #include "parse-options.h" +#include "wrapper.h" #if defined(NO_OPENSSL) && !defined(HAVE_OPENSSL_CSPRNG) typedef void *SSL; #endif diff --git a/ll-merge.c b/ll-merge.c index 130d26501c..8be38d3bd4 100644 --- a/ll-merge.c +++ b/ll-merge.c @@ -11,6 +11,7 @@ #include "run-command.h" #include "ll-merge.h" #include "quote.h" +#include "wrapper.h" struct ll_merge_driver; diff --git a/merge-recursive.c b/merge-recursive.c index 0b0255ebc8..f918cea4c6 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -30,6 +30,7 @@ #include "tag.h" #include "tree-walk.h" #include "unpack-trees.h" +#include "wrapper.h" #include "xdiff-interface.h" struct merge_options_internal { diff --git a/notes-merge.c b/notes-merge.c index c8d0020b1a..ba2970f070 100644 --- a/notes-merge.c +++ b/notes-merge.c @@ -15,6 +15,7 @@ #include "strbuf.h" #include "notes-utils.h" #include "commit-reach.h" +#include "wrapper.h" struct notes_merge_pair { struct object_id obj, base, local, remote; diff --git a/object-file.c b/object-file.c index bee41b3047..bdf68763a5 100644 --- a/object-file.c +++ b/object-file.c @@ -38,6 +38,7 @@ #include "promisor-remote.h" #include "submodule.h" #include "fsck.h" +#include "wrapper.h" /* The maximum size for an object header. */ #define MAX_HEADER_LEN 32 diff --git a/packfile.c b/packfile.c index 3290fde15a..8c117ccee2 100644 --- a/packfile.c +++ b/packfile.c @@ -20,6 +20,7 @@ #include "midx.h" #include "commit-graph.h" #include "promisor-remote.h" +#include "wrapper.h" char *odb_pack_name(struct strbuf *buf, const unsigned char *hash, diff --git a/parallel-checkout.c b/parallel-checkout.c index 38c4dc665d..50fd7fe31e 100644 --- a/parallel-checkout.c +++ b/parallel-checkout.c @@ -12,6 +12,7 @@ #include "streaming.h" #include "thread-utils.h" #include "trace2.h" +#include "wrapper.h" struct pc_worker { struct child_process cp; diff --git a/pkt-line.c b/pkt-line.c index c8b90b2242..30469eb4d8 100644 --- a/pkt-line.c +++ b/pkt-line.c @@ -3,6 +3,7 @@ #include "gettext.h" #include "hex.h" #include "run-command.h" +#include "wrapper.h" char packet_buffer[LARGE_PACKET_MAX]; static const char *packet_trace_prefix = "git"; diff --git a/read-cache.c b/read-cache.c index 63789ea5e2..9a8d5fe97e 100644 --- a/read-cache.c +++ b/read-cache.c @@ -32,6 +32,7 @@ #include "csum-file.h" #include "promisor-remote.h" #include "hook.h" +#include "wrapper.h" /* Mask for the name length in ce_flags in the on-disk index */ diff --git a/rebase-interactive.c b/rebase-interactive.c index 649c94e69a..7c885c35bf 100644 --- a/rebase-interactive.c +++ b/rebase-interactive.c @@ -7,6 +7,7 @@ #include "commit-slab.h" #include "config.h" #include "dir.h" +#include "wrapper.h" static const char edit_todo_list_advice[] = N_("You can fix this with 'git rebase --edit-todo' " diff --git a/refs.c b/refs.c index 8684f4610f..385051752f 100644 --- a/refs.c +++ b/refs.c @@ -24,6 +24,7 @@ #include "sigchain.h" #include "date.h" #include "commit.h" +#include "wrapper.h" /* * List of all available backends diff --git a/refs/files-backend.c b/refs/files-backend.c index de3628ff3f..eb14d124e3 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -13,7 +13,8 @@ #include "../object.h" #include "../dir.h" #include "../chdir-notify.h" -#include "worktree.h" +#include "../worktree.h" +#include "../wrapper.h" /* * This backend uses the following flags in `ref_update::flags` for diff --git a/rerere.c b/rerere.c index c3258e1390..b5ccbecdcd 100644 --- a/rerere.c +++ b/rerere.c @@ -16,6 +16,7 @@ #include "object-store.h" #include "hash-lookup.h" #include "strmap.h" +#include "wrapper.h" #define RESOLVED 0 #define PUNTED 1 diff --git a/sequencer.c b/sequencer.c index c61c1fc4d8..aa7983f5b4 100644 --- a/sequencer.c +++ b/sequencer.c @@ -41,6 +41,7 @@ #include "rebase-interactive.h" #include "reset.h" #include "branch.h" +#include "wrapper.h" #define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION" diff --git a/server-info.c b/server-info.c index 7864337705..ae96d784e5 100644 --- a/server-info.c +++ b/server-info.c @@ -10,6 +10,7 @@ #include "packfile.h" #include "object-store.h" #include "strbuf.h" +#include "wrapper.h" struct update_info_ctx { FILE *cur_fp; diff --git a/shallow.c b/shallow.c index c5433a4fd3..7fcba5f6d0 100644 --- a/shallow.c +++ b/shallow.c @@ -17,6 +17,7 @@ #include "list-objects.h" #include "commit-reach.h" #include "shallow.h" +#include "wrapper.h" void set_alternate_shallow_file(struct repository *r, const char *path, int override) { diff --git a/strbuf.c b/strbuf.c index 9633e37b62..70a83e7980 100644 --- a/strbuf.c +++ b/strbuf.c @@ -8,6 +8,7 @@ #include "string-list.h" #include "utf8.h" #include "date.h" +#include "wrapper.h" int starts_with(const char *str, const char *prefix) { diff --git a/streaming.c b/streaming.c index 27841dc1d9..6c69f59504 100644 --- a/streaming.c +++ b/streaming.c @@ -7,6 +7,7 @@ #include "object-store.h" #include "replace-object.h" #include "packfile.h" +#include "wrapper.h" typedef int (*open_istream_fn)(struct git_istream *, struct repository *, diff --git a/t/helper/test-delta.c b/t/helper/test-delta.c index b15481ea59..6609fcbc12 100644 --- a/t/helper/test-delta.c +++ b/t/helper/test-delta.c @@ -12,6 +12,7 @@ #include "git-compat-util.h" #include "delta.h" #include "cache.h" +#include "wrapper.h" static const char usage_str[] = "test-tool delta (-d|-p) "; diff --git a/t/helper/test-fsmonitor-client.c b/t/helper/test-fsmonitor-client.c index 54a4856c48..c43fc976b8 100644 --- a/t/helper/test-fsmonitor-client.c +++ b/t/helper/test-fsmonitor-client.c @@ -9,6 +9,7 @@ #include "fsmonitor-ipc.h" #include "thread-utils.h" #include "trace2.h" +#include "wrapper.h" #ifndef HAVE_FSMONITOR_DAEMON_BACKEND int cmd__fsmonitor_client(int argc, const char **argv) diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c index 23e9e27109..84818363d5 100644 --- a/t/helper/test-read-cache.c +++ b/t/helper/test-read-cache.c @@ -2,6 +2,7 @@ #include "test-tool.h" #include "cache.h" #include "config.h" +#include "wrapper.h" int cmd__read_cache(int argc, const char **argv) { diff --git a/tag.c b/tag.c index 18b718cca6..3408bb9433 100644 --- a/tag.c +++ b/tag.c @@ -8,6 +8,7 @@ #include "gpg-interface.h" #include "hex.h" #include "packfile.h" +#include "wrapper.h" const char *tag_type = "tag"; diff --git a/tempfile.c b/tempfile.c index e27048f970..cdd2cab3ba 100644 --- a/tempfile.c +++ b/tempfile.c @@ -45,6 +45,7 @@ #include "cache.h" #include "tempfile.h" #include "sigchain.h" +#include "wrapper.h" static VOLATILE_LIST_HEAD(tempfile_list); diff --git a/trace.c b/trace.c index 2b41c683fc..de004f6298 100644 --- a/trace.c +++ b/trace.c @@ -24,6 +24,7 @@ #include "cache.h" #include "abspath.h" #include "quote.h" +#include "wrapper.h" struct trace_key trace_default_key = { "GIT_TRACE", 0, 0, 0 }; struct trace_key trace_perf_key = TRACE_KEY_INIT(PERFORMANCE); diff --git a/transport-helper.c b/transport-helper.c index 105bb801c2..09048eab48 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -16,6 +16,7 @@ #include "refspec.h" #include "transport-internal.h" #include "protocol.h" +#include "wrapper.h" static int debug; diff --git a/transport.c b/transport.c index 80059124c0..c6179b801e 100644 --- a/transport.c +++ b/transport.c @@ -26,6 +26,7 @@ #include "object-store.h" #include "color.h" #include "bundle-uri.h" +#include "wrapper.h" static int transport_use_color = -1; static char transport_colors[][COLOR_MAXLEN] = { diff --git a/usage.c b/usage.c index 40a1c5a433..b53c99dbe5 100644 --- a/usage.c +++ b/usage.c @@ -5,6 +5,7 @@ */ #include "cache.h" #include "gettext.h" +#include "wrapper.h" static void vreportf(const char *prefix, const char *err, va_list params) { diff --git a/worktree.c b/worktree.c index b7bc4c7bb7..fe4345012c 100644 --- a/worktree.c +++ b/worktree.c @@ -9,6 +9,7 @@ #include "dir.h" #include "wt-status.h" #include "config.h" +#include "wrapper.h" void free_worktrees(struct worktree **worktrees) { diff --git a/wrapper.c b/wrapper.c index df1fa6286d..ee83757590 100644 --- a/wrapper.c +++ b/wrapper.c @@ -5,6 +5,7 @@ #include "abspath.h" #include "config.h" #include "gettext.h" +#include "wrapper.h" static intmax_t count_fsync_writeout_only; static intmax_t count_fsync_hardware_flush; diff --git a/wrapper.h b/wrapper.h new file mode 100644 index 0000000000..f0c7d0616d --- /dev/null +++ b/wrapper.h @@ -0,0 +1,36 @@ +#ifndef WRAPPER_H +#define WRAPPER_H + +/* set default permissions by passing mode arguments to open(2) */ +int git_mkstemps_mode(char *pattern, int suffix_len, int mode); +int git_mkstemp_mode(char *pattern, int mode); + +ssize_t read_in_full(int fd, void *buf, size_t count); +ssize_t write_in_full(int fd, const void *buf, size_t count); +ssize_t pread_in_full(int fd, void *buf, size_t count, off_t offset); + +static inline ssize_t write_str_in_full(int fd, const char *str) +{ + return write_in_full(fd, str, strlen(str)); +} + +/** + * Open (and truncate) the file at path, write the contents of buf to it, + * and close it. Dies if any errors are encountered. + */ +void write_file_buf(const char *path, const char *buf, size_t len); + +/** + * Like write_file_buf(), but format the contents into a buffer first. + * Additionally, write_file() will append a newline if one is not already + * present, making it convenient to write text files: + * + * write_file(path, "counter: %d", ctr); + */ +__attribute__((format (printf, 2, 3))) +void write_file(const char *path, const char *fmt, ...); + +/* Return 1 if the file is empty or does not exists, 0 otherwise. */ +int is_empty_or_missing_file(const char *filename); + +#endif /* WRAPPER_H */ diff --git a/write-or-die.c b/write-or-die.c index aaa0318e82..a7afc303db 100644 --- a/write-or-die.c +++ b/write-or-die.c @@ -1,6 +1,7 @@ #include "cache.h" #include "config.h" #include "run-command.h" +#include "wrapper.h" /* * Some cases use stdio, but want to flush after the write -- cgit 1.2.3-korg From ec2f02696157d3781fbfd410f0017c49cc1eda01 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Tue, 21 Mar 2023 06:26:08 +0000 Subject: csum-file.h: remove unnecessary inclusion of cache.h With the change in the last commit to move several functions to write-or-die.h, csum-file.h no longer needs to include cache.h. However, removing that include forces several other C files, which directly or indirectly dependend upon csum-file.h's inclusion of cache.h, to now be more explicit about their dependencies. Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- bulk-checkin.c | 2 +- chunk-format.c | 1 + commit-graph.c | 2 +- csum-file.h | 1 - delta-islands.c | 2 +- fetch-pack.c | 2 +- midx.c | 2 +- object-file.c | 2 +- pack-bitmap-write.c | 3 ++- pack-bitmap.c | 2 +- pack.h | 2 ++ packfile.c | 2 +- 12 files changed, 13 insertions(+), 10 deletions(-) (limited to 'commit-graph.c') diff --git a/bulk-checkin.c b/bulk-checkin.c index eb6d7a2805..d2428b8611 100644 --- a/bulk-checkin.c +++ b/bulk-checkin.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2011, Google Inc. */ -#include "git-compat-util.h" +#include "cache.h" #include "alloc.h" #include "bulk-checkin.h" #include "environment.h" diff --git a/chunk-format.c b/chunk-format.c index 6d1071729d..60a73c1b14 100644 --- a/chunk-format.c +++ b/chunk-format.c @@ -3,6 +3,7 @@ #include "chunk-format.h" #include "csum-file.h" #include "gettext.h" +#include "trace2.h" /* * When writing a chunk-based file format, collect the chunks in diff --git a/commit-graph.c b/commit-graph.c index 5481736c76..f0cd2e7a2a 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1,4 +1,4 @@ -#include "git-compat-util.h" +#include "cache.h" #include "config.h" #include "gettext.h" #include "hex.h" diff --git a/csum-file.h b/csum-file.h index 4cd9014e36..566e05cbd2 100644 --- a/csum-file.h +++ b/csum-file.h @@ -1,7 +1,6 @@ #ifndef CSUM_FILE_H #define CSUM_FILE_H -#include "cache.h" #include "hash.h" #include "write-or-die.h" diff --git a/delta-islands.c b/delta-islands.c index 1222b6a6cd..73a01179e8 100644 --- a/delta-islands.c +++ b/delta-islands.c @@ -1,4 +1,4 @@ -#include "git-compat-util.h" +#include "cache.h" #include "alloc.h" #include "attr.h" #include "object.h" diff --git a/fetch-pack.c b/fetch-pack.c index c453a4168f..10f759532c 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -1,4 +1,4 @@ -#include "git-compat-util.h" +#include "cache.h" #include "alloc.h" #include "repository.h" #include "config.h" diff --git a/midx.c b/midx.c index b111665dca..9af3e5de88 100644 --- a/midx.c +++ b/midx.c @@ -1,4 +1,4 @@ -#include "git-compat-util.h" +#include "cache.h" #include "abspath.h" #include "alloc.h" #include "config.h" diff --git a/object-file.c b/object-file.c index 05fff230f7..397596e3c8 100644 --- a/object-file.c +++ b/object-file.c @@ -6,7 +6,7 @@ * This handles basic git object files - packing, unpacking, * creation etc. */ -#include "git-compat-util.h" +#include "cache.h" #include "abspath.h" #include "alloc.h" #include "config.h" diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index 63f16080c9..0fddeb1298 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -1,4 +1,4 @@ -#include "git-compat-util.h" +#include "cache.h" #include "alloc.h" #include "environment.h" #include "gettext.h" @@ -17,6 +17,7 @@ #include "pack-objects.h" #include "commit-reach.h" #include "prio-queue.h" +#include "trace2.h" struct bitmapped_commit { struct commit *commit; diff --git a/pack-bitmap.c b/pack-bitmap.c index 241ac9166c..23d87e71bd 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -1,4 +1,4 @@ -#include "git-compat-util.h" +#include "cache.h" #include "alloc.h" #include "commit.h" #include "gettext.h" diff --git a/pack.h b/pack.h index 01d385903a..3ab9e3f60c 100644 --- a/pack.h +++ b/pack.h @@ -4,6 +4,8 @@ #include "object.h" #include "csum-file.h" +struct packed_git; +struct pack_window; struct repository; /* diff --git a/packfile.c b/packfile.c index 4b5b841d04..61672d50bd 100644 --- a/packfile.c +++ b/packfile.c @@ -1,4 +1,4 @@ -#include "git-compat-util.h" +#include "cache.h" #include "alloc.h" #include "environment.h" #include "gettext.h" -- cgit 1.2.3-korg From d3af1c193d4d62668a9d7ea98e2ef3771ac4e65a Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Mon, 27 Mar 2023 10:08:25 +0200 Subject: commit-graph: fix truncated generation numbers In 80c928d947 (commit-graph: simplify compute_generation_numbers(), 2023-03-20), the code to compute generation numbers was simplified to use the same infrastructure as is used to compute topological levels. This refactoring introduced a bug where the generation numbers are truncated when they exceed UINT32_MAX because we explicitly cast the computed generation number to `uint32_t`. This is not required though: both the computed value and the field of `struct commit_graph_data` are of the same type `timestamp_t` already, so casting to `uint32_t` will cause truncation. This cast can cause us to miscompute generation data overflows: 1. Given a commit with no parents and committer date `UINT32_MAX + 1`. 2. We compute its generation number as `UINT32_MAX + 1`, but truncate it to `1`. 3. We calculate the generation offset via `$generation - $date`, which is thus `1 - (UINT32_MAX + 1)`. The computation underflows and we thus end up with an offset that is bigger than the maximum allowed offset. As a result, we'd be writing generation data overflow information into the commit-graph that is bogus and ultimately not even required. Fix this bug by removing the needless cast. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- commit-graph.c | 2 +- t/t5328-commit-graph-64bit-time.sh | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'commit-graph.c') diff --git a/commit-graph.c b/commit-graph.c index 172e679db1..b96509354e 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1565,7 +1565,7 @@ static timestamp_t get_generation_from_graph_data(struct commit *c, void *data) static void set_generation_v2(struct commit *c, timestamp_t t, void *data) { struct commit_graph_data *g = commit_graph_data_at(c); - g->generation = (uint32_t)t; + g->generation = t; } static void compute_generation_numbers(struct write_commit_graph_context *ctx) diff --git a/t/t5328-commit-graph-64bit-time.sh b/t/t5328-commit-graph-64bit-time.sh index 093f0c067a..57e4d9c699 100755 --- a/t/t5328-commit-graph-64bit-time.sh +++ b/t/t5328-commit-graph-64bit-time.sh @@ -63,4 +63,13 @@ test_expect_success 'set up and verify repo with generation data overflow chunk' graph_git_behavior 'overflow 2' repo left right +test_expect_success 'single commit with generation data exceeding UINT32_MAX' ' + git init repo-uint32-max && + cd repo-uint32-max && + test_commit --date "@4294967297 +0000" 1 && + git commit-graph write --reachable && + graph_read_expect 1 "generation_data" && + git commit-graph verify +' + test_done -- cgit 1.2.3-korg From ecb5091fd4301ac647db0bd2504112b38f7ee06d Mon Sep 17 00:00:00 2001 From: Ævar Arnfjörð Bjarmason Date: Tue, 28 Mar 2023 15:58:48 +0200 Subject: cocci: apply the "commit.h" part of "the_repository.pending" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apply the part of "the_repository.pending.cocci" pertaining to "commit.h". Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- blame.c | 4 +- builtin/am.c | 7 ++- builtin/blame.c | 6 +- builtin/checkout.c | 13 ++-- builtin/commit.c | 8 +-- builtin/describe.c | 4 +- builtin/diff.c | 3 +- builtin/fast-export.c | 4 +- builtin/gc.c | 4 +- builtin/log.c | 5 +- builtin/merge-tree.c | 6 +- builtin/merge.c | 3 +- builtin/name-rev.c | 4 +- builtin/notes.c | 2 +- builtin/rebase.c | 2 +- builtin/replace.c | 4 +- builtin/shortlog.c | 5 +- builtin/show-branch.c | 4 +- commit-graph.c | 2 +- commit-reach.c | 16 ++--- commit.c | 25 ++++---- commit.h | 18 ------ contrib/coccinelle/the_repository.cocci | 19 ++++++ contrib/coccinelle/the_repository.pending.cocci | 19 ------ delta-islands.c | 5 +- fmt-merge-msg.c | 5 +- fsck.c | 4 +- http-push.c | 3 +- list-objects.c | 18 +++--- merge-recursive.c | 2 +- negotiator/default.c | 6 +- negotiator/skipping.c | 2 +- notes-merge.c | 5 +- notes-utils.c | 2 +- object-name.c | 8 +-- pack-bitmap-write.c | 3 +- pretty.c | 5 +- reflog.c | 2 +- revision.c | 12 ++-- sequencer.c | 82 +++++++++++++++---------- shallow.c | 4 +- t/helper/test-fast-rebase.c | 9 +-- tree.c | 2 +- walker.c | 4 +- 44 files changed, 196 insertions(+), 174 deletions(-) (limited to 'commit-graph.c') diff --git a/blame.c b/blame.c index 8bfeaa1c63..af2b67c084 100644 --- a/blame.c +++ b/blame.c @@ -2429,7 +2429,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin, if (sg_origin[i]) continue; - if (parse_commit(p)) + if (repo_parse_commit(the_repository, p)) continue; porigin = find(sb->repo, p, origin, sb->bloom_data); if (!porigin) @@ -2592,7 +2592,7 @@ void assign_blame(struct blame_scoreboard *sb, int opt) * so hold onto it in the meantime. */ blame_origin_incref(suspect); - parse_commit(commit); + repo_parse_commit(the_repository, commit); if (sb->reverse || (!(commit->object.flags & UNINTERESTING) && !(revs->max_age != -1 && commit->date < revs->max_age))) diff --git a/builtin/am.c b/builtin/am.c index c04038f1f3..456884852e 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -1329,7 +1329,8 @@ static void get_commit_info(struct am_state *state, struct commit *commit) size_t ident_len; struct ident_split id; - buffer = logmsg_reencode(commit, NULL, get_commit_output_encoding()); + buffer = repo_logmsg_reencode(the_repository, commit, NULL, + get_commit_output_encoding()); ident_line = find_commit_header(buffer, "author", &ident_len); if (!ident_line) @@ -1361,7 +1362,7 @@ static void get_commit_info(struct am_state *state, struct commit *commit) die(_("unable to parse commit %s"), oid_to_hex(&commit->object.oid)); state->msg = xstrdup(msg + 2); state->msg_len = strlen(state->msg); - unuse_commit_buffer(commit, buffer); + repo_unuse_commit_buffer(the_repository, commit, buffer); } /** @@ -1404,7 +1405,7 @@ static void write_index_patch(const struct am_state *state) if (!repo_get_oid(the_repository, "HEAD", &head)) { struct commit *commit = lookup_commit_or_die(&head, "HEAD"); - tree = get_commit_tree(commit); + tree = repo_get_commit_tree(the_repository, commit); } else tree = lookup_tree(the_repository, the_repository->hash_algo->empty_tree); diff --git a/builtin/blame.c b/builtin/blame.c index 0155062de1..91e04f57cc 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -199,13 +199,13 @@ static void get_commit_info(struct commit *commit, const char *message; encoding = get_log_output_encoding(); - message = logmsg_reencode(commit, NULL, encoding); + message = repo_logmsg_reencode(the_repository, commit, NULL, encoding); get_ac_line(message, "\nauthor ", &ret->author, &ret->author_mail, &ret->author_time, &ret->author_tz); if (!detailed) { - unuse_commit_buffer(commit, message); + repo_unuse_commit_buffer(the_repository, commit, message); return; } @@ -219,7 +219,7 @@ static void get_commit_info(struct commit *commit, else strbuf_addf(&ret->summary, "(%s)", oid_to_hex(&commit->object.oid)); - unuse_commit_buffer(commit, message); + repo_unuse_commit_buffer(the_repository, commit, message); } /* diff --git a/builtin/checkout.c b/builtin/checkout.c index 6216bb6bba..1d1f33e33e 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -640,7 +640,7 @@ static void describe_detached_head(const char *msg, struct commit *commit) { struct strbuf sb = STRBUF_INIT; - if (!parse_commit(commit)) + if (!repo_parse_commit(the_repository, commit)) pp_commit_easy(CMIT_FMT_ONELINE, commit, &sb); if (print_sha1_ellipsis()) { fprintf(stderr, "%s %s... %s\n", msg, @@ -755,7 +755,8 @@ static int merge_working_tree(const struct checkout_opts *opts, BUG("'switch --orphan' should never accept a commit as starting point"); new_tree = parse_tree_indirect(the_hash_algo->empty_tree); } else - new_tree = get_commit_tree(new_branch_info->commit); + new_tree = repo_get_commit_tree(the_repository, + new_branch_info->commit); if (opts->discard_changes) { ret = reset_tree(new_tree, opts, 1, writeout_error, new_branch_info); if (ret) @@ -817,7 +818,8 @@ static int merge_working_tree(const struct checkout_opts *opts, */ if (!old_branch_info->commit) return 1; - old_tree = get_commit_tree(old_branch_info->commit); + old_tree = repo_get_commit_tree(the_repository, + old_branch_info->commit); if (repo_index_has_changes(the_repository, old_tree, &sb)) die(_("cannot continue with staged changes in " @@ -1006,7 +1008,7 @@ static void describe_one_orphan(struct strbuf *sb, struct commit *commit) strbuf_addstr(sb, " "); strbuf_add_unique_abbrev(sb, &commit->object.oid, DEFAULT_ABBREV); strbuf_addch(sb, ' '); - if (!parse_commit(commit)) + if (!repo_parse_commit(the_repository, commit)) pp_commit_easy(CMIT_FMT_ONELINE, commit, sb); strbuf_addch(sb, '\n'); } @@ -1206,7 +1208,8 @@ static void setup_new_branch_info_and_source_tree( *source_tree = parse_tree_indirect(rev); } else { parse_commit_or_die(new_branch_info->commit); - *source_tree = get_commit_tree(new_branch_info->commit); + *source_tree = repo_get_commit_tree(the_repository, + new_branch_info->commit); } } diff --git a/builtin/commit.c b/builtin/commit.c index 80d1e31f25..bda6afc4bd 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -712,7 +712,7 @@ static void prepare_amend_commit(struct commit *commit, struct strbuf *sb, { const char *buffer, *subject, *fmt; - buffer = get_commit_buffer(commit, NULL); + buffer = repo_get_commit_buffer(the_repository, commit, NULL); find_commit_subject(buffer, &subject); /* * If we amend the 'amend!' commit then we don't want to @@ -720,7 +720,7 @@ static void prepare_amend_commit(struct commit *commit, struct strbuf *sb, */ fmt = starts_with(subject, "amend!") ? "%b" : "%B"; format_commit_message(commit, fmt, sb, ctx); - unuse_commit_buffer(commit, buffer); + repo_unuse_commit_buffer(the_repository, commit, buffer); } static int prepare_to_commit(const char *index_file, const char *prefix, @@ -1183,7 +1183,7 @@ static const char *read_commit_message(const char *name) if (!commit) die(_("could not lookup commit %s"), name); out_enc = get_commit_output_encoding(); - return logmsg_reencode(commit, NULL, out_enc); + return repo_logmsg_reencode(the_repository, commit, NULL, out_enc); } /* @@ -1718,7 +1718,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix) current_head = NULL; else { current_head = lookup_commit_or_die(&oid, "HEAD"); - if (parse_commit(current_head)) + if (repo_parse_commit(the_repository, current_head)) die(_("could not parse HEAD commit")); } verbose = -1; /* unspecified */ diff --git a/builtin/describe.c b/builtin/describe.c index c85bf9c418..e880a86f37 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -261,7 +261,7 @@ static unsigned long finish_depth_computation( best->depth++; while (parents) { struct commit *p = parents->item; - parse_commit(p); + repo_parse_commit(the_repository, p); if (!(p->object.flags & SEEN)) commit_list_insert_by_date(p, list); p->object.flags |= c->object.flags; @@ -404,7 +404,7 @@ static void describe_commit(struct object_id *oid, struct strbuf *dst) } while (parents) { struct commit *p = parents->item; - parse_commit(p); + repo_parse_commit(the_repository, p); if (!(p->object.flags & SEEN)) commit_list_insert_by_date(p, &list); p->object.flags |= c->object.flags; diff --git a/builtin/diff.c b/builtin/diff.c index 26f1e532c6..1091c377af 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -548,7 +548,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix) if (!obj) die(_("invalid object '%s' given."), name); if (obj->type == OBJ_COMMIT) - obj = &get_commit_tree(((struct commit *)obj))->object; + obj = &repo_get_commit_tree(the_repository, + ((struct commit *)obj))->object; if (obj->type == OBJ_TREE) { if (sdiff.skip && bitmap_get(sdiff.skip, i)) diff --git a/builtin/fast-export.c b/builtin/fast-export.c index 39a890fc00..5fe7c02970 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -618,7 +618,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev, rev->diffopt.output_format = DIFF_FORMAT_CALLBACK; parse_commit_or_die(commit); - commit_buffer = get_commit_buffer(commit, NULL); + commit_buffer = repo_get_commit_buffer(the_repository, commit, NULL); author = strstr(commit_buffer, "\nauthor "); if (!author) die("could not find author in commit %s", @@ -699,7 +699,7 @@ static void handle_commit(struct commit *commit, struct rev_info *rev, ? strlen(message) : 0), reencoded ? reencoded : message ? message : ""); free(reencoded); - unuse_commit_buffer(commit, commit_buffer); + repo_unuse_commit_buffer(the_repository, commit, commit_buffer); for (i = 0, p = commit->parents; p; p = p->next) { struct object *obj = &p->item->object; diff --git a/builtin/gc.c b/builtin/gc.c index 02455fdcd7..e60decbc56 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -820,7 +820,7 @@ static int dfs_on_ref(const char *refname UNUSED, commit = lookup_commit(the_repository, oid); if (!commit) return 0; - if (parse_commit(commit) || + if (repo_parse_commit(the_repository, commit) || commit_graph_position(commit) != COMMIT_NOT_FROM_GRAPH) return 0; @@ -837,7 +837,7 @@ static int dfs_on_ref(const char *refname UNUSED, commit = pop_commit(&stack); for (parent = commit->parents; parent; parent = parent->next) { - if (parse_commit(parent->item) || + if (repo_parse_commit(the_repository, parent->item) || commit_graph_position(parent->item) != COMMIT_NOT_FROM_GRAPH || parent->item->object.flags & SEEN) continue; diff --git a/builtin/log.c b/builtin/log.c index 5604b4b5f0..f249aca049 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -1314,10 +1314,11 @@ static void make_cover_letter(struct rev_info *rev, int use_separate_file, log_write_email_headers(rev, head, &pp.after_subject, &need_8bit_cte, 0); for (i = 0; !need_8bit_cte && i < nr; i++) { - const char *buf = get_commit_buffer(list[i], NULL); + const char *buf = repo_get_commit_buffer(the_repository, + list[i], NULL); if (has_non_ascii(buf)) need_8bit_cte = 1; - unuse_commit_buffer(list[i], buf); + repo_unuse_commit_buffer(the_repository, list[i], buf); } if (!branch_name) diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index 4e4a9d6ba1..c0acbc6a54 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -443,9 +443,9 @@ static int real_merge(struct merge_tree_options *o, die(_("could not lookup commit %s"), merge_base); opt.ancestor = merge_base; - base_tree = get_commit_tree(base_commit); - parent1_tree = get_commit_tree(parent1); - parent2_tree = get_commit_tree(parent2); + base_tree = repo_get_commit_tree(the_repository, base_commit); + parent1_tree = repo_get_commit_tree(the_repository, parent1); + parent2_tree = repo_get_commit_tree(the_repository, parent2); merge_incore_nonrecursive(&opt, base_tree, parent1_tree, parent2_tree, &result); } else { /* diff --git a/builtin/merge.c b/builtin/merge.c index c5a9321806..197e152aba 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -1611,7 +1611,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix) * Must first ensure that index matches HEAD before * attempting a trivial merge. */ - struct tree *head_tree = get_commit_tree(head_commit); + struct tree *head_tree = repo_get_commit_tree(the_repository, + head_commit); struct strbuf sb = STRBUF_INIT; if (repo_index_has_changes(the_repository, head_tree, diff --git a/builtin/name-rev.c b/builtin/name-rev.c index 35fd89f794..ad1de02308 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -181,7 +181,7 @@ static void name_rev(struct commit *start_commit, size_t parents_to_queue_nr, parents_to_queue_alloc = 0; struct rev_name *start_name; - parse_commit(start_commit); + repo_parse_commit(the_repository, start_commit); if (commit_is_before_cutoff(start_commit)) return; @@ -211,7 +211,7 @@ static void name_rev(struct commit *start_commit, struct rev_name *parent_name; int generation, distance; - parse_commit(parent); + repo_parse_commit(the_repository, parent); if (commit_is_before_cutoff(parent)) continue; diff --git a/builtin/notes.c b/builtin/notes.c index d98460e5d6..b497eae520 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -720,7 +720,7 @@ static int merge_commit(struct notes_merge_options *o) die(_("failed to read ref NOTES_MERGE_PARTIAL")); else if (!(partial = lookup_commit_reference(the_repository, &oid))) die(_("could not find commit from NOTES_MERGE_PARTIAL.")); - else if (parse_commit(partial)) + else if (repo_parse_commit(the_repository, partial)) die(_("could not parse commit from NOTES_MERGE_PARTIAL.")); if (partial->parents) diff --git a/builtin/rebase.c b/builtin/rebase.c index 5fd7bfb486..eba48bffaa 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -853,7 +853,7 @@ static int checkout_up_to_date(struct rebase_options *options) static int is_linear_history(struct commit *from, struct commit *to) { while (to && to != from) { - parse_commit(to); + repo_parse_commit(the_repository, to); if (!to->parents) return 1; if (to->parents->next) diff --git a/builtin/replace.c b/builtin/replace.c index 33c6cdb79c..85f0b79c92 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -458,9 +458,9 @@ static int create_graft(int argc, const char **argv, int force, int gentle) if (!commit) return error(_("could not parse %s"), old_ref); - buffer = get_commit_buffer(commit, &size); + buffer = repo_get_commit_buffer(the_repository, commit, &size); strbuf_add(&buf, buffer, size); - unuse_commit_buffer(commit, buffer); + repo_unuse_commit_buffer(the_repository, commit, buffer); if (replace_parents(&buf, argc - 1, &argv[1]) < 0) { strbuf_release(&buf); diff --git a/builtin/shortlog.c b/builtin/shortlog.c index 27a87167e1..8afd1ad865 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -179,7 +179,8 @@ static void insert_records_from_trailers(struct shortlog *log, * Using format_commit_message("%B") would be simpler here, but * this saves us copying the message. */ - commit_buffer = logmsg_reencode(commit, NULL, ctx->output_encoding); + commit_buffer = repo_logmsg_reencode(the_repository, commit, NULL, + ctx->output_encoding); body = strstr(commit_buffer, "\n\n"); if (!body) return; @@ -202,7 +203,7 @@ static void insert_records_from_trailers(struct shortlog *log, trailer_iterator_release(&iter); strbuf_release(&ident); - unuse_commit_buffer(commit, commit_buffer); + repo_unuse_commit_buffer(the_repository, commit, commit_buffer); } static int shortlog_needs_dedup(const struct shortlog *log) diff --git a/builtin/show-branch.c b/builtin/show-branch.c index 9e3b8ed27e..d60e536a53 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -240,7 +240,7 @@ static void join_revs(struct commit_list **list_p, parents = parents->next; if ((this_flag & flags) == flags) continue; - parse_commit(p); + repo_parse_commit(the_repository, p); if (mark_seen(p, seen_p) && !still_interesting) extra--; p->object.flags |= flags; @@ -842,7 +842,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) if (!commit) die(_("cannot find commit %s (%s)"), ref_name[num_rev], oid_to_hex(&revkey)); - parse_commit(commit); + repo_parse_commit(the_repository, commit); mark_seen(commit, &seen); /* rev#0 uses bit REV_SHIFT, rev#1 uses bit REV_SHIFT+1, diff --git a/commit-graph.c b/commit-graph.c index c11b59f28b..8273085aa6 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -2549,7 +2549,7 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g, int flags) graph_commit = lookup_commit(r, &cur_oid); odb_commit = (struct commit *)create_object(r, &cur_oid, alloc_commit_node(r)); - if (parse_commit_internal(odb_commit, 0, 0)) { + if (repo_parse_commit_internal(the_repository, odb_commit, 0, 0)) { graph_report(_("failed to parse commit %s from object database for commit-graph"), oid_to_hex(&cur_oid)); continue; diff --git a/commit-reach.c b/commit-reach.c index a4b9eda723..c88faf7e7b 100644 --- a/commit-reach.c +++ b/commit-reach.c @@ -585,7 +585,7 @@ int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid) return 0; new_commit = (struct commit *) o; - if (parse_commit(new_commit) < 0) + if (repo_parse_commit(the_repository, new_commit) < 0) return 0; commit_list_insert(old_commit, &old_commit_list); @@ -749,7 +749,7 @@ int can_all_from_reach_with_flag(struct object_array *from, } list[nr_commits] = (struct commit *)from_one; - if (parse_commit(list[nr_commits]) || + if (repo_parse_commit(the_repository, list[nr_commits]) || commit_graph_generation(list[nr_commits]) < min_generation) { result = 0; goto cleanup; @@ -784,7 +784,7 @@ int can_all_from_reach_with_flag(struct object_array *from, if (!(parent->item->object.flags & assign_flag)) { parent->item->object.flags |= assign_flag; - if (parse_commit(parent->item) || + if (repo_parse_commit(the_repository, parent->item) || parent->item->date < min_commit_date || commit_graph_generation(parent->item) < min_generation) continue; @@ -826,7 +826,7 @@ int can_all_from_reach(struct commit_list *from, struct commit_list *to, while (from_iter) { add_object_array(&from_iter->item->object, NULL, &from_objs); - if (!parse_commit(from_iter->item)) { + if (!repo_parse_commit(the_repository, from_iter->item)) { timestamp_t generation; if (from_iter->item->date < min_commit_date) min_commit_date = from_iter->item->date; @@ -840,7 +840,7 @@ int can_all_from_reach(struct commit_list *from, struct commit_list *to, } while (to_iter) { - if (!parse_commit(to_iter->item)) { + if (!repo_parse_commit(the_repository, to_iter->item)) { timestamp_t generation; if (to_iter->item->date < min_commit_date) min_commit_date = to_iter->item->date; @@ -890,7 +890,7 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from, timestamp_t generation; struct commit *c = *item; - parse_commit(c); + repo_parse_commit(the_repository, c); generation = commit_graph_generation(c); if (generation < min_generation) min_generation = generation; @@ -905,7 +905,7 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from, struct commit *c = *item; if (!(c->object.flags & PARENT2)) { c->object.flags |= PARENT2; - parse_commit(c); + repo_parse_commit(the_repository, c); prio_queue_put(&queue, *item); } @@ -924,7 +924,7 @@ struct commit_list *get_reachable_subset(struct commit **from, int nr_from, for (parents = current->parents; parents; parents = parents->next) { struct commit *p = parents->item; - parse_commit(p); + repo_parse_commit(the_repository, p); if (commit_graph_generation(p) < min_generation) continue; diff --git a/commit.c b/commit.c index 62682f5564..6036376d05 100644 --- a/commit.c +++ b/commit.c @@ -83,7 +83,7 @@ struct commit *lookup_commit_reference_by_name(const char *name) if (repo_get_oid_committish(the_repository, name, &oid)) return NULL; commit = lookup_commit_reference(the_repository, &oid); - if (parse_commit(commit)) + if (repo_parse_commit(the_repository, commit)) return NULL; return commit; } @@ -382,7 +382,7 @@ struct tree *repo_get_commit_tree(struct repository *r, struct object_id *get_commit_tree_oid(const struct commit *commit) { - struct tree *tree = get_commit_tree(commit); + struct tree *tree = repo_get_commit_tree(the_repository, commit); return tree ? &tree->object.oid : NULL; } @@ -555,7 +555,7 @@ int repo_parse_commit_gently(struct repository *r, void parse_commit_or_die(struct commit *item) { - if (parse_commit(item)) + if (repo_parse_commit(the_repository, item)) die("unable to parse commit %s", item ? oid_to_hex(&item->object.oid) : "(null)"); } @@ -688,7 +688,7 @@ struct commit *pop_most_recent_commit(struct commit_list **list, while (parents) { struct commit *commit = parents->item; - if (!parse_commit(commit) && !(commit->object.flags & mark)) { + if (!repo_parse_commit(the_repository, commit) && !(commit->object.flags & mark)) { commit->object.flags |= mark; commit_list_insert_by_date(commit, list); } @@ -762,7 +762,8 @@ define_commit_slab(author_date_slab, timestamp_t); void record_author_date(struct author_date_slab *author_date, struct commit *commit) { - const char *buffer = get_commit_buffer(commit, NULL); + const char *buffer = repo_get_commit_buffer(the_repository, commit, + NULL); struct ident_split ident; const char *ident_line; size_t ident_len; @@ -782,7 +783,7 @@ void record_author_date(struct author_date_slab *author_date, *(author_date_slab_at(author_date, commit)) = date; fail_exit: - unuse_commit_buffer(commit, buffer); + repo_unuse_commit_buffer(the_repository, commit, buffer); } int compare_commits_by_author_date(const void *a_, const void *b_, @@ -963,7 +964,7 @@ static void add_one_commit(struct object_id *oid, struct rev_collect *revs) commit = lookup_commit(the_repository, oid); if (!commit || (commit->object.flags & TMP_MARK) || - parse_commit(commit)) + repo_parse_commit(the_repository, commit)) return; ALLOC_GROW(revs->commit, revs->nr + 1, revs->alloc); @@ -1096,10 +1097,11 @@ int parse_signed_commit(const struct commit *commit, const struct git_hash_algo *algop) { unsigned long size; - const char *buffer = get_commit_buffer(commit, &size); + const char *buffer = repo_get_commit_buffer(the_repository, commit, + &size); int ret = parse_buffer_signed_by_header(buffer, size, payload, signature, algop); - unuse_commit_buffer(commit, buffer); + repo_unuse_commit_buffer(the_repository, commit, buffer); return ret; } @@ -1318,9 +1320,10 @@ struct commit_extra_header *read_commit_extra_headers(struct commit *commit, { struct commit_extra_header *extra = NULL; unsigned long size; - const char *buffer = get_commit_buffer(commit, &size); + const char *buffer = repo_get_commit_buffer(the_repository, commit, + &size); extra = read_commit_extra_header_lines(buffer, size, exclude); - unuse_commit_buffer(commit, buffer); + repo_unuse_commit_buffer(the_repository, commit, buffer); return extra; } diff --git a/commit.h b/commit.h index cc2c5da7bd..e98ee6e698 100644 --- a/commit.h +++ b/commit.h @@ -109,11 +109,6 @@ static inline int repo_parse_commit_no_graph(struct repository *r, return repo_parse_commit_internal(r, commit, 0, 0); } -#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS -#define parse_commit_internal(item, quiet, use) repo_parse_commit_internal(the_repository, item, quiet, use) -#define parse_commit(item) repo_parse_commit(the_repository, item) -#endif - void parse_commit_or_die(struct commit *item); struct buffer_slab; @@ -140,9 +135,6 @@ const void *get_cached_commit_buffer(struct repository *, const struct commit *, const void *repo_get_commit_buffer(struct repository *r, const struct commit *, unsigned long *size); -#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS -#define get_commit_buffer(c, s) repo_get_commit_buffer(the_repository, c, s) -#endif /* * Tell the commit subsystem that we are done with a particular commit buffer. @@ -153,9 +145,6 @@ const void *repo_get_commit_buffer(struct repository *r, void repo_unuse_commit_buffer(struct repository *r, const struct commit *, const void *buffer); -#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS -#define unuse_commit_buffer(c, b) repo_unuse_commit_buffer(the_repository, c, b) -#endif /* * Free any cached object buffer associated with the commit. @@ -163,7 +152,6 @@ void repo_unuse_commit_buffer(struct repository *r, void free_commit_buffer(struct parsed_object_pool *pool, struct commit *); struct tree *repo_get_commit_tree(struct repository *, const struct commit *); -#define get_commit_tree(c) repo_get_commit_tree(the_repository, c) struct object_id *get_commit_tree_oid(const struct commit *); /* @@ -206,16 +194,10 @@ void free_commit_list(struct commit_list *list); struct rev_info; /* in revision.h, it circularly uses enum cmit_fmt */ int has_non_ascii(const char *text); -const char *logmsg_reencode(const struct commit *commit, - char **commit_encoding, - const char *output_encoding); const char *repo_logmsg_reencode(struct repository *r, const struct commit *commit, char **commit_encoding, const char *output_encoding); -#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS -#define logmsg_reencode(c, enc, out) repo_logmsg_reencode(the_repository, c, enc, out) -#endif const char *skip_blank_lines(const char *msg); diff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci index 1ab63f0196..0cdf3f4630 100644 --- a/contrib/coccinelle/the_repository.cocci +++ b/contrib/coccinelle/the_repository.cocci @@ -54,6 +54,25 @@ | - in_merge_bases_many + repo_in_merge_bases_many +// commit.h +| +- parse_commit_internal ++ repo_parse_commit_internal +| +- parse_commit ++ repo_parse_commit +| +- get_commit_buffer ++ repo_get_commit_buffer +| +- unuse_commit_buffer ++ repo_unuse_commit_buffer +| +- logmsg_reencode ++ repo_logmsg_reencode +| +- get_commit_tree ++ repo_get_commit_tree ) ( + the_repository, diff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci index e9209fc0cc..bf19e6a248 100644 --- a/contrib/coccinelle/the_repository.pending.cocci +++ b/contrib/coccinelle/the_repository.pending.cocci @@ -5,26 +5,7 @@ @@ @@ ( -// commit.h -- parse_commit_internal -+ repo_parse_commit_internal -| -- parse_commit -+ repo_parse_commit -| -- get_commit_buffer -+ repo_get_commit_buffer -| -- unuse_commit_buffer -+ repo_unuse_commit_buffer -| -- logmsg_reencode -+ repo_logmsg_reencode -| -- get_commit_tree -+ repo_get_commit_tree // diff.h -| - diff_setup + repo_diff_setup // object-store.h diff --git a/delta-islands.c b/delta-islands.c index afdec0a878..05448851ad 100644 --- a/delta-islands.c +++ b/delta-islands.c @@ -506,8 +506,9 @@ void propagate_island_marks(struct commit *commit) struct commit_list *p; struct island_bitmap *root_marks = kh_value(island_marks, pos); - parse_commit(commit); - set_island_marks(&get_commit_tree(commit)->object, root_marks); + repo_parse_commit(the_repository, commit); + set_island_marks(&repo_get_commit_tree(the_repository, commit)->object, + root_marks); for (p = commit->parents; p; p = p->next) set_island_marks(&p->item->object, root_marks); } diff --git a/fmt-merge-msg.c b/fmt-merge-msg.c index e8e2d4ea0d..a5de91ba22 100644 --- a/fmt-merge-msg.c +++ b/fmt-merge-msg.c @@ -271,9 +271,10 @@ static void record_person_from_buf(int which, struct string_list *people, static void record_person(int which, struct string_list *people, struct commit *commit) { - const char *buffer = get_commit_buffer(commit, NULL); + const char *buffer = repo_get_commit_buffer(the_repository, commit, + NULL); record_person_from_buf(which, people, buffer); - unuse_commit_buffer(commit, buffer); + repo_unuse_commit_buffer(the_repository, commit, buffer); } static int cmp_string_list_util_as_integral(const void *a_, const void *b_) diff --git a/fsck.c b/fsck.c index 2b18717ee8..807a84971a 100644 --- a/fsck.c +++ b/fsck.c @@ -353,7 +353,7 @@ static int fsck_walk_commit(struct commit *commit, void *data, struct fsck_optio int result; const char *name; - if (parse_commit(commit)) + if (repo_parse_commit(the_repository, commit)) return -1; name = fsck_get_object_name(options, &commit->object.oid); @@ -361,7 +361,7 @@ static int fsck_walk_commit(struct commit *commit, void *data, struct fsck_optio fsck_put_object_name(options, get_commit_tree_oid(commit), "%s:", name); - result = options->walk((struct object *)get_commit_tree(commit), + result = options->walk((struct object *) repo_get_commit_tree(the_repository, commit), OBJ_TREE, data, options); if (result < 0) return result; diff --git a/http-push.c b/http-push.c index ceab00bd90..45d5cc0972 100644 --- a/http-push.c +++ b/http-push.c @@ -1331,7 +1331,8 @@ static int get_delta(struct rev_info *revs, struct remote_lock *lock) int count = 0; while ((commit = get_revision(revs)) != NULL) { - p = process_tree(get_commit_tree(commit), p); + p = process_tree(repo_get_commit_tree(the_repository, commit), + p); commit->object.flags |= LOCAL; if (!(commit->object.flags & UNINTERESTING)) count += add_send_request(&commit->object, lock); diff --git a/list-objects.c b/list-objects.c index 7528fe1db2..5550b3aafe 100644 --- a/list-objects.c +++ b/list-objects.c @@ -227,7 +227,8 @@ static void mark_edge_parents_uninteresting(struct commit *commit, struct commit *parent = parents->item; if (!(parent->object.flags & UNINTERESTING)) continue; - mark_tree_uninteresting(revs->repo, get_commit_tree(parent)); + mark_tree_uninteresting(revs->repo, + repo_get_commit_tree(the_repository, parent)); if (revs->edge_hint && !(parent->object.flags & SHOWN)) { parent->object.flags |= SHOWN; show_edge(parent); @@ -244,7 +245,8 @@ static void add_edge_parents(struct commit *commit, for (parents = commit->parents; parents; parents = parents->next) { struct commit *parent = parents->item; - struct tree *tree = get_commit_tree(parent); + struct tree *tree = repo_get_commit_tree(the_repository, + parent); if (!tree) continue; @@ -275,7 +277,8 @@ void mark_edges_uninteresting(struct rev_info *revs, for (list = revs->commits; list; list = list->next) { struct commit *commit = list->item; - struct tree *tree = get_commit_tree(commit); + struct tree *tree = repo_get_commit_tree(the_repository, + commit); if (commit->object.flags & UNINTERESTING) tree->object.flags |= UNINTERESTING; @@ -291,7 +294,7 @@ void mark_edges_uninteresting(struct rev_info *revs, struct commit *commit = list->item; if (commit->object.flags & UNINTERESTING) { mark_tree_uninteresting(revs->repo, - get_commit_tree(commit)); + repo_get_commit_tree(the_repository, commit)); if (revs->edge_hint_aggressive && !(commit->object.flags & SHOWN)) { commit->object.flags |= SHOWN; show_edge(commit); @@ -309,7 +312,7 @@ void mark_edges_uninteresting(struct rev_info *revs, if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING)) continue; mark_tree_uninteresting(revs->repo, - get_commit_tree(commit)); + repo_get_commit_tree(the_repository, commit)); if (!(obj->flags & SHOWN)) { obj->flags |= SHOWN; show_edge(commit); @@ -376,8 +379,9 @@ static void do_traverse(struct traversal_context *ctx) */ if (!ctx->revs->tree_objects) ; /* do not bother loading tree */ - else if (get_commit_tree(commit)) { - struct tree *tree = get_commit_tree(commit); + else if (repo_get_commit_tree(the_repository, commit)) { + struct tree *tree = repo_get_commit_tree(the_repository, + commit); tree->object.flags |= NOT_USER_GIVEN; add_pending_tree(ctx->revs, tree); } else if (commit->object.parsed) { diff --git a/merge-recursive.c b/merge-recursive.c index 9771ef540c..75fa0ef318 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -3797,7 +3797,7 @@ static struct commit *get_ref(struct repository *repo, return make_virtual_commit(repo, (struct tree*)object, name); if (object->type != OBJ_COMMIT) return NULL; - if (parse_commit((struct commit *)object)) + if (repo_parse_commit(the_repository, (struct commit *)object)) return NULL; return (struct commit *)object; } diff --git a/negotiator/default.c b/negotiator/default.c index b7e79feaf0..658d9dd6b9 100644 --- a/negotiator/default.c +++ b/negotiator/default.c @@ -25,7 +25,7 @@ static void rev_list_push(struct negotiation_state *ns, if (!(commit->object.flags & mark)) { commit->object.flags |= mark; - if (parse_commit(commit)) + if (repo_parse_commit(the_repository, commit)) return; prio_queue_put(&ns->rev_list, commit); @@ -69,7 +69,7 @@ static void mark_common(struct negotiation_state *ns, struct commit *commit, if (!ancestors_only && !(o->flags & POPPED)) ns->non_common_revs--; if (!o->parsed && !dont_parse) - if (parse_commit(commit)) + if (repo_parse_commit(the_repository, commit)) return; for (parents = commit->parents; @@ -96,7 +96,7 @@ static const struct object_id *get_rev(struct negotiation_state *ns) return NULL; commit = prio_queue_get(&ns->rev_list); - parse_commit(commit); + repo_parse_commit(the_repository, commit); parents = commit->parents; commit->object.flags |= POPPED; diff --git a/negotiator/skipping.c b/negotiator/skipping.c index 0f5ac48e87..594639b25a 100644 --- a/negotiator/skipping.c +++ b/negotiator/skipping.c @@ -183,7 +183,7 @@ static const struct object_id *get_rev(struct data *data) if (!(commit->object.flags & COMMON) && !entry->ttl) to_send = commit; - parse_commit(commit); + repo_parse_commit(the_repository, commit); for (p = commit->parents; p; p = p->next) parent_pushed |= push_parent(data, entry, p->item); diff --git a/notes-merge.c b/notes-merge.c index fca9422a29..df1a16ac66 100644 --- a/notes-merge.c +++ b/notes-merge.c @@ -678,7 +678,8 @@ int notes_merge_commit(struct notes_merge_options *o, DIR *dir; struct dirent *e; struct strbuf path = STRBUF_INIT; - const char *buffer = get_commit_buffer(partial_commit, NULL); + const char *buffer = repo_get_commit_buffer(the_repository, + partial_commit, NULL); const char *msg = strstr(buffer, "\n\n"); int baselen; @@ -725,7 +726,7 @@ int notes_merge_commit(struct notes_merge_options *o, create_notes_commit(o->repo, partial_tree, partial_commit->parents, msg, strlen(msg), result_oid); - unuse_commit_buffer(partial_commit, buffer); + repo_unuse_commit_buffer(the_repository, partial_commit, buffer); if (o->verbosity >= 4) printf("Finalized notes merge commit: %s\n", oid_to_hex(result_oid)); diff --git a/notes-utils.c b/notes-utils.c index d7d18e30f5..0550cfded8 100644 --- a/notes-utils.c +++ b/notes-utils.c @@ -23,7 +23,7 @@ void create_notes_commit(struct repository *r, struct object_id parent_oid; if (!read_ref(t->ref, &parent_oid)) { struct commit *parent = lookup_commit(r, &parent_oid); - if (parse_commit(parent)) + if (repo_parse_commit(the_repository, parent)) die("Failed to find/parse commit %s", t->ref); commit_list_insert(parent, &parents); } diff --git a/object-name.c b/object-name.c index 21e8f67489..2926f26251 100644 --- a/object-name.c +++ b/object-name.c @@ -1036,7 +1036,7 @@ static enum get_oid_result get_parent(struct repository *r, if (ret) return ret; commit = lookup_commit_reference(r, &oid); - if (parse_commit(commit)) + if (repo_parse_commit(the_repository, commit)) return MISSING_OBJECT; if (!idx) { oidcpy(result, &commit->object.oid); @@ -1070,7 +1070,7 @@ static enum get_oid_result get_nth_ancestor(struct repository *r, return MISSING_OBJECT; while (generation--) { - if (parse_commit(commit) || !commit->parents) + if (repo_parse_commit(the_repository, commit) || !commit->parents) return MISSING_OBJECT; commit = commit->parents->item; } @@ -1361,10 +1361,10 @@ static int get_oid_oneline(struct repository *r, commit = pop_most_recent_commit(&list, ONELINE_SEEN); if (!parse_object(r, &commit->object.oid)) continue; - buf = get_commit_buffer(commit, NULL); + buf = repo_get_commit_buffer(the_repository, commit, NULL); p = strstr(buf, "\n\n"); matches = negative ^ (p && !regexec(®ex, p + 2, 0, NULL, 0)); - unuse_commit_buffer(commit, buf); + repo_unuse_commit_buffer(the_repository, commit, buf); if (matches) { oidcpy(oid, &commit->object.oid); diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index cfa67a510f..84b6132893 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -425,7 +425,8 @@ static int fill_bitmap_commit(struct bb_commit *ent, if (!found) return -1; bitmap_set(ent->bitmap, pos); - prio_queue_put(tree_queue, get_commit_tree(c)); + prio_queue_put(tree_queue, + repo_get_commit_tree(the_repository, c)); for (p = c->parents; p; p = p->next) { pos = find_object_pos(&p->item->object.oid, &found); diff --git a/pretty.c b/pretty.c index 1e1e21878c..7e1614f67f 100644 --- a/pretty.c +++ b/pretty.c @@ -2204,7 +2204,8 @@ void pretty_print_commit(struct pretty_print_context *pp, } encoding = get_log_output_encoding(); - msg = reencoded = logmsg_reencode(commit, NULL, encoding); + msg = reencoded = repo_logmsg_reencode(the_repository, commit, NULL, + encoding); if (pp->fmt == CMIT_FMT_ONELINE || cmit_fmt_is_mail(pp->fmt)) indent = 0; @@ -2261,7 +2262,7 @@ void pretty_print_commit(struct pretty_print_context *pp, if (cmit_fmt_is_mail(pp->fmt) && sb->len <= beginning_of_body) strbuf_addch(sb, '\n'); - unuse_commit_buffer(commit, reencoded); + repo_unuse_commit_buffer(the_repository, commit, reencoded); } void pp_commit_easy(enum cmit_fmt fmt, const struct commit *commit, diff --git a/reflog.c b/reflog.c index 04630f56ec..6e8362e7a2 100644 --- a/reflog.c +++ b/reflog.c @@ -186,7 +186,7 @@ static void mark_reachable(struct expire_reflog_policy_cb *cb) struct commit *commit = pop_commit(&pending); if (commit->object.flags & REACHABLE) continue; - if (parse_commit(commit)) + if (repo_parse_commit(the_repository, commit)) continue; commit->object.flags |= REACHABLE; if (commit->date < expire_limit) { diff --git a/revision.c b/revision.c index c2b7b2f107..79e78b6f7e 100644 --- a/revision.c +++ b/revision.c @@ -778,8 +778,8 @@ static int check_maybe_different_in_bloom_filter(struct rev_info *revs, static int rev_compare_tree(struct rev_info *revs, struct commit *parent, struct commit *commit, int nth_parent) { - struct tree *t1 = get_commit_tree(parent); - struct tree *t2 = get_commit_tree(commit); + struct tree *t1 = repo_get_commit_tree(the_repository, parent); + struct tree *t2 = repo_get_commit_tree(the_repository, commit); int bloom_ret = 1; if (!t1) @@ -825,7 +825,7 @@ static int rev_compare_tree(struct rev_info *revs, static int rev_same_tree_as_empty(struct rev_info *revs, struct commit *commit) { - struct tree *t1 = get_commit_tree(commit); + struct tree *t1 = repo_get_commit_tree(the_repository, commit); if (!t1) return 0; @@ -963,7 +963,7 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit) if (!revs->prune) return; - if (!get_commit_tree(commit)) + if (!repo_get_commit_tree(the_repository, commit)) return; if (!commit->parents) { @@ -3878,7 +3878,7 @@ static int commit_match(struct commit *commit, struct rev_info *opt) * in it. */ encoding = get_log_output_encoding(); - message = logmsg_reencode(commit, NULL, encoding); + message = repo_logmsg_reencode(the_repository, commit, NULL, encoding); /* Copy the commit to temporary if we are using "fake" headers */ if (buf.len) @@ -3914,7 +3914,7 @@ static int commit_match(struct commit *commit, struct rev_info *opt) retval = grep_buffer(&opt->grep_filter, (char *)message, strlen(message)); strbuf_release(&buf); - unuse_commit_buffer(commit, message); + repo_unuse_commit_buffer(the_repository, commit, message); return retval; } diff --git a/sequencer.c b/sequencer.c index d97923883f..592b3d2875 100644 --- a/sequencer.c +++ b/sequencer.c @@ -428,7 +428,8 @@ static int get_message(struct commit *commit, struct commit_message *out) const char *abbrev, *subject; int subject_len; - out->message = logmsg_reencode(commit, NULL, get_commit_output_encoding()); + out->message = repo_logmsg_reencode(the_repository, commit, NULL, + get_commit_output_encoding()); abbrev = short_commit_name(commit); subject_len = find_commit_subject(out->message, &subject); @@ -445,7 +446,7 @@ static void free_message(struct commit *commit, struct commit_message *msg) free(msg->parent_label); free(msg->label); free(msg->subject); - unuse_commit_buffer(commit, msg->message); + repo_unuse_commit_buffer(the_repository, commit, msg->message); } static void print_advice(struct repository *r, int show_hint, @@ -693,8 +694,8 @@ static int do_recursive_merge(struct repository *r, o.show_rename_progress = 1; head_tree = parse_tree_indirect(head); - next_tree = next ? get_commit_tree(next) : empty_tree(r); - base_tree = base ? get_commit_tree(base) : empty_tree(r); + next_tree = next ? repo_get_commit_tree(the_repository, next) : empty_tree(r); + base_tree = base ? repo_get_commit_tree(the_repository, base) : empty_tree(r); for (i = 0; i < opts->xopts_nr; i++) parse_merge_opt(&o, opts->xopts[i]); @@ -772,7 +773,7 @@ static int is_index_unchanged(struct repository *r) * the commit is invalid, parse_commit() will complain. So * there is nothing for us to say here. Just return failure. */ - if (parse_commit(head_commit)) + if (repo_parse_commit(the_repository, head_commit)) return -1; if (!(cache_tree_oid = get_cache_tree_oid(istate))) @@ -1337,7 +1338,7 @@ void print_commit_summary(struct repository *r, commit = lookup_commit(r, oid); if (!commit) die(_("couldn't look up newly created commit")); - if (parse_commit(commit)) + if (repo_parse_commit(the_repository, commit)) die(_("could not parse newly created commit")); strbuf_addstr(&format, "format:%h] %s"); @@ -1417,7 +1418,7 @@ static int parse_head(struct repository *r, struct commit **head) warning(_("HEAD %s is not a commit!"), oid_to_hex(&oid)); } - if (parse_commit(current_head)) + if (repo_parse_commit(the_repository, current_head)) return error(_("could not parse HEAD commit")); } *head = current_head; @@ -1460,8 +1461,9 @@ static int try_to_commit(struct repository *r, if (flags & AMEND_MSG) { const char *exclude_gpgsig[] = { "gpgsig", "gpgsig-sha256", NULL }; const char *out_enc = get_commit_output_encoding(); - const char *message = logmsg_reencode(current_head, NULL, - out_enc); + const char *message = repo_logmsg_reencode(the_repository, + current_head, NULL, + out_enc); if (!msg) { const char *orig_message = NULL; @@ -1472,7 +1474,8 @@ static int try_to_commit(struct repository *r, hook_commit = "HEAD"; } author = amend_author = get_author(message); - unuse_commit_buffer(current_head, message); + repo_unuse_commit_buffer(the_repository, current_head, + message); if (!author) { res = error(_("unable to parse commit author")); goto out; @@ -1669,12 +1672,12 @@ static int is_original_commit_empty(struct commit *commit) { const struct object_id *ptree_oid; - if (parse_commit(commit)) + if (repo_parse_commit(the_repository, commit)) return error(_("could not parse commit %s"), oid_to_hex(&commit->object.oid)); if (commit->parents) { struct commit *parent = commit->parents->item; - if (parse_commit(parent)) + if (repo_parse_commit(the_repository, parent)) return error(_("could not parse parent commit %s"), oid_to_hex(&parent->object.oid)); ptree_oid = get_commit_tree_oid(parent); @@ -2002,13 +2005,14 @@ static int update_squash_messages(struct repository *r, return error(_("need a HEAD to fixup")); if (!(head_commit = lookup_commit_reference(r, &head))) return error(_("could not read HEAD")); - if (!(head_message = logmsg_reencode(head_commit, NULL, encoding))) + if (!(head_message = repo_logmsg_reencode(the_repository, head_commit, NULL, encoding))) return error(_("could not read HEAD's commit message")); find_commit_subject(head_message, &body); if (command == TODO_FIXUP && !flag && write_message(body, strlen(body), rebase_path_fixup_msg(), 0) < 0) { - unuse_commit_buffer(head_commit, head_message); + repo_unuse_commit_buffer(the_repository, head_commit, + head_message); return error(_("cannot write '%s'"), rebase_path_fixup_msg()); } strbuf_addf(&buf, "%c ", comment_line_char); @@ -2023,10 +2027,11 @@ static int update_squash_messages(struct repository *r, else strbuf_addstr(&buf, body); - unuse_commit_buffer(head_commit, head_message); + repo_unuse_commit_buffer(the_repository, head_commit, + head_message); } - if (!(message = logmsg_reencode(commit, NULL, encoding))) + if (!(message = repo_logmsg_reencode(the_repository, commit, NULL, encoding))) return error(_("could not read commit message of %s"), oid_to_hex(&commit->object.oid)); find_commit_subject(message, &body); @@ -2041,7 +2046,7 @@ static int update_squash_messages(struct repository *r, strbuf_add_commented_lines(&buf, body, strlen(body)); } else return error(_("unknown command: %d"), command); - unuse_commit_buffer(commit, message); + repo_unuse_commit_buffer(the_repository, commit, message); if (!res) res = write_message(buf.buf, buf.len, rebase_path_squash_msg(), @@ -2215,7 +2220,7 @@ static int do_pick_commit(struct repository *r, msg_file = NULL; goto fast_forward_edit; } - if (parent && parse_commit(parent) < 0) + if (parent && repo_parse_commit(the_repository, parent) < 0) /* TRANSLATORS: The first %s will be a "todo" command like "revert" or "pick", the second %s a SHA1. */ return error(_("%s: cannot parse parent commit %s"), @@ -3123,7 +3128,9 @@ static int walk_revs_populate_todo(struct todo_list *todo_list, while ((commit = get_revision(opts->revs))) { struct todo_item *item = append_new_todo(todo_list); - const char *commit_buffer = logmsg_reencode(commit, NULL, encoding); + const char *commit_buffer = repo_logmsg_reencode(the_repository, + commit, NULL, + encoding); const char *subject; int subject_len; @@ -3135,7 +3142,8 @@ static int walk_revs_populate_todo(struct todo_list *todo_list, subject_len = find_commit_subject(commit_buffer, &subject); strbuf_addf(&todo_list->buf, "%s %s %.*s\n", command_string, short_commit_name(commit), subject_len, subject); - unuse_commit_buffer(commit, commit_buffer); + repo_unuse_commit_buffer(the_repository, commit, + commit_buffer); } if (!todo_list->nr) @@ -3519,10 +3527,13 @@ static int make_patch(struct repository *r, strbuf_addf(&buf, "%s/message", get_dir(opts)); if (!file_exists(buf.buf)) { const char *encoding = get_commit_output_encoding(); - const char *commit_buffer = logmsg_reencode(commit, NULL, encoding); + const char *commit_buffer = repo_logmsg_reencode(the_repository, + commit, NULL, + encoding); find_commit_subject(commit_buffer, &subject); res |= write_message(subject, strlen(subject), buf.buf, 1); - unuse_commit_buffer(commit, commit_buffer); + repo_unuse_commit_buffer(the_repository, commit, + commit_buffer); } strbuf_release(&buf); release_revisions(&log_tree_opt); @@ -3989,7 +4000,9 @@ static int do_merge(struct repository *r, if (commit) { const char *encoding = get_commit_output_encoding(); - const char *message = logmsg_reencode(commit, NULL, encoding); + const char *message = repo_logmsg_reencode(the_repository, + commit, NULL, + encoding); const char *body; int len; @@ -4002,7 +4015,7 @@ static int do_merge(struct repository *r, find_commit_subject(message, &body); len = strlen(body); ret = write_message(body, len, git_path_merge_msg(r), 0); - unuse_commit_buffer(commit, message); + repo_unuse_commit_buffer(the_repository, commit, message); if (ret) { error_errno(_("could not write '%s'"), git_path_merge_msg(r)); @@ -4585,7 +4598,7 @@ static int stopped_at_head(struct repository *r) if (repo_get_oid(the_repository, "HEAD", &head) || !(commit = lookup_commit(r, &head)) || - parse_commit(commit) || get_message(commit, &message)) + repo_parse_commit(the_repository, commit) || get_message(commit, &message)) fprintf(stderr, _("Stopped at HEAD\n")); else { fprintf(stderr, _("Stopped at %s\n"), message.label); @@ -5042,13 +5055,15 @@ static int commit_staged_changes(struct repository *r, const char *encoding = get_commit_output_encoding(); if (parse_head(r, &commit) || - !(p = logmsg_reencode(commit, NULL, encoding)) || + !(p = repo_logmsg_reencode(the_repository, commit, NULL, encoding)) || write_message(p, strlen(p), path, 0)) { - unuse_commit_buffer(commit, p); + repo_unuse_commit_buffer(the_repository, + commit, p); return error(_("could not write file: " "'%s'"), path); } - unuse_commit_buffer(commit, p); + repo_unuse_commit_buffer(the_repository, + commit, p); } } @@ -5925,7 +5940,7 @@ static int skip_unnecessary_picks(struct repository *r, continue; if (item->command != TODO_PICK) break; - if (parse_commit(item->commit)) { + if (repo_parse_commit(the_repository, item->commit)) { return error(_("could not parse commit '%s'"), oid_to_hex(&item->commit->object.oid)); } @@ -6258,12 +6273,15 @@ int todo_list_rearrange_squash(struct todo_list *todo_list) return error(_("the script was already rearranged.")); } - parse_commit(item->commit); - commit_buffer = logmsg_reencode(item->commit, NULL, "UTF-8"); + repo_parse_commit(the_repository, item->commit); + commit_buffer = repo_logmsg_reencode(the_repository, + item->commit, NULL, + "UTF-8"); find_commit_subject(commit_buffer, &subject); format_subject(&buf, subject, " "); subject = subjects[i] = strbuf_detach(&buf, &subject_len); - unuse_commit_buffer(item->commit, commit_buffer); + repo_unuse_commit_buffer(the_repository, item->commit, + commit_buffer); if (skip_fixupish(subject, &p)) { struct commit *commit2; diff --git a/shallow.c b/shallow.c index 0fcdfd7d35..1a2b159fd4 100644 --- a/shallow.c +++ b/shallow.c @@ -247,7 +247,7 @@ struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av, struct commit *c = p->item; struct commit_list *parent; - if (parse_commit(c)) + if (repo_parse_commit(the_repository, c)) die("unable to parse commit %s", oid_to_hex(&c->object.oid)); @@ -583,7 +583,7 @@ static void paint_down(struct paint_info *info, const struct object_id *oid, if (c->object.flags & BOTTOM) continue; - if (parse_commit(c)) + if (repo_parse_commit(the_repository, c)) die("unable to parse commit %s", oid_to_hex(&c->object.oid)); diff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c index 5d1284328d..214612846a 100644 --- a/t/helper/test-fast-rebase.c +++ b/t/helper/test-fast-rebase.c @@ -65,7 +65,8 @@ static struct commit *create_commit(struct tree *tree, struct commit_extra_header *extra; struct strbuf msg = STRBUF_INIT; const char *out_enc = get_commit_output_encoding(); - const char *message = logmsg_reencode(based_on, NULL, out_enc); + const char *message = repo_logmsg_reencode(the_repository, based_on, + NULL, out_enc); const char *orig_message = NULL; const char *exclude_gpgsig[] = { "gpgsig", NULL }; @@ -156,7 +157,7 @@ int cmd__fast_rebase(int argc, const char **argv) memset(&result, 0, sizeof(result)); merge_opt.show_rename_progress = 1; merge_opt.branch1 = "HEAD"; - head_tree = get_commit_tree(onto); + head_tree = repo_get_commit_tree(the_repository, onto); result.tree = head_tree; last_commit = onto; while ((commit = get_revision(&revs))) { @@ -167,8 +168,8 @@ int cmd__fast_rebase(int argc, const char **argv) assert(commit->parents && !commit->parents->next); base = commit->parents->item; - next_tree = get_commit_tree(commit); - base_tree = get_commit_tree(base); + next_tree = repo_get_commit_tree(the_repository, commit); + base_tree = repo_get_commit_tree(the_repository, base); merge_opt.branch2 = short_commit_name(commit); merge_opt.ancestor = xstrfmt("parent of %s", merge_opt.branch2); diff --git a/tree.c b/tree.c index 410e3b477e..f0742f4167 100644 --- a/tree.c +++ b/tree.c @@ -58,7 +58,7 @@ int read_tree_at(struct repository *r, oid_to_hex(&entry.oid), base->buf, entry.path); - if (parse_commit(commit)) + if (repo_parse_commit(the_repository, commit)) die("Invalid commit %s in submodule path %s%s", oid_to_hex(&entry.oid), base->buf, entry.path); diff --git a/walker.c b/walker.c index 99d0e0eae0..98d65a559b 100644 --- a/walker.c +++ b/walker.c @@ -79,7 +79,7 @@ static int process_commit(struct walker *walker, struct commit *commit) { struct commit_list *parents; - if (parse_commit(commit)) + if (repo_parse_commit(the_repository, commit)) return -1; while (complete && complete->item->date >= commit->date) { @@ -93,7 +93,7 @@ static int process_commit(struct walker *walker, struct commit *commit) walker_say(walker, "walk %s\n", oid_to_hex(&commit->object.oid)); - if (process(walker, &get_commit_tree(commit)->object)) + if (process(walker, &repo_get_commit_tree(the_repository, commit)->object)) return -1; for (parents = commit->parents; parents; parents = parents->next) { -- cgit 1.2.3-korg From afe27c889429438829bc8818ed17e4960bd3ef02 Mon Sep 17 00:00:00 2001 From: Ævar Arnfjörð Bjarmason Date: Tue, 28 Mar 2023 15:58:52 +0200 Subject: cocci: apply the "packfile.h" part of "the_repository.pending" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apply the part of "the_repository.pending.cocci" pertaining to "packfile.h". Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- builtin/gc.c | 2 +- commit-graph.c | 2 +- contrib/coccinelle/the_repository.cocci | 4 ++++ contrib/coccinelle/the_repository.pending.cocci | 4 ---- packfile.h | 1 - 5 files changed, 6 insertions(+), 7 deletions(-) (limited to 'commit-graph.c') diff --git a/builtin/gc.c b/builtin/gc.c index e60decbc56..bef26020f9 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -284,7 +284,7 @@ static uint64_t total_ram(void) static uint64_t estimate_repack_memory(struct packed_git *pack) { - unsigned long nr_objects = approximate_object_count(); + unsigned long nr_objects = repo_approximate_object_count(the_repository); size_t os_cache, heap; if (!pack || !nr_objects) diff --git a/commit-graph.c b/commit-graph.c index 8273085aa6..268410e913 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -2360,7 +2360,7 @@ int write_commit_graph(struct object_directory *odb, replace = ctx->opts->split_flags & COMMIT_GRAPH_SPLIT_REPLACE; } - ctx->approx_nr_objects = approximate_object_count(); + ctx->approx_nr_objects = repo_approximate_object_count(the_repository); if (ctx->append && ctx->r->objects->commit_graph) { struct commit_graph *g = ctx->r->objects->commit_graph; diff --git a/contrib/coccinelle/the_repository.cocci b/contrib/coccinelle/the_repository.cocci index ff4c56114f..a325361f96 100644 --- a/contrib/coccinelle/the_repository.cocci +++ b/contrib/coccinelle/the_repository.cocci @@ -91,6 +91,10 @@ | - format_commit_message + repo_format_commit_message +// packfile.h +| +- approximate_object_count ++ repo_approximate_object_count ) ( + the_repository, diff --git a/contrib/coccinelle/the_repository.pending.cocci b/contrib/coccinelle/the_repository.pending.cocci index 375850e773..9b426e49e6 100644 --- a/contrib/coccinelle/the_repository.pending.cocci +++ b/contrib/coccinelle/the_repository.pending.cocci @@ -5,11 +5,7 @@ @@ @@ ( -// packfile.h -- approximate_object_count -+ repo_approximate_object_count // promisor-remote.h -| - promisor_remote_reinit + repo_promisor_remote_reinit | diff --git a/packfile.h b/packfile.h index a3f6723857..6ec1656797 100644 --- a/packfile.h +++ b/packfile.h @@ -65,7 +65,6 @@ struct packed_git *get_all_packs(struct repository *r); * for speed. */ unsigned long repo_approximate_object_count(struct repository *r); -#define approximate_object_count() repo_approximate_object_count(the_repository) struct packed_git *find_sha1_pack(const unsigned char *sha1, struct packed_git *packs); -- cgit 1.2.3-korg From 4a93b899c19794c28b140bf78a13fb9c2b34f433 Mon Sep 17 00:00:00 2001 From: Ævar Arnfjörð Bjarmason Date: Tue, 28 Mar 2023 15:58:58 +0200 Subject: libs: use "struct repository *" argument, not "the_repository" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As can easily be seen from grepping in our sources, we had these uses of "the_repository" in various library code in cases where the function in question was already getting a "struct repository *" argument. Let's use that argument instead. Out of these changes only the changes to "cache-tree.c", "commit-reach.c", "shallow.c" and "upload-pack.c" would have cleanly applied before the migration away from the "repo_*()" wrapper macros in the preceding commits. The rest aren't new, as we'd previously implicitly refer to "the_repository", but it's now more obvious that we were doing the wrong thing all along, and should have used the parameter instead. The change to change "get_index_format_default(the_repository)" in "read-cache.c" to use the "r" variable instead should arguably have been part of [1], or in the subsequent cleanup in [2]. Let's do it here, as can be seen from the initial code in [3] it's not important that we use "the_repository" there, but would prefer to always use the current repository. This change excludes the "the_repository" use in "upload-pack.c"'s upload_pack_advertise(), as the in-flight [4] makes that change. 1. ee1f0c242ef (read-cache: add index.skipHash config option, 2023-01-06) 2. 6269f8eaad0 (treewide: always have a valid "index_state.repo" member, 2023-01-17) 3. 7211b9e7534 (repo-settings: consolidate some config settings, 2019-08-13) 4. Signed-off-by: Ævar Arnfjörð Bjarmason Signed-off-by: Junio C Hamano --- add-interactive.c | 2 +- branch.c | 8 ++--- builtin/replace.c | 2 +- cache-tree.c | 4 +-- combine-diff.c | 2 +- commit-graph.c | 2 +- commit-reach.c | 2 +- merge-recursive.c | 2 +- notes-cache.c | 2 +- notes-utils.c | 2 +- object-name.c | 8 ++--- read-cache.c | 4 +-- reset.c | 2 +- sequencer.c | 102 +++++++++++++++++++++++++----------------------------- shallow.c | 2 +- tree.c | 2 +- wt-status.c | 10 +++--- 17 files changed, 76 insertions(+), 82 deletions(-) (limited to 'commit-graph.c') diff --git a/add-interactive.c b/add-interactive.c index 33f41d65a4..02bf6fc15c 100644 --- a/add-interactive.c +++ b/add-interactive.c @@ -551,7 +551,7 @@ static int get_modified_files(struct repository *r, opt.def = is_initial ? empty_tree_oid_hex() : oid_to_hex(&head_oid); - repo_init_revisions(the_repository, &rev, NULL); + repo_init_revisions(r, &rev, NULL); setup_revisions(0, NULL, &rev, &opt); rev.diffopt.output_format = DIFF_FORMAT_CALLBACK; diff --git a/branch.c b/branch.c index a01e465b11..2b266e6fcb 100644 --- a/branch.c +++ b/branch.c @@ -531,7 +531,7 @@ static void dwim_branch_start(struct repository *r, const char *start_name, explicit_tracking = 1; real_ref = NULL; - if (repo_get_oid_mb(the_repository, start_name, &oid)) { + if (repo_get_oid_mb(r, start_name, &oid)) { if (explicit_tracking) { int code = die_message(_(upstream_missing), start_name); advise_if_enabled(ADVICE_SET_UPSTREAM_FAILURE, @@ -541,8 +541,8 @@ static void dwim_branch_start(struct repository *r, const char *start_name, die(_("not a valid object name: '%s'"), start_name); } - switch (repo_dwim_ref(the_repository, start_name, strlen(start_name), - &oid, &real_ref, 0)) { + switch (repo_dwim_ref(r, start_name, strlen(start_name), &oid, + &real_ref, 0)) { case 0: /* Not branching from any existing branch */ if (explicit_tracking) @@ -773,7 +773,7 @@ void create_branches_recursively(struct repository *r, const char *name, name); } - create_branch(the_repository, name, start_commitish, force, 0, reflog, quiet, + create_branch(r, name, start_commitish, force, 0, reflog, quiet, BRANCH_TRACK_NEVER, dry_run); if (dry_run) return; diff --git a/builtin/replace.c b/builtin/replace.c index 85f0b79c92..bd67107a7c 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -54,7 +54,7 @@ static int show_reference(struct repository *r, const char *refname, struct object_id object; enum object_type obj_type, repl_type; - if (repo_get_oid(the_repository, refname, &object)) + if (repo_get_oid(r, refname, &object)) return error(_("failed to resolve '%s' as a valid ref"), refname); obj_type = oid_object_info(r, &object, NULL); diff --git a/cache-tree.c b/cache-tree.c index ab2cc1edf2..b0e490b5aa 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -814,14 +814,14 @@ void prime_cache_tree(struct repository *r, { struct strbuf tree_path = STRBUF_INIT; - trace2_region_enter("cache-tree", "prime_cache_tree", the_repository); + trace2_region_enter("cache-tree", "prime_cache_tree", r); cache_tree_free(&istate->cache_tree); istate->cache_tree = cache_tree(); prime_cache_tree_rec(r, istate->cache_tree, tree, &tree_path); strbuf_release(&tree_path); istate->cache_changed |= CACHE_TREE_CHANGED; - trace2_region_leave("cache-tree", "prime_cache_tree", the_repository); + trace2_region_leave("cache-tree", "prime_cache_tree", r); } /* diff --git a/combine-diff.c b/combine-diff.c index 20f8a03924..fa5967a5be 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -332,7 +332,7 @@ static char *grab_blob(struct repository *r, *size = fill_textconv(r, textconv, df, &blob); free_filespec(df); } else { - blob = repo_read_object_file(the_repository, oid, &type, size); + blob = repo_read_object_file(r, oid, &type, size); if (type != OBJ_BLOB) die("object '%s' is not a blob!", oid_to_hex(oid)); } diff --git a/commit-graph.c b/commit-graph.c index 268410e913..035816f4d8 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -2549,7 +2549,7 @@ int verify_commit_graph(struct repository *r, struct commit_graph *g, int flags) graph_commit = lookup_commit(r, &cur_oid); odb_commit = (struct commit *)create_object(r, &cur_oid, alloc_commit_node(r)); - if (repo_parse_commit_internal(the_repository, odb_commit, 0, 0)) { + if (repo_parse_commit_internal(r, odb_commit, 0, 0)) { graph_report(_("failed to parse commit %s from object database for commit-graph"), oid_to_hex(&cur_oid)); continue; diff --git a/commit-reach.c b/commit-reach.c index c88faf7e7b..01eb11b595 100644 --- a/commit-reach.c +++ b/commit-reach.c @@ -448,7 +448,7 @@ int repo_is_descendant_of(struct repository *r, if (!with_commit) return 1; - if (generation_numbers_enabled(the_repository)) { + if (generation_numbers_enabled(r)) { struct commit_list *from_list = NULL; int result; commit_list_insert(commit, &from_list); diff --git a/merge-recursive.c b/merge-recursive.c index d83ce19bb1..20aa18e220 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -3798,7 +3798,7 @@ static struct commit *get_ref(struct repository *repo, return make_virtual_commit(repo, (struct tree*)object, name); if (object->type != OBJ_COMMIT) return NULL; - if (repo_parse_commit(the_repository, (struct commit *)object)) + if (repo_parse_commit(repo, (struct commit *)object)) return NULL; return (struct commit *)object; } diff --git a/notes-cache.c b/notes-cache.c index e5e9092d36..1a6e214ea7 100644 --- a/notes-cache.c +++ b/notes-cache.c @@ -23,7 +23,7 @@ static int notes_cache_match_validity(struct repository *r, return 0; memset(&pretty_ctx, 0, sizeof(pretty_ctx)); - repo_format_commit_message(the_repository, commit, "%s", &msg, + repo_format_commit_message(r, commit, "%s", &msg, &pretty_ctx); strbuf_trim(&msg); diff --git a/notes-utils.c b/notes-utils.c index 0550cfded8..4be0aaa6de 100644 --- a/notes-utils.c +++ b/notes-utils.c @@ -23,7 +23,7 @@ void create_notes_commit(struct repository *r, struct object_id parent_oid; if (!read_ref(t->ref, &parent_oid)) { struct commit *parent = lookup_commit(r, &parent_oid); - if (repo_parse_commit(the_repository, parent)) + if (repo_parse_commit(r, parent)) die("Failed to find/parse commit %s", t->ref); commit_list_insert(parent, &parents); } diff --git a/object-name.c b/object-name.c index df31f192ce..c7bc311dce 100644 --- a/object-name.c +++ b/object-name.c @@ -1038,7 +1038,7 @@ static enum get_oid_result get_parent(struct repository *r, if (ret) return ret; commit = lookup_commit_reference(r, &oid); - if (repo_parse_commit(the_repository, commit)) + if (repo_parse_commit(r, commit)) return MISSING_OBJECT; if (!idx) { oidcpy(result, &commit->object.oid); @@ -1072,7 +1072,7 @@ static enum get_oid_result get_nth_ancestor(struct repository *r, return MISSING_OBJECT; while (generation--) { - if (repo_parse_commit(the_repository, commit) || !commit->parents) + if (repo_parse_commit(r, commit) || !commit->parents) return MISSING_OBJECT; commit = commit->parents->item; } @@ -1363,10 +1363,10 @@ static int get_oid_oneline(struct repository *r, commit = pop_most_recent_commit(&list, ONELINE_SEEN); if (!parse_object(r, &commit->object.oid)) continue; - buf = repo_get_commit_buffer(the_repository, commit, NULL); + buf = repo_get_commit_buffer(r, commit, NULL); p = strstr(buf, "\n\n"); matches = negative ^ (p && !regexec(®ex, p + 2, 0, NULL, 0)); - repo_unuse_commit_buffer(the_repository, commit, buf); + repo_unuse_commit_buffer(r, commit, buf); if (matches) { oidcpy(oid, &commit->object.oid); diff --git a/read-cache.c b/read-cache.c index 1548e88668..892fede6b4 100644 --- a/read-cache.c +++ b/read-cache.c @@ -2628,7 +2628,7 @@ int repo_index_has_changes(struct repository *repo, if (tree) cmp = tree->object.oid; - if (tree || !repo_get_oid_tree(the_repository, "HEAD", &cmp)) { + if (tree || !repo_get_oid_tree(repo, "HEAD", &cmp)) { struct diff_options opt; repo_diff_setup(repo, &opt); @@ -2947,7 +2947,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile, } if (!istate->version) - istate->version = get_index_format_default(the_repository); + istate->version = get_index_format_default(r); /* demote version 3 to version 2 when the latter suffices */ if (istate->version == 3 || istate->version == 2) diff --git a/reset.c b/reset.c index 3a9c6dfdd0..65f8138c78 100644 --- a/reset.c +++ b/reset.c @@ -106,7 +106,7 @@ int reset_head(struct repository *r, const struct reset_head_opts *opts) goto leave_reset_head; } - if (!repo_get_oid(the_repository, "HEAD", &head_oid)) { + if (!repo_get_oid(r, "HEAD", &head_oid)) { head = &head_oid; } else if (!oid || !reset_hard) { ret = error(_("could not determine HEAD revision")); diff --git a/sequencer.c b/sequencer.c index fb5a540fa0..f8f4e72112 100644 --- a/sequencer.c +++ b/sequencer.c @@ -694,8 +694,8 @@ static int do_recursive_merge(struct repository *r, o.show_rename_progress = 1; head_tree = parse_tree_indirect(head); - next_tree = next ? repo_get_commit_tree(the_repository, next) : empty_tree(r); - base_tree = base ? repo_get_commit_tree(the_repository, base) : empty_tree(r); + next_tree = next ? repo_get_commit_tree(r, next) : empty_tree(r); + base_tree = base ? repo_get_commit_tree(r, base) : empty_tree(r); for (i = 0; i < opts->xopts_nr; i++) parse_merge_opt(&o, opts->xopts[i]); @@ -773,7 +773,7 @@ static int is_index_unchanged(struct repository *r) * the commit is invalid, repo_parse_commit() will complain. So * there is nothing for us to say here. Just return failure. */ - if (repo_parse_commit(the_repository, head_commit)) + if (repo_parse_commit(r, head_commit)) return -1; if (!(cache_tree_oid = get_cache_tree_oid(istate))) @@ -1338,15 +1338,15 @@ void print_commit_summary(struct repository *r, commit = lookup_commit(r, oid); if (!commit) die(_("couldn't look up newly created commit")); - if (repo_parse_commit(the_repository, commit)) + if (repo_parse_commit(r, commit)) die(_("could not parse newly created commit")); strbuf_addstr(&format, "format:%h] %s"); - repo_format_commit_message(the_repository, commit, "%an <%ae>", - &author_ident, &pctx); - repo_format_commit_message(the_repository, commit, "%cn <%ce>", - &committer_ident, &pctx); + repo_format_commit_message(r, commit, "%an <%ae>", &author_ident, + &pctx); + repo_format_commit_message(r, commit, "%cn <%ce>", &committer_ident, + &pctx); if (strbuf_cmp(&author_ident, &committer_ident)) { strbuf_addstr(&format, "\n Author: "); strbuf_addbuf_percentquote(&format, &author_ident); @@ -1354,8 +1354,7 @@ void print_commit_summary(struct repository *r, if (flags & SUMMARY_SHOW_AUTHOR_DATE) { struct strbuf date = STRBUF_INIT; - repo_format_commit_message(the_repository, commit, "%ad", - &date, &pctx); + repo_format_commit_message(r, commit, "%ad", &date, &pctx); strbuf_addstr(&format, "\n Date: "); strbuf_addbuf_percentquote(&format, &date); strbuf_release(&date); @@ -1385,7 +1384,7 @@ void print_commit_summary(struct repository *r, rev.diffopt.detect_rename = DIFF_DETECT_RENAME; diff_setup_done(&rev.diffopt); - refs = get_main_ref_store(the_repository); + refs = get_main_ref_store(r); head = refs_resolve_ref_unsafe(refs, "HEAD", 0, NULL, NULL); if (!head) die(_("unable to resolve HEAD after creating commit")); @@ -1411,7 +1410,7 @@ static int parse_head(struct repository *r, struct commit **head) struct commit *current_head; struct object_id oid; - if (repo_get_oid(the_repository, "HEAD", &oid)) { + if (repo_get_oid(r, "HEAD", &oid)) { current_head = NULL; } else { current_head = lookup_commit_reference(r, &oid); @@ -1421,7 +1420,7 @@ static int parse_head(struct repository *r, struct commit **head) warning(_("HEAD %s is not a commit!"), oid_to_hex(&oid)); } - if (repo_parse_commit(the_repository, current_head)) + if (repo_parse_commit(r, current_head)) return error(_("could not parse HEAD commit")); } *head = current_head; @@ -1464,9 +1463,8 @@ static int try_to_commit(struct repository *r, if (flags & AMEND_MSG) { const char *exclude_gpgsig[] = { "gpgsig", "gpgsig-sha256", NULL }; const char *out_enc = get_commit_output_encoding(); - const char *message = repo_logmsg_reencode(the_repository, - current_head, NULL, - out_enc); + const char *message = repo_logmsg_reencode(r, current_head, + NULL, out_enc); if (!msg) { const char *orig_message = NULL; @@ -1477,7 +1475,7 @@ static int try_to_commit(struct repository *r, hook_commit = "HEAD"; } author = amend_author = get_author(message); - repo_unuse_commit_buffer(the_repository, current_head, + repo_unuse_commit_buffer(r, current_head, message); if (!author) { res = error(_("unable to parse commit author")); @@ -2004,18 +2002,18 @@ static int update_squash_messages(struct repository *r, struct commit *head_commit; const char *head_message, *body; - if (repo_get_oid(the_repository, "HEAD", &head)) + if (repo_get_oid(r, "HEAD", &head)) return error(_("need a HEAD to fixup")); if (!(head_commit = lookup_commit_reference(r, &head))) return error(_("could not read HEAD")); - if (!(head_message = repo_logmsg_reencode(the_repository, head_commit, NULL, encoding))) + if (!(head_message = repo_logmsg_reencode(r, head_commit, NULL, + encoding))) return error(_("could not read HEAD's commit message")); find_commit_subject(head_message, &body); if (command == TODO_FIXUP && !flag && write_message(body, strlen(body), rebase_path_fixup_msg(), 0) < 0) { - repo_unuse_commit_buffer(the_repository, head_commit, - head_message); + repo_unuse_commit_buffer(r, head_commit, head_message); return error(_("cannot write '%s'"), rebase_path_fixup_msg()); } strbuf_addf(&buf, "%c ", comment_line_char); @@ -2030,11 +2028,10 @@ static int update_squash_messages(struct repository *r, else strbuf_addstr(&buf, body); - repo_unuse_commit_buffer(the_repository, head_commit, - head_message); + repo_unuse_commit_buffer(r, head_commit, head_message); } - if (!(message = repo_logmsg_reencode(the_repository, commit, NULL, encoding))) + if (!(message = repo_logmsg_reencode(r, commit, NULL, encoding))) return error(_("could not read commit message of %s"), oid_to_hex(&commit->object.oid)); find_commit_subject(message, &body); @@ -2049,7 +2046,7 @@ static int update_squash_messages(struct repository *r, strbuf_add_commented_lines(&buf, body, strlen(body)); } else return error(_("unknown command: %d"), command); - repo_unuse_commit_buffer(the_repository, commit, message); + repo_unuse_commit_buffer(r, commit, message); if (!res) res = write_message(buf.buf, buf.len, rebase_path_squash_msg(), @@ -2162,7 +2159,7 @@ static int do_pick_commit(struct repository *r, if (write_index_as_tree(&head, r->index, r->index_file, 0, NULL)) return error(_("your index file is unmerged.")); } else { - unborn = repo_get_oid(the_repository, "HEAD", &head); + unborn = repo_get_oid(r, "HEAD", &head); /* Do we want to generate a root commit? */ if (is_pick_or_similar(command) && opts->have_squash_onto && oideq(&head, &opts->squash_onto)) { @@ -2224,7 +2221,7 @@ static int do_pick_commit(struct repository *r, msg_file = NULL; goto fast_forward_edit; } - if (parent && repo_parse_commit(the_repository, parent) < 0) + if (parent && repo_parse_commit(r, parent) < 0) /* TRANSLATORS: The first %s will be a "todo" command like "revert" or "pick", the second %s a SHA1. */ return error(_("%s: cannot parse parent commit %s"), @@ -2616,7 +2613,7 @@ static int parse_insn_line(struct repository *r, struct todo_item *item, end_of_object_name = (char *) bol + strcspn(bol, " \t\n"); saved = *end_of_object_name; *end_of_object_name = '\0'; - status = repo_get_oid(the_repository, bol, &commit_oid); + status = repo_get_oid(r, bol, &commit_oid); if (status < 0) error(_("could not parse '%s'"), bol); /* return later */ *end_of_object_name = saved; @@ -3531,12 +3528,12 @@ static int make_patch(struct repository *r, strbuf_addf(&buf, "%s/message", get_dir(opts)); if (!file_exists(buf.buf)) { const char *encoding = get_commit_output_encoding(); - const char *commit_buffer = repo_logmsg_reencode(the_repository, + const char *commit_buffer = repo_logmsg_reencode(r, commit, NULL, encoding); find_commit_subject(commit_buffer, &subject); res |= write_message(subject, strlen(subject), buf.buf, 1); - repo_unuse_commit_buffer(the_repository, commit, + repo_unuse_commit_buffer(r, commit, commit_buffer); } strbuf_release(&buf); @@ -3716,7 +3713,7 @@ static int do_label(struct repository *r, const char *name, int len) if (!transaction) { error("%s", err.buf); ret = -1; - } else if (repo_get_oid(the_repository, "HEAD", &head_oid)) { + } else if (repo_get_oid(r, "HEAD", &head_oid)) { error(_("could not read HEAD")); ret = -1; } else if (ref_transaction_update(transaction, ref_name.buf, &head_oid, @@ -4004,8 +4001,7 @@ static int do_merge(struct repository *r, if (commit) { const char *encoding = get_commit_output_encoding(); - const char *message = repo_logmsg_reencode(the_repository, - commit, NULL, + const char *message = repo_logmsg_reencode(r, commit, NULL, encoding); const char *body; int len; @@ -4019,7 +4015,7 @@ static int do_merge(struct repository *r, find_commit_subject(message, &body); len = strlen(body); ret = write_message(body, len, git_path_merge_msg(r), 0); - repo_unuse_commit_buffer(the_repository, commit, message); + repo_unuse_commit_buffer(r, commit, message); if (ret) { error_errno(_("could not write '%s'"), git_path_merge_msg(r)); @@ -4119,8 +4115,7 @@ static int do_merge(struct repository *r, } merge_commit = to_merge->item; - bases = repo_get_merge_bases(the_repository, head_commit, - merge_commit); + bases = repo_get_merge_bases(r, head_commit, merge_commit); if (bases && oideq(&merge_commit->object.oid, &bases->item->object.oid)) { ret = 0; @@ -4475,7 +4470,7 @@ void create_autostash(struct repository *r, const char *path) if (capture_command(&stash, &buf, GIT_MAX_HEXSZ)) die(_("Cannot autostash")); strbuf_trim_trailing_newline(&buf); - if (repo_get_oid(the_repository, buf.buf, &oid)) + if (repo_get_oid(r, buf.buf, &oid)) die(_("Unexpected stash response: '%s'"), buf.buf); strbuf_reset(&buf); @@ -4600,9 +4595,9 @@ static int stopped_at_head(struct repository *r) struct commit *commit; struct commit_message message; - if (repo_get_oid(the_repository, "HEAD", &head) || + if (repo_get_oid(r, "HEAD", &head) || !(commit = lookup_commit(r, &head)) || - repo_parse_commit(the_repository, commit) || get_message(commit, &message)) + repo_parse_commit(r, commit) || get_message(commit, &message)) fprintf(stderr, _("Stopped at HEAD\n")); else { fprintf(stderr, _("Stopped at %s\n"), message.label); @@ -4750,7 +4745,7 @@ static int pick_commits(struct repository *r, * otherwise we do not. */ if (item->command == TODO_REWORD && - !repo_get_oid(the_repository, "HEAD", &oid) && + !repo_get_oid(r, "HEAD", &oid) && (oideq(&item->commit->object.oid, &oid) || (opts->have_squash_onto && oideq(&opts->squash_onto, &oid)))) @@ -4839,7 +4834,7 @@ static int pick_commits(struct repository *r, struct object_id head, orig; int res; - if (repo_get_oid(the_repository, "HEAD", &head)) { + if (repo_get_oid(r, "HEAD", &head)) { res = error(_("cannot read HEAD")); cleanup_head_ref: strbuf_release(&head_ref); @@ -4886,8 +4881,8 @@ static int pick_commits(struct repository *r, log_tree_opt.disable_stdin = 1; if (read_oneliner(&buf, rebase_path_orig_head(), 0) && - !repo_get_oid(the_repository, buf.buf, &orig) && - !repo_get_oid(the_repository, "HEAD", &head)) { + !repo_get_oid(r, buf.buf, &orig) && + !repo_get_oid(r, "HEAD", &head)) { diff_tree_oid(&orig, &head, "", &log_tree_opt.diffopt); log_tree_diff_flush(&log_tree_opt); @@ -4979,7 +4974,7 @@ static int commit_staged_changes(struct repository *r, struct strbuf rev = STRBUF_INIT; struct object_id head, to_amend; - if (repo_get_oid(the_repository, "HEAD", &head)) + if (repo_get_oid(r, "HEAD", &head)) return error(_("cannot amend non-existing commit")); if (!read_oneliner(&rev, rebase_path_amend(), 0)) return error(_("invalid file: '%s'"), rebase_path_amend()); @@ -5059,14 +5054,13 @@ static int commit_staged_changes(struct repository *r, const char *encoding = get_commit_output_encoding(); if (parse_head(r, &commit) || - !(p = repo_logmsg_reencode(the_repository, commit, NULL, encoding)) || + !(p = repo_logmsg_reencode(r, commit, NULL, encoding)) || write_message(p, strlen(p), path, 0)) { - repo_unuse_commit_buffer(the_repository, - commit, p); + repo_unuse_commit_buffer(r, commit, p); return error(_("could not write file: " "'%s'"), path); } - repo_unuse_commit_buffer(the_repository, + repo_unuse_commit_buffer(r, commit, p); } } @@ -5206,7 +5200,7 @@ int sequencer_pick_revisions(struct repository *r, if (!strlen(name)) continue; - if (!repo_get_oid(the_repository, name, &oid)) { + if (!repo_get_oid(r, name, &oid)) { if (!lookup_commit_reference_gently(r, &oid, 1)) { enum object_type type = oid_object_info(r, &oid, @@ -5249,7 +5243,7 @@ int sequencer_pick_revisions(struct repository *r, if (walk_revs_populate_todo(&todo_list, opts) || create_seq_dir(r) < 0) return -1; - if (repo_get_oid(the_repository, "HEAD", &oid) && (opts->action == REPLAY_REVERT)) + if (repo_get_oid(r, "HEAD", &oid) && (opts->action == REPLAY_REVERT)) return error(_("can't revert as initial commit")); if (save_head(oid_to_hex(&oid))) return -1; @@ -5944,7 +5938,7 @@ static int skip_unnecessary_picks(struct repository *r, continue; if (item->command != TODO_PICK) break; - if (repo_parse_commit(the_repository, item->commit)) { + if (repo_parse_commit(r, item->commit)) { return error(_("could not parse commit '%s'"), oid_to_hex(&item->commit->object.oid)); } @@ -6115,7 +6109,7 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla struct object_id oid = onto->object.oid; int res; - repo_find_unique_abbrev_r(the_repository, shortonto, &oid, + repo_find_unique_abbrev_r(r, shortonto, &oid, DEFAULT_ABBREV); if (buf->len == 0) { @@ -6395,8 +6389,8 @@ int sequencer_determine_whence(struct repository *r, enum commit_whence *whence) if (file_exists(git_path_seq_dir())) *whence = FROM_CHERRY_PICK_MULTI; if (file_exists(rebase_path()) && - !repo_get_oid(the_repository, "REBASE_HEAD", &rebase_head) && - !repo_get_oid(the_repository, "CHERRY_PICK_HEAD", &cherry_pick_head) && + !repo_get_oid(r, "REBASE_HEAD", &rebase_head) && + !repo_get_oid(r, "CHERRY_PICK_HEAD", &cherry_pick_head) && oideq(&rebase_head, &cherry_pick_head)) *whence = FROM_REBASE_PICK; else diff --git a/shallow.c b/shallow.c index 07278467e4..fbafc4b30e 100644 --- a/shallow.c +++ b/shallow.c @@ -30,7 +30,7 @@ int register_shallow(struct repository *r, const struct object_id *oid) { struct commit_graft *graft = xmalloc(sizeof(struct commit_graft)); - struct commit *commit = lookup_commit(the_repository, oid); + struct commit *commit = lookup_commit(r, oid); oidcpy(&graft->oid, oid); graft->nr_parent = -1; diff --git a/tree.c b/tree.c index 1b403c4b5c..8643b73464 100644 --- a/tree.c +++ b/tree.c @@ -58,7 +58,7 @@ int read_tree_at(struct repository *r, oid_to_hex(&entry.oid), base->buf, entry.path); - if (repo_parse_commit(the_repository, commit)) + if (repo_parse_commit(r, commit)) die("Invalid commit %s in submodule path %s%s", oid_to_hex(&entry.oid), base->buf, entry.path); diff --git a/wt-status.c b/wt-status.c index dcd1d0cee4..28e35a2165 100644 --- a/wt-status.c +++ b/wt-status.c @@ -1664,7 +1664,7 @@ static void wt_status_get_detached_from(struct repository *r, return; } - if (repo_dwim_ref(the_repository, cb.buf.buf, cb.buf.len, &oid, &ref, + if (repo_dwim_ref(r, cb.buf.buf, cb.buf.len, &oid, &ref, 1) == 1 && /* oid is a commit? match without further lookup */ (oideq(&cb.noid, &oid) || @@ -1677,9 +1677,9 @@ static void wt_status_get_detached_from(struct repository *r, state->detached_from = xstrdup(from); } else state->detached_from = - xstrdup(repo_find_unique_abbrev(the_repository, &cb.noid, DEFAULT_ABBREV)); + xstrdup(repo_find_unique_abbrev(r, &cb.noid, DEFAULT_ABBREV)); oidcpy(&state->detached_oid, &cb.noid); - state->detached_at = !repo_get_oid(the_repository, "HEAD", &oid) && + state->detached_at = !repo_get_oid(r, "HEAD", &oid) && oideq(&oid, &state->detached_oid); free(ref); @@ -1770,13 +1770,13 @@ void wt_status_get_state(struct repository *r, } else if (wt_status_check_rebase(NULL, state)) { ; /* all set */ } else if (refs_ref_exists(get_main_ref_store(r), "CHERRY_PICK_HEAD") && - !repo_get_oid(the_repository, "CHERRY_PICK_HEAD", &oid)) { + !repo_get_oid(r, "CHERRY_PICK_HEAD", &oid)) { state->cherry_pick_in_progress = 1; oidcpy(&state->cherry_pick_head_oid, &oid); } wt_status_check_bisect(NULL, state); if (refs_ref_exists(get_main_ref_store(r), "REVERT_HEAD") && - !repo_get_oid(the_repository, "REVERT_HEAD", &oid)) { + !repo_get_oid(r, "REVERT_HEAD", &oid)) { state->revert_in_progress = 1; oidcpy(&state->revert_head_oid, &oid); } -- cgit 1.2.3-korg From 6f2d74304335f571374f786537b2efe5aba9f48c Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Tue, 11 Apr 2023 03:00:42 +0000 Subject: treewide: be explicit about dependence on oid-array.h Signed-off-by: Elijah Newren Acked-by: Calvin Wan Signed-off-by: Junio C Hamano --- builtin/bisect.c | 1 + builtin/fetch.c | 1 + builtin/index-pack.c | 1 + builtin/log.c | 1 + cache.h | 1 - commit-graph.c | 1 + diff.c | 1 + merge-ort.c | 1 + read-cache.c | 1 + ref-filter.c | 1 + upload-pack.c | 1 + 11 files changed, 10 insertions(+), 1 deletion(-) (limited to 'commit-graph.c') diff --git a/builtin/bisect.c b/builtin/bisect.c index 26f07357a0..7dc175c657 100644 --- a/builtin/bisect.c +++ b/builtin/bisect.c @@ -9,6 +9,7 @@ #include "dir.h" #include "strvec.h" #include "run-command.h" +#include "oid-array.h" #include "prompt.h" #include "quote.h" #include "revision.h" diff --git a/builtin/fetch.c b/builtin/fetch.c index f2b8098775..e093662921 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -12,6 +12,7 @@ #include "refspec.h" #include "object-store.h" #include "oidset.h" +#include "oid-array.h" #include "commit.h" #include "builtin.h" #include "string-list.h" diff --git a/builtin/index-pack.c b/builtin/index-pack.c index ceb0f120ed..5adfb2521c 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -19,6 +19,7 @@ #include "packfile.h" #include "pack-revindex.h" #include "object-store.h" +#include "oid-array.h" #include "replace-object.h" #include "promisor-remote.h" #include "setup.h" diff --git a/builtin/log.c b/builtin/log.c index 2ce645eee9..094897df23 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -20,6 +20,7 @@ #include "revision.h" #include "log-tree.h" #include "builtin.h" +#include "oid-array.h" #include "tag.h" #include "reflog-walk.h" #include "patch-ids.h" diff --git a/cache.h b/cache.h index 5f1279454a..6eac3134a2 100644 --- a/cache.h +++ b/cache.h @@ -11,7 +11,6 @@ #include "path.h" #include "pathspec.h" #include "object.h" -#include "oid-array.h" #include "repository.h" #include "statinfo.h" #include "mem-pool.h" diff --git a/commit-graph.c b/commit-graph.c index 1bf673b134..fe9a8b2342 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -12,6 +12,7 @@ #include "hash-lookup.h" #include "commit-graph.h" #include "object-store.h" +#include "oid-array.h" #include "alloc.h" #include "hashmap.h" #include "replace-object.h" diff --git a/diff.c b/diff.c index 47c1973a50..89cd0b17da 100644 --- a/diff.c +++ b/diff.c @@ -29,6 +29,7 @@ #include "string-list.h" #include "strvec.h" #include "graph.h" +#include "oid-array.h" #include "packfile.h" #include "parse-options.h" #include "help.h" diff --git a/merge-ort.c b/merge-ort.c index ad7367179d..9b0b184b13 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -32,6 +32,7 @@ #include "entry.h" #include "ll-merge.h" #include "object-store.h" +#include "oid-array.h" #include "promisor-remote.h" #include "revision.h" #include "strmap.h" diff --git a/read-cache.c b/read-cache.c index a744eb89e4..1b585ce842 100644 --- a/read-cache.c +++ b/read-cache.c @@ -15,6 +15,7 @@ #include "refs.h" #include "dir.h" #include "object-store.h" +#include "oid-array.h" #include "tree.h" #include "commit.h" #include "blob.h" diff --git a/ref-filter.c b/ref-filter.c index df84bb7164..1c6174c8ae 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -7,6 +7,7 @@ #include "refs.h" #include "wildmatch.h" #include "object-store.h" +#include "oid-array.h" #include "repository.h" #include "commit.h" #include "remote.h" diff --git a/upload-pack.c b/upload-pack.c index 71440c6380..e17545a834 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -8,6 +8,7 @@ #include "sideband.h" #include "repository.h" #include "object-store.h" +#include "oid-array.h" #include "tag.h" #include "object.h" #include "commit.h" -- cgit 1.2.3-korg From 87bed17907b2cb9a9581a5b8b16b8da264c2a2a8 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Tue, 11 Apr 2023 00:41:53 -0700 Subject: object-file.h: move declarations for object-file.c functions from cache.h Signed-off-by: Elijah Newren Acked-by: Calvin Wan Signed-off-by: Junio C Hamano --- apply.c | 1 + builtin/bugreport.c | 1 + builtin/cat-file.c | 1 + builtin/clone.c | 1 + builtin/credential-cache--daemon.c | 1 + builtin/diagnose.c | 1 + builtin/difftool.c | 1 + builtin/fast-export.c | 1 + builtin/fast-import.c | 1 + builtin/fetch-pack.c | 1 + builtin/fsck.c | 1 + builtin/gc.c | 1 + builtin/grep.c | 1 + builtin/hash-object.c | 1 + builtin/index-pack.c | 1 + builtin/init-db.c | 1 + builtin/log.c | 1 + builtin/mktag.c | 1 + builtin/mv.c | 1 + builtin/pack-objects.c | 1 + builtin/prune.c | 1 + builtin/rebase.c | 1 + builtin/replace.c | 1 + builtin/rev-list.c | 1 + builtin/sparse-checkout.c | 1 + builtin/submodule--helper.c | 1 + builtin/update-index.c | 1 + builtin/worktree.c | 1 + bulk-checkin.c | 1 + cache-tree.c | 1 + cache.h | 123 ----------------------------------- commit-graph.c | 1 + diff.c | 1 + dir.c | 1 + environment.c | 1 + http.c | 1 + merge-recursive.c | 1 + midx.c | 1 + notes-merge.c | 1 + object-file.c | 1 + object-file.h | 129 +++++++++++++++++++++++++++++++++++++ object.c | 1 + pack-bitmap.c | 1 + pack-check.c | 1 + pack-mtimes.c | 1 + pack-revindex.c | 1 + packfile.c | 1 + read-cache.c | 1 + refs/files-backend.c | 1 + rerere.c | 1 + revision.c | 1 + sequencer.c | 1 + server-info.c | 1 + streaming.c | 1 + submodule.c | 1 + tmp-objdir.c | 1 + tree-walk.c | 1 + 57 files changed, 184 insertions(+), 123 deletions(-) create mode 100644 object-file.h (limited to 'commit-graph.c') diff --git a/apply.c b/apply.c index 7e40f53ec4..2868cef5dd 100644 --- a/apply.c +++ b/apply.c @@ -23,6 +23,7 @@ #include "ll-merge.h" #include "lockfile.h" #include "object-name.h" +#include "object-file.h" #include "parse-options.h" #include "quote.h" #include "rerere.h" diff --git a/builtin/bugreport.c b/builtin/bugreport.c index 52955e1d38..03fb053691 100644 --- a/builtin/bugreport.c +++ b/builtin/bugreport.c @@ -8,6 +8,7 @@ #include "hook.h" #include "hook-list.h" #include "diagnose.h" +#include "object-file.h" #include "setup.h" #include "wrapper.h" diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 60b7a55dfc..0bafc14e6c 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -20,6 +20,7 @@ #include "tree-walk.h" #include "oid-array.h" #include "packfile.h" +#include "object-file.h" #include "object-name.h" #include "object-store.h" #include "replace-object.h" diff --git a/builtin/clone.c b/builtin/clone.c index f1e8aa3f27..c7fdffb484 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -21,6 +21,7 @@ #include "fetch-pack.h" #include "refs.h" #include "refspec.h" +#include "object-file.h" #include "object-store.h" #include "tree.h" #include "tree-walk.h" diff --git a/builtin/credential-cache--daemon.c b/builtin/credential-cache--daemon.c index 62c09a271d..4e571d9951 100644 --- a/builtin/credential-cache--daemon.c +++ b/builtin/credential-cache--daemon.c @@ -2,6 +2,7 @@ #include "abspath.h" #include "alloc.h" #include "gettext.h" +#include "object-file.h" #include "parse-options.h" #ifndef NO_UNIX_SOCKETS diff --git a/builtin/diagnose.c b/builtin/diagnose.c index 0f8b64994c..4f22eb2b55 100644 --- a/builtin/diagnose.c +++ b/builtin/diagnose.c @@ -1,6 +1,7 @@ #include "builtin.h" #include "abspath.h" #include "gettext.h" +#include "object-file.h" #include "parse-options.h" #include "diagnose.h" diff --git a/builtin/difftool.c b/builtin/difftool.c index e010a21bfb..3ffb0524be 100644 --- a/builtin/difftool.c +++ b/builtin/difftool.c @@ -25,6 +25,7 @@ #include "strvec.h" #include "strbuf.h" #include "lockfile.h" +#include "object-file.h" #include "object-store.h" #include "dir.h" #include "entry.h" diff --git a/builtin/fast-export.c b/builtin/fast-export.c index 0bb779deb6..c7835ea079 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -10,6 +10,7 @@ #include "hex.h" #include "refs.h" #include "refspec.h" +#include "object-file.h" #include "object-store.h" #include "commit.h" #include "object.h" diff --git a/builtin/fast-import.c b/builtin/fast-import.c index 31b8732128..9f90f5b9e4 100644 --- a/builtin/fast-import.c +++ b/builtin/fast-import.c @@ -19,6 +19,7 @@ #include "dir.h" #include "run-command.h" #include "packfile.h" +#include "object-file.h" #include "object-name.h" #include "object-store.h" #include "mem-pool.h" diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index 60e5a10ffc..664ac1ec0e 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -2,6 +2,7 @@ #include "alloc.h" #include "gettext.h" #include "hex.h" +#include "object-file.h" #include "pkt-line.h" #include "fetch-pack.h" #include "remote.h" diff --git a/builtin/fsck.c b/builtin/fsck.c index 04bc71d148..35a6de3cdb 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -19,6 +19,7 @@ #include "streaming.h" #include "decorate.h" #include "packfile.h" +#include "object-file.h" #include "object-name.h" #include "object-store.h" #include "replace-object.h" diff --git a/builtin/gc.c b/builtin/gc.c index 000a2ef5e1..b95154fba1 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -25,6 +25,7 @@ #include "commit.h" #include "commit-graph.h" #include "packfile.h" +#include "object-file.h" #include "object-store.h" #include "pack.h" #include "pack-objects.h" diff --git a/builtin/grep.c b/builtin/grep.c index f66e14389e..fb11be6075 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -26,6 +26,7 @@ #include "setup.h" #include "submodule.h" #include "submodule-config.h" +#include "object-file.h" #include "object-name.h" #include "object-store.h" #include "packfile.h" diff --git a/builtin/hash-object.c b/builtin/hash-object.c index a15fe4fd3f..a380121166 100644 --- a/builtin/hash-object.c +++ b/builtin/hash-object.c @@ -9,6 +9,7 @@ #include "config.h" #include "gettext.h" #include "hex.h" +#include "object-file.h" #include "object-store.h" #include "blob.h" #include "quote.h" diff --git a/builtin/index-pack.c b/builtin/index-pack.c index 5adfb2521c..0f59cf8aa0 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -18,6 +18,7 @@ #include "thread-utils.h" #include "packfile.h" #include "pack-revindex.h" +#include "object-file.h" #include "object-store.h" #include "oid-array.h" #include "replace-object.h" diff --git a/builtin/init-db.c b/builtin/init-db.c index ba6e0b20fa..6183f3fb3f 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -11,6 +11,7 @@ #include "refs.h" #include "builtin.h" #include "exec-cmd.h" +#include "object-file.h" #include "parse-options.h" #include "setup.h" #include "worktree.h" diff --git a/builtin/log.c b/builtin/log.c index 5cdc2276cc..b6246c7042 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -12,6 +12,7 @@ #include "gettext.h" #include "hex.h" #include "refs.h" +#include "object-file.h" #include "object-name.h" #include "object-store.h" #include "color.h" diff --git a/builtin/mktag.c b/builtin/mktag.c index f9d9a38452..f33d267fcb 100644 --- a/builtin/mktag.c +++ b/builtin/mktag.c @@ -4,6 +4,7 @@ #include "parse-options.h" #include "tag.h" #include "replace-object.h" +#include "object-file.h" #include "object-store.h" #include "fsck.h" #include "config.h" diff --git a/builtin/mv.c b/builtin/mv.c index 8f7770aa32..32935af48e 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -11,6 +11,7 @@ #include "config.h" #include "environment.h" #include "gettext.h" +#include "object-file.h" #include "pathspec.h" #include "lockfile.h" #include "dir.h" diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 69c6542861..68c914a8e1 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -33,6 +33,7 @@ #include "strvec.h" #include "list.h" #include "packfile.h" +#include "object-file.h" #include "object-store.h" #include "replace-object.h" #include "dir.h" diff --git a/builtin/prune.c b/builtin/prune.c index 09891832fb..5dc9b20720 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -11,6 +11,7 @@ #include "progress.h" #include "prune-packed.h" #include "replace-object.h" +#include "object-file.h" #include "object-name.h" #include "object-store.h" #include "shallow.h" diff --git a/builtin/rebase.c b/builtin/rebase.c index ff5dd77608..34fea4d822 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -21,6 +21,7 @@ #include "cache-tree.h" #include "unpack-trees.h" #include "lockfile.h" +#include "object-file.h" #include "object-name.h" #include "parse-options.h" #include "commit.h" diff --git a/builtin/replace.c b/builtin/replace.c index 134f738a45..f4b3a8efb2 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -17,6 +17,7 @@ #include "refs.h" #include "parse-options.h" #include "run-command.h" +#include "object-file.h" #include "object-name.h" #include "object-store.h" #include "replace-object.h" diff --git a/builtin/rev-list.c b/builtin/rev-list.c index c17f0282ae..6dc8be492a 100644 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@ -11,6 +11,7 @@ #include "list-objects-filter-options.h" #include "object.h" #include "object-name.h" +#include "object-file.h" #include "object-store.h" #include "pack.h" #include "pack-bitmap.h" diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c index 34b9d92fb1..4de37d07fd 100644 --- a/builtin/sparse-checkout.c +++ b/builtin/sparse-checkout.c @@ -4,6 +4,7 @@ #include "dir.h" #include "environment.h" #include "gettext.h" +#include "object-file.h" #include "object-name.h" #include "parse-options.h" #include "pathspec.h" diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 1f087d7bed..5d999f814e 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -24,6 +24,7 @@ #include "revision.h" #include "diffcore.h" #include "diff.h" +#include "object-file.h" #include "object-name.h" #include "object-store.h" #include "advice.h" diff --git a/builtin/update-index.c b/builtin/update-index.c index 03cda5e60d..33b00cef15 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -15,6 +15,7 @@ #include "cache-tree.h" #include "tree-walk.h" #include "builtin.h" +#include "object-file.h" #include "refs.h" #include "resolve-undo.h" #include "parse-options.h" diff --git a/builtin/worktree.c b/builtin/worktree.c index 69132bba31..0621f6f708 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -7,6 +7,7 @@ #include "environment.h" #include "gettext.h" #include "hex.h" +#include "object-file.h" #include "object-name.h" #include "parse-options.h" #include "strvec.h" diff --git a/bulk-checkin.c b/bulk-checkin.c index 6362b6aabc..af15f8a9af 100644 --- a/bulk-checkin.c +++ b/bulk-checkin.c @@ -15,6 +15,7 @@ #include "string-list.h" #include "tmp-objdir.h" #include "packfile.h" +#include "object-file.h" #include "object-store.h" static int odb_transaction_nesting; diff --git a/cache-tree.c b/cache-tree.c index 39f0c74472..ebfe649b33 100644 --- a/cache-tree.c +++ b/cache-tree.c @@ -7,6 +7,7 @@ #include "tree-walk.h" #include "cache-tree.h" #include "bulk-checkin.h" +#include "object-file.h" #include "object-store.h" #include "replace-object.h" #include "promisor-remote.h" diff --git a/cache.h b/cache.h index c06778b69c..89987cca22 100644 --- a/cache.h +++ b/cache.h @@ -3,7 +3,6 @@ #include "git-compat-util.h" #include "strbuf.h" -#include "git-zlib.h" #include "hashmap.h" #include "list.h" #include "gettext.h" @@ -596,13 +595,6 @@ int has_racy_timestamp(struct index_state *istate); int ie_match_stat(struct index_state *, const struct cache_entry *, struct stat *, unsigned int); int ie_modified(struct index_state *, const struct cache_entry *, struct stat *, unsigned int); -#define HASH_WRITE_OBJECT 1 -#define HASH_FORMAT_CHECK 2 -#define HASH_RENORMALIZE 4 -#define HASH_SILENT 8 -int index_fd(struct index_state *istate, struct object_id *oid, int fd, struct stat *st, enum object_type type, const char *path, unsigned flags); -int index_path(struct index_state *istate, struct object_id *oid, const char *path, struct stat *st, unsigned flags); - /* * Record to sd the data from st that we use to check whether a file * might have changed. @@ -664,107 +656,6 @@ extern int quote_path_fully; #define DATA_CHANGED 0x0020 #define TYPE_CHANGED 0x0040 -/* - * Create the directory containing the named path, using care to be - * somewhat safe against races. Return one of the scld_error values to - * indicate success/failure. On error, set errno to describe the - * problem. - * - * SCLD_VANISHED indicates that one of the ancestor directories of the - * path existed at one point during the function call and then - * suddenly vanished, probably because another process pruned the - * directory while we were working. To be robust against this kind of - * race, callers might want to try invoking the function again when it - * returns SCLD_VANISHED. - * - * safe_create_leading_directories() temporarily changes path while it - * is working but restores it before returning. - * safe_create_leading_directories_const() doesn't modify path, even - * temporarily. Both these variants adjust the permissions of the - * created directories to honor core.sharedRepository, so they are best - * suited for files inside the git dir. For working tree files, use - * safe_create_leading_directories_no_share() instead, as it ignores - * the core.sharedRepository setting. - */ -enum scld_error { - SCLD_OK = 0, - SCLD_FAILED = -1, - SCLD_PERMS = -2, - SCLD_EXISTS = -3, - SCLD_VANISHED = -4 -}; -enum scld_error safe_create_leading_directories(char *path); -enum scld_error safe_create_leading_directories_const(const char *path); -enum scld_error safe_create_leading_directories_no_share(char *path); - -int mkdir_in_gitdir(const char *path); - -int git_open_cloexec(const char *name, int flags); -#define git_open(name) git_open_cloexec(name, O_RDONLY) - -/** - * unpack_loose_header() initializes the data stream needed to unpack - * a loose object header. - * - * Returns: - * - * - ULHR_OK on success - * - ULHR_BAD on error - * - ULHR_TOO_LONG if the header was too long - * - * It will only parse up to MAX_HEADER_LEN bytes unless an optional - * "hdrbuf" argument is non-NULL. This is intended for use with - * OBJECT_INFO_ALLOW_UNKNOWN_TYPE to extract the bad type for (error) - * reporting. The full header will be extracted to "hdrbuf" for use - * with parse_loose_header(), ULHR_TOO_LONG will still be returned - * from this function to indicate that the header was too long. - */ -enum unpack_loose_header_result { - ULHR_OK, - ULHR_BAD, - ULHR_TOO_LONG, -}; -enum unpack_loose_header_result unpack_loose_header(git_zstream *stream, - unsigned char *map, - unsigned long mapsize, - void *buffer, - unsigned long bufsiz, - struct strbuf *hdrbuf); - -/** - * parse_loose_header() parses the starting " \0" of an - * object. If it doesn't follow that format -1 is returned. To check - * the validity of the populate the "typep" in the "struct - * object_info". It will be OBJ_BAD if the object type is unknown. The - * parsed can be retrieved via "oi->sizep", and from there - * passed to unpack_loose_rest(). - */ -struct object_info; -int parse_loose_header(const char *hdr, struct object_info *oi); - -/** - * With in-core object data in "buf", rehash it to make sure the - * object name actually matches "oid" to detect object corruption. - * - * A negative value indicates an error, usually that the OID is not - * what we expected, but it might also indicate another error. - */ -int check_object_signature(struct repository *r, const struct object_id *oid, - void *map, unsigned long size, - enum object_type type); - -/** - * A streaming version of check_object_signature(). - * Try reading the object named with "oid" using - * the streaming interface and rehash it to do the same. - */ -int stream_object_signature(struct repository *r, const struct object_id *oid); - -int finalize_object_file(const char *tmpfile, const char *filename); - -/* Helper to check and "touch" a file */ -int check_and_freshen_file(const char *fn, int freshen); - int base_name_compare(const char *name1, size_t len1, int mode1, const char *name2, size_t len2, int mode2); int df_name_compare(const char *name1, size_t len1, int mode1, @@ -772,12 +663,6 @@ int df_name_compare(const char *name1, size_t len1, int mode1, int name_compare(const char *name1, size_t len1, const char *name2, size_t len2); int cache_name_stage_compare(const char *name1, int len1, int stage1, const char *name2, int len2, int stage2); -void *read_object_with_reference(struct repository *r, - const struct object_id *oid, - enum object_type required_type, - unsigned long *size, - struct object_id *oid_ret); - const char *git_editor(void); const char *git_sequence_editor(void); const char *git_pager(int stdout_is_tty); @@ -819,14 +704,6 @@ struct pack_entry { struct packed_git *p; }; -/* - * Set this to 0 to prevent oid_object_info_extended() from fetching missing - * blobs. This has a difference only if extensions.partialClone is set. - * - * Its default value is 1. - */ -extern int fetch_if_missing; - /* Dumb servers support */ int update_server_info(int); diff --git a/commit-graph.c b/commit-graph.c index fe9a8b2342..c20e73ceeb 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -11,6 +11,7 @@ #include "revision.h" #include "hash-lookup.h" #include "commit-graph.h" +#include "object-file.h" #include "object-store.h" #include "oid-array.h" #include "alloc.h" diff --git a/diff.c b/diff.c index 9e6ad94bc6..f8e0d3b5c5 100644 --- a/diff.c +++ b/diff.c @@ -35,6 +35,7 @@ #include "help.h" #include "promisor-remote.h" #include "dir.h" +#include "object-file.h" #include "object-name.h" #include "setup.h" #include "strmap.h" diff --git a/dir.c b/dir.c index d1f1b1ef76..aa840995c4 100644 --- a/dir.c +++ b/dir.c @@ -13,6 +13,7 @@ #include "dir.h" #include "environment.h" #include "gettext.h" +#include "object-file.h" #include "object-store.h" #include "attr.h" #include "refs.h" diff --git a/environment.c b/environment.c index e57292eccc..39efa49fe3 100644 --- a/environment.c +++ b/environment.c @@ -19,6 +19,7 @@ #include "fmt-merge-msg.h" #include "commit.h" #include "strvec.h" +#include "object-file.h" #include "object-store.h" #include "replace-object.h" #include "tmp-objdir.h" diff --git a/http.c b/http.c index 0212c0ad3b..c3916ceb4d 100644 --- a/http.c +++ b/http.c @@ -17,6 +17,7 @@ #include "packfile.h" #include "protocol.h" #include "string-list.h" +#include "object-file.h" #include "object-store.h" static struct trace_key trace_curl = TRACE_KEY_INIT(CURL); diff --git a/merge-recursive.c b/merge-recursive.c index 748a6799a3..9875bdb11c 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -22,6 +22,7 @@ #include "hex.h" #include "ll-merge.h" #include "lockfile.h" +#include "object-file.h" #include "object-name.h" #include "object-store.h" #include "repository.h" diff --git a/midx.c b/midx.c index 9af3e5de88..2d0da57328 100644 --- a/midx.c +++ b/midx.c @@ -8,6 +8,7 @@ #include "hex.h" #include "lockfile.h" #include "packfile.h" +#include "object-file.h" #include "object-store.h" #include "hash-lookup.h" #include "midx.h" diff --git a/notes-merge.c b/notes-merge.c index b496b77d9d..cc9538ac5c 100644 --- a/notes-merge.c +++ b/notes-merge.c @@ -3,6 +3,7 @@ #include "commit.h" #include "gettext.h" #include "refs.h" +#include "object-file.h" #include "object-name.h" #include "object-store.h" #include "repository.h" diff --git a/object-file.c b/object-file.c index a4331e0da6..8163ddbadd 100644 --- a/object-file.c +++ b/object-file.c @@ -36,6 +36,7 @@ #include "mergesort.h" #include "quote.h" #include "packfile.h" +#include "object-file.h" #include "object-store.h" #include "promisor-remote.h" #include "setup.h" diff --git a/object-file.h b/object-file.h new file mode 100644 index 0000000000..e0cfc3a5db --- /dev/null +++ b/object-file.h @@ -0,0 +1,129 @@ +#ifndef OBJECT_FILE_H +#define OBJECT_FILE_H + +#include "git-zlib.h" +#include "object.h" + +/* + * Set this to 0 to prevent oid_object_info_extended() from fetching missing + * blobs. This has a difference only if extensions.partialClone is set. + * + * Its default value is 1. + */ +extern int fetch_if_missing; + +#define HASH_WRITE_OBJECT 1 +#define HASH_FORMAT_CHECK 2 +#define HASH_RENORMALIZE 4 +#define HASH_SILENT 8 +int index_fd(struct index_state *istate, struct object_id *oid, int fd, struct stat *st, enum object_type type, const char *path, unsigned flags); +int index_path(struct index_state *istate, struct object_id *oid, const char *path, struct stat *st, unsigned flags); + +/* + * Create the directory containing the named path, using care to be + * somewhat safe against races. Return one of the scld_error values to + * indicate success/failure. On error, set errno to describe the + * problem. + * + * SCLD_VANISHED indicates that one of the ancestor directories of the + * path existed at one point during the function call and then + * suddenly vanished, probably because another process pruned the + * directory while we were working. To be robust against this kind of + * race, callers might want to try invoking the function again when it + * returns SCLD_VANISHED. + * + * safe_create_leading_directories() temporarily changes path while it + * is working but restores it before returning. + * safe_create_leading_directories_const() doesn't modify path, even + * temporarily. Both these variants adjust the permissions of the + * created directories to honor core.sharedRepository, so they are best + * suited for files inside the git dir. For working tree files, use + * safe_create_leading_directories_no_share() instead, as it ignores + * the core.sharedRepository setting. + */ +enum scld_error { + SCLD_OK = 0, + SCLD_FAILED = -1, + SCLD_PERMS = -2, + SCLD_EXISTS = -3, + SCLD_VANISHED = -4 +}; +enum scld_error safe_create_leading_directories(char *path); +enum scld_error safe_create_leading_directories_const(const char *path); +enum scld_error safe_create_leading_directories_no_share(char *path); + +int mkdir_in_gitdir(const char *path); + +int git_open_cloexec(const char *name, int flags); +#define git_open(name) git_open_cloexec(name, O_RDONLY) + +/** + * unpack_loose_header() initializes the data stream needed to unpack + * a loose object header. + * + * Returns: + * + * - ULHR_OK on success + * - ULHR_BAD on error + * - ULHR_TOO_LONG if the header was too long + * + * It will only parse up to MAX_HEADER_LEN bytes unless an optional + * "hdrbuf" argument is non-NULL. This is intended for use with + * OBJECT_INFO_ALLOW_UNKNOWN_TYPE to extract the bad type for (error) + * reporting. The full header will be extracted to "hdrbuf" for use + * with parse_loose_header(), ULHR_TOO_LONG will still be returned + * from this function to indicate that the header was too long. + */ +enum unpack_loose_header_result { + ULHR_OK, + ULHR_BAD, + ULHR_TOO_LONG, +}; +enum unpack_loose_header_result unpack_loose_header(git_zstream *stream, + unsigned char *map, + unsigned long mapsize, + void *buffer, + unsigned long bufsiz, + struct strbuf *hdrbuf); + +/** + * parse_loose_header() parses the starting " \0" of an + * object. If it doesn't follow that format -1 is returned. To check + * the validity of the populate the "typep" in the "struct + * object_info". It will be OBJ_BAD if the object type is unknown. The + * parsed can be retrieved via "oi->sizep", and from there + * passed to unpack_loose_rest(). + */ +struct object_info; +int parse_loose_header(const char *hdr, struct object_info *oi); + +/** + * With in-core object data in "buf", rehash it to make sure the + * object name actually matches "oid" to detect object corruption. + * + * A negative value indicates an error, usually that the OID is not + * what we expected, but it might also indicate another error. + */ +int check_object_signature(struct repository *r, const struct object_id *oid, + void *map, unsigned long size, + enum object_type type); + +/** + * A streaming version of check_object_signature(). + * Try reading the object named with "oid" using + * the streaming interface and rehash it to do the same. + */ +int stream_object_signature(struct repository *r, const struct object_id *oid); + +int finalize_object_file(const char *tmpfile, const char *filename); + +/* Helper to check and "touch" a file */ +int check_and_freshen_file(const char *fn, int freshen); + +void *read_object_with_reference(struct repository *r, + const struct object_id *oid, + enum object_type required_type, + unsigned long *size, + struct object_id *oid_ret); + +#endif /* OBJECT_FILE_H */ diff --git a/object.c b/object.c index 45c9721b8c..6d4ef1524d 100644 --- a/object.c +++ b/object.c @@ -3,6 +3,7 @@ #include "hex.h" #include "object.h" #include "replace-object.h" +#include "object-file.h" #include "object-store.h" #include "blob.h" #include "tree.h" diff --git a/pack-bitmap.c b/pack-bitmap.c index eba838d24e..1371f17d22 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -16,6 +16,7 @@ #include "packfile.h" #include "repository.h" #include "trace2.h" +#include "object-file.h" #include "object-store.h" #include "list-objects-filter-options.h" #include "midx.h" diff --git a/pack-check.c b/pack-check.c index 6974e40a95..40d88bc5eb 100644 --- a/pack-check.c +++ b/pack-check.c @@ -6,6 +6,7 @@ #include "pack-revindex.h" #include "progress.h" #include "packfile.h" +#include "object-file.h" #include "object-store.h" struct idx_entry { diff --git a/pack-mtimes.c b/pack-mtimes.c index afed632190..0096ace080 100644 --- a/pack-mtimes.c +++ b/pack-mtimes.c @@ -1,6 +1,7 @@ #include "cache.h" #include "gettext.h" #include "pack-mtimes.h" +#include "object-file.h" #include "object-store.h" #include "packfile.h" diff --git a/pack-revindex.c b/pack-revindex.c index 9f9927d947..22a1958a1f 100644 --- a/pack-revindex.c +++ b/pack-revindex.c @@ -1,6 +1,7 @@ #include "cache.h" #include "gettext.h" #include "pack-revindex.h" +#include "object-file.h" #include "object-store.h" #include "packfile.h" #include "trace2.h" diff --git a/packfile.c b/packfile.c index 02afbe7713..9ae2278c22 100644 --- a/packfile.c +++ b/packfile.c @@ -18,6 +18,7 @@ #include "trace.h" #include "tree-walk.h" #include "tree.h" +#include "object-file.h" #include "object-store.h" #include "midx.h" #include "commit-graph.h" diff --git a/read-cache.c b/read-cache.c index cbbfc030da..f225bf44cd 100644 --- a/read-cache.c +++ b/read-cache.c @@ -14,6 +14,7 @@ #include "cache-tree.h" #include "refs.h" #include "dir.h" +#include "object-file.h" #include "object-store.h" #include "oid-array.h" #include "tree.h" diff --git a/refs/files-backend.c b/refs/files-backend.c index e6a6971381..d0581ee41a 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -12,6 +12,7 @@ #include "../dir-iterator.h" #include "../lockfile.h" #include "../object.h" +#include "../object-file.h" #include "../dir.h" #include "../chdir-notify.h" #include "../setup.h" diff --git a/rerere.c b/rerere.c index 5516e336d0..093c0f6f99 100644 --- a/rerere.c +++ b/rerere.c @@ -13,6 +13,7 @@ #include "ll-merge.h" #include "attr.h" #include "pathspec.h" +#include "object-file.h" #include "object-store.h" #include "hash-lookup.h" #include "strmap.h" diff --git a/revision.c b/revision.c index 7438b50e26..3d86e07abb 100644 --- a/revision.c +++ b/revision.c @@ -5,6 +5,7 @@ #include "gettext.h" #include "hex.h" #include "object-name.h" +#include "object-file.h" #include "object-store.h" #include "tag.h" #include "blob.h" diff --git a/sequencer.c b/sequencer.c index 22b287be98..be10249fd0 100644 --- a/sequencer.c +++ b/sequencer.c @@ -8,6 +8,7 @@ #include "hex.h" #include "lockfile.h" #include "dir.h" +#include "object-file.h" #include "object-name.h" #include "object-store.h" #include "object.h" diff --git a/server-info.c b/server-info.c index 355b6e01a5..68098ddd1a 100644 --- a/server-info.c +++ b/server-info.c @@ -9,6 +9,7 @@ #include "commit.h" #include "tag.h" #include "packfile.h" +#include "object-file.h" #include "object-store.h" #include "strbuf.h" #include "wrapper.h" diff --git a/streaming.c b/streaming.c index 27e014d8b2..b3415724ee 100644 --- a/streaming.c +++ b/streaming.c @@ -6,6 +6,7 @@ #include "environment.h" #include "streaming.h" #include "repository.h" +#include "object-file.h" #include "object-store.h" #include "replace-object.h" #include "packfile.h" diff --git a/submodule.c b/submodule.c index 4f403b9eef..d09bc22d4b 100644 --- a/submodule.c +++ b/submodule.c @@ -24,6 +24,7 @@ #include "remote.h" #include "worktree.h" #include "parse-options.h" +#include "object-file.h" #include "object-name.h" #include "object-store.h" #include "commit-reach.h" diff --git a/tmp-objdir.c b/tmp-objdir.c index 5adad1925d..fff7ff42db 100644 --- a/tmp-objdir.c +++ b/tmp-objdir.c @@ -4,6 +4,7 @@ #include "chdir-notify.h" #include "dir.h" #include "environment.h" +#include "object-file.h" #include "sigchain.h" #include "string-list.h" #include "strbuf.h" diff --git a/tree-walk.c b/tree-walk.c index 59add24c8e..2993c48c2f 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -4,6 +4,7 @@ #include "dir.h" #include "gettext.h" #include "hex.h" +#include "object-file.h" #include "object-store.h" #include "trace2.h" #include "tree.h" -- cgit 1.2.3-korg From b6fdc44c8441d04c6659252cdf9adae240339e17 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Tue, 11 Apr 2023 00:41:54 -0700 Subject: treewide: remove cache.h inclusion due to object-file.h changes Signed-off-by: Elijah Newren Acked-by: Calvin Wan Signed-off-by: Junio C Hamano --- bulk-checkin.c | 2 +- commit-graph.c | 2 +- http-fetch.c | 2 +- http-walker.c | 2 +- http.h | 1 - notes-merge.c | 2 +- pack-bitmap.c | 2 +- pack-check.c | 2 +- pack-mtimes.c | 2 +- pack-revindex.c | 2 +- streaming.c | 2 +- tmp-objdir.c | 2 +- 12 files changed, 11 insertions(+), 12 deletions(-) (limited to 'commit-graph.c') diff --git a/bulk-checkin.c b/bulk-checkin.c index af15f8a9af..9192298db6 100644 --- a/bulk-checkin.c +++ b/bulk-checkin.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2011, Google Inc. */ -#include "cache.h" +#include "git-compat-util.h" #include "alloc.h" #include "bulk-checkin.h" #include "environment.h" diff --git a/commit-graph.c b/commit-graph.c index c20e73ceeb..0c4f226644 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "config.h" #include "gettext.h" #include "hex.h" diff --git a/http-fetch.c b/http-fetch.c index c874d3402d..fffda59267 100644 --- a/http-fetch.c +++ b/http-fetch.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "config.h" #include "exec-cmd.h" #include "gettext.h" diff --git a/http-walker.c b/http-walker.c index 4588e6a340..3b41f5654b 100644 --- a/http-walker.c +++ b/http-walker.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "repository.h" #include "commit.h" #include "hex.h" diff --git a/http.h b/http.h index 783b2b09b8..3a409bccd4 100644 --- a/http.h +++ b/http.h @@ -3,7 +3,6 @@ struct packed_git; -#include "cache.h" #include "git-zlib.h" #include diff --git a/notes-merge.c b/notes-merge.c index cc9538ac5c..233e49e319 100644 --- a/notes-merge.c +++ b/notes-merge.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "advice.h" #include "commit.h" #include "gettext.h" diff --git a/pack-bitmap.c b/pack-bitmap.c index 1371f17d22..48fc2ec76d 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "alloc.h" #include "commit.h" #include "gettext.h" diff --git a/pack-check.c b/pack-check.c index 40d88bc5eb..049f2f0bfc 100644 --- a/pack-check.c +++ b/pack-check.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "environment.h" #include "hex.h" #include "repository.h" diff --git a/pack-mtimes.c b/pack-mtimes.c index 0096ace080..020a37f8fe 100644 --- a/pack-mtimes.c +++ b/pack-mtimes.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "gettext.h" #include "pack-mtimes.h" #include "object-file.h" diff --git a/pack-revindex.c b/pack-revindex.c index 22a1958a1f..4d9bb41b4d 100644 --- a/pack-revindex.c +++ b/pack-revindex.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "gettext.h" #include "pack-revindex.h" #include "object-file.h" diff --git a/streaming.c b/streaming.c index b3415724ee..21e39585e8 100644 --- a/streaming.c +++ b/streaming.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2011, Google Inc. */ -#include "cache.h" +#include "git-compat-util.h" #include "convert.h" #include "environment.h" #include "streaming.h" diff --git a/tmp-objdir.c b/tmp-objdir.c index fff7ff42db..c33a554f92 100644 --- a/tmp-objdir.c +++ b/tmp-objdir.c @@ -1,4 +1,4 @@ -#include "cache.h" +#include "git-compat-util.h" #include "tmp-objdir.h" #include "abspath.h" #include "chdir-notify.h" -- cgit 1.2.3-korg From d4a4f9291d63b48b368f79bce3151bee9ca28009 Mon Sep 17 00:00:00 2001 From: Elijah Newren Date: Sat, 22 Apr 2023 20:17:26 +0000 Subject: commit.h: reduce unnecessary includes Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- add-interactive.c | 1 + archive.c | 2 ++ bloom.c | 1 + builtin/diff-tree.c | 1 + builtin/diff.c | 1 + builtin/gc.c | 1 + builtin/log.c | 1 + builtin/merge-tree.c | 1 + combine-diff.c | 1 + commit-graph.c | 1 + commit.c | 1 + commit.h | 11 ++++------- dir.c | 1 + fetch-pack.c | 1 + fsck.c | 1 + gpg-interface.c | 1 + grep.c | 1 + http-push.c | 1 + log-tree.c | 1 + merge-ort-wrappers.c | 1 + merge.c | 1 + notes-cache.c | 1 + notes-utils.c | 1 + object-name.c | 1 + pack-bitmap-write.c | 1 + parse-options-cb.c | 1 + parse-options.c | 1 + read-cache.c | 1 + ref-filter.c | 1 + reflog.c | 1 + refs/debug.c | 1 + refspec.c | 1 + revision.h | 1 + send-pack.c | 1 + wt-status.c | 1 + 35 files changed, 39 insertions(+), 7 deletions(-) (limited to 'commit-graph.c') diff --git a/add-interactive.c b/add-interactive.c index 757a9929d4..de877ca052 100644 --- a/add-interactive.c +++ b/add-interactive.c @@ -12,6 +12,7 @@ #include "dir.h" #include "run-command.h" #include "prompt.h" +#include "tree.h" static void init_color(struct repository *r, struct add_i_state *s, const char *section_and_slot, char *dst, diff --git a/archive.c b/archive.c index ab8966d73a..6226e16b25 100644 --- a/archive.c +++ b/archive.c @@ -6,10 +6,12 @@ #include "environment.h" #include "gettext.h" #include "hex.h" +#include "pretty.h" #include "setup.h" #include "refs.h" #include "object-store.h" #include "commit.h" +#include "tree.h" #include "tree-walk.h" #include "attr.h" #include "archive.h" diff --git a/bloom.c b/bloom.c index d0730525da..aef6b5fea2 100644 --- a/bloom.c +++ b/bloom.c @@ -6,6 +6,7 @@ #include "hashmap.h" #include "commit-graph.h" #include "commit.h" +#include "commit-slab.h" define_commit_slab(bloom_filter_slab, struct bloom_filter); diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c index 385c2d0230..0b02c62b85 100644 --- a/builtin/diff-tree.c +++ b/builtin/diff-tree.c @@ -9,6 +9,7 @@ #include "builtin.h" #include "submodule.h" #include "repository.h" +#include "tree.h" static struct rev_info log_tree_opt; diff --git a/builtin/diff.c b/builtin/diff.c index 8f386535d6..457dee1445 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -22,6 +22,7 @@ #include "setup.h" #include "submodule.h" #include "oid-array.h" +#include "tree.h" #define DIFF_NO_INDEX_EXPLICIT 1 #define DIFF_NO_INDEX_IMPLICIT 2 diff --git a/builtin/gc.c b/builtin/gc.c index b95154fba1..d11712b144 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -12,6 +12,7 @@ #include "builtin.h" #include "abspath.h" +#include "date.h" #include "environment.h" #include "hex.h" #include "repository.h" diff --git a/builtin/log.c b/builtin/log.c index 95de51921f..137b84b31e 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -44,6 +44,7 @@ #include "commit-reach.h" #include "range-diff.h" #include "tmp-objdir.h" +#include "tree.h" #include "write-or-die.h" #define MAIL_DEFAULT_WRAP 72 diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index 6b9f006ec1..aa8040c2a6 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -16,6 +16,7 @@ #include "exec-cmd.h" #include "merge-blobs.h" #include "quote.h" +#include "tree.h" static int line_termination = '\n'; diff --git a/combine-diff.c b/combine-diff.c index f8d6196577..1e3cd7fb17 100644 --- a/combine-diff.c +++ b/combine-diff.c @@ -13,6 +13,7 @@ #include "xdiff/xmacros.h" #include "log-tree.h" #include "refs.h" +#include "tree.h" #include "userdiff.h" #include "oid-array.h" #include "revision.h" diff --git a/commit-graph.c b/commit-graph.c index 0c4f226644..6f612f368b 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -23,6 +23,7 @@ #include "shallow.h" #include "json-writer.h" #include "trace2.h" +#include "tree.h" #include "chunk-format.h" #include "wrapper.h" diff --git a/commit.c b/commit.c index 878b4473e4..10676165a1 100644 --- a/commit.c +++ b/commit.c @@ -26,6 +26,7 @@ #include "run-command.h" #include "setup.h" #include "shallow.h" +#include "tree.h" #include "hook.h" static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **); diff --git a/commit.h b/commit.h index 69b2f376e9..28928833c5 100644 --- a/commit.h +++ b/commit.h @@ -2,13 +2,10 @@ #define COMMIT_H #include "object.h" -#include "tree.h" -#include "strbuf.h" -#include "decorate.h" -#include "gpg-interface.h" -#include "string-list.h" -#include "pretty.h" -#include "commit-slab.h" + +struct signature_check; +struct strbuf; +struct tree; #define COMMIT_NOT_FROM_GRAPH 0xFFFFFFFF #define GENERATION_NUMBER_INFINITY ((1ULL << 63) - 1) diff --git a/dir.c b/dir.c index ed262fa6e4..a7469df3ac 100644 --- a/dir.c +++ b/dir.c @@ -27,6 +27,7 @@ #include "submodule-config.h" #include "symlinks.h" #include "trace2.h" +#include "tree.h" #include "wrapper.h" /* diff --git a/fetch-pack.c b/fetch-pack.c index 677102465a..a9745bd9fa 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -2,6 +2,7 @@ #include "alloc.h" #include "repository.h" #include "config.h" +#include "date.h" #include "environment.h" #include "gettext.h" #include "hex.h" diff --git a/fsck.c b/fsck.c index adbe8bf59e..3261ef9ec2 100644 --- a/fsck.c +++ b/fsck.c @@ -1,5 +1,6 @@ #include "git-compat-util.h" #include "alloc.h" +#include "date.h" #include "hex.h" #include "object-store.h" #include "repository.h" diff --git a/gpg-interface.c b/gpg-interface.c index 8615dcd4b4..49d72c2066 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "commit.h" #include "config.h" +#include "date.h" #include "gettext.h" #include "run-command.h" #include "strbuf.h" diff --git a/grep.c b/grep.c index d144b37489..e620e375b1 100644 --- a/grep.c +++ b/grep.c @@ -4,6 +4,7 @@ #include "grep.h" #include "hex.h" #include "object-store.h" +#include "pretty.h" #include "userdiff.h" #include "xdiff-interface.h" #include "diff.h" diff --git a/http-push.c b/http-push.c index 637a4e91f7..3f18498636 100644 --- a/http-push.c +++ b/http-push.c @@ -15,6 +15,7 @@ #include "setup.h" #include "sigchain.h" #include "strvec.h" +#include "tree.h" #include "packfile.h" #include "object-store.h" #include "commit-reach.h" diff --git a/log-tree.c b/log-tree.c index b5cf3d8439..8861900b59 100644 --- a/log-tree.c +++ b/log-tree.c @@ -24,6 +24,7 @@ #include "help.h" #include "range-diff.h" #include "strmap.h" +#include "tree.h" #include "write-or-die.h" static struct decoration name_decoration = { "object names" }; diff --git a/merge-ort-wrappers.c b/merge-ort-wrappers.c index 2c47c5a623..a550753300 100644 --- a/merge-ort-wrappers.c +++ b/merge-ort-wrappers.c @@ -3,6 +3,7 @@ #include "hash.h" #include "merge-ort.h" #include "merge-ort-wrappers.h" +#include "tree.h" #include "commit.h" diff --git a/merge.c b/merge.c index da7fa652c2..10aaec3a6c 100644 --- a/merge.c +++ b/merge.c @@ -7,6 +7,7 @@ #include "commit.h" #include "run-command.h" #include "resolve-undo.h" +#include "tree.h" #include "tree-walk.h" #include "unpack-trees.h" #include "dir.h" diff --git a/notes-cache.c b/notes-cache.c index fbcdfd0dfe..14288caf98 100644 --- a/notes-cache.c +++ b/notes-cache.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "notes-cache.h" #include "object-store.h" +#include "pretty.h" #include "repository.h" #include "commit.h" #include "refs.h" diff --git a/notes-utils.c b/notes-utils.c index cb88171b7b..4a793eb347 100644 --- a/notes-utils.c +++ b/notes-utils.c @@ -6,6 +6,7 @@ #include "refs.h" #include "notes-utils.h" #include "repository.h" +#include "strbuf.h" void create_notes_commit(struct repository *r, struct notes_tree *t, diff --git a/object-name.c b/object-name.c index 3cd5b32729..5ccbe854b6 100644 --- a/object-name.c +++ b/object-name.c @@ -15,6 +15,7 @@ #include "dir.h" #include "oid-array.h" #include "packfile.h" +#include "pretty.h" #include "object-store.h" #include "repository.h" #include "setup.h" diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c index faf67c94d3..3d3fd38065 100644 --- a/pack-bitmap-write.c +++ b/pack-bitmap-write.c @@ -18,6 +18,7 @@ #include "commit-reach.h" #include "prio-queue.h" #include "trace2.h" +#include "tree.h" struct bitmapped_commit { struct commit *commit; diff --git a/parse-options-cb.c b/parse-options-cb.c index 26a4c7d08a..be81158f86 100644 --- a/parse-options-cb.c +++ b/parse-options-cb.c @@ -3,6 +3,7 @@ #include "branch.h" #include "commit.h" #include "color.h" +#include "date.h" #include "environment.h" #include "gettext.h" #include "object-name.h" diff --git a/parse-options.c b/parse-options.c index b6803647d0..f8a155ee13 100644 --- a/parse-options.c +++ b/parse-options.c @@ -5,6 +5,7 @@ #include "commit.h" #include "color.h" #include "gettext.h" +#include "strbuf.h" #include "utf8.h" static int disallow_abbreviated_options; diff --git a/read-cache.c b/read-cache.c index b3e2917ddc..d64d93bc36 100644 --- a/read-cache.c +++ b/read-cache.c @@ -6,6 +6,7 @@ #include "cache.h" #include "alloc.h" #include "config.h" +#include "date.h" #include "diff.h" #include "diffcore.h" #include "hex.h" diff --git a/ref-filter.c b/ref-filter.c index 594e66ad36..84eee904ba 100644 --- a/ref-filter.c +++ b/ref-filter.c @@ -2,6 +2,7 @@ #include "alloc.h" #include "environment.h" #include "gettext.h" +#include "gpg-interface.h" #include "hex.h" #include "parse-options.h" #include "refs.h" diff --git a/reflog.c b/reflog.c index 9c09443088..57dc7c0d05 100644 --- a/reflog.c +++ b/reflog.c @@ -4,6 +4,7 @@ #include "reflog.h" #include "refs.h" #include "revision.h" +#include "tree.h" #include "worktree.h" /* Remember to update object flag allocation in object.h */ diff --git a/refs/debug.c b/refs/debug.c index adc34c836f..6f11e6de46 100644 --- a/refs/debug.c +++ b/refs/debug.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "hex.h" #include "refs-internal.h" +#include "string-list.h" #include "trace.h" static struct trace_key trace_refs = TRACE_KEY_INIT(REFS); diff --git a/refspec.c b/refspec.c index 31b61d782c..57f6c2aaf9 100644 --- a/refspec.c +++ b/refspec.c @@ -6,6 +6,7 @@ #include "strvec.h" #include "refs.h" #include "refspec.h" +#include "strbuf.h" static struct refspec_item s_tag_refspec = { .force = 0, diff --git a/revision.h b/revision.h index 742700504a..6630bb2eae 100644 --- a/revision.h +++ b/revision.h @@ -8,6 +8,7 @@ #include "pretty.h" #include "diff.h" #include "commit-slab-decl.h" +#include "decorate.h" #include "ident.h" #include "list-objects-filter-options.h" diff --git a/send-pack.c b/send-pack.c index 351037b07b..e68da24cc5 100644 --- a/send-pack.c +++ b/send-pack.c @@ -1,6 +1,7 @@ #include "git-compat-util.h" #include "config.h" #include "commit.h" +#include "date.h" #include "gettext.h" #include "hex.h" #include "refs.h" diff --git a/wt-status.c b/wt-status.c index 97b9c1c035..068b76ef6d 100644 --- a/wt-status.c +++ b/wt-status.c @@ -22,6 +22,7 @@ #include "strbuf.h" #include "trace.h" #include "trace2.h" +#include "tree.h" #include "utf8.h" #include "worktree.h" #include "lockfile.h" -- cgit 1.2.3-korg