Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/add.c1
-rw-r--r--builtin/am.c18
-rw-r--r--builtin/apply.c1
-rw-r--r--builtin/archive.c4
-rw-r--r--builtin/bisect.c7
-rw-r--r--builtin/blame.c8
-rw-r--r--builtin/branch.c3
-rw-r--r--builtin/bugreport.c5
-rw-r--r--builtin/bundle.c46
-rw-r--r--builtin/cat-file.c15
-rw-r--r--builtin/check-attr.c4
-rw-r--r--builtin/check-ignore.c2
-rw-r--r--builtin/check-mailmap.c3
-rw-r--r--builtin/check-ref-format.c1
-rw-r--r--builtin/checkout--worker.c2
-rw-r--r--builtin/checkout-index.c2
-rw-r--r--builtin/checkout.c38
-rw-r--r--builtin/clean.c3
-rw-r--r--builtin/clone.c5
-rw-r--r--builtin/column.c1
-rw-r--r--builtin/commit-graph.c4
-rw-r--r--builtin/commit-tree.c12
-rw-r--r--builtin/commit.c6
-rw-r--r--builtin/config.c8
-rw-r--r--builtin/count-objects.c8
-rw-r--r--builtin/credential-cache--daemon.c3
-rw-r--r--builtin/credential-cache.c3
-rw-r--r--builtin/credential-store.c2
-rw-r--r--builtin/describe.c4
-rw-r--r--builtin/diagnose.c2
-rw-r--r--builtin/diff-index.c1
-rw-r--r--builtin/diff-tree.c2
-rw-r--r--builtin/diff.c2
-rw-r--r--builtin/difftool.c6
-rw-r--r--builtin/fast-export.c2
-rw-r--r--builtin/fast-import.c7
-rw-r--r--builtin/fetch-pack.c3
-rw-r--r--builtin/fetch.c13
-rw-r--r--builtin/fmt-merge-msg.c2
-rw-r--r--builtin/for-each-ref.c1
-rw-r--r--builtin/for-each-repo.c1
-rw-r--r--builtin/fsck.c121
-rw-r--r--builtin/fsmonitor--daemon.c4
-rw-r--r--builtin/gc.c20
-rw-r--r--builtin/get-tar-commit-id.c1
-rw-r--r--builtin/grep.c5
-rw-r--r--builtin/hash-object.c5
-rw-r--r--builtin/help.c2
-rw-r--r--builtin/hook.c1
-rw-r--r--builtin/index-pack.c7
-rw-r--r--builtin/init-db.c5
-rw-r--r--builtin/interpret-trailers.c1
-rw-r--r--builtin/log.c13
-rw-r--r--builtin/ls-files.c2
-rw-r--r--builtin/ls-remote.c2
-rw-r--r--builtin/ls-tree.c2
-rw-r--r--builtin/mailinfo.c3
-rw-r--r--builtin/mailsplit.c1
-rw-r--r--builtin/merge-base.c2
-rw-r--r--builtin/merge-file.c3
-rw-r--r--builtin/merge-index.c1
-rw-r--r--builtin/merge-recursive.c1
-rw-r--r--builtin/merge-tree.c2
-rw-r--r--builtin/merge.c9
-rw-r--r--builtin/mktag.c2
-rw-r--r--builtin/mktree.c3
-rw-r--r--builtin/multi-pack-index.c3
-rw-r--r--builtin/mv.c5
-rw-r--r--builtin/name-rev.c5
-rw-r--r--builtin/notes.c8
-rw-r--r--builtin/pack-objects.c33
-rw-r--r--builtin/pack-redundant.c2
-rw-r--r--builtin/pack-refs.c1
-rw-r--r--builtin/patch-id.c2
-rw-r--r--builtin/prune-packed.c1
-rw-r--r--builtin/prune.c10
-rw-r--r--builtin/pull.c8
-rw-r--r--builtin/push.c7
-rw-r--r--builtin/range-diff.c1
-rw-r--r--builtin/read-tree.c13
-rw-r--r--builtin/rebase.c7
-rw-r--r--builtin/receive-pack.c15
-rw-r--r--builtin/reflog.c1
-rw-r--r--builtin/remote.c1
-rw-r--r--builtin/repack.c10
-rw-r--r--builtin/replace.c4
-rw-r--r--builtin/rerere.c2
-rw-r--r--builtin/reset.c8
-rw-r--r--builtin/rev-list.c18
-rw-r--r--builtin/rev-parse.c6
-rw-r--r--builtin/revert.c4
-rw-r--r--builtin/rm.c3
-rw-r--r--builtin/send-pack.c4
-rw-r--r--builtin/shortlog.c3
-rw-r--r--builtin/show-branch.c3
-rw-r--r--builtin/show-index.c2
-rw-r--r--builtin/show-ref.c2
-rw-r--r--builtin/sparse-checkout.c7
-rw-r--r--builtin/stash.c5
-rw-r--r--builtin/stripspace.c3
-rw-r--r--builtin/submodule--helper.c10
-rw-r--r--builtin/symbolic-ref.c1
-rw-r--r--builtin/tag.c13
-rw-r--r--builtin/unpack-file.c2
-rw-r--r--builtin/unpack-objects.c4
-rw-r--r--builtin/update-index.c5
-rw-r--r--builtin/update-ref.c1
-rw-r--r--builtin/update-server-info.c1
-rw-r--r--builtin/upload-pack.c2
-rw-r--r--builtin/var.c1
-rw-r--r--builtin/verify-commit.c11
-rw-r--r--builtin/verify-pack.c1
-rw-r--r--builtin/verify-tag.c11
-rw-r--r--builtin/worktree.c5
-rw-r--r--builtin/write-tree.c3
115 files changed, 555 insertions, 202 deletions
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 456884852e..cd1e20f24e 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -5,9 +5,13 @@
*/
#define USE_THE_INDEX_VARIABLE
#include "cache.h"
+#include "abspath.h"
#include "config.h"
#include "builtin.h"
+#include "environment.h"
#include "exec-cmd.h"
+#include "gettext.h"
+#include "hex.h"
#include "parse-options.h"
#include "dir.h"
#include "run-command.h"
@@ -35,6 +39,7 @@
#include "packfile.h"
#include "repository.h"
#include "pretty.h"
+#include "wrapper.h"
/**
* Returns the length of the first line of msg.
@@ -2301,17 +2306,6 @@ static int parse_opt_show_current_patch(const struct option *opt, const char *ar
return 0;
}
-static int git_am_config(const char *k, const char *v, void *cb UNUSED)
-{
- int status;
-
- status = git_gpg_config(k, v, NULL);
- if (status)
- return status;
-
- return git_default_config(k, v, NULL);
-}
-
int cmd_am(int argc, const char **argv, const char *prefix)
{
struct am_state state;
@@ -2435,7 +2429,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
if (argc == 2 && !strcmp(argv[1], "-h"))
usage_with_options(usage, options);
- git_config(git_am_config, NULL);
+ git_config(git_default_config, NULL);
am_state_init(&state);
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 f094390ee0..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"
@@ -81,7 +82,7 @@ static int run_remote_archiver(int argc, const char **argv,
int cmd_archive(int argc, const char **argv, const char *prefix)
{
const char *exec = "git-upload-archive";
- const char *output = NULL;
+ char *output = NULL;
const char *remote = NULL;
struct option local_opts[] = {
OPT_FILENAME('o', "output", &output,
@@ -106,5 +107,6 @@ int cmd_archive(int argc, const char **argv, const char *prefix)
setvbuf(stderr, NULL, _IOLBF, BUFSIZ);
+ UNLEAK(output);
return write_archive(argc, argv, prefix, the_repository, output, 0);
}
diff --git a/builtin/bisect.c b/builtin/bisect.c
index 0f35361bd1..26f07357a0 100644
--- a/builtin/bisect.c
+++ b/builtin/bisect.c
@@ -1,5 +1,8 @@
#include "builtin.h"
#include "cache.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "parse-options.h"
#include "bisect.h"
#include "refs.h"
@@ -9,6 +12,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")
@@ -244,7 +248,8 @@ static int bisect_reset(const char *commit)
struct child_process cmd = CHILD_PROCESS_INIT;
cmd.git_cmd = 1;
- strvec_pushl(&cmd.args, "checkout", branch.buf, "--", NULL);
+ strvec_pushl(&cmd.args, "checkout", "--ignore-other-worktrees",
+ branch.buf, "--", NULL);
if (run_command(&cmd)) {
error(_("could not check out original"
" HEAD '%s'. Try 'git bisect"
diff --git a/builtin/blame.c b/builtin/blame.c
index 91e04f57cc..a8d2114adc 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -5,10 +5,14 @@
* See COPYING for licensing conditions
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "config.h"
#include "color.h"
#include "builtin.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "commit.h"
#include "diff.h"
@@ -27,7 +31,9 @@
#include "object-store.h"
#include "blame.h"
#include "refs.h"
+#include "setup.h"
#include "tag.h"
+#include "write-or-die.h"
static char blame_usage[] = N_("git blame [<options>] [<rev-opts>] [<rev>] [--] <file>");
static char annotate_usage[] = N_("git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>");
diff --git a/builtin/branch.c b/builtin/branch.c
index 45910039e6..5706eb0097 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -8,9 +8,11 @@
#include "cache.h"
#include "config.h"
#include "color.h"
+#include "environment.h"
#include "refs.h"
#include "commit.h"
#include "builtin.h"
+#include "gettext.h"
#include "remote.h"
#include "parse-options.h"
#include "branch.h"
@@ -24,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 [<options>] [-r | -a] [--merged] [--no-merged]"),
diff --git a/builtin/bugreport.c b/builtin/bugreport.c
index 5bc254be80..52955e1d38 100644
--- a/builtin/bugreport.c
+++ b/builtin/bugreport.c
@@ -1,4 +1,6 @@
#include "builtin.h"
+#include "abspath.h"
+#include "gettext.h"
#include "parse-options.h"
#include "strbuf.h"
#include "help.h"
@@ -6,7 +8,8 @@
#include "hook.h"
#include "hook-list.h"
#include "diagnose.h"
-
+#include "setup.h"
+#include "wrapper.h"
static void get_system_info(struct strbuf *sys_info)
{
diff --git a/builtin/bundle.c b/builtin/bundle.c
index acceef6200..e68fc83d94 100644
--- a/builtin/bundle.c
+++ b/builtin/bundle.c
@@ -1,4 +1,7 @@
#include "builtin.h"
+#include "abspath.h"
+#include "gettext.h"
+#include "setup.h"
#include "strvec.h"
#include "parse-options.h"
#include "cache.h"
@@ -12,7 +15,7 @@
*/
#define BUILTIN_BUNDLE_CREATE_USAGE \
- N_("git bundle create [-q | --quiet | --progress | --all-progress] [--all-progress-implied]\n" \
+ N_("git bundle create [-q | --quiet | --progress]\n" \
" [--version=<version>] <file> <git-rev-list-args>")
#define BUILTIN_BUNDLE_VERIFY_USAGE \
N_("git bundle verify [-q | --quiet] <file>")
@@ -59,12 +62,12 @@ static int parse_options_cmd_bundle(int argc,
PARSE_OPT_STOP_AT_NON_OPTION);
if (!argc)
usage_msg_opt(_("need a <file> argument"), usagestr, options);
- *bundle_file = prefix_filename(prefix, argv[0]);
+ *bundle_file = prefix_filename_except_for_dash(prefix, argv[0]);
return argc;
}
static int cmd_bundle_create(int argc, const char **argv, const char *prefix) {
- int all_progress_implied = 0;
+ int all_progress_implied = 1;
int progress = isatty(STDERR_FILENO);
struct strvec pack_opts;
int version = -1;
@@ -74,11 +77,12 @@ static int cmd_bundle_create(int argc, const char **argv, const char *prefix) {
N_("do not show progress meter"), 0),
OPT_SET_INT(0, "progress", &progress,
N_("show progress meter"), 1),
- OPT_SET_INT(0, "all-progress", &progress,
- N_("show progress meter during object writing phase"), 2),
- OPT_BOOL(0, "all-progress-implied",
- &all_progress_implied,
- N_("similar to --all-progress when progress meter is shown")),
+ OPT_SET_INT_F(0, "all-progress", &progress,
+ N_("historical; same as --progress"), 2,
+ PARSE_OPT_HIDDEN),
+ OPT_HIDDEN_BOOL(0, "all-progress-implied",
+ &all_progress_implied,
+ N_("historical; does nothing")),
OPT_INTEGER(0, "version", &version,
N_("specify bundle format version")),
OPT_END()
@@ -107,6 +111,23 @@ static int cmd_bundle_create(int argc, const char **argv, const char *prefix) {
return ret;
}
+/*
+ * Similar to read_bundle_header(), but handle "-" as stdin.
+ */
+static int open_bundle(const char *path, struct bundle_header *header,
+ const char **name)
+{
+ if (!strcmp(path, "-")) {
+ if (name)
+ *name = "<stdin>";
+ return read_bundle_header_fd(0, header, "<stdin>");
+ }
+
+ if (name)
+ *name = path;
+ return read_bundle_header(path, header);
+}
+
static int cmd_bundle_verify(int argc, const char **argv, const char *prefix) {
struct bundle_header header = BUNDLE_HEADER_INIT;
int bundle_fd = -1;
@@ -118,12 +139,13 @@ static int cmd_bundle_verify(int argc, const char **argv, const char *prefix) {
OPT_END()
};
char *bundle_file;
+ const char *name;
argc = parse_options_cmd_bundle(argc, argv, prefix,
builtin_bundle_verify_usage, options, &bundle_file);
/* bundle internals use argv[1] as further parameters */
- if ((bundle_fd = read_bundle_header(bundle_file, &header)) < 0) {
+ if ((bundle_fd = open_bundle(bundle_file, &header, &name)) < 0) {
ret = 1;
goto cleanup;
}
@@ -134,7 +156,7 @@ static int cmd_bundle_verify(int argc, const char **argv, const char *prefix) {
goto cleanup;
}
- fprintf(stderr, _("%s is okay\n"), bundle_file);
+ fprintf(stderr, _("%s is okay\n"), name);
ret = 0;
cleanup:
free(bundle_file);
@@ -155,7 +177,7 @@ static int cmd_bundle_list_heads(int argc, const char **argv, const char *prefix
builtin_bundle_list_heads_usage, options, &bundle_file);
/* bundle internals use argv[1] as further parameters */
- if ((bundle_fd = read_bundle_header(bundle_file, &header)) < 0) {
+ if ((bundle_fd = open_bundle(bundle_file, &header, NULL)) < 0) {
ret = 1;
goto cleanup;
}
@@ -185,7 +207,7 @@ static int cmd_bundle_unbundle(int argc, const char **argv, const char *prefix)
builtin_bundle_unbundle_usage, options, &bundle_file);
/* bundle internals use argv[1] as further parameters */
- if ((bundle_fd = read_bundle_header(bundle_file, &header)) < 0) {
+ if ((bundle_fd = open_bundle(bundle_file, &header, NULL)) < 0) {
ret = 1;
goto cleanup;
}
diff --git a/builtin/cat-file.c b/builtin/cat-file.c
index b72dd91bd1..04d4bb6c77 100644
--- a/builtin/cat-file.c
+++ b/builtin/cat-file.c
@@ -5,9 +5,14 @@
*/
#define USE_THE_INDEX_VARIABLE
#include "cache.h"
+#include "alloc.h"
#include "config.h"
#include "builtin.h"
#include "diff.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
+#include "ident.h"
#include "parse-options.h"
#include "userdiff.h"
#include "streaming.h"
@@ -15,8 +20,10 @@
#include "oid-array.h"
#include "packfile.h"
#include "object-store.h"
+#include "replace-object.h"
#include "promisor-remote.h"
#include "mailmap.h"
+#include "write-or-die.h"
enum batch_mode {
BATCH_MODE_CONTENTS,
@@ -564,7 +571,7 @@ static int batch_object_cb(const struct object_id *oid, void *vdata)
}
static int collect_loose_object(const struct object_id *oid,
- const char *path,
+ const char *path UNUSED,
void *data)
{
oid_array_append(data, oid);
@@ -572,8 +579,8 @@ static int collect_loose_object(const struct object_id *oid,
}
static int collect_packed_object(const struct object_id *oid,
- struct packed_git *pack,
- uint32_t pos,
+ struct packed_git *pack UNUSED,
+ uint32_t pos UNUSED,
void *data)
{
oid_array_append(data, oid);
@@ -596,7 +603,7 @@ static int batch_unordered_object(const struct object_id *oid,
}
static int batch_unordered_loose(const struct object_id *oid,
- const char *path,
+ const char *path UNUSED,
void *data)
{
return batch_unordered_object(oid, NULL, 0, data);
diff --git a/builtin/check-attr.c b/builtin/check-attr.c
index d7a40e674c..1dbe9d6ca8 100644
--- a/builtin/check-attr.c
+++ b/builtin/check-attr.c
@@ -3,8 +3,12 @@
#include "cache.h"
#include "config.h"
#include "attr.h"
+#include "environment.h"
+#include "gettext.h"
#include "quote.h"
+#include "setup.h"
#include "parse-options.h"
+#include "write-or-die.h"
static int all_attrs;
static int cached_attrs;
diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c
index ab776061c7..9401dad007 100644
--- a/builtin/check-ignore.c
+++ b/builtin/check-ignore.c
@@ -3,10 +3,12 @@
#include "cache.h"
#include "config.h"
#include "dir.h"
+#include "gettext.h"
#include "quote.h"
#include "pathspec.h"
#include "parse-options.h"
#include "submodule.h"
+#include "write-or-die.h"
static int quiet, verbose, stdin_paths, show_non_matching, no_index;
static const char * const check_ignore_usage[] = {
diff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c
index 7dc47e4793..002d2941e9 100644
--- a/builtin/check-mailmap.c
+++ b/builtin/check-mailmap.c
@@ -1,8 +1,11 @@
#include "builtin.h"
#include "config.h"
+#include "gettext.h"
+#include "ident.h"
#include "mailmap.h"
#include "parse-options.h"
#include "string-list.h"
+#include "write-or-die.h"
static int use_stdin;
static const char * const check_mailmap_usage[] = {
diff --git a/builtin/check-ref-format.c b/builtin/check-ref-format.c
index fd0e5f8683..b026346742 100644
--- a/builtin/check-ref-format.c
+++ b/builtin/check-ref-format.c
@@ -5,6 +5,7 @@
#include "cache.h"
#include "refs.h"
#include "builtin.h"
+#include "setup.h"
#include "strbuf.h"
static const char builtin_check_ref_format_usage[] =
diff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c
index ede7dc32a4..2120dd1d30 100644
--- a/builtin/checkout--worker.c
+++ b/builtin/checkout--worker.c
@@ -1,6 +1,8 @@
#include "builtin.h"
+#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..7df673e3e7 100644
--- a/builtin/checkout-index.c
+++ b/builtin/checkout-index.c
@@ -8,12 +8,14 @@
#include "builtin.h"
#include "config.h"
#include "dir.h"
+#include "gettext.h"
#include "lockfile.h"
#include "quote.h"
#include "cache-tree.h"
#include "parse-options.h"
#include "entry.h"
#include "parallel-checkout.h"
+#include "setup.h"
#define CHECKOUT_ALL 4
static int nul_term_line;
diff --git a/builtin/checkout.c b/builtin/checkout.c
index cb7cd315b3..38a8cd6a96 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -9,6 +9,9 @@
#include "config.h"
#include "diff.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "hook.h"
#include "ll-merge.h"
#include "lockfile.h"
@@ -20,6 +23,7 @@
#include "resolve-undo.h"
#include "revision.h"
#include "run-command.h"
+#include "setup.h"
#include "submodule.h"
#include "submodule-config.h"
#include "tree.h"
@@ -75,7 +79,7 @@ struct checkout_opts {
const char *ignore_unmerged_opt;
int ignore_unmerged;
int pathspec_file_nul;
- const char *pathspec_from_file;
+ char *pathspec_from_file;
const char *new_branch;
const char *new_branch_force;
@@ -489,15 +493,28 @@ static int checkout_paths(const struct checkout_opts *opts,
die(_("'%s' must be used when '%s' is not specified"),
"--worktree", "--source");
- if (opts->checkout_index && !opts->checkout_worktree &&
- opts->writeout_stage)
- die(_("'%s' or '%s' cannot be used with %s"),
- "--ours", "--theirs", "--staged");
-
- if (opts->checkout_index && !opts->checkout_worktree &&
- opts->merge)
- die(_("'%s' or '%s' cannot be used with %s"),
- "--merge", "--conflict", "--staged");
+ /*
+ * Reject --staged option to the restore command when combined with
+ * merge-related options. Use the accept_ref flag to distinguish it
+ * from the checkout command, which does not accept --staged anyway.
+ *
+ * `restore --ours|--theirs --worktree --staged` could mean resolving
+ * conflicted paths to one side in both the worktree and the index,
+ * but does not currently.
+ *
+ * `restore --merge|--conflict=<style>` already recreates conflicts
+ * in both the worktree and the index, so adding --staged would be
+ * meaningless.
+ */
+ if (!opts->accept_ref && opts->checkout_index) {
+ if (opts->writeout_stage)
+ die(_("'%s' or '%s' cannot be used with %s"),
+ "--ours", "--theirs", "--staged");
+
+ if (opts->merge)
+ die(_("'%s' or '%s' cannot be used with %s"),
+ "--merge", "--conflict", "--staged");
+ }
if (opts->patch_mode) {
enum add_p_mode patch_mode;
@@ -1883,6 +1900,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
options, checkout_usage, &new_branch_info);
branch_info_release(&new_branch_info);
clear_pathspec(&opts.pathspec);
+ free(opts.pathspec_from_file);
FREE_AND_NULL(options);
return ret;
}
diff --git a/builtin/clean.c b/builtin/clean.c
index 10aaa8c603..14c0d555ea 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -8,10 +8,13 @@
#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
+#include "abspath.h"
#include "cache.h"
#include "config.h"
#include "dir.h"
+#include "gettext.h"
#include "parse-options.h"
+#include "setup.h"
#include "string-list.h"
#include "quote.h"
#include "column.h"
diff --git a/builtin/clone.c b/builtin/clone.c
index 4de4640ed4..c171def1f3 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -10,7 +10,11 @@
#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
+#include "abspath.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "parse-options.h"
#include "fetch-pack.h"
@@ -29,6 +33,7 @@
#include "branch.h"
#include "remote.h"
#include "run-command.h"
+#include "setup.h"
#include "connected.h"
#include "packfile.h"
#include "list-objects-filter-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 93704f95a9..9011426976 100644
--- a/builtin/commit-graph.c
+++ b/builtin/commit-graph.c
@@ -1,12 +1,16 @@
#include "builtin.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "parse-options.h"
#include "repository.h"
#include "commit-graph.h"
#include "object-store.h"
#include "progress.h"
+#include "replace-object.h"
#include "tag.h"
#define BUILTIN_COMMIT_GRAPH_VERIFY_USAGE \
diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c
index 7941512c19..15be167f87 100644
--- a/builtin/commit-tree.c
+++ b/builtin/commit-tree.c
@@ -5,6 +5,8 @@
*/
#include "cache.h"
#include "config.h"
+#include "gettext.h"
+#include "hex.h"
#include "object-store.h"
#include "repository.h"
#include "commit.h"
@@ -37,14 +39,6 @@ static void new_parent(struct commit *parent, struct commit_list **parents_p)
commit_list_insert(parent, parents_p);
}
-static int commit_tree_config(const char *var, const char *value, void *cb)
-{
- int status = git_gpg_config(var, value, NULL);
- if (status)
- return status;
- return git_default_config(var, value, cb);
-}
-
static int parse_parent_arg_callback(const struct option *opt,
const char *arg, int unset)
{
@@ -121,7 +115,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
OPT_END()
};
- git_config(commit_tree_config, NULL);
+ git_config(git_default_config, NULL);
if (argc < 2 || !strcmp(argv[1], "-h"))
usage_with_options(commit_tree_usage, options);
diff --git a/builtin/commit.c b/builtin/commit.c
index 92b7e8c56f..9d8e1ea91a 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -12,10 +12,12 @@
#include "cache-tree.h"
#include "color.h"
#include "dir.h"
+#include "environment.h"
#include "builtin.h"
#include "diff.h"
#include "diffcore.h"
#include "commit.h"
+#include "gettext.h"
#include "revision.h"
#include "wt-status.h"
#include "run-command.h"
@@ -1603,7 +1605,6 @@ int cmd_status(int argc, const char **argv, const char *prefix)
static int git_commit_config(const char *k, const char *v, void *cb)
{
struct wt_status *s = cb;
- int status;
if (!strcmp(k, "commit.template"))
return git_config_pathname(&template_file, k, v);
@@ -1623,9 +1624,6 @@ static int git_commit_config(const char *k, const char *v, void *cb)
return 0;
}
- status = git_gpg_config(k, v, NULL);
- if (status)
- return status;
return git_status_config(k, v, s);
}
diff --git a/builtin/config.c b/builtin/config.c
index 060cf9f3e0..fe79fb60c4 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -1,11 +1,17 @@
#include "builtin.h"
-#include "cache.h"
+#include "abspath.h"
+#include "alloc.h"
#include "config.h"
#include "color.h"
+#include "environment.h"
+#include "gettext.h"
+#include "ident.h"
#include "parse-options.h"
#include "urlmatch.h"
#include "quote.h"
+#include "setup.h"
#include "worktree.h"
+#include "wrapper.h"
static const char *const builtin_config_usage[] = {
N_("git config [<options>]"),
diff --git a/builtin/count-objects.c b/builtin/count-objects.c
index 07b9419596..f3d8f1bcbb 100644
--- a/builtin/count-objects.c
+++ b/builtin/count-objects.c
@@ -7,6 +7,8 @@
#include "cache.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
#include "repository.h"
#include "builtin.h"
#include "parse-options.h"
@@ -57,7 +59,8 @@ static void loose_garbage(const char *path)
report_garbage(PACKDIR_FILE_GARBAGE, path);
}
-static int count_loose(const struct object_id *oid, const char *path, void *data)
+static int count_loose(const struct object_id *oid, const char *path,
+ void *data UNUSED)
{
struct stat st;
@@ -72,7 +75,8 @@ static int count_loose(const struct object_id *oid, const char *path, void *data
return 0;
}
-static int count_cruft(const char *basename, const char *path, void *data)
+static int count_cruft(const char *basename UNUSED, const char *path,
+ void *data UNUSED)
{
loose_garbage(path);
return 0;
diff --git a/builtin/credential-cache--daemon.c b/builtin/credential-cache--daemon.c
index 338058be7f..62c09a271d 100644
--- a/builtin/credential-cache--daemon.c
+++ b/builtin/credential-cache--daemon.c
@@ -1,4 +1,7 @@
#include "builtin.h"
+#include "abspath.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..508da4c6e4 100644
--- a/builtin/credential-cache.c
+++ b/builtin/credential-cache.c
@@ -1,5 +1,8 @@
#include "builtin.h"
+#include "gettext.h"
#include "parse-options.h"
+#include "wrapper.h"
+#include "write-or-die.h"
#ifndef NO_UNIX_SOCKETS
diff --git a/builtin/credential-store.c b/builtin/credential-store.c
index 62a4f3c265..8977604eb9 100644
--- a/builtin/credential-store.c
+++ b/builtin/credential-store.c
@@ -1,9 +1,11 @@
#include "builtin.h"
#include "config.h"
+#include "gettext.h"
#include "lockfile.h"
#include "credential.h"
#include "string-list.h"
#include "parse-options.h"
+#include "write-or-die.h"
static struct lock_file credential_lock;
diff --git a/builtin/describe.c b/builtin/describe.c
index e880a86f37..0125d4ddba 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -1,6 +1,9 @@
#define USE_THE_INDEX_VARIABLE
#include "cache.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "commit.h"
#include "tag.h"
@@ -12,6 +15,7 @@
#include "revision.h"
#include "diff.h"
#include "hashmap.h"
+#include "setup.h"
#include "strvec.h"
#include "run-command.h"
#include "object-store.h"
diff --git a/builtin/diagnose.c b/builtin/diagnose.c
index d52015c67a..0f8b64994c 100644
--- a/builtin/diagnose.c
+++ b/builtin/diagnose.c
@@ -1,4 +1,6 @@
#include "builtin.h"
+#include "abspath.h"
+#include "gettext.h"
#include "parse-options.h"
#include "diagnose.h"
diff --git a/builtin/diff-index.c b/builtin/diff-index.c
index 35dc9b23ee..b9a19bb7d3 100644
--- a/builtin/diff-index.c
+++ b/builtin/diff-index.c
@@ -5,6 +5,7 @@
#include "commit.h"
#include "revision.h"
#include "builtin.h"
+#include "setup.h"
#include "submodule.h"
static const char diff_cache_usage[] =
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index 25b853b85c..385c2d0230 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -3,6 +3,8 @@
#include "config.h"
#include "diff.h"
#include "commit.h"
+#include "gettext.h"
+#include "hex.h"
#include "log-tree.h"
#include "builtin.h"
#include "submodule.h"
diff --git a/builtin/diff.c b/builtin/diff.c
index 1091c377af..8f386535d6 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"
@@ -18,6 +19,7 @@
#include "revision.h"
#include "log-tree.h"
#include "builtin.h"
+#include "setup.h"
#include "submodule.h"
#include "oid-array.h"
diff --git a/builtin/difftool.c b/builtin/difftool.c
index 30daa83bc6..e010a21bfb 100644
--- a/builtin/difftool.c
+++ b/builtin/difftool.c
@@ -13,10 +13,14 @@
*/
#define USE_THE_INDEX_VARIABLE
#include "cache.h"
+#include "abspath.h"
#include "config.h"
#include "builtin.h"
#include "run-command.h"
+#include "environment.h"
#include "exec-cmd.h"
+#include "gettext.h"
+#include "hex.h"
#include "parse-options.h"
#include "strvec.h"
#include "strbuf.h"
@@ -24,6 +28,8 @@
#include "object-store.h"
#include "dir.h"
#include "entry.h"
+#include "setup.h"
+#include "wrapper.h"
static int trust_exit_code;
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 550f078a8e..0bb779deb6 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -6,6 +6,8 @@
#include "builtin.h"
#include "cache.h"
#include "config.h"
+#include "gettext.h"
+#include "hex.h"
#include "refs.h"
#include "refspec.h"
#include "object-store.h"
diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index 2065434178..68b1a53987 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -1,5 +1,9 @@
#include "builtin.h"
+#include "abspath.h"
#include "cache.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "config.h"
#include "lockfile.h"
@@ -20,6 +24,7 @@
#include "commit-reach.h"
#include "khash.h"
#include "date.h"
+#include "wrapper.h"
#define PACK_ID_BITS 16
#define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)
@@ -436,7 +441,7 @@ static void set_checkpoint_signal(void)
#else
-static void checkpoint_signal(int signo)
+static void checkpoint_signal(int signo UNUSED)
{
checkpoint_requested = 1;
}
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index afe679368d..60e5a10ffc 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -1,4 +1,7 @@
#include "builtin.h"
+#include "alloc.h"
+#include "gettext.h"
+#include "hex.h"
#include "pkt-line.h"
#include "fetch-pack.h"
#include "remote.h"
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 0020015ca4..6a6a58d49c 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -3,6 +3,9 @@
*/
#include "cache.h"
#include "config.h"
+#include "gettext.h"
+#include "environment.h"
+#include "hex.h"
#include "repository.h"
#include "refs.h"
#include "refspec.h"
@@ -1133,6 +1136,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
if (!connectivity_checked) {
struct check_connected_options opt = CHECK_CONNECTED_INIT;
+ opt.exclude_hidden_refs_section = "fetch";
rm = ref_map;
if (check_connected(iterate_ref_map, &rm, &opt)) {
rc = error(_("%s did not send all necessary objects\n"), url);
@@ -1326,6 +1330,7 @@ static int check_exist_and_connected(struct ref *ref_map)
}
opt.quiet = 1;
+ opt.exclude_hidden_refs_section = "fetch";
return check_connected(iterate_ref_map, &rm, &opt);
}
@@ -1881,6 +1886,8 @@ static void add_options_to_argv(struct strvec *argv)
strvec_push(argv, "--ipv4");
else if (family == TRANSPORT_FAMILY_IPV6)
strvec_push(argv, "--ipv6");
+ if (!write_fetch_head)
+ strvec_push(argv, "--no-write-fetch-head");
}
/* Fetch multiple remotes in parallel */
@@ -1891,7 +1898,8 @@ struct parallel_fetch_state {
int next, result;
};
-static int fetch_next_remote(struct child_process *cp, struct strbuf *out,
+static int fetch_next_remote(struct child_process *cp,
+ struct strbuf *out UNUSED,
void *cb, void **task_cb)
{
struct parallel_fetch_state *state = cb;
@@ -1913,7 +1921,8 @@ static int fetch_next_remote(struct child_process *cp, struct strbuf *out,
return 1;
}
-static int fetch_failed_to_start(struct strbuf *out, void *cb, void *task_cb)
+static int fetch_failed_to_start(struct strbuf *out UNUSED,
+ void *cb, void *task_cb)
{
struct parallel_fetch_state *state = cb;
const char *remote = task_cb;
diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c
index 8d8fd393f8..cc81241642 100644
--- a/builtin/fmt-merge-msg.c
+++ b/builtin/fmt-merge-msg.c
@@ -1,7 +1,9 @@
#include "builtin.h"
#include "config.h"
#include "fmt-merge-msg.h"
+#include "gettext.h"
#include "parse-options.h"
+#include "wrapper.h"
static const char * const fmt_merge_msg_usage[] = {
N_("git fmt-merge-msg [-m <message>] [--log[=<n>] | --no-log] [--file <file>]"),
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 2bf183a43b..095b39d398 100644
--- a/builtin/fsck.c
+++ b/builtin/fsck.c
@@ -1,6 +1,7 @@
-#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
#include "cache.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "config.h"
#include "commit.h"
@@ -19,6 +20,7 @@
#include "decorate.h"
#include "packfile.h"
#include "object-store.h"
+#include "replace-object.h"
#include "resolve-undo.h"
#include "run-command.h"
#include "worktree.h"
@@ -233,17 +235,17 @@ static void mark_unreachable_referents(const struct object_id *oid)
}
static int mark_loose_unreachable_referents(const struct object_id *oid,
- const char *path,
- void *data)
+ const char *path UNUSED,
+ void *data UNUSED)
{
mark_unreachable_referents(oid);
return 0;
}
static int mark_packed_unreachable_referents(const struct object_id *oid,
- struct packed_git *pack,
- uint32_t pos,
- void *data)
+ struct packed_git *pack UNUSED,
+ uint32_t pos UNUSED,
+ void *data UNUSED)
{
mark_unreachable_referents(oid);
return 0;
@@ -661,14 +663,15 @@ static int fsck_loose(const struct object_id *oid, const char *path, void *data)
return 0; /* keep checking other objects, even if we saw an error */
}
-static int fsck_cruft(const char *basename, const char *path, void *data)
+static int fsck_cruft(const char *basename, const char *path,
+ void *data UNUSED)
{
if (!starts_with(basename, "tmp_obj_"))
fprintf_ln(stderr, _("bad sha1 file: %s"), path);
return 0;
}
-static int fsck_subdir(unsigned int nr, const char *path, void *data)
+static int fsck_subdir(unsigned int nr, const char *path UNUSED, void *data)
{
struct for_each_loose_cb *cb_data = data;
struct progress *progress = cb_data->progress;
@@ -732,19 +735,19 @@ static int fsck_head_link(const char *head_ref_name,
return 0;
}
-static int fsck_cache_tree(struct cache_tree *it)
+static int fsck_cache_tree(struct cache_tree *it, const char *index_path)
{
int i;
int err = 0;
if (verbose)
- fprintf_ln(stderr, _("Checking cache tree"));
+ fprintf_ln(stderr, _("Checking cache tree of %s"), index_path);
if (0 <= it->entry_count) {
struct object *obj = parse_object(the_repository, &it->oid);
if (!obj) {
- error(_("%s: invalid sha1 pointer in cache-tree"),
- oid_to_hex(&it->oid));
+ error(_("%s: invalid sha1 pointer in cache-tree of %s"),
+ oid_to_hex(&it->oid), index_path);
errors_found |= ERROR_REFS;
return 1;
}
@@ -755,11 +758,12 @@ static int fsck_cache_tree(struct cache_tree *it)
err |= objerror(obj, _("non-tree in cache-tree"));
}
for (i = 0; i < it->subtree_nr; i++)
- err |= fsck_cache_tree(it->down[i]->cache_tree);
+ err |= fsck_cache_tree(it->down[i]->cache_tree, index_path);
return err;
}
-static int fsck_resolve_undo(struct index_state *istate)
+static int fsck_resolve_undo(struct index_state *istate,
+ const char *index_path)
{
struct string_list_item *item;
struct string_list *resolve_undo = istate->resolve_undo;
@@ -782,8 +786,9 @@ static int fsck_resolve_undo(struct index_state *istate)
obj = parse_object(the_repository, &ru->oid[i]);
if (!obj) {
- error(_("%s: invalid sha1 pointer in resolve-undo"),
- oid_to_hex(&ru->oid[i]));
+ error(_("%s: invalid sha1 pointer in resolve-undo of %s"),
+ oid_to_hex(&ru->oid[i]),
+ index_path);
errors_found |= ERROR_REFS;
continue;
}
@@ -796,6 +801,38 @@ static int fsck_resolve_undo(struct index_state *istate)
return 0;
}
+static void fsck_index(struct index_state *istate, const char *index_path,
+ int is_main_index)
+{
+ unsigned int i;
+
+ /* TODO: audit for interaction with sparse-index. */
+ ensure_full_index(istate);
+ for (i = 0; i < istate->cache_nr; i++) {
+ unsigned int mode;
+ struct blob *blob;
+ struct object *obj;
+
+ mode = istate->cache[i]->ce_mode;
+ if (S_ISGITLINK(mode))
+ continue;
+ blob = lookup_blob(the_repository,
+ &istate->cache[i]->oid);
+ if (!blob)
+ continue;
+ obj = &blob->object;
+ obj->flags |= USED;
+ fsck_put_object_name(&fsck_walk_options, &obj->oid,
+ "%s:%s",
+ is_main_index ? "" : index_path,
+ istate->cache[i]->name);
+ mark_object_reachable(obj);
+ }
+ if (istate->cache_tree)
+ fsck_cache_tree(istate->cache_tree, index_path);
+ fsck_resolve_undo(istate, index_path);
+}
+
static void mark_object_for_connectivity(const struct object_id *oid)
{
struct object *obj = lookup_unknown_object(the_repository, oid);
@@ -803,17 +840,17 @@ static void mark_object_for_connectivity(const struct object_id *oid)
}
static int mark_loose_for_connectivity(const struct object_id *oid,
- const char *path,
- void *data)
+ const char *path UNUSED,
+ void *data UNUSED)
{
mark_object_for_connectivity(oid);
return 0;
}
static int mark_packed_for_connectivity(const struct object_id *oid,
- struct packed_git *pack,
- uint32_t pos,
- void *data)
+ struct packed_git *pack UNUSED,
+ uint32_t pos UNUSED,
+ void *data UNUSED)
{
mark_object_for_connectivity(oid);
return 0;
@@ -956,32 +993,30 @@ int cmd_fsck(int argc, const char **argv, const char *prefix)
}
if (keep_cache_objects) {
+ struct worktree **worktrees, **p;
+
verify_index_checksum = 1;
verify_ce_order = 1;
- repo_read_index(the_repository);
- /* TODO: audit for interaction with sparse-index. */
- ensure_full_index(&the_index);
- for (i = 0; i < the_index.cache_nr; i++) {
- unsigned int mode;
- struct blob *blob;
- struct object *obj;
- mode = the_index.cache[i]->ce_mode;
- if (S_ISGITLINK(mode))
- continue;
- blob = lookup_blob(the_repository,
- &the_index.cache[i]->oid);
- if (!blob)
- continue;
- obj = &blob->object;
- obj->flags |= USED;
- fsck_put_object_name(&fsck_walk_options, &obj->oid,
- ":%s", the_index.cache[i]->name);
- mark_object_reachable(obj);
+ worktrees = get_worktrees();
+ for (p = worktrees; *p; p++) {
+ struct worktree *wt = *p;
+ struct index_state istate =
+ INDEX_STATE_INIT(the_repository);
+ char *path;
+
+ /*
+ * Make a copy since the buffer is reusable
+ * and may get overwritten by other calls
+ * while we're examining the index.
+ */
+ path = xstrdup(worktree_git_path(wt, "index"));
+ read_index_from(&istate, path, get_worktree_git_dir(wt));
+ fsck_index(&istate, path, wt->is_current);
+ discard_index(&istate);
+ free(path);
}
- if (the_index.cache_tree)
- fsck_cache_tree(the_index.cache_tree);
- fsck_resolve_undo(&the_index);
+ free_worktrees(worktrees);
}
check_connectivity();
diff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c
index 0feef8caf6..a280d8bb14 100644
--- a/builtin/fsmonitor--daemon.c
+++ b/builtin/fsmonitor--daemon.c
@@ -1,5 +1,9 @@
#include "builtin.h"
+#include "abspath.h"
+#include "alloc.h"
#include "config.h"
+#include "environment.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 a1a2ae4da2..b291e23b13 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -11,6 +11,9 @@
*/
#include "builtin.h"
+#include "abspath.h"
+#include "environment.h"
+#include "hex.h"
#include "repository.h"
#include "config.h"
#include "tempfile.h"
@@ -31,7 +34,10 @@
#include "refs.h"
#include "remote.h"
#include "exec-cmd.h"
+#include "gettext.h"
#include "hook.h"
+#include "setup.h"
+#include "wrapper.h"
#define FAILED_RUN "failed to run %s"
@@ -976,9 +982,9 @@ struct write_loose_object_data {
static int loose_object_auto_limit = 100;
-static int loose_object_count(const struct object_id *oid,
- const char *path,
- void *data)
+static int loose_object_count(const struct object_id *oid UNUSED,
+ const char *path UNUSED,
+ void *data)
{
int *count = (int*)data;
if (++(*count) >= loose_object_auto_limit)
@@ -1003,15 +1009,15 @@ static int loose_object_auto_condition(void)
NULL, NULL, &count);
}
-static int bail_on_loose(const struct object_id *oid,
- const char *path,
- void *data)
+static int bail_on_loose(const struct object_id *oid UNUSED,
+ const char *path UNUSED,
+ void *data UNUSED)
{
return 1;
}
static int write_loose_object_to_stdin(const struct object_id *oid,
- const char *path,
+ const char *path UNUSED,
void *data)
{
struct write_loose_object_data *d = (struct write_loose_object_data *)data;
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/grep.c b/builtin/grep.c
index 18561b1002..a1b68d90bd 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -4,6 +4,9 @@
* Copyright (c) 2006 Junio C Hamano
*/
#include "cache.h"
+#include "alloc.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "config.h"
#include "blob.h"
@@ -20,10 +23,12 @@
#include "quote.h"
#include "dir.h"
#include "pathspec.h"
+#include "setup.h"
#include "submodule.h"
#include "submodule-config.h"
#include "object-store.h"
#include "packfile.h"
+#include "write-or-die.h"
static const char *grep_prefix;
diff --git a/builtin/hash-object.c b/builtin/hash-object.c
index 44db83f07f..a15fe4fd3f 100644
--- a/builtin/hash-object.c
+++ b/builtin/hash-object.c
@@ -5,12 +5,17 @@
* Copyright (C) Junio C Hamano, 2005
*/
#include "builtin.h"
+#include "abspath.h"
#include "config.h"
+#include "gettext.h"
+#include "hex.h"
#include "object-store.h"
#include "blob.h"
#include "quote.h"
#include "parse-options.h"
#include "exec-cmd.h"
+#include "setup.h"
+#include "write-or-die.h"
/*
* This is to create corrupt objects for debugging and as such it
diff --git a/builtin/help.c b/builtin/help.c
index 53f2812dfb..87333a02ec 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -5,11 +5,13 @@
#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"
#include "help.h"
#include "alias.h"
+#include "setup.h"
#ifndef DEFAULT_HELP_FORMAT
#define DEFAULT_HELP_FORMAT "man"
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 de47f3f644..b17e79cd40 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1,6 +1,10 @@
#include "builtin.h"
+#include "alloc.h"
#include "config.h"
#include "delta.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "pack.h"
#include "csum-file.h"
#include "blob.h"
@@ -14,7 +18,10 @@
#include "thread-utils.h"
#include "packfile.h"
#include "object-store.h"
+#include "replace-object.h"
#include "promisor-remote.h"
+#include "setup.h"
+#include "wrapper.h"
static const char index_pack_usage[] =
"git index-pack [-v] [-o <index-file>] [--keep | --keep=<msg>] [--[no-]rev-index] [--verify] [--strict] (<pack-file> | --stdin [--fix-thin] [<pack-file>])";
diff --git a/builtin/init-db.c b/builtin/init-db.c
index dcaaf102ea..ba6e0b20fa 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -4,12 +4,17 @@
* Copyright (C) Linus Torvalds, 2005
*/
#include "cache.h"
+#include "abspath.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
#include "refs.h"
#include "builtin.h"
#include "exec-cmd.h"
#include "parse-options.h"
+#include "setup.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/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 acf3faecd8..2ce645eee9 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -4,8 +4,13 @@
* (C) Copyright 2006 Linus Torvalds
* 2006 Junio Hamano
*/
-#include "cache.h"
+#include "git-compat-util.h"
+#include "abspath.h"
+#include "alloc.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "refs.h"
#include "object-store.h"
#include "color.h"
@@ -35,6 +40,7 @@
#include "commit-reach.h"
#include "range-diff.h"
#include "tmp-objdir.h"
+#include "write-or-die.h"
#define MAIL_DEFAULT_WRAP 72
#define COVER_FROM_AUTO_MAX_SUBJECT_LEN 100
@@ -436,7 +442,7 @@ static void log_show_early(struct rev_info *revs, struct commit_list *list)
setitimer(ITIMER_REAL, &early_output_timer, NULL);
}
-static void early_output(int signal)
+static void early_output(int signal UNUSED)
{
show_early_output = log_show_early;
}
@@ -601,8 +607,6 @@ static int git_log_config(const char *var, const char *value, void *cb)
return 0;
}
- if (git_gpg_config(var, value, cb) < 0)
- return -1;
return git_diff_ui_config(var, value, cb);
}
@@ -2103,6 +2107,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
/* Always generate a patch */
rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
+ rev.always_show_header = 1;
rev.zero_commit = zero_commit;
rev.patch_name_max = fmt_patch_name_max;
diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index c10d51a969..68532f3e51 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"
@@ -19,6 +20,7 @@
#include "string-list.h"
#include "pathspec.h"
#include "run-command.h"
+#include "setup.h"
#include "submodule.h"
#include "submodule-config.h"
diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c
index 6516177348..11d9424804 100644
--- a/builtin/ls-remote.c
+++ b/builtin/ls-remote.c
@@ -1,5 +1,7 @@
#include "builtin.h"
#include "cache.h"
+#include "gettext.h"
+#include "hex.h"
#include "transport.h"
#include "ref-filter.h"
#include "remote.h"
diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c
index ebcc8fd6ff..f32e6be219 100644
--- a/builtin/ls-tree.c
+++ b/builtin/ls-tree.c
@@ -5,6 +5,8 @@
*/
#include "cache.h"
#include "config.h"
+#include "gettext.h"
+#include "hex.h"
#include "object-store.h"
#include "blob.h"
#include "tree.h"
diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c
index 01d16ef9e5..a032a1c388 100644
--- a/builtin/mailinfo.c
+++ b/builtin/mailinfo.c
@@ -3,7 +3,10 @@
* email to figure out authorship and subject
*/
#include "cache.h"
+#include "abspath.h"
#include "builtin.h"
+#include "environment.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 64d29136d1..3f22273b40 100644
--- a/builtin/merge-base.c
+++ b/builtin/merge-base.c
@@ -2,6 +2,8 @@
#include "cache.h"
#include "config.h"
#include "commit.h"
+#include "gettext.h"
+#include "hex.h"
#include "refs.h"
#include "diff.h"
#include "revision.h"
diff --git a/builtin/merge-file.c b/builtin/merge-file.c
index c923bbf2ab..781818d08f 100644
--- a/builtin/merge-file.c
+++ b/builtin/merge-file.c
@@ -1,6 +1,9 @@
#include "builtin.h"
+#include "abspath.h"
#include "cache.h"
#include "config.h"
+#include "gettext.h"
+#include "setup.h"
#include "xdiff/xdiff.h"
#include "xdiff-interface.h"
#include "parse-options.h"
diff --git a/builtin/merge-index.c b/builtin/merge-index.c
index 452f833ac4..c875f5d37e 100644
--- a/builtin/merge-index.c
+++ b/builtin/merge-index.c
@@ -1,5 +1,6 @@
#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
+#include "hex.h"
#include "run-command.h"
static const char *pgm;
diff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c
index a50b328d94..8ea9dc78aa 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 d628ad1da9..803e380856 100644
--- a/builtin/merge-tree.c
+++ b/builtin/merge-tree.c
@@ -3,6 +3,8 @@
#include "tree-walk.h"
#include "xdiff-interface.h"
#include "help.h"
+#include "gettext.h"
+#include "hex.h"
#include "commit.h"
#include "commit-reach.h"
#include "merge-ort.h"
diff --git a/builtin/merge.c b/builtin/merge.c
index 69666546ca..a99be9610e 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -8,7 +8,12 @@
#define USE_THE_INDEX_VARIABLE
#include "cache.h"
+#include "abspath.h"
+#include "alloc.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "parse-options.h"
#include "builtin.h"
#include "lockfile.h"
@@ -44,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)
@@ -662,9 +668,6 @@ static int git_merge_config(const char *k, const char *v, void *cb)
status = fmt_merge_msg_config(k, v, cb);
if (status)
return status;
- status = git_gpg_config(k, v, NULL);
- if (status)
- return status;
return git_diff_ui_config(k, v, cb);
}
diff --git a/builtin/mktag.c b/builtin/mktag.c
index 141a2d4569..f9d9a38452 100644
--- a/builtin/mktag.c
+++ b/builtin/mktag.c
@@ -1,4 +1,6 @@
#include "builtin.h"
+#include "gettext.h"
+#include "hex.h"
#include "parse-options.h"
#include "tag.h"
#include "replace-object.h"
diff --git a/builtin/mktree.c b/builtin/mktree.c
index 06d81400f5..09a7bd5c5c 100644
--- a/builtin/mktree.c
+++ b/builtin/mktree.c
@@ -4,6 +4,9 @@
* Copyright (c) Junio C Hamano, 2006, 2009
*/
#include "builtin.h"
+#include "alloc.h"
+#include "gettext.h"
+#include "hex.h"
#include "quote.h"
#include "tree.h"
#include "parse-options.h"
diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
index 9a18a82b05..1b5083f8b2 100644
--- a/builtin/multi-pack-index.c
+++ b/builtin/multi-pack-index.c
@@ -1,6 +1,9 @@
#include "builtin.h"
+#include "abspath.h"
#include "cache.h"
#include "config.h"
+#include "environment.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 edd7b931fd..b7c5ffbd8c 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -5,13 +5,18 @@
*/
#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
+#include "abspath.h"
+#include "alloc.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
#include "pathspec.h"
#include "lockfile.h"
#include "dir.h"
#include "cache-tree.h"
#include "string-list.h"
#include "parse-options.h"
+#include "setup.h"
#include "submodule.h"
#include "entry.h"
diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index ad1de02308..831d360a78 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -1,5 +1,8 @@
#include "builtin.h"
-#include "cache.h"
+#include "alloc.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "config.h"
#include "commit.h"
diff --git a/builtin/notes.c b/builtin/notes.c
index f4939176da..4ff44f1e3d 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -10,6 +10,8 @@
#include "cache.h"
#include "config.h"
#include "builtin.h"
+#include "gettext.h"
+#include "hex.h"
#include "notes.h"
#include "object-store.h"
#include "repository.h"
@@ -23,6 +25,7 @@
#include "notes-merge.h"
#include "notes-utils.h"
#include "worktree.h"
+#include "write-or-die.h"
static const char * const git_notes_usage[] = {
N_("git notes [--ref <notes-ref>] [list [<object>]]"),
@@ -113,8 +116,9 @@ static void free_note_data(struct note_data *d)
}
static int list_each_note(const struct object_id *object_oid,
- const struct object_id *note_oid, char *note_path,
- void *cb_data)
+ const struct object_id *note_oid,
+ char *note_path UNUSED,
+ void *cb_data UNUSED)
{
printf("%s %s\n", oid_to_hex(note_oid), oid_to_hex(object_oid));
return 0;
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 2f2c02589b..69c6542861 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1,5 +1,8 @@
#include "builtin.h"
-#include "cache.h"
+#include "alloc.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "config.h"
#include "attr.h"
@@ -31,12 +34,14 @@
#include "list.h"
#include "packfile.h"
#include "object-store.h"
+#include "replace-object.h"
#include "dir.h"
#include "midx.h"
#include "trace2.h"
#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.
@@ -1594,7 +1599,7 @@ static int add_object_entry(const struct object_id *oid, enum object_type type,
static int add_object_entry_from_bitmap(const struct object_id *oid,
enum object_type type,
- int flags, uint32_t name_hash,
+ int flags UNUSED, uint32_t name_hash,
struct packed_git *pack, off_t offset)
{
display_progress(progress_state, ++nr_seen);
@@ -3268,13 +3273,14 @@ static int add_object_entry_from_pack(const struct object_id *oid,
return 0;
}
-static void show_commit_pack_hint(struct commit *commit, void *_data)
+static void show_commit_pack_hint(struct commit *commit UNUSED,
+ void *data UNUSED)
{
/* nothing to do; commits don't have a namehash */
}
static void show_object_pack_hint(struct object *object, const char *name,
- void *_data)
+ void *data UNUSED)
{
struct object_entry *oe = packlist_find(&to_pack, &object->oid);
if (!oe)
@@ -3472,7 +3478,7 @@ static void add_cruft_object_entry(const struct object_id *oid, enum object_type
return;
}
-static void show_cruft_object(struct object *obj, const char *name, void *data)
+static void show_cruft_object(struct object *obj, const char *name, void *data UNUSED)
{
/*
* if we did not record it earlier, it's at least as old as our
@@ -3492,7 +3498,7 @@ static void show_cruft_commit(struct commit *commit, void *data)
show_cruft_object((struct object*)commit, NULL, data);
}
-static int cruft_include_check_obj(struct object *obj, void *data)
+static int cruft_include_check_obj(struct object *obj, void *data UNUSED)
{
return !has_object_kept_pack(&obj->oid, IN_CORE_KEEP_PACKS);
}
@@ -3671,7 +3677,7 @@ static void read_object_list_from_stdin(void)
}
}
-static void show_commit(struct commit *commit, void *data)
+static void show_commit(struct commit *commit, void *data UNUSED)
{
add_object_entry(&commit->object.oid, OBJ_COMMIT, NULL, 0);
@@ -3682,7 +3688,8 @@ static void show_commit(struct commit *commit, void *data)
propagate_island_marks(commit);
}
-static void show_object(struct object *obj, const char *name, void *data)
+static void show_object(struct object *obj, const char *name,
+ void *data UNUSED)
{
add_preferred_base_object(name);
add_object_entry(&obj->oid, obj->type, name, 0);
@@ -3769,7 +3776,7 @@ static void show_edge(struct commit *commit)
static int add_object_in_unpacked_pack(const struct object_id *oid,
struct packed_git *pack,
uint32_t pos,
- void *_data)
+ void *data UNUSED)
{
if (cruft) {
off_t offset;
@@ -3803,7 +3810,7 @@ static void add_objects_in_unpacked_packs(void)
}
static int add_loose_object(const struct object_id *oid, const char *path,
- void *data)
+ void *data UNUSED)
{
enum object_type type = oid_object_info(the_repository, oid, NULL);
@@ -3954,13 +3961,13 @@ static int get_object_list_from_bitmap(struct rev_info *revs)
}
static void record_recent_object(struct object *obj,
- const char *name,
- void *data)
+ const char *name UNUSED,
+ void *data UNUSED)
{
oid_array_append(&recent_objects, &obj->oid);
}
-static void record_recent_commit(struct commit *commit, void *data)
+static void record_recent_commit(struct commit *commit, void *data UNUSED)
{
oid_array_append(&recent_objects, &commit->object.oid);
}
diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c
index ecd49ca268..3451971b56 100644
--- a/builtin/pack-redundant.c
+++ b/builtin/pack-redundant.c
@@ -7,6 +7,8 @@
*/
#include "builtin.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "packfile.h"
#include "object-store.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 f840fbf1c7..9d5585d3a7 100644
--- a/builtin/patch-id.c
+++ b/builtin/patch-id.c
@@ -2,6 +2,8 @@
#include "builtin.h"
#include "config.h"
#include "diff.h"
+#include "gettext.h"
+#include "hex.h"
#include "parse-options.h"
static void flush_current_id(int patchlen, struct object_id *id, struct object_id *result)
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 93be90825d..5c0952f5c6 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -1,12 +1,16 @@
#include "cache.h"
#include "commit.h"
#include "diff.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "revision.h"
#include "builtin.h"
#include "reachable.h"
#include "parse-options.h"
#include "progress.h"
#include "prune-packed.h"
+#include "replace-object.h"
#include "object-store.h"
#include "shallow.h"
@@ -98,7 +102,8 @@ static int prune_object(const struct object_id *oid, const char *fullpath,
return 0;
}
-static int prune_cruft(const char *basename, const char *path, void *data)
+static int prune_cruft(const char *basename, const char *path,
+ void *data UNUSED)
{
if (starts_with(basename, "tmp_obj_"))
prune_tmp_file(path);
@@ -107,7 +112,8 @@ static int prune_cruft(const char *basename, const char *path, void *data)
return 0;
}
-static int prune_subdir(unsigned int nr, const char *path, void *data)
+static int prune_subdir(unsigned int nr UNUSED, const char *path,
+ void *data UNUSED)
{
if (!show_only)
rmdir(path);
diff --git a/builtin/pull.c b/builtin/pull.c
index 880eebcdd6..5405d09f22 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -9,6 +9,8 @@
#include "cache.h"
#include "config.h"
#include "builtin.h"
+#include "gettext.h"
+#include "hex.h"
#include "parse-options.h"
#include "exec-cmd.h"
#include "run-command.h"
@@ -359,8 +361,6 @@ static enum rebase_type config_get_rebase(int *rebase_unspecified)
*/
static int git_pull_config(const char *var, const char *value, void *cb)
{
- int status;
-
if (!strcmp(var, "rebase.autostash")) {
config_autostash = git_config_bool(var, value);
return 0;
@@ -372,10 +372,6 @@ static int git_pull_config(const char *var, const char *value, void *cb)
check_trust_level = 0;
}
- status = git_gpg_config(var, value, cb);
- if (status)
- return status;
-
return git_default_config(var, value, cb);
}
diff --git a/builtin/push.c b/builtin/push.c
index 8f7d326ab3..fa550b8f80 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -4,6 +4,8 @@
#include "cache.h"
#include "branch.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
#include "refs.h"
#include "refspec.h"
#include "run-command.h"
@@ -508,11 +510,6 @@ static int git_push_config(const char *k, const char *v, void *cb)
{
const char *slot_name;
int *flags = cb;
- int status;
-
- status = git_gpg_config(k, v, NULL);
- if (status)
- return status;
if (!strcmp(k, "push.followtags")) {
if (git_config_bool(k, v))
diff --git a/builtin/range-diff.c b/builtin/range-diff.c
index 556ee84b6d..b72af527f0 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 a1c6aa9641..600d4f748f 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -7,6 +7,8 @@
#define USE_THE_INDEX_VARIABLE
#include "cache.h"
#include "config.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "object.h"
#include "tree.h"
@@ -17,6 +19,7 @@
#include "builtin.h"
#include "parse-options.h"
#include "resolve-undo.h"
+#include "setup.h"
#include "submodule.h"
#include "submodule-config.h"
@@ -87,9 +90,9 @@ static int debug_merge(const struct cache_entry * const *stages,
{
int i;
- printf("* %d-way merge\n", o->merge_size);
+ printf("* %d-way merge\n", o->internal.merge_size);
debug_stage("index", stages[0], o);
- for (i = 1; i <= o->merge_size; i++) {
+ for (i = 1; i <= o->internal.merge_size; i++) {
char buf[24];
xsnprintf(buf, sizeof(buf), "ent#%d", i);
debug_stage(buf, stages[i], o);
@@ -144,7 +147,7 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
OPT__DRY_RUN(&opts.dry_run, N_("don't update the index or the work tree")),
OPT_BOOL(0, "no-sparse-checkout", &opts.skip_sparse_checkout,
N_("skip applying sparse checkout filter")),
- OPT_BOOL(0, "debug-unpack", &opts.debug_unpack,
+ OPT_BOOL(0, "debug-unpack", &opts.internal.debug_unpack,
N_("debug unpack-trees")),
OPT_CALLBACK_F(0, "recurse-submodules", NULL,
"checkout", "control recursive updating of submodules",
@@ -247,7 +250,7 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
opts.head_idx = 1;
}
- if (opts.debug_unpack)
+ if (opts.internal.debug_unpack)
opts.fn = debug_merge;
/* If we're going to prime_cache_tree later, skip cache tree update */
@@ -263,7 +266,7 @@ int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
if (unpack_trees(nr_trees, t, &opts))
return 128;
- if (opts.debug_unpack || opts.dry_run)
+ if (opts.internal.debug_unpack || opts.dry_run)
return 0; /* do not write the index out */
/*
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 76cce94373..dbc8f90ef0 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -6,6 +6,10 @@
#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
+#include "abspath.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "run-command.h"
#include "exec-cmd.h"
#include "strvec.h"
@@ -29,6 +33,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 <cmd>] "
@@ -1516,7 +1521,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
die(_("apply options and merge options "
"cannot be used together"));
else if (options.autosquash == -1 && options.config_autosquash == 1)
- die(_("apply options are incompatible with rebase.autosquash. Consider adding --no-autosquash"));
+ die(_("apply options are incompatible with rebase.autoSquash. Consider adding --no-autosquash"));
else if (options.update_refs == -1 && options.config_update_refs == 1)
die(_("apply options are incompatible with rebase.updateRefs. Consider adding --no-update-refs"));
else
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 5609206499..2ba5a74ba7 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1,6 +1,10 @@
#include "builtin.h"
+#include "abspath.h"
#include "repository.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "pack.h"
#include "refs.h"
@@ -30,6 +34,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 <git-dir>"),
@@ -136,10 +141,6 @@ static int receive_pack_config(const char *var, const char *value, void *cb)
if (status)
return status;
- status = git_gpg_config(var, value, NULL);
- if (status)
- return status;
-
if (strcmp(var, "receive.denydeletes") == 0) {
deny_deletes = git_config_bool(var, value);
return 0;
@@ -1463,8 +1464,10 @@ static const char *update(struct command *cmd, struct shallow_info *si)
find_shared_symref(worktrees, "HEAD", name);
/* only refs/... are allowed */
- if (!starts_with(name, "refs/") || check_refname_format(name + 5, 0)) {
- rp_error("refusing to create funny ref '%s' remotely", name);
+ if (!starts_with(name, "refs/") ||
+ check_refname_format(name + 5, is_null_oid(new_oid) ?
+ REFNAME_ALLOW_ONELEVEL : 0)) {
+ rp_error("refusing to update funny ref '%s' remotely", name);
ret = "funny refname";
goto out;
}
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 a6b100dce7..1e0b137d97 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 25658fe732..df4d8e0f0b 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -1,7 +1,10 @@
#include "builtin.h"
-#include "cache.h"
+#include "alloc.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "parse-options.h"
#include "run-command.h"
#include "sigchain.h"
@@ -182,8 +185,9 @@ static void prepare_pack_objects(struct child_process *cmd,
* Write oid to the given struct child_process's stdin, starting it first if
* necessary.
*/
-static int write_oid(const struct object_id *oid, struct packed_git *pack,
- uint32_t pos, void *data)
+static int write_oid(const struct object_id *oid,
+ struct packed_git *pack UNUSED,
+ uint32_t pos UNUSED, void *data)
{
struct child_process *cmd = data;
diff --git a/builtin/replace.c b/builtin/replace.c
index bd67107a7c..d2adc8ab61 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -11,10 +11,14 @@
#include "cache.h"
#include "config.h"
#include "builtin.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "refs.h"
#include "parse-options.h"
#include "run-command.h"
#include "object-store.h"
+#include "replace-object.h"
#include "repository.h"
#include "tag.h"
diff --git a/builtin/rerere.c b/builtin/rerere.c
index 94ffb8c21a..d4a03707b1 100644
--- a/builtin/rerere.c
+++ b/builtin/rerere.c
@@ -2,9 +2,11 @@
#include "cache.h"
#include "config.h"
#include "dir.h"
+#include "gettext.h"
#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/reset.c b/builtin/reset.c
index b65f379440..0ed329236c 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -10,6 +10,9 @@
#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "tag.h"
#include "object.h"
@@ -23,6 +26,7 @@
#include "parse-options.h"
#include "unpack-trees.h"
#include "cache-tree.h"
+#include "setup.h"
#include "submodule.h"
#include "submodule-config.h"
#include "dir.h"
@@ -317,7 +321,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
int reset_type = NONE, update_ref_status = 0, quiet = 0;
int no_refresh = 0;
int patch_mode = 0, pathspec_file_nul = 0, unborn;
- const char *rev, *pathspec_from_file = NULL;
+ const char *rev;
+ char *pathspec_from_file = NULL;
struct object_id oid;
struct pathspec pathspec;
int intent_to_add = 0;
@@ -497,5 +502,6 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
cleanup:
clear_pathspec(&pathspec);
+ free(pathspec_from_file);
return update_ref_status;
}
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 0f55eae22e..a3dbbb6338 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -2,6 +2,9 @@
#include "config.h"
#include "commit.h"
#include "diff.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "revision.h"
#include "list-objects.h"
#include "list-objects-filter.h"
@@ -38,7 +41,7 @@ static const char rev_list_usage[] =
" --tags\n"
" --remotes\n"
" --stdin\n"
-" --exclude-hidden=[receive|uploadpack]\n"
+" --exclude-hidden=[fetch|receive|uploadpack]\n"
" --quiet\n"
" ordering output:\n"
" --topo-order\n"
@@ -257,7 +260,8 @@ static inline void finish_object__ma(struct object *obj)
}
}
-static int finish_object(struct object *obj, const char *name, void *cb_data)
+static int finish_object(struct object *obj, const char *name UNUSED,
+ void *cb_data)
{
struct rev_list_info *info = cb_data;
if (oid_object_info_extended(the_repository, &obj->oid, NULL, 0) < 0) {
@@ -362,11 +366,11 @@ static int show_bisect_vars(struct rev_list_info *info, int reaches, int all)
static int show_object_fast(
const struct object_id *oid,
- enum object_type type,
- int exclude,
- uint32_t name_hash,
- struct packed_git *found_pack,
- off_t found_offset)
+ enum object_type type UNUSED,
+ int exclude UNUSED,
+ uint32_t name_hash UNUSED,
+ struct packed_git *found_pack UNUSED,
+ off_t found_offset UNUSED)
{
fprintf(stdout, "%s\n", oid_to_hex(oid));
return 1;
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 663f282c5f..1af2089f9b 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -5,14 +5,20 @@
*/
#define USE_THE_INDEX_VARIABLE
#include "cache.h"
+#include "abspath.h"
+#include "alloc.h"
#include "config.h"
#include "commit.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "refs.h"
#include "quote.h"
#include "builtin.h"
#include "parse-options.h"
#include "diff.h"
#include "revision.h"
+#include "setup.h"
#include "split-index.h"
#include "submodule.h"
#include "commit-reach.h"
diff --git a/builtin/revert.c b/builtin/revert.c
index 77d2035616..dd6587a99d 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -1,8 +1,10 @@
-#include "cache.h"
+#include "git-compat-util.h"
+#include "alloc.h"
#include "config.h"
#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 25130f1b19..6be9281742 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -5,14 +5,17 @@
*/
#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
+#include "alloc.h"
#include "advice.h"
#include "config.h"
#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"
+#include "setup.h"
#include "submodule.h"
#include "pathspec.h"
diff --git a/builtin/send-pack.c b/builtin/send-pack.c
index 4c5d125fa0..2b360fee42 100644
--- a/builtin/send-pack.c
+++ b/builtin/send-pack.c
@@ -1,6 +1,7 @@
#include "builtin.h"
#include "config.h"
#include "commit.h"
+#include "hex.h"
#include "refs.h"
#include "pkt-line.h"
#include "sideband.h"
@@ -15,6 +16,7 @@
#include "gpg-interface.h"
#include "gettext.h"
#include "protocol.h"
+#include "write-or-die.h"
static const char * const send_pack_usage[] = {
N_("git send-pack [--mirror] [--dry-run] [--force]\n"
@@ -130,8 +132,6 @@ static void print_helper_status(struct ref *ref)
static int send_pack_config(const char *k, const char *v, void *cb)
{
- git_gpg_config(k, v, NULL);
-
if (!strcmp(k, "push.gpgsign")) {
const char *value;
if (!git_config_get_value("push.gpgsign", &value)) {
diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index f287a6acd0..46f4e0832a 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -3,10 +3,13 @@
#include "config.h"
#include "commit.h"
#include "diff.h"
+#include "environment.h"
+#include "gettext.h"
#include "string-list.h"
#include "revision.h"
#include "utf8.h"
#include "mailmap.h"
+#include "setup.h"
#include "shortlog.h"
#include "parse-options.h"
#include "trailer.h"
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index af680485d5..463a8d11c3 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -1,5 +1,8 @@
#include "cache.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "pretty.h"
#include "refs.h"
#include "builtin.h"
diff --git a/builtin/show-index.c b/builtin/show-index.c
index 0e0b9fb95b..d4bbbbcd6c 100644
--- a/builtin/show-index.c
+++ b/builtin/show-index.c
@@ -1,5 +1,7 @@
#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 b294ae4164..138d30a005 100644
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -1,6 +1,8 @@
#include "builtin.h"
#include "cache.h"
#include "config.h"
+#include "gettext.h"
+#include "hex.h"
#include "refs.h"
#include "object-store.h"
#include "object.h"
diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c
index c5c8b7b89c..090bf33510 100644
--- a/builtin/sparse-checkout.c
+++ b/builtin/sparse-checkout.c
@@ -2,6 +2,8 @@
#include "cache.h"
#include "config.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
#include "parse-options.h"
#include "pathspec.h"
#include "repository.h"
@@ -14,6 +16,7 @@
#include "unpack-trees.h"
#include "wt-status.h"
#include "quote.h"
+#include "setup.h"
#include "sparse-index.h"
#include "worktree.h"
@@ -217,16 +220,14 @@ static int update_working_directory(struct pattern_list *pl)
o.head_idx = -1;
o.src_index = r->index;
o.dst_index = r->index;
- index_state_init(&o.result, r);
o.skip_sparse_checkout = 0;
- o.pl = pl;
setup_work_tree();
repo_hold_locked_index(r, &lock_file, LOCK_DIE_ON_ERROR);
setup_unpack_trees_porcelain(&o, "sparse-checkout");
- result = update_sparsity(&o);
+ result = update_sparsity(&o, pl);
clear_unpack_trees_porcelain(&o);
if (result == UPDATE_SPARSITY_WARNINGS)
diff --git a/builtin/stash.c b/builtin/stash.c
index 888ffa0728..14194b13bd 100644
--- a/builtin/stash.c
+++ b/builtin/stash.c
@@ -1,6 +1,10 @@
#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
+#include "abspath.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "parse-options.h"
#include "refs.h"
#include "lockfile.h"
@@ -14,6 +18,7 @@
#include "entry.h"
#include "rerere.h"
#include "revision.h"
+#include "setup.h"
#include "log-tree.h"
#include "diffcore.h"
#include "exec-cmd.h"
diff --git a/builtin/stripspace.c b/builtin/stripspace.c
index 1e34cf2beb..9451eb69ff 100644
--- a/builtin/stripspace.c
+++ b/builtin/stripspace.c
@@ -1,8 +1,11 @@
#include "builtin.h"
#include "cache.h"
#include "config.h"
+#include "gettext.h"
#include "parse-options.h"
+#include "setup.h"
#include "strbuf.h"
+#include "write-or-die.h"
static void comment_lines(struct strbuf *buf)
{
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 32b8e49817..8337703715 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1,5 +1,10 @@
#define USE_THE_INDEX_VARIABLE
#include "builtin.h"
+#include "abspath.h"
+#include "alloc.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "repository.h"
#include "cache.h"
#include "config.h"
@@ -7,6 +12,7 @@
#include "quote.h"
#include "pathspec.h"
#include "dir.h"
+#include "setup.h"
#include "submodule.h"
#include "submodule-config.h"
#include "string-list.h"
@@ -2132,9 +2138,9 @@ static int update_clone_get_next_task(struct child_process *child,
return 0;
}
-static int update_clone_start_failure(struct strbuf *err,
+static int update_clone_start_failure(struct strbuf *err UNUSED,
void *suc_cb,
- void *idx_task_cb)
+ void *idx_task_cb UNUSED)
{
struct submodule_update_clone *suc = suc_cb;
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 cd97a141fa..bfd5138957 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -9,6 +9,9 @@
#include "cache.h"
#include "config.h"
#include "builtin.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "refs.h"
#include "object-store.h"
#include "tag.h"
@@ -21,6 +24,7 @@
#include "column.h"
#include "ref-filter.h"
#include "date.h"
+#include "write-or-die.h"
static const char * const git_tag_usage[] = {
N_("git tag [-a | -s | -u <key-id>] [-f] [-m <msg> | -F <file>] [-e]\n"
@@ -180,8 +184,6 @@ static const char tag_template_nocleanup[] =
static int git_tag_config(const char *var, const char *value, void *cb)
{
- int status;
-
if (!strcmp(var, "tag.gpgsign")) {
config_sign_tag = git_config_bool(var, value);
return 0;
@@ -194,9 +196,6 @@ static int git_tag_config(const char *var, const char *value, void *cb)
return 0;
}
- status = git_gpg_config(var, value, cb);
- if (status)
- return status;
if (!strcmp(var, "tag.forcesignannotated")) {
force_sign_annotate = git_config_bool(var, value);
return 0;
@@ -433,7 +432,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
int create_reflog = 0;
int annotate = 0, force = 0;
int cmdmode = 0, create_tag_object = 0;
- const char *msgfile = NULL, *keyid = NULL;
+ char *msgfile = NULL;
+ const char *keyid = NULL;
struct msg_arg msg = { .buf = STRBUF_INIT };
struct ref_transaction *transaction;
struct strbuf err = STRBUF_INIT;
@@ -643,5 +643,6 @@ cleanup:
strbuf_release(&reflog_msg);
strbuf_release(&msg.buf);
strbuf_release(&err);
+ free(msgfile);
return ret;
}
diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c
index 9d5c152419..314761b0b4 100644
--- a/builtin/unpack-file.c
+++ b/builtin/unpack-file.c
@@ -1,6 +1,8 @@
#include "builtin.h"
#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/unpack-objects.c b/builtin/unpack-objects.c
index c072096174..f2c1323e66 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -2,12 +2,16 @@
#include "cache.h"
#include "bulk-checkin.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "object-store.h"
#include "object.h"
#include "delta.h"
#include "pack.h"
#include "blob.h"
#include "commit.h"
+#include "replace-object.h"
#include "tag.h"
#include "tree.h"
#include "tree-walk.h"
diff --git a/builtin/update-index.c b/builtin/update-index.c
index bf38885d54..03cda5e60d 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -7,6 +7,9 @@
#include "cache.h"
#include "bulk-checkin.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "lockfile.h"
#include "quote.h"
#include "cache-tree.h"
@@ -17,8 +20,10 @@
#include "parse-options.h"
#include "pathspec.h"
#include "dir.h"
+#include "setup.h"
#include "split-index.h"
#include "fsmonitor.h"
+#include "write-or-die.h"
/*
* Default to not allowing changes to the list of files. The
diff --git a/builtin/update-ref.c b/builtin/update-ref.c
index 1ba0727ba7..3ffd75b3e7 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 25b69da2bf..beb9dd0861 100644
--- a/builtin/upload-pack.c
+++ b/builtin/upload-pack.c
@@ -1,9 +1,11 @@
#include "cache.h"
#include "builtin.h"
#include "exec-cmd.h"
+#include "gettext.h"
#include "pkt-line.h"
#include "parse-options.h"
#include "protocol.h"
+#include "replace-object.h"
#include "upload-pack.h"
#include "serve.h"
diff --git a/builtin/var.c b/builtin/var.c
index a80c1df86f..d9943be9af 100644
--- a/builtin/var.c
+++ b/builtin/var.c
@@ -5,6 +5,7 @@
*/
#include "builtin.h"
#include "config.h"
+#include "ident.h"
#include "refs.h"
static const char var_usage[] = "git var (-l | <variable>)";
diff --git a/builtin/verify-commit.c b/builtin/verify-commit.c
index 424b43083c..4d10aa98b1 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"
@@ -52,14 +53,6 @@ static int verify_commit(const char *name, unsigned flags)
return run_gpg_verify((struct commit *)obj, flags);
}
-static int git_verify_commit_config(const char *var, const char *value, void *cb)
-{
- int status = git_gpg_config(var, value, cb);
- if (status)
- return status;
- return git_default_config(var, value, cb);
-}
-
int cmd_verify_commit(int argc, const char **argv, const char *prefix)
{
int i = 1, verbose = 0, had_error = 0;
@@ -70,7 +63,7 @@ int cmd_verify_commit(int argc, const char **argv, const char *prefix)
OPT_END()
};
- git_config(git_verify_commit_config, NULL);
+ git_config(git_default_config, NULL);
argc = parse_options(argc, argv, prefix, verify_commit_options,
verify_commit_usage, PARSE_OPT_KEEP_ARGV0);
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 050fd29251..28d0da6845 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"
@@ -19,14 +20,6 @@ static const char * const verify_tag_usage[] = {
NULL
};
-static int git_verify_tag_config(const char *var, const char *value, void *cb)
-{
- int status = git_gpg_config(var, value, cb);
- if (status)
- return status;
- return git_default_config(var, value, cb);
-}
-
int cmd_verify_tag(int argc, const char **argv, const char *prefix)
{
int i = 1, verbose = 0, had_error = 0;
@@ -39,7 +32,7 @@ int cmd_verify_tag(int argc, const char **argv, const char *prefix)
OPT_END()
};
- git_config(git_verify_tag_config, NULL);
+ git_config(git_default_config, NULL);
argc = parse_options(argc, argv, prefix, verify_tag_options,
verify_tag_usage, PARSE_OPT_KEEP_ARGV0);
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 16fa30f01c..944dd40f94 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -1,8 +1,12 @@
#include "cache.h"
+#include "abspath.h"
#include "checkout.h"
#include "config.h"
#include "builtin.h"
#include "dir.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "parse-options.h"
#include "strvec.h"
#include "branch.h"
@@ -13,6 +17,7 @@
#include "submodule.h"
#include "utf8.h"
#include "worktree.h"
+#include "wrapper.h"
#include "quote.h"
#define BUILTIN_WORKTREE_ADD_USAGE \
diff --git a/builtin/write-tree.c b/builtin/write-tree.c
index 078010315f..6085f64d10 100644
--- a/builtin/write-tree.c
+++ b/builtin/write-tree.c
@@ -7,6 +7,9 @@
#include "builtin.h"
#include "cache.h"
#include "config.h"
+#include "environment.h"
+#include "gettext.h"
+#include "hex.h"
#include "tree.h"
#include "cache-tree.h"
#include "parse-options.h"