From patchwork Thu Sep 5 16:57:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jean-No=C3=ABl_Avila_via_GitGitGadget?= X-Patchwork-Id: 13792740 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F25DB1A0737 for ; Thu, 5 Sep 2024 16:57:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725555480; cv=none; b=GScF+HvKum+K/zT0nHe9/S+CbMpU7wc7W3umWkp1HeZVx6QE0dqGqWJs/PJeeXoeTTn/6kmYTvykRYn8lTBMv6xPkJ5tZIYhCu62hS+h6EHdUm9XRZqAvgFfdPV4lj0T3wzk0nnMe72merCHfDZF9ZGx0uuolJ5ABvn1r6Cgkt8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725555480; c=relaxed/simple; bh=UgltYly/MRXgrNU+EOkxUxuz5rC5aJgIPyUOAeLAsts=; h=Message-Id:In-Reply-To:References:From:Date:Subject:Content-Type: MIME-Version:To:Cc; b=V2MW1q5SjDP06kb17pXCT1S+Ai67sKgOiYwwNyTbXIc48u75iUtayfDrltAyL/TFUu8qt5nqQV387PzLAQzwGNfc3hl4F1BtypifL3UIg3GvFu49c2ndMRDKcGyqBna5ZtMz/3Hyap3qN3jtEzN2GPfN6nhyulAj95eSOWARU2A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dVGBkqHX; arc=none smtp.client-ip=209.85.208.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dVGBkqHX" Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-5c27067b81aso1132993a12.0 for ; Thu, 05 Sep 2024 09:57:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725555473; x=1726160273; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=mSwgTtj/KyUyo2TB04hTVg84k0MKIXyIOHofSPSq9QQ=; b=dVGBkqHX+kpIT/jfLIsfDeR6fJK4fkSriB7asd+oCZ57qD4PO4Po+F8Y7E/wvBSnow nsAw7QEd+98MsGMqUiUwPtTMxfJnHUFgOvvTDMyNgMwmvk0kteMlgl44SREpMqCpd/ft UQk2URgCuMkEzzCjCLvVA4Ia1Nh0v1EDdJgKaz1GOKKRYT0cNqN1NmyE5zLVnYIs/KAN JkuZCmoPK0EE1Btwh3WZ7sKLneFq6+7P1jVu1IN5kOqZONBR32ZrFT8toudkp+K7u15C wOQktiFw8BIPfV67E2mJaU/6HH0HbxPgmYGIbh8SbTymrIYwYfWrs+soduE9sxDR3vRl GPNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725555473; x=1726160273; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mSwgTtj/KyUyo2TB04hTVg84k0MKIXyIOHofSPSq9QQ=; b=RxXbO2J6P6wiZwpfhI/VUeDacFRSJr9Nh8JoSy0KUKFEhg3UhShuKy8LCgg+jUc3ok 3yegA49YjPG4yk8YrAznJ765myYrDC6auL3+uB4li5N4QIO/SYjVvbnyau7R5WAOShBV NV8Z1nrv2zs5LPoP4ksyE0lzh5CQgfD4ptvVrK8lBQx5z5v1NVotsMk2COgX5CFdl8x+ /luXU823YhtsEsIByyNvhq9XJR8GeWC4oOVJGFBQ0NzoobUp+Pw1aVgC5f+Yw4ydBz6V +8AwkuYAstRwQdmzbZd3m4JMxd1Qhi8dsgFrQeLL0ib7BAcv1qUYBW/6wJj2oSOYDd3N D5Uw== X-Gm-Message-State: AOJu0Ywdm1RHptX7kDMfem0RHMlUmfnukK2yT5Hfj4uCvZwplKN3SvfD nGvk+Yr0mQFLbfG9ngP3PsNhFKWh5zX9Xv5JudfEnkKycrtMpWVmXffumA== X-Google-Smtp-Source: AGHT+IGszSR+ei7LlOUnA2EFZOVDeHGzAcCELoOqR0RFtxvZqcguM+czfUZpn4IhzwRuwBehg3ZFcQ== X-Received: by 2002:a05:6402:1d49:b0:5c2:4dcc:b911 with SMTP id 4fb4d7f45d1cf-5c24dccbb0fmr10045487a12.26.1725555471113; Thu, 05 Sep 2024 09:57:51 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3cc6a69efsm1420898a12.96.2024.09.05.09.57.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2024 09:57:50 -0700 (PDT) Message-Id: <3301a34f76303c43feaf4eb9d6913fbeec439e97.1725555468.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "John Cai via GitGitGadget" Date: Thu, 05 Sep 2024 16:57:45 +0000 Subject: [PATCH 1/3] builtin: add a repository parameter for builtin functions Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: John Cai , John Cai From: John Cai In order to reduce the usage of the global the_repository, add a parameter to builtin functions that will get passed a repository variable. This commit uses UNUSED on most of the builtin functions, as subsequent commits will modify the actual builtins to pass the repository parameter down. Signed-off-by: John Cai --- builtin.h | 277 +++++++++++++++-------------- builtin/add.c | 2 +- builtin/am.c | 2 +- builtin/annotate.c | 4 +- builtin/apply.c | 2 +- builtin/archive.c | 2 +- builtin/bisect.c | 2 +- builtin/blame.c | 2 +- builtin/branch.c | 2 +- builtin/bugreport.c | 2 +- builtin/bundle.c | 2 +- builtin/cat-file.c | 4 +- builtin/check-attr.c | 2 +- builtin/check-ignore.c | 2 +- builtin/check-mailmap.c | 2 +- builtin/check-ref-format.c | 2 +- builtin/checkout--worker.c | 2 +- builtin/checkout-index.c | 2 +- builtin/checkout.c | 6 +- builtin/clean.c | 2 +- builtin/clone.c | 2 +- builtin/column.c | 2 +- builtin/commit-graph.c | 2 +- builtin/commit-tree.c | 2 +- builtin/commit.c | 4 +- builtin/config.c | 2 +- builtin/count-objects.c | 2 +- builtin/credential-cache--daemon.c | 4 +- builtin/credential-cache.c | 2 +- builtin/credential-store.c | 2 +- builtin/credential.c | 2 +- builtin/describe.c | 4 +- builtin/diagnose.c | 2 +- builtin/diff-files.c | 2 +- builtin/diff-index.c | 2 +- builtin/diff-tree.c | 2 +- builtin/diff.c | 2 +- builtin/difftool.c | 2 +- builtin/fast-export.c | 2 +- builtin/fast-import.c | 2 +- builtin/fetch-pack.c | 2 +- builtin/fetch.c | 2 +- builtin/fmt-merge-msg.c | 2 +- builtin/for-each-ref.c | 2 +- builtin/for-each-repo.c | 2 +- builtin/fsck.c | 2 +- builtin/fsmonitor--daemon.c | 4 +- builtin/gc.c | 4 +- builtin/get-tar-commit-id.c | 2 +- builtin/grep.c | 2 +- builtin/hash-object.c | 2 +- builtin/help.c | 2 +- builtin/hook.c | 2 +- builtin/index-pack.c | 2 +- builtin/init-db.c | 2 +- builtin/interpret-trailers.c | 2 +- builtin/log.c | 12 +- builtin/ls-files.c | 2 +- builtin/ls-remote.c | 2 +- builtin/ls-tree.c | 2 +- builtin/mailinfo.c | 2 +- builtin/mailsplit.c | 2 +- builtin/merge-base.c | 2 +- builtin/merge-file.c | 2 +- builtin/merge-index.c | 2 +- builtin/merge-ours.c | 2 +- builtin/merge-recursive.c | 2 +- builtin/merge-tree.c | 2 +- builtin/merge.c | 6 +- builtin/mktag.c | 2 +- builtin/mktree.c | 2 +- builtin/multi-pack-index.c | 2 +- builtin/mv.c | 2 +- builtin/name-rev.c | 2 +- builtin/notes.c | 2 +- builtin/pack-objects.c | 2 +- builtin/pack-redundant.c | 2 +- builtin/pack-refs.c | 2 +- builtin/patch-id.c | 2 +- builtin/prune-packed.c | 2 +- builtin/prune.c | 2 +- builtin/pull.c | 2 +- builtin/push.c | 2 +- builtin/range-diff.c | 2 +- builtin/read-tree.c | 2 +- builtin/rebase.c | 2 +- builtin/receive-pack.c | 2 +- builtin/reflog.c | 6 +- builtin/refs.c | 2 +- builtin/remote-ext.c | 2 +- builtin/remote-fd.c | 2 +- builtin/remote.c | 2 +- builtin/repack.c | 2 +- builtin/replace.c | 2 +- builtin/replay.c | 2 +- builtin/rerere.c | 2 +- builtin/reset.c | 2 +- builtin/rev-list.c | 2 +- builtin/rev-parse.c | 2 +- builtin/revert.c | 4 +- builtin/rm.c | 2 +- builtin/send-pack.c | 2 +- builtin/shortlog.c | 2 +- builtin/show-branch.c | 2 +- builtin/show-index.c | 2 +- builtin/show-ref.c | 2 +- builtin/sparse-checkout.c | 2 +- builtin/stash.c | 2 +- builtin/stripspace.c | 2 +- builtin/submodule--helper.c | 2 +- builtin/symbolic-ref.c | 2 +- builtin/tag.c | 2 +- builtin/unpack-file.c | 2 +- builtin/unpack-objects.c | 2 +- builtin/update-index.c | 2 +- builtin/update-ref.c | 2 +- builtin/update-server-info.c | 2 +- builtin/upload-archive.c | 4 +- builtin/upload-pack.c | 2 +- builtin/var.c | 2 +- builtin/verify-commit.c | 2 +- builtin/verify-pack.c | 2 +- builtin/verify-tag.c | 2 +- builtin/worktree.c | 2 +- builtin/write-tree.c | 2 +- git.c | 14 +- help.c | 3 +- 127 files changed, 293 insertions(+), 289 deletions(-) diff --git a/builtin.h b/builtin.h index 14fa0171607..fc6fc8ffed8 100644 --- a/builtin.h +++ b/builtin.h @@ -10,6 +10,7 @@ #define USE_THE_REPOSITORY_VARIABLE #include "git-compat-util.h" +#include "repository.h" /* * builtin API @@ -122,143 +123,143 @@ int is_builtin(const char *s); BUG("unexpected prefix in builtin: %s", (prefix)); \ } while (0) -int cmd_add(int argc, const char **argv, const char *prefix); -int cmd_am(int argc, const char **argv, const char *prefix); -int cmd_annotate(int argc, const char **argv, const char *prefix); -int cmd_apply(int argc, const char **argv, const char *prefix); -int cmd_archive(int argc, const char **argv, const char *prefix); -int cmd_bisect(int argc, const char **argv, const char *prefix); -int cmd_blame(int argc, const char **argv, const char *prefix); -int cmd_branch(int argc, const char **argv, const char *prefix); -int cmd_bugreport(int argc, const char **argv, const char *prefix); -int cmd_bundle(int argc, const char **argv, const char *prefix); -int cmd_cat_file(int argc, const char **argv, const char *prefix); -int cmd_checkout(int argc, const char **argv, const char *prefix); -int cmd_checkout__worker(int argc, const char **argv, const char *prefix); -int cmd_checkout_index(int argc, const char **argv, const char *prefix); -int cmd_check_attr(int argc, const char **argv, const char *prefix); -int cmd_check_ignore(int argc, const char **argv, const char *prefix); -int cmd_check_mailmap(int argc, const char **argv, const char *prefix); -int cmd_check_ref_format(int argc, const char **argv, const char *prefix); -int cmd_cherry(int argc, const char **argv, const char *prefix); -int cmd_cherry_pick(int argc, const char **argv, const char *prefix); -int cmd_clone(int argc, const char **argv, const char *prefix); -int cmd_clean(int argc, const char **argv, const char *prefix); -int cmd_column(int argc, const char **argv, const char *prefix); -int cmd_commit(int argc, const char **argv, const char *prefix); -int cmd_commit_graph(int argc, const char **argv, const char *prefix); -int cmd_commit_tree(int argc, const char **argv, const char *prefix); -int cmd_config(int argc, const char **argv, const char *prefix); -int cmd_count_objects(int argc, const char **argv, const char *prefix); -int cmd_credential(int argc, const char **argv, const char *prefix); -int cmd_credential_cache(int argc, const char **argv, const char *prefix); -int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix); -int cmd_credential_store(int argc, const char **argv, const char *prefix); -int cmd_describe(int argc, const char **argv, const char *prefix); -int cmd_diagnose(int argc, const char **argv, const char *prefix); -int cmd_diff_files(int argc, const char **argv, const char *prefix); -int cmd_diff_index(int argc, const char **argv, const char *prefix); -int cmd_diff(int argc, const char **argv, const char *prefix); -int cmd_diff_tree(int argc, const char **argv, const char *prefix); -int cmd_difftool(int argc, const char **argv, const char *prefix); -int cmd_env__helper(int argc, const char **argv, const char *prefix); -int cmd_fast_export(int argc, const char **argv, const char *prefix); -int cmd_fast_import(int argc, const char **argv, const char *prefix); -int cmd_fetch(int argc, const char **argv, const char *prefix); -int cmd_fetch_pack(int argc, const char **argv, const char *prefix); -int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix); -int cmd_for_each_ref(int argc, const char **argv, const char *prefix); -int cmd_for_each_repo(int argc, const char **argv, const char *prefix); -int cmd_format_patch(int argc, const char **argv, const char *prefix); -int cmd_fsck(int argc, const char **argv, const char *prefix); -int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix); -int cmd_gc(int argc, const char **argv, const char *prefix); -int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix); -int cmd_grep(int argc, const char **argv, const char *prefix); -int cmd_hash_object(int argc, const char **argv, const char *prefix); -int cmd_help(int argc, const char **argv, const char *prefix); -int cmd_hook(int argc, const char **argv, const char *prefix); -int cmd_index_pack(int argc, const char **argv, const char *prefix); -int cmd_init_db(int argc, const char **argv, const char *prefix); -int cmd_interpret_trailers(int argc, const char **argv, const char *prefix); -int cmd_log(int argc, const char **argv, const char *prefix); -int cmd_log_reflog(int argc, const char **argv, const char *prefix); -int cmd_ls_files(int argc, const char **argv, const char *prefix); -int cmd_ls_tree(int argc, const char **argv, const char *prefix); -int cmd_ls_remote(int argc, const char **argv, const char *prefix); -int cmd_mailinfo(int argc, const char **argv, const char *prefix); -int cmd_mailsplit(int argc, const char **argv, const char *prefix); -int cmd_maintenance(int argc, const char **argv, const char *prefix); -int cmd_merge(int argc, const char **argv, const char *prefix); -int cmd_merge_base(int argc, const char **argv, const char *prefix); -int cmd_merge_index(int argc, const char **argv, const char *prefix); -int cmd_merge_ours(int argc, const char **argv, const char *prefix); -int cmd_merge_file(int argc, const char **argv, const char *prefix); -int cmd_merge_recursive(int argc, const char **argv, const char *prefix); -int cmd_merge_tree(int argc, const char **argv, const char *prefix); -int cmd_mktag(int argc, const char **argv, const char *prefix); -int cmd_mktree(int argc, const char **argv, const char *prefix); -int cmd_multi_pack_index(int argc, const char **argv, const char *prefix); -int cmd_mv(int argc, const char **argv, const char *prefix); -int cmd_name_rev(int argc, const char **argv, const char *prefix); -int cmd_notes(int argc, const char **argv, const char *prefix); -int cmd_pack_objects(int argc, const char **argv, const char *prefix); -int cmd_pack_redundant(int argc, const char **argv, const char *prefix); -int cmd_patch_id(int argc, const char **argv, const char *prefix); -int cmd_prune(int argc, const char **argv, const char *prefix); -int cmd_prune_packed(int argc, const char **argv, const char *prefix); -int cmd_pull(int argc, const char **argv, const char *prefix); -int cmd_push(int argc, const char **argv, const char *prefix); -int cmd_range_diff(int argc, const char **argv, const char *prefix); -int cmd_read_tree(int argc, const char **argv, const char *prefix); -int cmd_rebase(int argc, const char **argv, const char *prefix); -int cmd_rebase__interactive(int argc, const char **argv, const char *prefix); -int cmd_receive_pack(int argc, const char **argv, const char *prefix); -int cmd_reflog(int argc, const char **argv, const char *prefix); -int cmd_refs(int argc, const char **argv, const char *prefix); -int cmd_remote(int argc, const char **argv, const char *prefix); -int cmd_remote_ext(int argc, const char **argv, const char *prefix); -int cmd_remote_fd(int argc, const char **argv, const char *prefix); -int cmd_repack(int argc, const char **argv, const char *prefix); -int cmd_replay(int argc, const char **argv, const char *prefix); -int cmd_rerere(int argc, const char **argv, const char *prefix); -int cmd_reset(int argc, const char **argv, const char *prefix); -int cmd_restore(int argc, const char **argv, const char *prefix); -int cmd_rev_list(int argc, const char **argv, const char *prefix); -int cmd_rev_parse(int argc, const char **argv, const char *prefix); -int cmd_revert(int argc, const char **argv, const char *prefix); -int cmd_rm(int argc, const char **argv, const char *prefix); -int cmd_send_pack(int argc, const char **argv, const char *prefix); -int cmd_shortlog(int argc, const char **argv, const char *prefix); -int cmd_show(int argc, const char **argv, const char *prefix); -int cmd_show_branch(int argc, const char **argv, const char *prefix); -int cmd_show_index(int argc, const char **argv, const char *prefix); -int cmd_sparse_checkout(int argc, const char **argv, const char *prefix); -int cmd_status(int argc, const char **argv, const char *prefix); -int cmd_stash(int argc, const char **argv, const char *prefix); -int cmd_stripspace(int argc, const char **argv, const char *prefix); -int cmd_submodule__helper(int argc, const char **argv, const char *prefix); -int cmd_switch(int argc, const char **argv, const char *prefix); -int cmd_symbolic_ref(int argc, const char **argv, const char *prefix); -int cmd_tag(int argc, const char **argv, const char *prefix); -int cmd_unpack_file(int argc, const char **argv, const char *prefix); -int cmd_unpack_objects(int argc, const char **argv, const char *prefix); -int cmd_update_index(int argc, const char **argv, const char *prefix); -int cmd_update_ref(int argc, const char **argv, const char *prefix); -int cmd_update_server_info(int argc, const char **argv, const char *prefix); -int cmd_upload_archive(int argc, const char **argv, const char *prefix); -int cmd_upload_archive_writer(int argc, const char **argv, const char *prefix); -int cmd_upload_pack(int argc, const char **argv, const char *prefix); -int cmd_var(int argc, const char **argv, const char *prefix); -int cmd_verify_commit(int argc, const char **argv, const char *prefix); -int cmd_verify_tag(int argc, const char **argv, const char *prefix); -int cmd_version(int argc, const char **argv, const char *prefix); -int cmd_whatchanged(int argc, const char **argv, const char *prefix); -int cmd_worktree(int argc, const char **argv, const char *prefix); -int cmd_write_tree(int argc, const char **argv, const char *prefix); -int cmd_verify_pack(int argc, const char **argv, const char *prefix); -int cmd_show_ref(int argc, const char **argv, const char *prefix); -int cmd_pack_refs(int argc, const char **argv, const char *prefix); -int cmd_replace(int argc, const char **argv, const char *prefix); +int cmd_add(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_am(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_annotate(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_apply(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_archive(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_bisect(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_blame(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_branch(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_bugreport(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_bundle(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_cat_file(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_checkout(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_checkout__worker(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_checkout_index(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_check_attr(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_check_ignore(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_check_mailmap(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_check_ref_format(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_cherry(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_cherry_pick(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_clone(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_clean(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_column(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_commit(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_commit_graph(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_commit_tree(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_config(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_count_objects(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_credential(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_credential_cache(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_credential_store(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_describe(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_diagnose(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_diff_files(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_diff_index(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_diff(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_diff_tree(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_difftool(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_env__helper(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_fast_export(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_fast_import(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_fetch(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_fetch_pack(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_for_each_ref(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_for_each_repo(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_format_patch(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_fsck(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_gc(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_grep(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_hash_object(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_help(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_hook(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_index_pack(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_init_db(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_interpret_trailers(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_log_reflog(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_log(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_ls_files(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_ls_tree(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_ls_remote(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_mailinfo(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_mailsplit(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_maintenance(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_merge(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_merge_base(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_merge_index(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_merge_ours(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_merge_file(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_merge_recursive(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_merge_tree(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_mktag(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_mktree(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_multi_pack_index(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_mv(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_name_rev(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_notes(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_pack_objects(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_pack_redundant(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_patch_id(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_prune(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_prune_packed(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_pull(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_push(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_range_diff(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_read_tree(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_rebase(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_rebase__interactive(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_receive_pack(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_reflog(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_refs(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_remote(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_remote_ext(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_remote_fd(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_repack(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_replay(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_rerere(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_reset(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_restore(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_rev_list(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_rev_parse(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_revert(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_rm(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_send_pack(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_shortlog(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_show(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_show_branch(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_show_index(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_sparse_checkout(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_status(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_stash(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_stripspace(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_submodule__helper(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_switch(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_symbolic_ref(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_tag(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_unpack_file(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_unpack_objects(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_update_index(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_update_ref(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_update_server_info(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_upload_archive(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_upload_archive_writer(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_upload_pack(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_var(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_verify_commit(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_verify_tag(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_version(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_whatchanged(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_worktree(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_write_tree(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_verify_pack(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_show_ref(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_pack_refs(int argc, const char **argv, const char *prefix, struct repository *repo); +int cmd_replace(int argc, const char **argv, const char *prefix, struct repository *repo); #endif diff --git a/builtin/add.c b/builtin/add.c index 40b61ef90d9..3b9bc93ed9a 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -358,7 +358,7 @@ static int add_files(struct dir_struct *dir, int flags) return exit_status; } -int cmd_add(int argc, const char **argv, const char *prefix) +int cmd_add(int argc, const char **argv, const char *prefix, struct repository *repository UNUSED) { int exit_status = 0; struct pathspec pathspec; diff --git a/builtin/am.c b/builtin/am.c index d8875ad4022..830c295314b 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -2298,7 +2298,7 @@ static int parse_opt_show_current_patch(const struct option *opt, const char *ar return 0; } -int cmd_am(int argc, const char **argv, const char *prefix) +int cmd_am(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct am_state state; int binary = -1; diff --git a/builtin/annotate.c b/builtin/annotate.c index 58ff977a231..3878b1994d8 100644 --- a/builtin/annotate.c +++ b/builtin/annotate.c @@ -7,7 +7,7 @@ #include "builtin.h" #include "strvec.h" -int cmd_annotate(int argc, const char **argv, const char *prefix) +int cmd_annotate(int argc, const char **argv, const char *prefix, struct repository *repo) { struct strvec args = STRVEC_INIT; int i; @@ -18,5 +18,5 @@ int cmd_annotate(int argc, const char **argv, const char *prefix) strvec_push(&args, argv[i]); } - return cmd_blame(args.nr, args.v, prefix); + return cmd_blame(args.nr, args.v, prefix, repo); } diff --git a/builtin/apply.c b/builtin/apply.c index d623c52f78f..923ce992bdd 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -9,7 +9,7 @@ static const char * const apply_usage[] = { NULL }; -int cmd_apply(int argc, const char **argv, const char *prefix) +int cmd_apply(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int force_apply = 0; int options = 0; diff --git a/builtin/archive.c b/builtin/archive.c index b50981504f3..21e5e3b877b 100644 --- a/builtin/archive.c +++ b/builtin/archive.c @@ -76,7 +76,7 @@ static int run_remote_archiver(int argc, const char **argv, PARSE_OPT_KEEP_UNKNOWN_OPT | \ PARSE_OPT_NO_INTERNAL_HELP ) -int cmd_archive(int argc, const char **argv, const char *prefix) +int cmd_archive(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { const char *exec = "git-upload-archive"; char *output = NULL; diff --git a/builtin/bisect.c b/builtin/bisect.c index 453a6cccd70..8cf6167df61 100644 --- a/builtin/bisect.c +++ b/builtin/bisect.c @@ -1411,7 +1411,7 @@ static int cmd_bisect__run(int argc, const char **argv, const char *prefix UNUSE return res; } -int cmd_bisect(int argc, const char **argv, const char *prefix) +int cmd_bisect(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int res = 0; parse_opt_subcommand_fn *fn = NULL; diff --git a/builtin/blame.c b/builtin/blame.c index 35e975fb132..522f564d6b0 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -864,7 +864,7 @@ static void build_ignorelist(struct blame_scoreboard *sb, } } -int cmd_blame(int argc, const char **argv, const char *prefix) +int cmd_blame(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct rev_info revs; char *path = NULL; diff --git a/builtin/branch.c b/builtin/branch.c index 3f870741bfd..e20420059a2 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -704,7 +704,7 @@ static int edit_branch_description(const char *branch_name) return 0; } -int cmd_branch(int argc, const char **argv, const char *prefix) +int cmd_branch(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { /* possible actions */ int delete = 0, rename = 0, copy = 0, list = 0, diff --git a/builtin/bugreport.c b/builtin/bugreport.c index bdfed3d8f18..5269f073d59 100644 --- a/builtin/bugreport.c +++ b/builtin/bugreport.c @@ -98,7 +98,7 @@ static void get_header(struct strbuf *buf, const char *title) strbuf_addf(buf, "\n\n[%s]\n", title); } -int cmd_bugreport(int argc, const char **argv, const char *prefix) +int cmd_bugreport(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct strbuf buffer = STRBUF_INIT; struct strbuf report_path = STRBUF_INIT; diff --git a/builtin/bundle.c b/builtin/bundle.c index 86d0ed7049c..e26c1f7d4a7 100644 --- a/builtin/bundle.c +++ b/builtin/bundle.c @@ -226,7 +226,7 @@ cleanup: return ret; } -int cmd_bundle(int argc, const char **argv, const char *prefix) +int cmd_bundle(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { parse_opt_subcommand_fn *fn = NULL; struct option options[] = { diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 18fe58d6b8b..6e6f134eab1 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -191,7 +191,7 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name, const char *ls_args[3] = { NULL }; ls_args[0] = "ls-tree"; ls_args[1] = obj_name; - ret = cmd_ls_tree(2, ls_args, NULL); + ret = cmd_ls_tree(2, ls_args, NULL, the_repository); goto cleanup; } @@ -923,7 +923,7 @@ static int batch_option_callback(const struct option *opt, return 0; } -int cmd_cat_file(int argc, const char **argv, const char *prefix) +int cmd_cat_file(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int opt = 0; int opt_cw = 0; diff --git a/builtin/check-attr.c b/builtin/check-attr.c index 93768107100..0f180350bec 100644 --- a/builtin/check-attr.c +++ b/builtin/check-attr.c @@ -107,7 +107,7 @@ static NORETURN void error_with_usage(const char *msg) usage_with_options(check_attr_usage, check_attr_options); } -int cmd_check_attr(int argc, const char **argv, const char *prefix) +int cmd_check_attr(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct attr_check *check; struct object_id initialized_oid; diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c index 2bda6a1d462..4067127c8b4 100644 --- a/builtin/check-ignore.c +++ b/builtin/check-ignore.c @@ -151,7 +151,7 @@ static int check_ignore_stdin_paths(struct dir_struct *dir, const char *prefix) return num_ignored; } -int cmd_check_ignore(int argc, const char **argv, const char *prefix) +int cmd_check_ignore(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int num_ignored; struct dir_struct dir = DIR_INIT; diff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c index b8a05b8e07b..07ab8fa9b3c 100644 --- a/builtin/check-mailmap.c +++ b/builtin/check-mailmap.c @@ -40,7 +40,7 @@ static void check_mailmap(struct string_list *mailmap, const char *contact) printf("<%.*s>\n", (int)maillen, mail); } -int cmd_check_mailmap(int argc, const char **argv, const char *prefix) +int cmd_check_mailmap(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int i; struct string_list mailmap = STRING_LIST_INIT_NODUP; diff --git a/builtin/check-ref-format.c b/builtin/check-ref-format.c index 5eb6bdc3f69..594a5465d4d 100644 --- a/builtin/check-ref-format.c +++ b/builtin/check-ref-format.c @@ -51,7 +51,7 @@ static int check_ref_format_branch(const char *arg) return 0; } -int cmd_check_ref_format(int argc, const char **argv, const char *prefix) +int cmd_check_ref_format(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int i; int normalize = 0; diff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c index 6b62b5375bd..61758a11d5d 100644 --- a/builtin/checkout--worker.c +++ b/builtin/checkout--worker.c @@ -113,7 +113,7 @@ static const char * const checkout_worker_usage[] = { NULL }; -int cmd_checkout__worker(int argc, const char **argv, const char *prefix) +int cmd_checkout__worker(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct checkout state = CHECKOUT_INIT; struct option checkout_worker_options[] = { diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c index 29e744d11be..dcf58a4fe13 100644 --- a/builtin/checkout-index.c +++ b/builtin/checkout-index.c @@ -208,7 +208,7 @@ static int option_parse_stage(const struct option *opt, return 0; } -int cmd_checkout_index(int argc, const char **argv, const char *prefix) +int cmd_checkout_index(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int i; struct lock_file lock_file = LOCK_INIT; diff --git a/builtin/checkout.c b/builtin/checkout.c index 4cfe6fab505..c43bba082f5 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -1953,7 +1953,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix, return ret; } -int cmd_checkout(int argc, const char **argv, const char *prefix) +int cmd_checkout(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct checkout_opts opts = CHECKOUT_OPTS_INIT; struct option *options; @@ -2000,7 +2000,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix) checkout_usage); } -int cmd_switch(int argc, const char **argv, const char *prefix) +int cmd_switch(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct checkout_opts opts = CHECKOUT_OPTS_INIT; struct option *options = NULL; @@ -2036,7 +2036,7 @@ int cmd_switch(int argc, const char **argv, const char *prefix) switch_branch_usage); } -int cmd_restore(int argc, const char **argv, const char *prefix) +int cmd_restore(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct checkout_opts opts = CHECKOUT_OPTS_INIT; struct option *options; diff --git a/builtin/clean.c b/builtin/clean.c index ded5a91534c..d4e00f4f3af 100644 --- a/builtin/clean.c +++ b/builtin/clean.c @@ -915,7 +915,7 @@ static void correct_untracked_entries(struct dir_struct *dir) dir->nr = dst; } -int cmd_clean(int argc, const char **argv, const char *prefix) +int cmd_clean(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int i, res; int dry_run = 0, remove_directories = 0, quiet = 0, ignored = 0; diff --git a/builtin/clone.c b/builtin/clone.c index 269b6e18a4e..fb820861cd9 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -956,7 +956,7 @@ static int path_exists(const char *path) return !stat(path, &sb); } -int cmd_clone(int argc, const char **argv, const char *prefix) +int cmd_clone(int argc, const char **argv, const char *prefix, struct repository *repository UNUSED) { int is_bundle = 0, is_local; int reject_shallow = 0; diff --git a/builtin/column.c b/builtin/column.c index 10ff7e01668..ca2b522284e 100644 --- a/builtin/column.c +++ b/builtin/column.c @@ -18,7 +18,7 @@ static int column_config(const char *var, const char *value, return git_column_config(var, value, cb, &colopts); } -int cmd_column(int argc, const char **argv, const char *prefix) +int cmd_column(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct string_list list = STRING_LIST_INIT_DUP; struct strbuf sb = STRBUF_INIT; diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c index 7102ee90a00..67e27ef0cd7 100644 --- a/builtin/commit-graph.c +++ b/builtin/commit-graph.c @@ -331,7 +331,7 @@ cleanup: return result; } -int cmd_commit_graph(int argc, const char **argv, const char *prefix) +int cmd_commit_graph(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { parse_opt_subcommand_fn *fn = NULL; struct option builtin_commit_graph_options[] = { diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c index 84bb4502229..42f88d007ff 100644 --- a/builtin/commit-tree.c +++ b/builtin/commit-tree.c @@ -90,7 +90,7 @@ static int parse_file_arg_callback(const struct option *opt, return 0; } -int cmd_commit_tree(int argc, const char **argv, const char *prefix) +int cmd_commit_tree(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { static struct strbuf buffer = STRBUF_INIT; struct commit_list *parents = NULL; diff --git a/builtin/commit.c b/builtin/commit.c index b2033c48877..27c807cde08 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1502,7 +1502,7 @@ static int git_status_config(const char *k, const char *v, return git_diff_ui_config(k, v, ctx, NULL); } -int cmd_status(int argc, const char **argv, const char *prefix) +int cmd_status(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { static int no_renames = -1; static const char *rename_score_arg = (const char *)-1; @@ -1641,7 +1641,7 @@ static int git_commit_config(const char *k, const char *v, return git_status_config(k, v, ctx, s); } -int cmd_commit(int argc, const char **argv, const char *prefix) +int cmd_commit(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { static struct wt_status s; static struct option builtin_commit_options[] = { diff --git a/builtin/config.c b/builtin/config.c index e00d983596b..8604986fa98 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -1392,7 +1392,7 @@ out: return ret; } -int cmd_config(int argc, const char **argv, const char *prefix) +int cmd_config(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { parse_opt_subcommand_fn *subcommand = NULL; struct option subcommand_opts[] = { diff --git a/builtin/count-objects.c b/builtin/count-objects.c index ec6098a149d..74225ff2488 100644 --- a/builtin/count-objects.c +++ b/builtin/count-objects.c @@ -95,7 +95,7 @@ static char const * const count_objects_usage[] = { NULL }; -int cmd_count_objects(int argc, const char **argv, const char *prefix) +int cmd_count_objects(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int human_readable = 0; struct option opts[] = { diff --git a/builtin/credential-cache--daemon.c b/builtin/credential-cache--daemon.c index 4952b225477..0c4d29a0745 100644 --- a/builtin/credential-cache--daemon.c +++ b/builtin/credential-cache--daemon.c @@ -287,7 +287,7 @@ static void init_socket_directory(const char *path) free(path_copy); } -int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix) +int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct tempfile *socket_file; const char *socket_path; @@ -330,7 +330,7 @@ int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix) #else -int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix) +int cmd_credential_cache_daemon(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { const char * const usage[] = { "git credential-cache--daemon [--debug] ", diff --git a/builtin/credential-cache.c b/builtin/credential-cache.c index aaf2f8438b4..7e6e749ed45 100644 --- a/builtin/credential-cache.c +++ b/builtin/credential-cache.c @@ -137,7 +137,7 @@ static void announce_capabilities(void) credential_announce_capabilities(&c, stdout); } -int cmd_credential_cache(int argc, const char **argv, const char *prefix) +int cmd_credential_cache(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { const char *socket_path_arg = NULL; char *socket_path; diff --git a/builtin/credential-store.c b/builtin/credential-store.c index 97968bfa1c2..e79d72d9695 100644 --- a/builtin/credential-store.c +++ b/builtin/credential-store.c @@ -170,7 +170,7 @@ static void lookup_credential(const struct string_list *fns, struct credential * return; /* Found credential */ } -int cmd_credential_store(int argc, const char **argv, const char *prefix) +int cmd_credential_store(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { const char * const usage[] = { "git credential-store [] ", diff --git a/builtin/credential.c b/builtin/credential.c index b72e76dd9a6..9235fbf1977 100644 --- a/builtin/credential.c +++ b/builtin/credential.c @@ -6,7 +6,7 @@ static const char usage_msg[] = "git credential (fill|approve|reject)"; -int cmd_credential(int argc, const char **argv, const char *prefix UNUSED) +int cmd_credential(int argc, const char **argv, const char *prefix UNUSED, struct repository *repo UNUSED) { const char *op; struct credential c = CREDENTIAL_INIT; diff --git a/builtin/describe.c b/builtin/describe.c index b43093c099f..32ab17de651 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -571,7 +571,7 @@ static int option_parse_exact_match(const struct option *opt, const char *arg, return 0; } -int cmd_describe(int argc, const char **argv, const char *prefix) +int cmd_describe(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED ) { int contains = 0; struct option options[] = { @@ -650,7 +650,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix) argv_copy[i] = args.v[i]; argv_copy[args.nr] = NULL; - ret = cmd_name_rev(args.nr, argv_copy, prefix); + ret = cmd_name_rev(args.nr, argv_copy, prefix, the_repository); strvec_clear(&args); free(argv_copy); diff --git a/builtin/diagnose.c b/builtin/diagnose.c index 4857a4395ba..8d13df9b991 100644 --- a/builtin/diagnose.c +++ b/builtin/diagnose.c @@ -11,7 +11,7 @@ static const char * const diagnose_usage[] = { NULL }; -int cmd_diagnose(int argc, const char **argv, const char *prefix) +int cmd_diagnose(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct strbuf zip_path = STRBUF_INIT; time_t now = time(NULL); diff --git a/builtin/diff-files.c b/builtin/diff-files.c index 018011f29ea..93a3df766ad 100644 --- a/builtin/diff-files.c +++ b/builtin/diff-files.c @@ -17,7 +17,7 @@ static const char diff_files_usage[] = "\n" COMMON_DIFF_OPTIONS_HELP; -int cmd_diff_files(int argc, const char **argv, const char *prefix) +int cmd_diff_files(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct rev_info rev; int result; diff --git a/builtin/diff-index.c b/builtin/diff-index.c index 685b60284fd..645d2fba359 100644 --- a/builtin/diff-index.c +++ b/builtin/diff-index.c @@ -14,7 +14,7 @@ static const char diff_cache_usage[] = "\n" COMMON_DIFF_OPTIONS_HELP; -int cmd_diff_index(int argc, const char **argv, const char *prefix) +int cmd_diff_index(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct rev_info rev; unsigned int option = 0; diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c index b8df1d4b79b..0d17708d2a3 100644 --- a/builtin/diff-tree.c +++ b/builtin/diff-tree.c @@ -108,7 +108,7 @@ static void diff_tree_tweak_rev(struct rev_info *rev) } } -int cmd_diff_tree(int argc, const char **argv, const char *prefix) +int cmd_diff_tree(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { char line[1000]; struct object *tree1, *tree2; diff --git a/builtin/diff.c b/builtin/diff.c index 6eac445579b..ebf71aa5592 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -393,7 +393,7 @@ static void symdiff_release(struct symdiff *sdiff) bitmap_free(sdiff->skip); } -int cmd_diff(int argc, const char **argv, const char *prefix) +int cmd_diff(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int i; struct rev_info rev; diff --git a/builtin/difftool.c b/builtin/difftool.c index dcc68e190c2..94f3bf72a7c 100644 --- a/builtin/difftool.c +++ b/builtin/difftool.c @@ -690,7 +690,7 @@ static int run_file_diff(int prompt, const char *prefix, return run_command(child); } -int cmd_difftool(int argc, const char **argv, const char *prefix) +int cmd_difftool(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int use_gui_tool = -1, dir_diff = 0, prompt = -1, symlinks = 0, tool_help = 0, no_index = 0; diff --git a/builtin/fast-export.c b/builtin/fast-export.c index f253b79322a..37482785b81 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -1180,7 +1180,7 @@ static int parse_opt_anonymize_map(const struct option *opt, return 0; } -int cmd_fast_export(int argc, const char **argv, const char *prefix) +int cmd_fast_export(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct rev_info revs; struct commit *commit; diff --git a/builtin/fast-import.c b/builtin/fast-import.c index 2214c105f17..36b76490e1e 100644 --- a/builtin/fast-import.c +++ b/builtin/fast-import.c @@ -3537,7 +3537,7 @@ static void parse_argv(void) build_mark_map(&sub_marks_from, &sub_marks_to); } -int cmd_fast_import(int argc, const char **argv, const char *prefix) +int cmd_fast_import(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { unsigned int i; diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index af329e8d5cf..fcabd1906d4 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -43,7 +43,7 @@ static void add_sought_entry(struct ref ***sought, int *nr, int *alloc, (*sought)[*nr - 1] = ref; } -int cmd_fetch_pack(int argc, const char **argv, const char *prefix UNUSED) +int cmd_fetch_pack(int argc, const char **argv, const char *prefix UNUSED, struct repository *repo UNUSED) { int i, ret; struct ref *ref = NULL; diff --git a/builtin/fetch.c b/builtin/fetch.c index c297569a473..ccdb409da43 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -2138,7 +2138,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv, return exit_code; } -int cmd_fetch(int argc, const char **argv, const char *prefix) +int cmd_fetch(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct fetch_config config = { .display_format = DISPLAY_FORMAT_FULL, diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c index 957786d1b3a..0a9c2008429 100644 --- a/builtin/fmt-merge-msg.c +++ b/builtin/fmt-merge-msg.c @@ -9,7 +9,7 @@ static const char * const fmt_merge_msg_usage[] = { NULL }; -int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix) +int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { char *inpath = NULL; const char *message = NULL; diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index 5517a4a1c08..70391638a3d 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -16,7 +16,7 @@ static char const * const for_each_ref_usage[] = { NULL }; -int cmd_for_each_ref(int argc, const char **argv, const char *prefix) +int cmd_for_each_ref(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct ref_sorting *sorting; struct string_list sorting_options = STRING_LIST_INIT_DUP; diff --git a/builtin/for-each-repo.c b/builtin/for-each-repo.c index c4fa41fda9f..6b2935ae140 100644 --- a/builtin/for-each-repo.c +++ b/builtin/for-each-repo.c @@ -29,7 +29,7 @@ static int run_command_on_repo(const char *path, int argc, const char ** argv) return run_command(&child); } -int cmd_for_each_repo(int argc, const char **argv, const char *prefix) +int cmd_for_each_repo(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { static const char *config_key = NULL; int keep_going = 0; diff --git a/builtin/fsck.c b/builtin/fsck.c index 60f4e6fad97..2b69c963b2e 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -925,7 +925,7 @@ static struct option fsck_opts[] = { OPT_END(), }; -int cmd_fsck(int argc, const char **argv, const char *prefix) +int cmd_fsck(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int i; struct object_directory *odb; diff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c index 1593713f4cb..93f4a60ca22 100644 --- a/builtin/fsmonitor--daemon.c +++ b/builtin/fsmonitor--daemon.c @@ -1521,7 +1521,7 @@ static int try_to_start_background_daemon(void) } } -int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix) +int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { const char *subcmd; enum fsmonitor_reason reason; @@ -1584,7 +1584,7 @@ int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix) } #else -int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix UNUSED) +int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix UNUSED, struct repository *repo UNUSED) { struct option options[] = { OPT_END() diff --git a/builtin/gc.c b/builtin/gc.c index 427faf1cfe1..462dacb0bdb 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -657,7 +657,7 @@ static void gc_before_repack(struct maintenance_run_opts *opts, } } -int cmd_gc(int argc, const char **argv, const char *prefix) +int cmd_gc(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int aggressive = 0; int quiet = 0; @@ -2890,7 +2890,7 @@ static const char * const builtin_maintenance_usage[] = { NULL, }; -int cmd_maintenance(int argc, const char **argv, const char *prefix) +int cmd_maintenance(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { parse_opt_subcommand_fn *fn = NULL; struct option builtin_maintenance_options[] = { diff --git a/builtin/get-tar-commit-id.c b/builtin/get-tar-commit-id.c index 7195a072edc..627133807b7 100644 --- a/builtin/get-tar-commit-id.c +++ b/builtin/get-tar-commit-id.c @@ -12,7 +12,7 @@ static const char builtin_get_tar_commit_id_usage[] = #define RECORDSIZE (512) #define HEADERSIZE (2 * RECORDSIZE) -int cmd_get_tar_commit_id(int argc, const char **argv UNUSED, const char *prefix) +int cmd_get_tar_commit_id(int argc, const char **argv UNUSED, const char *prefix, struct repository *repo UNUSED) { char buffer[HEADERSIZE]; struct ustar_header *header = (struct ustar_header *)buffer; diff --git a/builtin/grep.c b/builtin/grep.c index dfc3c3e8bd2..98eea1f4dc5 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -888,7 +888,7 @@ static int pattern_callback(const struct option *opt, const char *arg, return 0; } -int cmd_grep(int argc, const char **argv, const char *prefix) +int cmd_grep(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int hit = 0; int cached = 0, untracked = 0, opt_exclude = -1; diff --git a/builtin/hash-object.c b/builtin/hash-object.c index c767414a0cc..59a48345394 100644 --- a/builtin/hash-object.c +++ b/builtin/hash-object.c @@ -84,7 +84,7 @@ static void hash_stdin_paths(const char *type, int no_filters, unsigned flags, strbuf_release(&unquoted); } -int cmd_hash_object(int argc, const char **argv, const char *prefix) +int cmd_hash_object(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { static const char * const hash_object_usage[] = { N_("git hash-object [-t ] [-w] [--path= | --no-filters]\n" diff --git a/builtin/help.c b/builtin/help.c index dc1fbe2b986..4efdccfb7fb 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -631,7 +631,7 @@ static void opt_mode_usage(int argc, const char *opt_mode, no_help_format(opt_mode, fmt); } -int cmd_help(int argc, const char **argv, const char *prefix) +int cmd_help(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int nongit; enum help_format parsed_help_format; diff --git a/builtin/hook.c b/builtin/hook.c index cc37438fdee..2aa6476f8fc 100644 --- a/builtin/hook.c +++ b/builtin/hook.c @@ -66,7 +66,7 @@ usage: usage_with_options(builtin_hook_run_usage, run_options); } -int cmd_hook(int argc, const char **argv, const char *prefix) +int cmd_hook(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { parse_opt_subcommand_fn *fn = NULL; struct option builtin_hook_options[] = { diff --git a/builtin/index-pack.c b/builtin/index-pack.c index fd968d673d2..64754da036d 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -1718,7 +1718,7 @@ static void show_pack_info(int stat_only) free(chain_histogram); } -int cmd_index_pack(int argc, const char **argv, const char *prefix) +int cmd_index_pack(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int i, fix_thin_pack = 0, verify = 0, stat_only = 0, rev_index; const char *curr_index; diff --git a/builtin/init-db.c b/builtin/init-db.c index 582dcf20f86..fe16d91aaba 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -70,7 +70,7 @@ static const char *const init_db_usage[] = { * On the other hand, it might just make lookup slower and messier. You * be the judge. The default case is to have one DB per managed directory. */ -int cmd_init_db(int argc, const char **argv, const char *prefix) +int cmd_init_db(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { const char *git_dir; const char *real_git_dir = NULL; diff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c index 1d969494cf5..79da472e8eb 100644 --- a/builtin/interpret-trailers.c +++ b/builtin/interpret-trailers.c @@ -188,7 +188,7 @@ static void interpret_trailers(const struct process_trailer_options *opts, strbuf_release(&sb); } -int cmd_interpret_trailers(int argc, const char **argv, const char *prefix) +int cmd_interpret_trailers(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct process_trailer_options opts = PROCESS_TRAILER_OPTIONS_INIT; LIST_HEAD(trailers); diff --git a/builtin/log.c b/builtin/log.c index 36769bab3b6..c9018e89e55 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -637,7 +637,7 @@ static int git_log_config(const char *var, const char *value, return git_diff_ui_config(var, value, ctx, cb); } -int cmd_whatchanged(int argc, const char **argv, const char *prefix) +int cmd_whatchanged(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct log_config cfg; struct rev_info rev; @@ -758,7 +758,7 @@ static void show_setup_revisions_tweak(struct rev_info *rev) rev->diffopt.output_format = DIFF_FORMAT_PATCH; } -int cmd_show(int argc, const char **argv, const char *prefix) +int cmd_show(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct log_config cfg; struct rev_info rev; @@ -874,7 +874,7 @@ int cmd_show(int argc, const char **argv, const char *prefix) /* * This is equivalent to "git log -g --abbrev-commit --pretty=oneline" */ -int cmd_log_reflog(int argc, const char **argv, const char *prefix) +int cmd_log_reflog(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct log_config cfg; struct rev_info rev; @@ -916,7 +916,7 @@ static void log_setup_revisions_tweak(struct rev_info *rev) diff_merges_default_to_first_parent(rev); } -int cmd_log(int argc, const char **argv, const char *prefix) +int cmd_log(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct log_config cfg; struct rev_info rev; @@ -1986,7 +1986,7 @@ static void infer_range_diff_ranges(struct strbuf *r1, } } -int cmd_format_patch(int argc, const char **argv, const char *prefix) +int cmd_format_patch(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct format_config cfg; struct commit *commit; @@ -2619,7 +2619,7 @@ static void print_commit(char sign, struct commit *commit, int verbose, } } -int cmd_cherry(int argc, const char **argv, const char *prefix) +int cmd_cherry(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct rev_info revs; struct patch_ids ids; diff --git a/builtin/ls-files.c b/builtin/ls-files.c index 6eeb5cba783..5185f264e8d 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -561,7 +561,7 @@ static int option_parse_exclude_standard(const struct option *opt, return 0; } -int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix) +int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix, struct repository *repo UNUSED) { int require_work_tree = 0, show_tag = 0, i; char *max_prefix; diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c index 0a491595ca8..ce826d32686 100644 --- a/builtin/ls-remote.c +++ b/builtin/ls-remote.c @@ -37,7 +37,7 @@ static int tail_match(const struct strvec *pattern, const char *path) return 0; } -int cmd_ls_remote(int argc, const char **argv, const char *prefix) +int cmd_ls_remote(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { const char *dest = NULL; unsigned flags = 0; diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c index bf372c67d77..f91361ca788 100644 --- a/builtin/ls-tree.c +++ b/builtin/ls-tree.c @@ -329,7 +329,7 @@ static struct ls_tree_cmdmode_to_fmt ls_tree_cmdmode_format[] = { }, }; -int cmd_ls_tree(int argc, const char **argv, const char *prefix) +int cmd_ls_tree(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct object_id oid; struct tree *tree; diff --git a/builtin/mailinfo.c b/builtin/mailinfo.c index 53a22645da5..d883ccf4590 100644 --- a/builtin/mailinfo.c +++ b/builtin/mailinfo.c @@ -48,7 +48,7 @@ static int parse_opt_quoted_cr(const struct option *opt, const char *arg, int un return 0; } -int cmd_mailinfo(int argc, const char **argv, const char *prefix) +int cmd_mailinfo(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct metainfo_charset meta_charset; struct mailinfo mi; diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c index fe6dbc5d053..585b81834c2 100644 --- a/builtin/mailsplit.c +++ b/builtin/mailsplit.c @@ -269,7 +269,7 @@ out: return ret; } -int cmd_mailsplit(int argc, const char **argv, const char *prefix) +int cmd_mailsplit(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int nr = 0, nr_prec = 4, num = 0; int allow_bare = 0; diff --git a/builtin/merge-base.c b/builtin/merge-base.c index 5a8e7295029..d5aef8b32c0 100644 --- a/builtin/merge-base.c +++ b/builtin/merge-base.c @@ -143,7 +143,7 @@ static int handle_fork_point(int argc, const char **argv) return 0; } -int cmd_merge_base(int argc, const char **argv, const char *prefix) +int cmd_merge_base(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct commit **rev; int rev_nr = 0; diff --git a/builtin/merge-file.c b/builtin/merge-file.c index 1f987334a31..a538edf2a46 100644 --- a/builtin/merge-file.c +++ b/builtin/merge-file.c @@ -53,7 +53,7 @@ static int diff_algorithm_cb(const struct option *opt, return 0; } -int cmd_merge_file(int argc, const char **argv, const char *prefix) +int cmd_merge_file(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { const char *names[3] = { 0 }; mmfile_t mmfs[3] = { 0 }; diff --git a/builtin/merge-index.c b/builtin/merge-index.c index 0fabe3f6bb2..39870e14bfa 100644 --- a/builtin/merge-index.c +++ b/builtin/merge-index.c @@ -73,7 +73,7 @@ static void merge_all(void) } } -int cmd_merge_index(int argc, const char **argv, const char *prefix UNUSED) +int cmd_merge_index(int argc, const char **argv, const char *prefix UNUSED, struct repository *repo UNUSED) { int i, force_file = 0; diff --git a/builtin/merge-ours.c b/builtin/merge-ours.c index 932924e5d0e..391c767e122 100644 --- a/builtin/merge-ours.c +++ b/builtin/merge-ours.c @@ -15,7 +15,7 @@ static const char builtin_merge_ours_usage[] = "git merge-ours ... -- HEAD ..."; -int cmd_merge_ours(int argc, const char **argv, const char *prefix UNUSED) +int cmd_merge_ours(int argc, const char **argv, const char *prefix UNUSED, struct repository *repo UNUSED) { if (argc == 2 && !strcmp(argv[1], "-h")) usage(builtin_merge_ours_usage); diff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c index e951b09805d..cd2b4d9a721 100644 --- a/builtin/merge-recursive.c +++ b/builtin/merge-recursive.c @@ -21,7 +21,7 @@ static char *better_branch_name(const char *branch) return xstrdup(name ? name : branch); } -int cmd_merge_recursive(int argc, const char **argv, const char *prefix UNUSED) +int cmd_merge_recursive(int argc, const char **argv, const char *prefix UNUSED, struct repository *repo UNUSED) { struct object_id bases[21]; unsigned bases_count = 0; diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index 9bca9b5f33c..e69ed337f46 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -526,7 +526,7 @@ static int real_merge(struct merge_tree_options *o, return !result.clean; /* result.clean < 0 handled above */ } -int cmd_merge_tree(int argc, const char **argv, const char *prefix) +int cmd_merge_tree(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct merge_tree_options o = { .show_messages = -1 }; struct strvec xopts = STRVEC_INIT; diff --git a/builtin/merge.c b/builtin/merge.c index 662a49a0e8c..4e817f6e91f 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -1275,7 +1275,7 @@ static int merging_a_throwaway_tag(struct commit *commit) return is_throwaway_tag; } -int cmd_merge(int argc, const char **argv, const char *prefix) +int cmd_merge(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct object_id result_tree, stash, head_oid; struct commit *head_commit; @@ -1347,7 +1347,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix) REF_NO_DEREF); /* Invoke 'git reset --merge' */ - ret = cmd_reset(nargc, nargv, prefix); + ret = cmd_reset(nargc, nargv, prefix, the_repository); if (!is_null_oid(&stash_oid)) { oid_to_hex_r(stash_oid_hex, &stash_oid); @@ -1379,7 +1379,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix) die(_("There is no merge in progress (MERGE_HEAD missing).")); /* Invoke 'git commit' */ - ret = cmd_commit(nargc, nargv, prefix); + ret = cmd_commit(nargc, nargv, prefix, the_repository); goto done; } diff --git a/builtin/mktag.c b/builtin/mktag.c index c6b644219fb..cc3f1b7c5bb 100644 --- a/builtin/mktag.c +++ b/builtin/mktag.c @@ -71,7 +71,7 @@ static int verify_object_in_tag(struct object_id *tagged_oid, int *tagged_type) return ret; } -int cmd_mktag(int argc, const char **argv, const char *prefix) +int cmd_mktag(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { static struct option builtin_mktag_options[] = { OPT_BOOL(0, "strict", &option_strict, diff --git a/builtin/mktree.c b/builtin/mktree.c index 9a22d4e2773..1c43360b50c 100644 --- a/builtin/mktree.c +++ b/builtin/mktree.c @@ -150,7 +150,7 @@ static void mktree_line(char *buf, int nul_term_line, int allow_missing) free(to_free); } -int cmd_mktree(int ac, const char **av, const char *prefix) +int cmd_mktree(int ac, const char **av, const char *prefix, struct repository *repo UNUSED) { struct strbuf sb = STRBUF_INIT; struct object_id oid; diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c index 8805cbbeb3b..91324a5581d 100644 --- a/builtin/multi-pack-index.c +++ b/builtin/multi-pack-index.c @@ -268,7 +268,7 @@ static int cmd_multi_pack_index_repack(int argc, const char **argv, } int cmd_multi_pack_index(int argc, const char **argv, - const char *prefix) + const char *prefix, struct repository *repo UNUSED) { int res; parse_opt_subcommand_fn *fn = NULL; diff --git a/builtin/mv.c b/builtin/mv.c index 6c69033c5f5..3069d1d9ce8 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -178,7 +178,7 @@ static void remove_empty_src_dirs(const char **src_dir, size_t src_dir_nr) strbuf_release(&a_src_dir); } -int cmd_mv(int argc, const char **argv, const char *prefix) +int cmd_mv(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int i, flags, gitmodules_modified = 0; int verbose = 0, show_only = 0, force = 0, ignore_errors = 0, ignore_sparse = 0; diff --git a/builtin/name-rev.c b/builtin/name-rev.c index a468ef84c37..f46f5546629 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -558,7 +558,7 @@ static void name_rev_line(char *p, struct name_ref_data *data) strbuf_release(&buf); } -int cmd_name_rev(int argc, const char **argv, const char *prefix) +int cmd_name_rev(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct mem_pool string_pool; struct object_array revs = OBJECT_ARRAY_INIT; diff --git a/builtin/notes.c b/builtin/notes.c index 04f9dfb7fbd..2f8e896283a 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -1096,7 +1096,7 @@ static int get_ref(int argc, const char **argv, const char *prefix) return 0; } -int cmd_notes(int argc, const char **argv, const char *prefix) +int cmd_notes(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { const char *override_notes_ref = NULL; parse_opt_subcommand_fn *fn = NULL; diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 778be80f564..702d10ea86b 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -4284,7 +4284,7 @@ static int option_parse_cruft_expiration(const struct option *opt UNUSED, return 0; } -int cmd_pack_objects(int argc, const char **argv, const char *prefix) +int cmd_pack_objects(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int use_internal_rev_list = 0; int shallow = 0; diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c index dd9bf35f5b8..42d367c95d1 100644 --- a/builtin/pack-redundant.c +++ b/builtin/pack-redundant.c @@ -561,7 +561,7 @@ static void load_all(void) } } -int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED) +int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED, struct repository *repo UNUSED) { int i; int i_still_use_this = 0; diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c index db408256663..c61e876216a 100644 --- a/builtin/pack-refs.c +++ b/builtin/pack-refs.c @@ -11,7 +11,7 @@ static char const * const pack_refs_usage[] = { NULL }; -int cmd_pack_refs(int argc, const char **argv, const char *prefix) +int cmd_pack_refs(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct ref_exclusions excludes = REF_EXCLUSIONS_INIT; struct string_list included_refs = STRING_LIST_INIT_NODUP; diff --git a/builtin/patch-id.c b/builtin/patch-id.c index 35c1179f7e9..4449c44580a 100644 --- a/builtin/patch-id.c +++ b/builtin/patch-id.c @@ -260,7 +260,7 @@ static int git_patch_id_config(const char *var, const char *value, return git_default_config(var, value, ctx, cb); } -int cmd_patch_id(int argc, const char **argv, const char *prefix) +int cmd_patch_id(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { /* if nothing is set, default to unstable */ struct patch_id_opts config = {0, 0}; diff --git a/builtin/prune-packed.c b/builtin/prune-packed.c index ca3578e1588..d22cd632340 100644 --- a/builtin/prune-packed.c +++ b/builtin/prune-packed.c @@ -8,7 +8,7 @@ static const char * const prune_packed_usage[] = { NULL }; -int cmd_prune_packed(int argc, const char **argv, const char *prefix) +int cmd_prune_packed(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int opts = isatty(2) ? PRUNE_PACKED_VERBOSE : 0; const struct option prune_packed_options[] = { diff --git a/builtin/prune.c b/builtin/prune.c index 57fe31467fe..ed532fab0a5 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -147,7 +147,7 @@ static void remove_temporary_files(const char *path) closedir(dir); } -int cmd_prune(int argc, const char **argv, const char *prefix) +int cmd_prune(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct rev_info revs; int exclude_promisor_objects = 0; diff --git a/builtin/pull.c b/builtin/pull.c index 4c54d8196fa..906c02e5a97 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -977,7 +977,7 @@ static void show_advice_pull_non_ff(void) "invocation.\n")); } -int cmd_pull(int argc, const char **argv, const char *prefix) +int cmd_pull(int argc, const char **argv, const char *prefix, struct repository *repository UNUSED) { const char *repo, **refspecs; struct oid_array merge_heads = OID_ARRAY_INIT; diff --git a/builtin/push.c b/builtin/push.c index 7a67398124f..a6b7fcd9538 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -546,7 +546,7 @@ static int git_push_config(const char *k, const char *v, return git_default_config(k, v, ctx, NULL); } -int cmd_push(int argc, const char **argv, const char *prefix) +int cmd_push(int argc, const char **argv, const char *prefix, struct repository *repository UNUSED) { int flags = 0; int tags = 0; diff --git a/builtin/range-diff.c b/builtin/range-diff.c index f02cbac087d..30a5b003bab 100644 --- a/builtin/range-diff.c +++ b/builtin/range-diff.c @@ -13,7 +13,7 @@ N_("git range-diff [] "), NULL }; -int cmd_range_diff(int argc, const char **argv, const char *prefix) +int cmd_range_diff(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct diff_options diffopt = { NULL }; struct strvec other_arg = STRVEC_INIT; diff --git a/builtin/read-tree.c b/builtin/read-tree.c index a8cf8504b8a..89fa0b728d7 100644 --- a/builtin/read-tree.c +++ b/builtin/read-tree.c @@ -108,7 +108,7 @@ static int git_read_tree_config(const char *var, const char *value, return git_default_config(var, value, ctx, cb); } -int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix) +int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix, struct repository *repo UNUSED) { int i, stage = 0; struct object_id oid; diff --git a/builtin/rebase.c b/builtin/rebase.c index a2c96c080e1..20a0a324aff 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -1063,7 +1063,7 @@ static int check_exec_cmd(const char *cmd) return 0; } -int cmd_rebase(int argc, const char **argv, const char *prefix) +int cmd_rebase(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct rebase_options options = REBASE_OPTIONS_INIT; const char *branch_name; diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 3f35140e489..74677ff1a24 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -2480,7 +2480,7 @@ static int delete_only(struct command *commands) return 1; } -int cmd_receive_pack(int argc, const char **argv, const char *prefix) +int cmd_receive_pack(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int advertise_refs = 0; struct command *commands; diff --git a/builtin/reflog.c b/builtin/reflog.c index 0d2ff95c6e7..1eab96aca98 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -244,7 +244,7 @@ static int cmd_reflog_show(int argc, const char **argv, const char *prefix) PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN_OPT); - return cmd_log_reflog(argc, argv, prefix); + return cmd_log_reflog(argc, argv, prefix, the_repository); } static int show_reflog(const char *refname, void *cb_data UNUSED) @@ -447,7 +447,7 @@ static int cmd_reflog_exists(int argc, const char **argv, const char *prefix) * main "reflog" */ -int cmd_reflog(int argc, const char **argv, const char *prefix) +int cmd_reflog(int argc, const char **argv, const char *prefix, struct repository *repository) { parse_opt_subcommand_fn *fn = NULL; struct option options[] = { @@ -466,5 +466,5 @@ int cmd_reflog(int argc, const char **argv, const char *prefix) if (fn) return fn(argc - 1, argv + 1, prefix); else - return cmd_log_reflog(argc, argv, prefix); + return cmd_log_reflog(argc, argv, prefix, repository); } diff --git a/builtin/refs.c b/builtin/refs.c index 131f98be986..355e0abce76 100644 --- a/builtin/refs.c +++ b/builtin/refs.c @@ -90,7 +90,7 @@ static int cmd_refs_verify(int argc, const char **argv, const char *prefix) return ret; } -int cmd_refs(int argc, const char **argv, const char *prefix) +int cmd_refs(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { const char * const refs_usage[] = { REFS_MIGRATE_USAGE, diff --git a/builtin/remote-ext.c b/builtin/remote-ext.c index 282782eccdd..b325dff729d 100644 --- a/builtin/remote-ext.c +++ b/builtin/remote-ext.c @@ -195,7 +195,7 @@ static int command_loop(const char *child) } } -int cmd_remote_ext(int argc, const char **argv, const char *prefix) +int cmd_remote_ext(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { BUG_ON_NON_EMPTY_PREFIX(prefix); diff --git a/builtin/remote-fd.c b/builtin/remote-fd.c index 9020fab9c58..6ec2b45c97d 100644 --- a/builtin/remote-fd.c +++ b/builtin/remote-fd.c @@ -53,7 +53,7 @@ static void command_loop(int input_fd, int output_fd) } } -int cmd_remote_fd(int argc, const char **argv, const char *prefix) +int cmd_remote_fd(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int input_fd = -1; int output_fd = -1; diff --git a/builtin/remote.c b/builtin/remote.c index d1f9292ed2b..d24d4966ccb 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -1754,7 +1754,7 @@ out: return 0; } -int cmd_remote(int argc, const char **argv, const char *prefix) +int cmd_remote(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { parse_opt_subcommand_fn *fn = NULL; struct option options[] = { diff --git a/builtin/repack.c b/builtin/repack.c index 62cfa50c50f..ea06f0b4a0f 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -1116,7 +1116,7 @@ static const char *find_pack_prefix(const char *packdir, const char *packtmp) return pack_prefix; } -int cmd_repack(int argc, const char **argv, const char *prefix) +int cmd_repack(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct child_process cmd = CHILD_PROCESS_INIT; struct string_list_item *item; diff --git a/builtin/replace.c b/builtin/replace.c index 34cc4672bc1..9c6d846c497 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -545,7 +545,7 @@ static int convert_graft_file(int force) return -1; } -int cmd_replace(int argc, const char **argv, const char *prefix) +int cmd_replace(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int force = 0; int raw = 0; diff --git a/builtin/replay.c b/builtin/replay.c index 138198ce9ca..66f417aab78 100644 --- a/builtin/replay.c +++ b/builtin/replay.c @@ -274,7 +274,7 @@ static struct commit *pick_regular_commit(struct commit *pickme, return create_commit(result->tree, pickme, replayed_base); } -int cmd_replay(int argc, const char **argv, const char *prefix) +int cmd_replay(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { const char *advance_name_opt = NULL; char *advance_name = NULL; diff --git a/builtin/rerere.c b/builtin/rerere.c index 81b65ffa39c..7bccf393c8d 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -48,7 +48,7 @@ static int diff_two(const char *file1, const char *label1, return ret; } -int cmd_rerere(int argc, const char **argv, const char *prefix) +int cmd_rerere(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct string_list merge_rr = STRING_LIST_INIT_DUP; int i, autoupdate = -1, flags = 0; diff --git a/builtin/reset.c b/builtin/reset.c index 5f941fb3a29..a8e293b0c57 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -330,7 +330,7 @@ static int git_reset_config(const char *var, const char *value, return git_default_config(var, value, ctx, cb); } -int cmd_reset(int argc, const char **argv, const char *prefix) +int cmd_reset(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int reset_type = NONE, update_ref_status = 0, quiet = 0; int no_refresh = 0; diff --git a/builtin/rev-list.c b/builtin/rev-list.c index 97d077a9943..71bc12ee6b2 100644 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@ -513,7 +513,7 @@ static int try_bitmap_disk_usage(struct rev_info *revs, return 0; } -int cmd_rev_list(int argc, const char **argv, const char *prefix) +int cmd_rev_list(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct rev_info revs; struct rev_list_info info; diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index 4285dc34a7b..ba5bc0facd7 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -688,7 +688,7 @@ static void print_path(const char *path, const char *prefix, enum format_type fo free(cwd); } -int cmd_rev_parse(int argc, const char **argv, const char *prefix) +int cmd_rev_parse(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int i, as_is = 0, verify = 0, quiet = 0, revs_count = 0, type = 0; const struct git_hash_algo *output_algo = NULL; diff --git a/builtin/revert.c b/builtin/revert.c index 7bf2b4e11d6..e6be55a2bd9 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -261,7 +261,7 @@ static int run_sequencer(int argc, const char **argv, const char *prefix, return sequencer_pick_revisions(the_repository, opts); } -int cmd_revert(int argc, const char **argv, const char *prefix) +int cmd_revert(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct replay_opts opts = REPLAY_OPTS_INIT; int res; @@ -275,7 +275,7 @@ int cmd_revert(int argc, const char **argv, const char *prefix) return res; } -int cmd_cherry_pick(int argc, const char **argv, const char *prefix) +int cmd_cherry_pick(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct replay_opts opts = REPLAY_OPTS_INIT; int res; diff --git a/builtin/rm.c b/builtin/rm.c index 0e79cbab62b..4fd94f7e7e8 100644 --- a/builtin/rm.c +++ b/builtin/rm.c @@ -261,7 +261,7 @@ static struct option builtin_rm_options[] = { OPT_END(), }; -int cmd_rm(int argc, const char **argv, const char *prefix) +int cmd_rm(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct lock_file lock_file = LOCK_INIT; int i, ret = 0; diff --git a/builtin/send-pack.c b/builtin/send-pack.c index 17cae6bbbdf..5479cd5731c 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -147,7 +147,7 @@ static int send_pack_config(const char *k, const char *v, return git_default_config(k, v, ctx, cb); } -int cmd_send_pack(int argc, const char **argv, const char *prefix) +int cmd_send_pack(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct refspec rs = REFSPEC_INIT_PUSH; const char *remote_name = NULL; diff --git a/builtin/shortlog.c b/builtin/shortlog.c index b529608c923..c911383026d 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -378,7 +378,7 @@ void shortlog_finish_setup(struct shortlog *log) string_list_sort(&log->trailers); } -int cmd_shortlog(int argc, const char **argv, const char *prefix) +int cmd_shortlog(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct shortlog log = { STRING_LIST_INIT_NODUP }; struct rev_info rev; diff --git a/builtin/show-branch.c b/builtin/show-branch.c index 29237f653d8..800a64fd4c7 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -632,7 +632,7 @@ static int parse_reflog_param(const struct option *opt, const char *arg, return 0; } -int cmd_show_branch(int ac, const char **av, const char *prefix) +int cmd_show_branch(int ac, const char **av, const char *prefix, struct repository *repo UNUSED) { struct commit *rev[MAX_REVS], *commit; char *reflog_msg[MAX_REVS] = {0}; diff --git a/builtin/show-index.c b/builtin/show-index.c index 540dc3dad1c..952ea798fc1 100644 --- a/builtin/show-index.c +++ b/builtin/show-index.c @@ -11,7 +11,7 @@ static const char *const show_index_usage[] = { NULL }; -int cmd_show_index(int argc, const char **argv, const char *prefix) +int cmd_show_index(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int i; unsigned nr; diff --git a/builtin/show-ref.c b/builtin/show-ref.c index f5899ce9ff7..8d908a03949 100644 --- a/builtin/show-ref.c +++ b/builtin/show-ref.c @@ -287,7 +287,7 @@ static int exclude_existing_callback(const struct option *opt, const char *arg, return 0; } -int cmd_show_ref(int argc, const char **argv, const char *prefix) +int cmd_show_ref(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct exclude_existing_options exclude_existing_opts = {0}; struct patterns_options patterns_opts = {0}; diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c index 2604ab04df5..da9d582b12d 100644 --- a/builtin/sparse-checkout.c +++ b/builtin/sparse-checkout.c @@ -1030,7 +1030,7 @@ static int sparse_checkout_check_rules(int argc, const char **argv, const char * return ret; } -int cmd_sparse_checkout(int argc, const char **argv, const char *prefix) +int cmd_sparse_checkout(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { parse_opt_subcommand_fn *fn = NULL; struct option builtin_sparse_checkout_options[] = { diff --git a/builtin/stash.c b/builtin/stash.c index fcfd97972a4..da90d18f16d 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -1871,7 +1871,7 @@ static int save_stash(int argc, const char **argv, const char *prefix) return ret; } -int cmd_stash(int argc, const char **argv, const char *prefix) +int cmd_stash(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { pid_t pid = getpid(); const char *index_file; diff --git a/builtin/stripspace.c b/builtin/stripspace.c index e5626e51266..a83ad2b5f30 100644 --- a/builtin/stripspace.c +++ b/builtin/stripspace.c @@ -29,7 +29,7 @@ enum stripspace_mode { COMMENT_LINES }; -int cmd_stripspace(int argc, const char **argv, const char *prefix) +int cmd_stripspace(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct strbuf buf = STRBUF_INIT; enum stripspace_mode mode = STRIP_DEFAULT; diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 85fb23dee84..1a1fc40e467 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -3528,7 +3528,7 @@ cleanup: return ret; } -int cmd_submodule__helper(int argc, const char **argv, const char *prefix) +int cmd_submodule__helper(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { parse_opt_subcommand_fn *fn = NULL; const char *const usage[] = { diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c index 81abdd170fe..682f3cf3ae4 100644 --- a/builtin/symbolic-ref.c +++ b/builtin/symbolic-ref.c @@ -41,7 +41,7 @@ static int check_symref(const char *HEAD, int quiet, int shorten, int recurse, i return 0; } -int cmd_symbolic_ref(int argc, const char **argv, const char *prefix) +int cmd_symbolic_ref(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int quiet = 0, delete = 0, shorten = 0, recurse = 1, ret = 0; const char *msg = NULL; diff --git a/builtin/tag.c b/builtin/tag.c index a1fb218512c..925e269f0f4 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -457,7 +457,7 @@ static int strbuf_check_tag_ref(struct strbuf *sb, const char *name) return check_refname_format(sb->buf, 0); } -int cmd_tag(int argc, const char **argv, const char *prefix) +int cmd_tag(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct strbuf buf = STRBUF_INIT; struct strbuf ref = STRBUF_INIT; diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c index c129e2bb6cb..366d4743d4c 100644 --- a/builtin/unpack-file.c +++ b/builtin/unpack-file.c @@ -25,7 +25,7 @@ static char *create_temp_file(struct object_id *oid) return path; } -int cmd_unpack_file(int argc, const char **argv, const char *prefix UNUSED) +int cmd_unpack_file(int argc, const char **argv, const char *prefix UNUSED, struct repository *repo UNUSED) { struct object_id oid; diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c index 08fa2a7a743..c6f9456a0ec 100644 --- a/builtin/unpack-objects.c +++ b/builtin/unpack-objects.c @@ -601,7 +601,7 @@ static void unpack_all(void) die("unresolved deltas left after unpacking"); } -int cmd_unpack_objects(int argc, const char **argv, const char *prefix UNUSED) +int cmd_unpack_objects(int argc, const char **argv, const char *prefix UNUSED, struct repository *repo UNUSED) { int i; struct object_id oid; diff --git a/builtin/update-index.c b/builtin/update-index.c index 35a1f957adc..c2974b57661 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -917,7 +917,7 @@ static enum parse_opt_result reupdate_callback( return 0; } -int cmd_update_index(int argc, const char **argv, const char *prefix) +int cmd_update_index(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int newfd, entries, has_errors = 0, nul_term_line = 0; enum uc_mode untracked_cache = UC_UNSPECIFIED; diff --git a/builtin/update-ref.c b/builtin/update-ref.c index 8f31da9a4b7..97f116ed391 100644 --- a/builtin/update-ref.c +++ b/builtin/update-ref.c @@ -713,7 +713,7 @@ static void update_refs_stdin(void) strbuf_release(&input); } -int cmd_update_ref(int argc, const char **argv, const char *prefix) +int cmd_update_ref(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { const char *refname, *oldval; struct object_id oid, oldoid; diff --git a/builtin/update-server-info.c b/builtin/update-server-info.c index 1dc3971edeb..b09527b2865 100644 --- a/builtin/update-server-info.c +++ b/builtin/update-server-info.c @@ -9,7 +9,7 @@ static const char * const update_server_info_usage[] = { NULL }; -int cmd_update_server_info(int argc, const char **argv, const char *prefix) +int cmd_update_server_info(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int force = 0; struct option options[] = { diff --git a/builtin/upload-archive.c b/builtin/upload-archive.c index 1b09e5e1aa3..447fbbb90b5 100644 --- a/builtin/upload-archive.c +++ b/builtin/upload-archive.c @@ -18,7 +18,7 @@ static const char deadchild[] = #define MAX_ARGS (64) -int cmd_upload_archive_writer(int argc, const char **argv, const char *prefix) +int cmd_upload_archive_writer(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct strvec sent_argv = STRVEC_INIT; const char *arg_cmd = "argument "; @@ -76,7 +76,7 @@ static ssize_t process_input(int child_fd, int band) return sz; } -int cmd_upload_archive(int argc, const char **argv, const char *prefix) +int cmd_upload_archive(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { struct child_process writer = CHILD_PROCESS_INIT; diff --git a/builtin/upload-pack.c b/builtin/upload-pack.c index 46d93278d9a..a6fd26d4a7c 100644 --- a/builtin/upload-pack.c +++ b/builtin/upload-pack.c @@ -17,7 +17,7 @@ static const char * const upload_pack_usage[] = { NULL }; -int cmd_upload_pack(int argc, const char **argv, const char *prefix) +int cmd_upload_pack(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { const char *dir; int strict = 0; diff --git a/builtin/var.c b/builtin/var.c index e30ff45be1c..8b07a7a6a09 100644 --- a/builtin/var.c +++ b/builtin/var.c @@ -210,7 +210,7 @@ static int show_config(const char *var, const char *value, return git_default_config(var, value, ctx, cb); } -int cmd_var(int argc, const char **argv, const char *prefix UNUSED) +int cmd_var(int argc, const char **argv, const char *prefix UNUSED, struct repository *repo UNUSED) { const struct git_var *git_var; char *val; diff --git a/builtin/verify-commit.c b/builtin/verify-commit.c index 0d2b9aea2ae..dbf5b315569 100644 --- a/builtin/verify-commit.c +++ b/builtin/verify-commit.c @@ -51,7 +51,7 @@ static int verify_commit(const char *name, unsigned flags) return run_gpg_verify((struct commit *)obj, flags); } -int cmd_verify_commit(int argc, const char **argv, const char *prefix) +int cmd_verify_commit(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int i = 1, verbose = 0, had_error = 0; unsigned flags = 0; diff --git a/builtin/verify-pack.c b/builtin/verify-pack.c index 011dddd2dc3..1d0a789d19a 100644 --- a/builtin/verify-pack.c +++ b/builtin/verify-pack.c @@ -61,7 +61,7 @@ static const char * const verify_pack_usage[] = { NULL }; -int cmd_verify_pack(int argc, const char **argv, const char *prefix) +int cmd_verify_pack(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int err = 0; unsigned int flags = 0; diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c index c731e2f87b4..8e81a9a9e05 100644 --- a/builtin/verify-tag.c +++ b/builtin/verify-tag.c @@ -19,7 +19,7 @@ static const char * const verify_tag_usage[] = { NULL }; -int cmd_verify_tag(int argc, const char **argv, const char *prefix) +int cmd_verify_tag(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { int i = 1, verbose = 0, had_error = 0; unsigned flags = 0; diff --git a/builtin/worktree.c b/builtin/worktree.c index 41e7f6a3271..4c2b9e19217 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -1392,7 +1392,7 @@ static int repair(int ac, const char **av, const char *prefix) return rc; } -int cmd_worktree(int ac, const char **av, const char *prefix) +int cmd_worktree(int ac, const char **av, const char *prefix, struct repository *repo UNUSED) { parse_opt_subcommand_fn *fn = NULL; struct option options[] = { diff --git a/builtin/write-tree.c b/builtin/write-tree.c index 8c75b4609b5..91b80e05d3a 100644 --- a/builtin/write-tree.c +++ b/builtin/write-tree.c @@ -19,7 +19,7 @@ static const char * const write_tree_usage[] = { NULL }; -int cmd_write_tree(int argc, const char **argv, const char *cmd_prefix) +int cmd_write_tree(int argc, const char **argv, const char *cmd_prefix, struct repository *repo UNUSED) { int flags = 0, ret; const char *tree_prefix = NULL; diff --git a/git.c b/git.c index 9a618a2740f..0ea6e351dfd 100644 --- a/git.c +++ b/git.c @@ -31,7 +31,7 @@ struct cmd_struct { const char *cmd; - int (*fn)(int, const char **, const char *); + int (*fn)(int, const char **, const char *, struct repository *); unsigned int option; }; @@ -441,7 +441,7 @@ static int handle_alias(int *argcp, const char ***argv) return ret; } -static int run_builtin(struct cmd_struct *p, int argc, const char **argv) +static int run_builtin(struct cmd_struct *p, int argc, const char **argv, struct repository *repo) { int status, help; struct stat st; @@ -479,9 +479,11 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv) trace_argv_printf(argv, "trace: built-in: git"); trace2_cmd_name(p->cmd); - validate_cache_entries(the_repository->index); - status = p->fn(argc, argv, prefix); - validate_cache_entries(the_repository->index); + validate_cache_entries(repo->index); + + status = p->fn(argc, argv, prefix, startup_info->have_repository? repo: NULL) ; + + validate_cache_entries(repo->index); if (status) return status; @@ -736,7 +738,7 @@ static void handle_builtin(int argc, const char **argv) builtin = get_builtin(cmd); if (builtin) - exit(run_builtin(builtin, argc, argv)); + exit(run_builtin(builtin, argc, argv, the_repository)); strvec_clear(&args); } diff --git a/help.c b/help.c index c03863f2265..e7cdfab6432 100644 --- a/help.c +++ b/help.c @@ -16,6 +16,7 @@ #include "parse-options.h" #include "prompt.h" #include "fsmonitor-ipc.h" +#include "repository.h" #ifndef NO_CURL #include "git-curl-compat.h" /* For LIBCURL_VERSION only */ @@ -775,7 +776,7 @@ void get_version_info(struct strbuf *buf, int show_build_options) } } -int cmd_version(int argc, const char **argv, const char *prefix) +int cmd_version(int argc, const char **argv, const char *prefix, struct repository *repository UNUSED) { struct strbuf buf = STRBUF_INIT; int build_options = 0; From patchwork Thu Sep 5 16:57:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Cai X-Patchwork-Id: 13792739 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF3CC1A0722 for ; Thu, 5 Sep 2024 16:57:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725555477; cv=none; b=G1BzbEaBcthQUr0u8uGnWq4icrDYnFWxsDJ4vDDdRvKpwl3azX9MmswWFYu54s/NhkmT6/6oo0sleFJFGf/SgY/wyCrav7U0voqKXsSrsDT4bfhOUddEgSbcEDwAm8hToFiKkB+0/5G9XYITk6xpx3wk2y/8uZG84I2dX0lXQOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725555477; c=relaxed/simple; bh=LocHGDwJGPh1BpRaInBWxaL4x0Y1HjNM92DOhWPGAbQ=; h=Message-Id:In-Reply-To:References:From:Date:Subject:Content-Type: MIME-Version:To:Cc; b=UiF+tseimd+pXh2ncEEJtXORIAq/FRgKpNqdC5hH2oBePXCzgFAYw4GJ/dNH8EgnfRtnTdSk7hP3dUMQEUaAMTWxXs5WRQX+SjwUMb/wVmVVswmpkC7NONCG3B4l3IjCb7oX25juzaN3gIH8DuSaOBwhLbWiAjFnlkcPE1Lx6M4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ecamOmaS; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ecamOmaS" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a7a9cf7d3f3so141423566b.1 for ; Thu, 05 Sep 2024 09:57:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725555473; x=1726160273; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=6PcpTRGDrtbOh6tW4V/ywyrvg7ERlZ+3zWl5cdIWkn8=; b=ecamOmaSfd5c35fxNgCY4TZFZTuUZems8aPDj+93/VqLciKrxW/pK58L3cv29Kz/T8 /GBI3SgJBG7FeDQfNOAFBRbGR/IWXfMkBz6h5K9SBd2794qCBf26NHAHYxnbQCVUaUJU XluDfHyFrJEMbSbrU3LGrwudl51PKcGxwB6nyYEwtLAyf9E0h3gcW0TIGnnsNI2eT5K9 eELApJz0TDGM24lw0eY9VhVXS6n22LpFY5FtJCDRNHdxIborL2utsg/ihnBtv5jafzZN B+d+fsJwFP27LkopNb5kOYW1rvHxhmrINbPX/5Iyw3ZPbf0fUYnOTX7pK4zi1B+gt7v7 PR0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725555473; x=1726160273; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6PcpTRGDrtbOh6tW4V/ywyrvg7ERlZ+3zWl5cdIWkn8=; b=IwKZfDKMCNzodVGK84oaBCQlQ1H2VF+iR+6P4UtwDGeYiAB/zLQWx7q1XerGC/RMSz VLCS45S0D1aYjQQ+TwLW4sKmKeD3MBNN163pYr6vTM/aL9KzlfETl3BDSpvIMaPZLGSl /WAxcr8c0Sfxe4uxGhI0wTRRfhqMft6WBdT9yXfnvtcoyxg7yMNiXMUbifYzlMQRzqzc L59AXg8fHPidGxsJVUBjMRrY3eUoYH/7z8lSgtu+TEMLXht0/TXJKIQkRbj/Lsvmc7ML CnVzqJOvbHB/h3YOWgNqf+h6Cm3bARn9y59jh1DE1jngQ/xZV4/Psyfd08fUvE0juNQ8 QigA== X-Gm-Message-State: AOJu0YwCpjYNXAyYInALAhUx3u5NaAg76dlwcGJ5NMR6ezm8WYQbPxrw e9X3VcnWoE4Ffa7HyMU4924dmrPCYx9mJ22B9amIt3e1cUAcznG2CjFmXw== X-Google-Smtp-Source: AGHT+IFl5a5KL9mvsglEhbacm/uodulmkrFMdrRhIJ7VtU4ZCpRLq5x/uFOps/PrV8r6nsHekYmvqA== X-Received: by 2002:a17:907:f7a7:b0:a7a:9a78:4b5a with SMTP id a640c23a62f3a-a8a3f49d7e4mr529920466b.52.1725555472025; Thu, 05 Sep 2024 09:57:52 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8a623a6e85sm159132066b.167.2024.09.05.09.57.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2024 09:57:51 -0700 (PDT) Message-Id: <17acc1e054c26b67659df17db828b106c005ffea.1725555468.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Thu, 05 Sep 2024 16:57:46 +0000 Subject: [PATCH 2/3] builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: John Cai , John Cai From: John Cai From: John Cai Instead of including USE_THE_REPOSITORY_VARIABLE by default on every builtin, remove it from builtin.h and add it where necessary to individual builtins/*. The next step will be to migrate each builtin from having to use the_repository. Signed-off-by: John Cai --- builtin.h | 8 -------- builtin/add.c | 2 +- builtin/am.c | 1 + builtin/apply.c | 1 + builtin/archive.c | 1 + builtin/bisect.c | 1 + builtin/blame.c | 2 +- builtin/branch.c | 3 ++- builtin/bugreport.c | 1 + builtin/bundle.c | 1 + builtin/cat-file.c | 3 ++- 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 | 2 +- builtin/clone.c | 3 ++- builtin/column.c | 2 ++ builtin/commit-graph.c | 1 + builtin/commit-tree.c | 1 + builtin/commit.c | 3 ++- builtin/config.c | 1 + builtin/count-objects.c | 2 +- builtin/credential-cache--daemon.c | 1 + builtin/credential-store.c | 1 + builtin/credential.c | 2 ++ builtin/describe.c | 1 + builtin/diff-files.c | 1 + builtin/diff-index.c | 1 + builtin/diff-tree.c | 1 + builtin/diff.c | 3 ++- builtin/difftool.c | 3 ++- builtin/fast-export.c | 2 ++ 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 | 2 +- builtin/grep.c | 1 + builtin/hash-object.c | 2 ++ builtin/help.c | 2 ++ builtin/hook.c | 1 + builtin/index-pack.c | 1 + builtin/interpret-trailers.c | 2 +- builtin/log.c | 1 + builtin/ls-files.c | 1 + builtin/ls-remote.c | 1 + builtin/ls-tree.c | 2 ++ builtin/merge-base.c | 1 + builtin/merge-file.c | 1 + builtin/merge-index.c | 1 + builtin/merge-ours.c | 1 + builtin/merge-recursive.c | 1 + builtin/merge-tree.c | 1 + builtin/merge.c | 3 ++- builtin/mktag.c | 1 + builtin/mktree.c | 2 ++ builtin/multi-pack-index.c | 1 + builtin/mv.c | 1 + builtin/name-rev.c | 1 + builtin/notes.c | 2 +- builtin/pack-objects.c | 1 + builtin/pack-redundant.c | 1 + builtin/pack-refs.c | 1 + builtin/patch-id.c | 1 + builtin/prune.c | 1 + builtin/pull.c | 1 + builtin/push.c | 1 + builtin/range-diff.c | 1 + builtin/read-tree.c | 2 +- builtin/rebase.c | 3 ++- builtin/receive-pack.c | 1 + builtin/reflog.c | 1 + builtin/refs.c | 1 + builtin/remote.c | 1 + builtin/repack.c | 1 + builtin/replace.c | 1 + builtin/replay.c | 1 + builtin/rerere.c | 1 + builtin/reset.c | 3 ++- builtin/rev-list.c | 1 + builtin/rev-parse.c | 3 ++- builtin/revert.c | 1 + builtin/rm.c | 2 +- builtin/send-pack.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 | 3 ++- builtin/unpack-file.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-archive.c | 1 + builtin/var.c | 2 ++ builtin/verify-commit.c | 1 + builtin/verify-pack.c | 1 + builtin/verify-tag.c | 2 ++ builtin/worktree.c | 1 + builtin/write-tree.c | 2 +- 113 files changed, 132 insertions(+), 29 deletions(-) diff --git a/builtin.h b/builtin.h index fc6fc8ffed8..f7b166b3348 100644 --- a/builtin.h +++ b/builtin.h @@ -1,14 +1,6 @@ #ifndef BUILTIN_H #define BUILTIN_H -/* - * TODO: Almost all of our builtins access `the_repository` by necessity - * because they do not get passed a pointer to it. We should adapt the function - * signature of those main functions to accept a `struct repository *` and then - * remove the macro here. - */ -#define USE_THE_REPOSITORY_VARIABLE - #include "git-compat-util.h" #include "repository.h" diff --git a/builtin/add.c b/builtin/add.c index 3b9bc93ed9a..dac832df3e7 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -3,7 +3,7 @@ * * Copyright (C) 2006 Linus Torvalds */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "advice.h" #include "config.h" diff --git a/builtin/am.c b/builtin/am.c index 830c295314b..0546aee12ad 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -4,6 +4,7 @@ * Based on git-am.sh by Junio C Hamano. */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" #include "advice.h" diff --git a/builtin/apply.c b/builtin/apply.c index 923ce992bdd..456b1498067 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "gettext.h" #include "repository.h" diff --git a/builtin/archive.c b/builtin/archive.c index 21e5e3b877b..e1743b93ac0 100644 --- a/builtin/archive.c +++ b/builtin/archive.c @@ -2,6 +2,7 @@ * Copyright (c) 2006 Franck Bui-Huu * Copyright (c) 2006 Rene Scharfe */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "archive.h" #include "gettext.h" diff --git a/builtin/bisect.c b/builtin/bisect.c index 8cf6167df61..23af9a3ae4d 100644 --- a/builtin/bisect.c +++ b/builtin/bisect.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "copy.h" #include "environment.h" diff --git a/builtin/blame.c b/builtin/blame.c index 522f564d6b0..2d263074e90 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -4,7 +4,7 @@ * Copyright (c) 2006, 2014 by its authors * See COPYING for licensing conditions */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "color.h" diff --git a/builtin/branch.c b/builtin/branch.c index e20420059a2..8a5424c836f 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -4,8 +4,9 @@ * Copyright (c) 2006 Kristian Høgsberg * Based on git-branch.sh by Junio C Hamano. */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "repository.h" #include "config.h" #include "color.h" #include "editor.h" diff --git a/builtin/bugreport.c b/builtin/bugreport.c index 5269f073d59..428d3a26f80 100644 --- a/builtin/bugreport.c +++ b/builtin/bugreport.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" #include "editor.h" diff --git a/builtin/bundle.c b/builtin/bundle.c index e26c1f7d4a7..f54559a54ea 100644 --- a/builtin/bundle.c +++ b/builtin/bundle.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" #include "gettext.h" diff --git a/builtin/cat-file.c b/builtin/cat-file.c index 6e6f134eab1..34888633e4f 100644 --- a/builtin/cat-file.c +++ b/builtin/cat-file.c @@ -3,8 +3,9 @@ * * Copyright (C) Linus Torvalds, 2005 */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "repository.h" #include "config.h" #include "convert.h" #include "diff.h" diff --git a/builtin/check-attr.c b/builtin/check-attr.c index 0f180350bec..704da2743bf 100644 --- a/builtin/check-attr.c +++ b/builtin/check-attr.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "attr.h" diff --git a/builtin/check-ignore.c b/builtin/check-ignore.c index 4067127c8b4..319676e2b8e 100644 --- a/builtin/check-ignore.c +++ b/builtin/check-ignore.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "dir.h" diff --git a/builtin/check-mailmap.c b/builtin/check-mailmap.c index 07ab8fa9b3c..18733e78fb6 100644 --- a/builtin/check-mailmap.c +++ b/builtin/check-mailmap.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/checkout--worker.c b/builtin/checkout--worker.c index 61758a11d5d..369097aa43e 100644 --- a/builtin/checkout--worker.c +++ b/builtin/checkout--worker.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "entry.h" diff --git a/builtin/checkout-index.c b/builtin/checkout-index.c index dcf58a4fe13..118845bcc25 100644 --- a/builtin/checkout-index.c +++ b/builtin/checkout-index.c @@ -4,6 +4,7 @@ * Copyright (C) 2005 Linus Torvalds * */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" diff --git a/builtin/checkout.c b/builtin/checkout.c index c43bba082f5..74052571026 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "advice.h" #include "branch.h" diff --git a/builtin/clean.c b/builtin/clean.c index d4e00f4f3af..f3eb6a0886e 100644 --- a/builtin/clean.c +++ b/builtin/clean.c @@ -5,7 +5,7 @@ * * Based on git-clean.sh by Pavel Roskin */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" #include "config.h" diff --git a/builtin/clone.c b/builtin/clone.c index fb820861cd9..9772a9723e7 100644 --- a/builtin/clone.c +++ b/builtin/clone.c @@ -7,8 +7,9 @@ * * Clone a repository into a different directory that does not yet exist. */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "repository.h" #include "abspath.h" #include "advice.h" #include "config.h" diff --git a/builtin/column.c b/builtin/column.c index ca2b522284e..e3e95a9ee20 100644 --- a/builtin/column.c +++ b/builtin/column.c @@ -1,3 +1,5 @@ +#define USE_THE_REPOSITORY_VARIABLE + #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c index 67e27ef0cd7..83e566de652 100644 --- a/builtin/commit-graph.c +++ b/builtin/commit-graph.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "commit.h" #include "config.h" diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c index 42f88d007ff..2e7e2ecb203 100644 --- a/builtin/commit-tree.c +++ b/builtin/commit-tree.c @@ -3,6 +3,7 @@ * * Copyright (C) Linus Torvalds, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/commit.c b/builtin/commit.c index 27c807cde08..141c8d85620 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -4,8 +4,9 @@ * Copyright (c) 2007 Kristian Høgsberg * Based on git-commit.sh by Junio C Hamano and Linus Torvalds */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "repository.h" #include "advice.h" #include "config.h" #include "lockfile.h" diff --git a/builtin/config.c b/builtin/config.c index 8604986fa98..69b2e857888 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" #include "config.h" diff --git a/builtin/count-objects.c b/builtin/count-objects.c index 74225ff2488..7d9d7cd94ab 100644 --- a/builtin/count-objects.c +++ b/builtin/count-objects.c @@ -3,7 +3,7 @@ * * Copyright (c) 2006 Junio C Hamano */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "dir.h" diff --git a/builtin/credential-cache--daemon.c b/builtin/credential-cache--daemon.c index 0c4d29a0745..9cda9f30739 100644 --- a/builtin/credential-cache--daemon.c +++ b/builtin/credential-cache--daemon.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" #include "gettext.h" diff --git a/builtin/credential-store.c b/builtin/credential-store.c index e79d72d9695..6dfa66b300e 100644 --- a/builtin/credential-store.c +++ b/builtin/credential-store.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/credential.c b/builtin/credential.c index 9235fbf1977..73510946cac 100644 --- a/builtin/credential.c +++ b/builtin/credential.c @@ -1,3 +1,5 @@ +#define USE_THE_REPOSITORY_VARIABLE + #include "git-compat-util.h" #include "credential.h" #include "builtin.h" diff --git a/builtin/describe.c b/builtin/describe.c index 32ab17de651..d8ea2e8fdf8 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "environment.h" diff --git a/builtin/diff-files.c b/builtin/diff-files.c index 93a3df766ad..b2e3628d9ef 100644 --- a/builtin/diff-files.c +++ b/builtin/diff-files.c @@ -3,6 +3,7 @@ * * Copyright (C) Linus Torvalds, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "diff.h" diff --git a/builtin/diff-index.c b/builtin/diff-index.c index 645d2fba359..15e0dcf60f8 100644 --- a/builtin/diff-index.c +++ b/builtin/diff-index.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "diff.h" diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c index 0d17708d2a3..e01caea94d7 100644 --- a/builtin/diff-tree.c +++ b/builtin/diff-tree.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "diff.h" diff --git a/builtin/diff.c b/builtin/diff.c index ebf71aa5592..bf3b7ab3350 100644 --- a/builtin/diff.c +++ b/builtin/diff.c @@ -3,8 +3,9 @@ * * Copyright (c) 2006 Junio C Hamano */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "repository.h" #include "config.h" #include "ewah/ewok.h" #include "lockfile.h" diff --git a/builtin/difftool.c b/builtin/difftool.c index 94f3bf72a7c..f1a2c7e7e1e 100644 --- a/builtin/difftool.c +++ b/builtin/difftool.c @@ -11,8 +11,9 @@ * * Copyright (C) 2016 Johannes Schindelin */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "repository.h" #include "abspath.h" #include "config.h" #include "copy.h" diff --git a/builtin/fast-export.c b/builtin/fast-export.c index 37482785b81..d2e1a5028d3 100644 --- a/builtin/fast-export.c +++ b/builtin/fast-export.c @@ -3,7 +3,9 @@ * * Copyright (C) 2007 Johannes E. Schindelin */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "repository.h" #include "config.h" #include "gettext.h" #include "hex.h" diff --git a/builtin/fast-import.c b/builtin/fast-import.c index 36b76490e1e..e0df21bf5fe 100644 --- a/builtin/fast-import.c +++ b/builtin/fast-import.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" #include "environment.h" diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c index fcabd1906d4..83b131d5c5d 100644 --- a/builtin/fetch-pack.c +++ b/builtin/fetch-pack.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "gettext.h" #include "hex.h" diff --git a/builtin/fetch.c b/builtin/fetch.c index ccdb409da43..b4bd8d89851 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1,6 +1,7 @@ /* * "git fetch" */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "advice.h" #include "config.h" diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c index 0a9c2008429..af4264159af 100644 --- a/builtin/fmt-merge-msg.c +++ b/builtin/fmt-merge-msg.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "fmt-merge-msg.h" diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index 70391638a3d..aeba8e69408 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "commit.h" #include "config.h" diff --git a/builtin/for-each-repo.c b/builtin/for-each-repo.c index 6b2935ae140..47a97653474 100644 --- a/builtin/for-each-repo.c +++ b/builtin/for-each-repo.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/fsck.c b/builtin/fsck.c index 2b69c963b2e..bc6046c3c73 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "gettext.h" #include "hex.h" diff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c index 93f4a60ca22..1bd7cf41ffd 100644 --- a/builtin/fsmonitor--daemon.c +++ b/builtin/fsmonitor--daemon.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" #include "config.h" diff --git a/builtin/gc.c b/builtin/gc.c index 462dacb0bdb..2cca94afce4 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -9,7 +9,7 @@ * * Copyright (c) 2006 Shawn O. Pearce */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" #include "date.h" diff --git a/builtin/grep.c b/builtin/grep.c index 98eea1f4dc5..b0b149d81bf 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -3,6 +3,7 @@ * * Copyright (c) 2006 Junio C Hamano */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" #include "gettext.h" diff --git a/builtin/hash-object.c b/builtin/hash-object.c index 59a48345394..293fc2ab879 100644 --- a/builtin/hash-object.c +++ b/builtin/hash-object.c @@ -4,7 +4,9 @@ * Copyright (C) Linus Torvalds, 2005 * Copyright (C) Junio C Hamano, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "repository.h" #include "abspath.h" #include "config.h" #include "gettext.h" diff --git a/builtin/help.c b/builtin/help.c index 4efdccfb7fb..557d2b645e6 100644 --- a/builtin/help.c +++ b/builtin/help.c @@ -1,6 +1,8 @@ + /* * Builtin help command */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "exec-cmd.h" diff --git a/builtin/hook.c b/builtin/hook.c index 2aa6476f8fc..1b71eb021c2 100644 --- a/builtin/hook.c +++ b/builtin/hook.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/index-pack.c b/builtin/index-pack.c index 64754da036d..a0acfad823d 100644 --- a/builtin/index-pack.c +++ b/builtin/index-pack.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "delta.h" diff --git a/builtin/interpret-trailers.c b/builtin/interpret-trailers.c index 79da472e8eb..2e05551b4dd 100644 --- a/builtin/interpret-trailers.c +++ b/builtin/interpret-trailers.c @@ -4,7 +4,7 @@ * Copyright (c) 2013, 2014 Christian Couder * */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "gettext.h" #include "parse-options.h" diff --git a/builtin/log.c b/builtin/log.c index c9018e89e55..5353ec02df7 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -4,6 +4,7 @@ * (C) Copyright 2006 Linus Torvalds * 2006 Junio Hamano */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" #include "config.h" diff --git a/builtin/ls-files.c b/builtin/ls-files.c index 5185f264e8d..5496536b0ff 100644 --- a/builtin/ls-files.c +++ b/builtin/ls-files.c @@ -5,6 +5,7 @@ * * Copyright (C) Linus Torvalds, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "repository.h" #include "config.h" diff --git a/builtin/ls-remote.c b/builtin/ls-remote.c index ce826d32686..de282999059 100644 --- a/builtin/ls-remote.c +++ b/builtin/ls-remote.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "gettext.h" #include "hex.h" diff --git a/builtin/ls-tree.c b/builtin/ls-tree.c index f91361ca788..57a9a00c348 100644 --- a/builtin/ls-tree.c +++ b/builtin/ls-tree.c @@ -3,7 +3,9 @@ * * Copyright (C) Linus Torvalds, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "repository.h" #include "config.h" #include "gettext.h" #include "hex.h" diff --git a/builtin/merge-base.c b/builtin/merge-base.c index d5aef8b32c0..b6b28d60df2 100644 --- a/builtin/merge-base.c +++ b/builtin/merge-base.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "commit.h" diff --git a/builtin/merge-file.c b/builtin/merge-file.c index a538edf2a46..a5a6d821f20 100644 --- a/builtin/merge-file.c +++ b/builtin/merge-file.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" #include "diff.h" diff --git a/builtin/merge-index.c b/builtin/merge-index.c index 39870e14bfa..7ca6af69539 100644 --- a/builtin/merge-index.c +++ b/builtin/merge-index.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "hex.h" #include "read-cache-ll.h" diff --git a/builtin/merge-ours.c b/builtin/merge-ours.c index 391c767e122..258d5560a17 100644 --- a/builtin/merge-ours.c +++ b/builtin/merge-ours.c @@ -7,6 +7,7 @@ * * Pretend we resolved the heads, but declare our tree trumps everybody else. */ +#define USE_THE_REPOSITORY_VARIABLE #include "git-compat-util.h" #include "builtin.h" #include "diff.h" diff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c index cd2b4d9a721..c7ec78b0d66 100644 --- a/builtin/merge-recursive.c +++ b/builtin/merge-recursive.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "advice.h" #include "gettext.h" diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index e69ed337f46..f247480b434 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "tree-walk.h" #include "xdiff-interface.h" diff --git a/builtin/merge.c b/builtin/merge.c index 4e817f6e91f..6427b7c4a8b 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -5,8 +5,9 @@ * * Based on git-merge.sh by Junio C Hamano. */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "repository.h" #include "abspath.h" #include "advice.h" #include "config.h" diff --git a/builtin/mktag.c b/builtin/mktag.c index cc3f1b7c5bb..d4bcebb0abf 100644 --- a/builtin/mktag.c +++ b/builtin/mktag.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "gettext.h" #include "hex.h" diff --git a/builtin/mktree.c b/builtin/mktree.c index 1c43360b50c..f52015a5e81 100644 --- a/builtin/mktree.c +++ b/builtin/mktree.c @@ -3,7 +3,9 @@ * * Copyright (c) Junio C Hamano, 2006, 2009 */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "repository.h" #include "gettext.h" #include "hex.h" #include "quote.h" diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c index 91324a5581d..86f974bc6ae 100644 --- a/builtin/multi-pack-index.c +++ b/builtin/multi-pack-index.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" #include "config.h" diff --git a/builtin/mv.c b/builtin/mv.c index 3069d1d9ce8..1123c3d5f1a 100644 --- a/builtin/mv.c +++ b/builtin/mv.c @@ -3,6 +3,7 @@ * * Copyright (C) 2006 Johannes Schindelin */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" diff --git a/builtin/name-rev.c b/builtin/name-rev.c index f46f5546629..8bccc3ebf59 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "environment.h" #include "gettext.h" diff --git a/builtin/notes.c b/builtin/notes.c index 2f8e896283a..9b894ab85f3 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -6,7 +6,7 @@ * Based on git-notes.sh by Johannes Schindelin, * and builtin/tag.c by Kristian Høgsberg and Carlos Rica. */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "editor.h" diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 702d10ea86b..cf255e537d0 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "environment.h" #include "gettext.h" diff --git a/builtin/pack-redundant.c b/builtin/pack-redundant.c index 42d367c95d1..690dbe233f9 100644 --- a/builtin/pack-redundant.c +++ b/builtin/pack-redundant.c @@ -5,6 +5,7 @@ * This file is licensed under the GPL v2. * */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "gettext.h" diff --git a/builtin/pack-refs.c b/builtin/pack-refs.c index c61e876216a..ea155d4f076 100644 --- a/builtin/pack-refs.c +++ b/builtin/pack-refs.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/patch-id.c b/builtin/patch-id.c index 4449c44580a..7853f052ce1 100644 --- a/builtin/patch-id.c +++ b/builtin/patch-id.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "diff.h" diff --git a/builtin/prune.c b/builtin/prune.c index ed532fab0a5..289344efdb8 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "commit.h" #include "diff.h" diff --git a/builtin/pull.c b/builtin/pull.c index 906c02e5a97..60ac523e4f4 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -6,6 +6,7 @@ * Fetch one or more remote refs and merge it/them into the current HEAD. */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "advice.h" #include "config.h" diff --git a/builtin/push.c b/builtin/push.c index a6b7fcd9538..5d5e4899bb8 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -1,6 +1,7 @@ /* * "git push" */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "advice.h" #include "branch.h" diff --git a/builtin/range-diff.c b/builtin/range-diff.c index 30a5b003bab..82a44684805 100644 --- a/builtin/range-diff.c +++ b/builtin/range-diff.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "gettext.h" #include "object-name.h" diff --git a/builtin/read-tree.c b/builtin/read-tree.c index 89fa0b728d7..b08627980da 100644 --- a/builtin/read-tree.c +++ b/builtin/read-tree.c @@ -3,7 +3,7 @@ * * Copyright (C) Linus Torvalds, 2005 */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/rebase.c b/builtin/rebase.c index 20a0a324aff..232b1fecffd 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -3,8 +3,9 @@ * * Copyright (c) 2018 Pratik Karki */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "repository.h" #include "abspath.h" #include "environment.h" #include "gettext.h" diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index 74677ff1a24..db23fff7dac 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" #include "repository.h" diff --git a/builtin/reflog.c b/builtin/reflog.c index 1eab96aca98..d946d1b2245 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/refs.c b/builtin/refs.c index 355e0abce76..aa020eef7f8 100644 --- a/builtin/refs.c +++ b/builtin/refs.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "fsck.h" diff --git a/builtin/remote.c b/builtin/remote.c index d24d4966ccb..cfd5b891181 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/repack.c b/builtin/repack.c index ea06f0b4a0f..8a7e8e80af1 100644 --- a/builtin/repack.c +++ b/builtin/repack.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "dir.h" diff --git a/builtin/replace.c b/builtin/replace.c index 9c6d846c497..d157c237d57 100644 --- a/builtin/replace.c +++ b/builtin/replace.c @@ -7,6 +7,7 @@ * and Carlos Rica that was itself based on * git-tag.sh and mktag.c by Linus Torvalds. */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" diff --git a/builtin/replay.c b/builtin/replay.c index 66f417aab78..feb2e0192c6 100644 --- a/builtin/replay.c +++ b/builtin/replay.c @@ -4,6 +4,7 @@ #include "git-compat-util.h" +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "environment.h" #include "hex.h" diff --git a/builtin/rerere.c b/builtin/rerere.c index 7bccf393c8d..2a33c57c481 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/reset.c b/builtin/reset.c index a8e293b0c57..956d716c787 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -7,8 +7,9 @@ * * Copyright (c) 2005, 2006 Linus Torvalds and Junio C Hamano */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "repository.h" #include "advice.h" #include "config.h" #include "environment.h" diff --git a/builtin/rev-list.c b/builtin/rev-list.c index 71bc12ee6b2..c90c7e77a11 100644 --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "commit.h" diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index ba5bc0facd7..b84b2ef642a 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -3,8 +3,9 @@ * * Copyright (C) Linus Torvalds, 2005 */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "repository.h" #include "abspath.h" #include "config.h" #include "commit.h" diff --git a/builtin/revert.c b/builtin/revert.c index e6be55a2bd9..e4f71b5fbf0 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "git-compat-util.h" #include "builtin.h" #include "parse-options.h" diff --git a/builtin/rm.c b/builtin/rm.c index 4fd94f7e7e8..6f9638ca079 100644 --- a/builtin/rm.c +++ b/builtin/rm.c @@ -3,7 +3,7 @@ * * Copyright (C) Linus Torvalds 2006 */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "advice.h" #include "config.h" diff --git a/builtin/send-pack.c b/builtin/send-pack.c index 5479cd5731c..02654613ed5 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "hex.h" diff --git a/builtin/shortlog.c b/builtin/shortlog.c index c911383026d..f12f7ad0a53 100644 --- a/builtin/shortlog.c +++ b/builtin/shortlog.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "commit.h" diff --git a/builtin/show-branch.c b/builtin/show-branch.c index 800a64fd4c7..27207e515be 100644 --- a/builtin/show-branch.c +++ b/builtin/show-branch.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "environment.h" diff --git a/builtin/show-index.c b/builtin/show-index.c index 952ea798fc1..b96a28531cd 100644 --- a/builtin/show-index.c +++ b/builtin/show-index.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "gettext.h" #include "hash.h" diff --git a/builtin/show-ref.c b/builtin/show-ref.c index 8d908a03949..47831bf793b 100644 --- a/builtin/show-ref.c +++ b/builtin/show-ref.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c index da9d582b12d..138cece3ac9 100644 --- a/builtin/sparse-checkout.c +++ b/builtin/sparse-checkout.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "dir.h" diff --git a/builtin/stash.c b/builtin/stash.c index da90d18f16d..557bbcc6740 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" #include "config.h" diff --git a/builtin/stripspace.c b/builtin/stripspace.c index a83ad2b5f30..336194a93f4 100644 --- a/builtin/stripspace.c +++ b/builtin/stripspace.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "environment.h" diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 1a1fc40e467..970d0b93022 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" #include "environment.h" diff --git a/builtin/symbolic-ref.c b/builtin/symbolic-ref.c index 682f3cf3ae4..a13dc8b35a2 100644 --- a/builtin/symbolic-ref.c +++ b/builtin/symbolic-ref.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/tag.c b/builtin/tag.c index 925e269f0f4..757fd390b29 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -5,8 +5,9 @@ * Carlos Rica * Based on git-tag.sh and mktag.c by Linus Torvalds. */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "repository.h" #include "advice.h" #include "config.h" #include "editor.h" diff --git a/builtin/unpack-file.c b/builtin/unpack-file.c index 366d4743d4c..f4ba988711c 100644 --- a/builtin/unpack-file.c +++ b/builtin/unpack-file.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "hex.h" diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c index c6f9456a0ec..51075fc0e54 100644 --- a/builtin/unpack-objects.c +++ b/builtin/unpack-objects.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "bulk-checkin.h" #include "config.h" diff --git a/builtin/update-index.c b/builtin/update-index.c index c2974b57661..df1ee60dd2d 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -3,6 +3,7 @@ * * Copyright (C) Linus Torvalds, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "bulk-checkin.h" diff --git a/builtin/update-ref.c b/builtin/update-ref.c index 97f116ed391..ede553a34c8 100644 --- a/builtin/update-ref.c +++ b/builtin/update-ref.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/update-server-info.c b/builtin/update-server-info.c index b09527b2865..ce0784f390b 100644 --- a/builtin/update-server-info.c +++ b/builtin/update-server-info.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/upload-archive.c b/builtin/upload-archive.c index 447fbbb90b5..f7f89771827 100644 --- a/builtin/upload-archive.c +++ b/builtin/upload-archive.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2006 Franck Bui-Huu */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "archive.h" #include "path.h" diff --git a/builtin/var.c b/builtin/var.c index 8b07a7a6a09..07785b3dd1b 100644 --- a/builtin/var.c +++ b/builtin/var.c @@ -3,7 +3,9 @@ * * Copyright (C) Eric Biederman, 2005 */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "repository.h" #include "attr.h" #include "config.h" #include "editor.h" diff --git a/builtin/verify-commit.c b/builtin/verify-commit.c index dbf5b315569..57fa5657add 100644 --- a/builtin/verify-commit.c +++ b/builtin/verify-commit.c @@ -5,6 +5,7 @@ * * Based on git-verify-tag */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/verify-pack.c b/builtin/verify-pack.c index 1d0a789d19a..323466af865 100644 --- a/builtin/verify-pack.c +++ b/builtin/verify-pack.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "gettext.h" diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c index 8e81a9a9e05..818c373cc63 100644 --- a/builtin/verify-tag.c +++ b/builtin/verify-tag.c @@ -5,7 +5,9 @@ * * Based on git-verify-tag.sh */ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" +#include "repository.h" #include "config.h" #include "gettext.h" #include "tag.h" diff --git a/builtin/worktree.c b/builtin/worktree.c index 4c2b9e19217..e4f024cf2db 100644 --- a/builtin/worktree.c +++ b/builtin/worktree.c @@ -1,3 +1,4 @@ +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "abspath.h" #include "advice.h" diff --git a/builtin/write-tree.c b/builtin/write-tree.c index 91b80e05d3a..47a2837cb8e 100644 --- a/builtin/write-tree.c +++ b/builtin/write-tree.c @@ -3,7 +3,7 @@ * * Copyright (C) Linus Torvalds, 2005 */ - +#define USE_THE_REPOSITORY_VARIABLE #include "builtin.h" #include "config.h" #include "environment.h" From patchwork Thu Sep 5 16:57:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai X-Patchwork-Id: 13792738 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E4E21A08D7 for ; Thu, 5 Sep 2024 16:57:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725555477; cv=none; b=gOX2BVhcEbMjcFf0oEwlqDY3KseCXvP2rHfhhwNwMmv0cxfVPXt50bR0Tf2YdRNGyIICs6W9BFBAqSNpgJgXaUZUqe1NA/RlqydyB+Fl/zKTVwGvl4H/1K7Op+1M4gmQufs3C98r8hkRWJBmP5kOfvrpUQewLYr58fq0ZYDytsY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725555477; c=relaxed/simple; bh=lucANiGrlE7Nm4MtYPqt9SK+MVpkDWeWMiq0kssxGsw=; h=Message-Id:In-Reply-To:References:From:Date:Subject:Content-Type: MIME-Version:To:Cc; b=mqvBVQfIY1yPoCzATZxQhCg/yQzypL+1f5HayPJqQdOBh9Yj6X1+jlMVJ84GC3MYZUmEGVJ2lZ67mYPWfwwWrFLRnkd+6RwZXY6vUStQTKljCMCFhDL6dvP6h/5AyLNhfd0EFjUPm/UEzqUGYLYO3w5PyM7R7YhT2BJPNTDAYiU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZA/NVf36; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZA/NVf36" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-5c3cdba33b0so1145965a12.1 for ; Thu, 05 Sep 2024 09:57:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725555473; x=1726160273; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=S9KuSqjpCUZRHaoM/jNNBpXqXkaT0VaOhflZ2gNuWwA=; b=ZA/NVf36DPNKozg9hsr3cIEPQwTV3AaWcscg8qFrenD2Zk2RVfeH53s6LOC+ttv4wQ imFazPahD5PnyDFfdGuWPaVSxJ2+XQN1xJZYPmhYwqt/obTih3a0D87Uek+nuNJxAuL5 k7CEY5MQfgaRtYQh82+D6+GrOhi6yl+ggHEG83Hp2HAOmUkfw6dIhYxJNfqdwrG5OEkn R5cM52GlyRdqYFlcGuE1ikgAIGbpalZEbjyWc7Mqo0zggkqT4hjR0TEoWMHfS8PZt0xC va3lJvRG7Dllz4SQphpKzSETKdr7dFADcABE2KG++ZSlu4Ej2n1B454RBba3s4PFkH1U 6Syg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725555473; x=1726160273; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S9KuSqjpCUZRHaoM/jNNBpXqXkaT0VaOhflZ2gNuWwA=; b=Cu29M/1c4/th/ShwFEv8e8klwe7Lw+szDATjTUi1f4u7wssamBJcKtIgOAY3bfBAxE Xr+To7Pfa7aw6cK8SEBbAkaBYWXcfSG46u9DUe/gOif9H06fOxzV9bJsOU6idQdfK2xa S2etNqyNi8tqKWJX5ExNraeCeby/38XBANIkxeKKEjynJMIlT2owx/IoGeYgnmFs1Jjc XOBMdNSoEi+EcfTRX1P3b3iRf26t07TyFjtoacfRctR9joC4bu9f6k1HyyScIq/MpXHe H7MKL1CF1SYw4uQOhrfiIqXQYJFinhCJC3bXAwoTv57C0WBmSAcHWTMTJ+2686uEe23N 0/xQ== X-Gm-Message-State: AOJu0YxPLPmsTmpr2c/wun+xWdGdJPz+keBr+0UNtn7LM3R8iOsYlo+Z /LjoZ79Ipz/AguCZccNQYfvg3jfI5gEZFYrB9QThtyQ3VeOKTeN+WS+Qdg== X-Google-Smtp-Source: AGHT+IF/iP5DJQ687E6oka8/lF6zQsz/a1jZZFU9qY63FeRlNLLaknykjLCch5FGBoisQALtj/9Zaw== X-Received: by 2002:a50:8d8c:0:b0:5c2:5d34:a481 with SMTP id 4fb4d7f45d1cf-5c2757d6db0mr5088802a12.11.1725555472860; Thu, 05 Sep 2024 09:57:52 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3cc6985aasm1437570a12.70.2024.09.05.09.57.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2024 09:57:52 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Thu, 05 Sep 2024 16:57:47 +0000 Subject: [PATCH 3/3] add: pass in repo variable instead of global the_repository Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: John Cai , John Cai From: John Cai From: John Cai With the repository variable available in the builtin function as an argument, pass this down into helper functions instead of using the global the_repository. Signed-off-by: John Cai --- builtin/add.c | 97 +++++++++++++++++++++++++----------------------- builtin/commit.c | 2 +- commit.h | 3 +- 3 files changed, 53 insertions(+), 49 deletions(-) diff --git a/builtin/add.c b/builtin/add.c index dac832df3e7..a68fd7c8313 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -36,24 +36,27 @@ static int pathspec_file_nul; static int include_sparse; static const char *pathspec_from_file; -static int chmod_pathspec(struct pathspec *pathspec, char flip, int show_only) +static int chmod_pathspec(struct pathspec *pathspec, + char flip, + int show_only, + struct repository *repo) { int i, ret = 0; - for (i = 0; i < the_repository->index->cache_nr; i++) { - struct cache_entry *ce = the_repository->index->cache[i]; + for (i = 0; i < repo->index->cache_nr; i++) { + struct cache_entry *ce = repo->index->cache[i]; int err; if (!include_sparse && (ce_skip_worktree(ce) || - !path_in_sparse_checkout(ce->name, the_repository->index))) + !path_in_sparse_checkout(ce->name, repo->index))) continue; - if (pathspec && !ce_path_match(the_repository->index, ce, pathspec, NULL)) + if (pathspec && !ce_path_match(repo->index, ce, pathspec, NULL)) continue; if (!show_only) - err = chmod_index_entry(the_repository->index, ce, flip); + err = chmod_index_entry(repo->index, ce, flip); else err = S_ISREG(ce->ce_mode) ? 0 : -1; @@ -64,31 +67,31 @@ static int chmod_pathspec(struct pathspec *pathspec, char flip, int show_only) return ret; } -static int renormalize_tracked_files(const struct pathspec *pathspec, int flags) +static int renormalize_tracked_files(const struct pathspec *pathspec, int flags, struct repository *repo) { int i, retval = 0; - for (i = 0; i < the_repository->index->cache_nr; i++) { - struct cache_entry *ce = the_repository->index->cache[i]; + for (i = 0; i < repo->index->cache_nr; i++) { + struct cache_entry *ce = repo->index->cache[i]; if (!include_sparse && (ce_skip_worktree(ce) || - !path_in_sparse_checkout(ce->name, the_repository->index))) + !path_in_sparse_checkout(ce->name, repo->index))) continue; if (ce_stage(ce)) continue; /* do not touch unmerged paths */ if (!S_ISREG(ce->ce_mode) && !S_ISLNK(ce->ce_mode)) continue; /* do not touch non blobs */ - if (pathspec && !ce_path_match(the_repository->index, ce, pathspec, NULL)) + if (pathspec && !ce_path_match(repo->index, ce, pathspec, NULL)) continue; - retval |= add_file_to_index(the_repository->index, ce->name, + retval |= add_file_to_index(repo->index, ce->name, flags | ADD_CACHE_RENORMALIZE); } return retval; } -static char *prune_directory(struct dir_struct *dir, struct pathspec *pathspec, int prefix) +static char *prune_directory(struct dir_struct *dir, struct pathspec *pathspec, int prefix, struct repository *repo) { char *seen; int i; @@ -100,16 +103,16 @@ static char *prune_directory(struct dir_struct *dir, struct pathspec *pathspec, i = dir->nr; while (--i >= 0) { struct dir_entry *entry = *src++; - if (dir_path_match(the_repository->index, entry, pathspec, prefix, seen)) + if (dir_path_match(repo->index, entry, pathspec, prefix, seen)) *dst++ = entry; } dir->nr = dst - dir->entries; - add_pathspec_matches_against_index(pathspec, the_repository->index, seen, + add_pathspec_matches_against_index(pathspec, repo->index, seen, PS_IGNORE_SKIP_WORKTREE); return seen; } -static int refresh(int verbose, const struct pathspec *pathspec) +static int refresh(int verbose, const struct pathspec *pathspec, struct repository *repo) { char *seen; int i, ret = 0; @@ -119,14 +122,14 @@ static int refresh(int verbose, const struct pathspec *pathspec) (verbose ? REFRESH_IN_PORCELAIN : REFRESH_QUIET); seen = xcalloc(pathspec->nr, 1); - refresh_index(the_repository->index, flags, pathspec, seen, + refresh_index(repo->index, flags, pathspec, seen, _("Unstaged changes after refreshing the index:")); for (i = 0; i < pathspec->nr; i++) { if (!seen[i]) { const char *path = pathspec->items[i].original; if (matches_skip_worktree(pathspec, i, &skip_worktree_seen) || - !path_in_sparse_checkout(path, the_repository->index)) { + !path_in_sparse_checkout(path, repo->index)) { string_list_append(&only_match_skip_worktree, pathspec->items[i].original); } else { @@ -147,7 +150,7 @@ static int refresh(int verbose, const struct pathspec *pathspec) return ret; } -int interactive_add(const char **argv, const char *prefix, int patch) +int interactive_add(const char **argv, const char *prefix, int patch, struct repository *repo) { struct pathspec pathspec; int ret; @@ -159,15 +162,15 @@ int interactive_add(const char **argv, const char *prefix, int patch) prefix, argv); if (patch) - ret = !!run_add_p(the_repository, ADD_P_ADD, NULL, &pathspec); + ret = !!run_add_p(repo, ADD_P_ADD, NULL, &pathspec); else - ret = !!run_add_i(the_repository, &pathspec); + ret = !!run_add_i(repo, &pathspec); clear_pathspec(&pathspec); return ret; } -static int edit_patch(int argc, const char **argv, const char *prefix) +static int edit_patch(int argc, const char **argv, const char *prefix, struct repository *repo) { char *file = git_pathdup("ADD_EDIT.patch"); struct child_process child = CHILD_PROCESS_INIT; @@ -177,10 +180,10 @@ static int edit_patch(int argc, const char **argv, const char *prefix) git_config(git_diff_basic_config, NULL); /* no "diff" UI options */ - if (repo_read_index(the_repository) < 0) + if (repo_read_index(repo) < 0) die(_("could not read the index")); - repo_init_revisions(the_repository, &rev, prefix); + repo_init_revisions(repo, &rev, prefix); rev.diffopt.context = 7; argc = setup_revisions(argc, argv, &rev, NULL); @@ -318,7 +321,7 @@ static void check_embedded_repo(const char *path) strbuf_release(&name); } -static int add_files(struct dir_struct *dir, int flags) +static int add_files(struct dir_struct *dir, int flags, struct repository *repo) { int i, exit_status = 0; struct string_list matched_sparse_paths = STRING_LIST_INIT_NODUP; @@ -334,12 +337,12 @@ static int add_files(struct dir_struct *dir, int flags) for (i = 0; i < dir->nr; i++) { if (!include_sparse && - !path_in_sparse_checkout(dir->entries[i]->name, the_repository->index)) { + !path_in_sparse_checkout(dir->entries[i]->name, repo->index)) { string_list_append(&matched_sparse_paths, dir->entries[i]->name); continue; } - if (add_file_to_index(the_repository->index, dir->entries[i]->name, flags)) { + if (add_file_to_index(repo->index, dir->entries[i]->name, flags)) { if (!ignore_add_errors) die(_("adding files failed")); exit_status = 1; @@ -358,7 +361,7 @@ static int add_files(struct dir_struct *dir, int flags) return exit_status; } -int cmd_add(int argc, const char **argv, const char *prefix, struct repository *repository UNUSED) +int cmd_add(int argc, const char **argv, const char *prefix, struct repository *repo) { int exit_status = 0; struct pathspec pathspec; @@ -381,13 +384,13 @@ int cmd_add(int argc, const char **argv, const char *prefix, struct repository * die(_("options '%s' and '%s' cannot be used together"), "--dry-run", "--interactive/--patch"); if (pathspec_from_file) die(_("options '%s' and '%s' cannot be used together"), "--pathspec-from-file", "--interactive/--patch"); - exit(interactive_add(argv + 1, prefix, patch_interactive)); + exit(interactive_add(argv + 1, prefix, patch_interactive, repo)); } if (edit_interactive) { if (pathspec_from_file) die(_("options '%s' and '%s' cannot be used together"), "--pathspec-from-file", "--edit"); - return(edit_patch(argc, argv, prefix)); + return(edit_patch(argc, argv, prefix, repo)); } argc--; argv++; @@ -410,10 +413,10 @@ int cmd_add(int argc, const char **argv, const char *prefix, struct repository * add_new_files = !take_worktree_changes && !refresh_only && !add_renormalize; require_pathspec = !(take_worktree_changes || (0 < addremove_explicit)); - prepare_repo_settings(the_repository); - the_repository->settings.command_requires_full_index = 0; + prepare_repo_settings(repo); + repo->settings.command_requires_full_index = 0; - repo_hold_locked_index(the_repository, &lock_file, LOCK_DIE_ON_ERROR); + repo_hold_locked_index(repo, &lock_file, LOCK_DIE_ON_ERROR); /* * Check the "pathspec '%s' did not match any files" block @@ -454,11 +457,11 @@ int cmd_add(int argc, const char **argv, const char *prefix, struct repository * (!(addremove || take_worktree_changes) ? ADD_CACHE_IGNORE_REMOVAL : 0)); - if (repo_read_index_preload(the_repository, &pathspec, 0) < 0) + if (repo_read_index_preload(repo, &pathspec, 0) < 0) die(_("index file corrupt")); - die_in_unpopulated_submodule(the_repository->index, prefix); - die_path_inside_submodule(the_repository->index, &pathspec); + die_in_unpopulated_submodule(repo->index, prefix); + die_path_inside_submodule(repo->index, &pathspec); if (add_new_files) { int baselen; @@ -470,13 +473,13 @@ int cmd_add(int argc, const char **argv, const char *prefix, struct repository * } /* This picks up the paths that are not tracked */ - baselen = fill_directory(&dir, the_repository->index, &pathspec); + baselen = fill_directory(&dir, repo->index, &pathspec); if (pathspec.nr) - seen = prune_directory(&dir, &pathspec, baselen); + seen = prune_directory(&dir, &pathspec, baselen, repo); } if (refresh_only) { - exit_status |= refresh(verbose, &pathspec); + exit_status |= refresh(verbose, &pathspec, repo); goto finish; } @@ -487,7 +490,7 @@ int cmd_add(int argc, const char **argv, const char *prefix, struct repository * if (!seen) seen = find_pathspecs_matching_against_index(&pathspec, - the_repository->index, PS_IGNORE_SKIP_WORKTREE); + repo->index, PS_IGNORE_SKIP_WORKTREE); /* * file_exists() assumes exact match @@ -523,8 +526,8 @@ int cmd_add(int argc, const char **argv, const char *prefix, struct repository * !file_exists(path)) { if (ignore_missing) { int dtype = DT_UNKNOWN; - if (is_excluded(&dir, the_repository->index, path, &dtype)) - dir_add_ignored(&dir, the_repository->index, + if (is_excluded(&dir, repo->index, path, &dtype)) + dir_add_ignored(&dir, repo->index, path, pathspec.items[i].len); } else die(_("pathspec '%s' did not match any files"), @@ -547,9 +550,9 @@ int cmd_add(int argc, const char **argv, const char *prefix, struct repository * ps_matched = xcalloc(pathspec.nr, 1); if (add_renormalize) - exit_status |= renormalize_tracked_files(&pathspec, flags); + exit_status |= renormalize_tracked_files(&pathspec, flags, repo); else - exit_status |= add_files_to_cache(the_repository, prefix, + exit_status |= add_files_to_cache(repo, prefix, &pathspec, ps_matched, include_sparse, flags); @@ -558,14 +561,14 @@ int cmd_add(int argc, const char **argv, const char *prefix, struct repository * exit(128); if (add_new_files) - exit_status |= add_files(&dir, flags); + exit_status |= add_files(&dir, flags, repo); if (chmod_arg && pathspec.nr) - exit_status |= chmod_pathspec(&pathspec, chmod_arg[0], show_only); + exit_status |= chmod_pathspec(&pathspec, chmod_arg[0], show_only, repo); end_odb_transaction(); finish: - if (write_locked_index(the_repository->index, &lock_file, + if (write_locked_index(repo->index, &lock_file, COMMIT_LOCK | SKIP_IF_UNCHANGED)) die(_("unable to write new index file")); diff --git a/builtin/commit.c b/builtin/commit.c index 141c8d85620..d9ee6502448 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -396,7 +396,7 @@ static const char *prepare_index(const char **argv, const char *prefix, old_index_env = xstrdup_or_null(getenv(INDEX_ENVIRONMENT)); setenv(INDEX_ENVIRONMENT, the_repository->index_file, 1); - if (interactive_add(argv, prefix, patch_interactive) != 0) + if (interactive_add(argv, prefix, patch_interactive, the_repository) != 0) die(_("interactive add failed")); the_repository->index_file = old_repo_index_file; diff --git a/commit.h b/commit.h index 0e5fce543c2..92fef717be1 100644 --- a/commit.h +++ b/commit.h @@ -2,6 +2,7 @@ #define COMMIT_H #include "object.h" +#include "repository.h" struct signature_check; struct strbuf; @@ -253,7 +254,7 @@ struct oid_array; struct ref; int for_each_commit_graft(each_commit_graft_fn, void *); -int interactive_add(const char **argv, const char *prefix, int patch); +int interactive_add(const char **argv, const char *prefix, int patch, struct repository *repo); struct commit_extra_header { struct commit_extra_header *next;