Merge branch 'jc/pass-repo-to-builtins'

The convention to calling into built-in command implementation has
been updated to pass the repository, if known, together with the
prefix value.

* jc/pass-repo-to-builtins:
  add: pass in repo variable instead of global the_repository
  builtin: remove USE_THE_REPOSITORY for those without the_repository
  builtin: remove USE_THE_REPOSITORY_VARIABLE from builtin.h
  builtin: add a repository parameter for builtin functions
This commit is contained in:
Junio C Hamano 2024-09-23 10:35:09 -07:00
commit b8e318ea58
128 changed files with 903 additions and 437 deletions

285
builtin.h
View File

@ -1,15 +1,8 @@
#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"
/*
* builtin API
@ -122,143 +115,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

View File

@ -3,7 +3,6 @@
*
* Copyright (C) 2006 Linus Torvalds
*/
#include "builtin.h"
#include "advice.h"
#include "config.h"
@ -18,7 +17,6 @@
#include "preload-index.h"
#include "diff.h"
#include "read-cache.h"
#include "repository.h"
#include "revision.h"
#include "bulk-checkin.h"
#include "strvec.h"
@ -36,24 +34,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 repository *repo,
struct pathspec *pathspec,
char flip,
int show_only)
{
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 +65,36 @@ 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(struct repository *repo,
const struct pathspec *pathspec,
int flags)
{
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 repository *repo,
struct dir_struct *dir,
struct pathspec *pathspec,
int prefix)
{
char *seen;
int i;
@ -100,16 +106,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(struct repository *repo, int verbose, const struct pathspec *pathspec)
{
char *seen;
int i, ret = 0;
@ -119,14 +125,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 +153,10 @@ 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(struct repository *repo,
const char **argv,
const char *prefix,
int patch)
{
struct pathspec pathspec;
int ret;
@ -159,28 +168,31 @@ 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(struct repository *repo,
int argc,
const char **argv,
const char *prefix)
{
char *file = git_pathdup("ADD_EDIT.patch");
char *file = repo_git_path(repo, "ADD_EDIT.patch");
struct child_process child = CHILD_PROCESS_INIT;
struct rev_info rev;
int out;
struct stat st;
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
repo_config(repo, git_diff_basic_config, NULL);
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 +330,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 repository *repo, struct dir_struct *dir, int flags)
{
int i, exit_status = 0;
struct string_list matched_sparse_paths = STRING_LIST_INIT_NODUP;
@ -334,12 +346,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 +370,10 @@ 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 *repo)
{
int exit_status = 0;
struct pathspec pathspec;
@ -370,7 +385,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
char *ps_matched = NULL;
struct lock_file lock_file = LOCK_INIT;
git_config(add_config, NULL);
repo_config(repo, add_config, NULL);
argc = parse_options(argc, argv, prefix, builtin_add_options,
builtin_add_usage, PARSE_OPT_KEEP_ARGV0);
@ -381,13 +396,13 @@ int cmd_add(int argc, const char **argv, const char *prefix)
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(repo, argv + 1, prefix, patch_interactive));
}
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(repo, argc, argv, prefix));
}
argc--;
argv++;
@ -410,10 +425,10 @@ int cmd_add(int argc, const char **argv, const char *prefix)
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 +469,11 @@ int cmd_add(int argc, const char **argv, const char *prefix)
(!(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 +485,13 @@ int cmd_add(int argc, const char **argv, const char *prefix)
}
/* 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(repo, &dir, &pathspec, baselen);
}
if (refresh_only) {
exit_status |= refresh(verbose, &pathspec);
exit_status |= refresh(repo, verbose, &pathspec);
goto finish;
}
@ -487,7 +502,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
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 +538,8 @@ int cmd_add(int argc, const char **argv, const char *prefix)
!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 +562,9 @@ int cmd_add(int argc, const char **argv, const char *prefix)
ps_matched = xcalloc(pathspec.nr, 1);
if (add_renormalize)
exit_status |= renormalize_tracked_files(&pathspec, flags);
exit_status |= renormalize_tracked_files(repo, &pathspec, flags);
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 +573,14 @@ int cmd_add(int argc, const char **argv, const char *prefix)
exit(128);
if (add_new_files)
exit_status |= add_files(&dir, flags);
exit_status |= add_files(repo, &dir, flags);
if (chmod_arg && pathspec.nr)
exit_status |= chmod_pathspec(&pathspec, chmod_arg[0], show_only);
exit_status |= chmod_pathspec(repo, &pathspec, chmod_arg[0], show_only);
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"));

View File

@ -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"
@ -38,7 +39,6 @@
#include "string-list.h"
#include "pager.h"
#include "path.h"
#include "repository.h"
#include "pretty.h"
/**
@ -2303,7 +2303,10 @@ 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;

View File

@ -3,11 +3,16 @@
*
* Copyright (C) 2006 Ryan Anderson
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "git-compat-util.h"
#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 UNUSED)
{
struct strvec args = STRVEC_INIT;
int i;
@ -18,5 +23,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, the_repository);
}

View File

@ -1,6 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "gettext.h"
#include "repository.h"
#include "hash.h"
#include "apply.h"
@ -9,7 +9,10 @@ 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;

View File

@ -2,13 +2,13 @@
* 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"
#include "transport.h"
#include "parse-options.h"
#include "pkt-line.h"
#include "repository.h"
static void create_output_file(const char *output_file)
{
@ -76,7 +76,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "copy.h"
#include "environment.h"
@ -1411,7 +1412,10 @@ 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;

View File

@ -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"
@ -12,7 +12,6 @@
#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "repository.h"
#include "commit.h"
#include "diff.h"
#include "revision.h"
@ -864,7 +863,10 @@ 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;

View File

@ -4,7 +4,7 @@
* Copyright (c) 2006 Kristian Høgsberg <krh@redhat.com>
* Based on git-branch.sh by Junio C Hamano.
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "color.h"
@ -704,7 +704,10 @@ 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,

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "editor.h"
@ -98,7 +99,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "gettext.h"
@ -5,7 +6,6 @@
#include "strvec.h"
#include "parse-options.h"
#include "pkt-line.h"
#include "repository.h"
#include "bundle.h"
/*
@ -228,7 +228,10 @@ 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[] = {

View File

@ -3,7 +3,7 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "convert.h"
@ -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,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "attr.h"
@ -5,7 +6,6 @@
#include "gettext.h"
#include "object-name.h"
#include "quote.h"
#include "repository.h"
#include "setup.h"
#include "parse-options.h"
#include "write-or-die.h"
@ -107,7 +107,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "dir.h"
@ -5,7 +6,6 @@
#include "quote.h"
#include "pathspec.h"
#include "parse-options.h"
#include "repository.h"
#include "submodule.h"
#include "write-or-die.h"
@ -151,7 +151,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"
@ -47,7 +48,10 @@ 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;

View File

@ -1,7 +1,6 @@
/*
* GIT - The information manager from hell
*/
#include "builtin.h"
#include "refs.h"
#include "setup.h"
@ -51,7 +50,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "entry.h"
@ -113,7 +114,10 @@ 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[] = {

View File

@ -4,13 +4,12 @@
* Copyright (C) 2005 Linus Torvalds
*
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"
#include "lockfile.h"
#include "quote.h"
#include "repository.h"
#include "cache-tree.h"
#include "parse-options.h"
#include "entry.h"
@ -208,7 +207,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "advice.h"
#include "branch.h"
@ -1956,7 +1957,10 @@ 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;
@ -2003,7 +2007,10 @@ 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;
@ -2039,7 +2046,10 @@ 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;

View File

@ -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"
@ -14,7 +14,6 @@
#include "parse-options.h"
#include "path.h"
#include "read-cache-ll.h"
#include "repository.h"
#include "setup.h"
#include "string-list.h"
#include "quote.h"
@ -915,7 +914,10 @@ 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;

View File

@ -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 "abspath.h"
#include "advice.h"
#include "config.h"
@ -956,7 +957,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"
@ -18,7 +19,10 @@ 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;

View File

@ -1,10 +1,10 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "commit.h"
#include "config.h"
#include "gettext.h"
#include "hex.h"
#include "parse-options.h"
#include "repository.h"
#include "commit-graph.h"
#include "object-store-ll.h"
#include "progress.h"
@ -330,7 +330,10 @@ 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[] = {

View File

@ -3,13 +3,14 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"
#include "hex.h"
#include "object-name.h"
#include "object-store-ll.h"
#include "repository.h"
#include "commit.h"
#include "parse-options.h"
@ -90,7 +91,10 @@ 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;

View File

@ -4,7 +4,7 @@
* Copyright (c) 2007 Kristian Høgsberg <krh@redhat.com>
* Based on git-commit.sh by Junio C Hamano and Linus Torvalds
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "advice.h"
#include "config.h"
@ -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(the_repository, argv, prefix, patch_interactive) != 0)
die(_("interactive add failed"));
the_repository->index_file = old_repo_index_file;
@ -1503,7 +1503,10 @@ 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;
@ -1642,7 +1645,10 @@ 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[] = {

View File

@ -1,10 +1,10 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "config.h"
#include "color.h"
#include "editor.h"
#include "environment.h"
#include "repository.h"
#include "gettext.h"
#include "ident.h"
#include "parse-options.h"
@ -1392,7 +1392,10 @@ 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[] = {

View File

@ -3,13 +3,12 @@
*
* Copyright (c) 2006 Junio C Hamano
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "dir.h"
#include "gettext.h"
#include "path.h"
#include "repository.h"
#include "parse-options.h"
#include "quote.h"
#include "packfile.h"
@ -94,7 +93,10 @@ 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[] = {

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "gettext.h"
@ -287,7 +288,10 @@ 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 +334,10 @@ 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] <socket-path>",

View File

@ -137,7 +137,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"
@ -170,7 +171,10 @@ 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 [<options>] <action>",

View File

@ -1,3 +1,5 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "git-compat-util.h"
#include "credential.h"
#include "builtin.h"
@ -6,7 +8,10 @@
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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "environment.h"
@ -571,7 +572,10 @@ 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 +654,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);

View File

@ -11,7 +11,10 @@ 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);

View File

@ -3,13 +3,13 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "diff.h"
#include "diff-merges.h"
#include "commit.h"
#include "preload-index.h"
#include "repository.h"
#include "revision.h"
static const char diff_files_usage[] =
@ -17,7 +17,10 @@ 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;

View File

@ -1,10 +1,10 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "diff.h"
#include "diff-merges.h"
#include "commit.h"
#include "preload-index.h"
#include "repository.h"
#include "revision.h"
#include "setup.h"
@ -14,7 +14,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "diff.h"
@ -6,7 +7,6 @@
#include "hex.h"
#include "log-tree.h"
#include "read-cache-ll.h"
#include "repository.h"
#include "revision.h"
#include "tmp-objdir.h"
#include "tree.h"
@ -108,7 +108,10 @@ 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;

View File

@ -3,7 +3,7 @@
*
* Copyright (c) 2006 Junio C Hamano
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "ewah/ewok.h"
@ -393,7 +393,10 @@ 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;

View File

@ -11,8 +11,9 @@
*
* Copyright (C) 2016 Johannes Schindelin
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "config.h"
#include "copy.h"
@ -691,7 +692,10 @@ 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;

View File

@ -3,6 +3,7 @@
*
* Copyright (C) 2007 Johannes E. Schindelin
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"
@ -1180,7 +1181,10 @@ 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;

View File

@ -1,9 +1,9 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "repository.h"
#include "config.h"
#include "lockfile.h"
#include "object.h"
@ -3537,7 +3537,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "gettext.h"
#include "hex.h"
@ -43,7 +44,10 @@ 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 *fetched_refs = NULL, *remote_refs = NULL;

View File

@ -1,13 +1,13 @@
/*
* "git fetch"
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "advice.h"
#include "config.h"
#include "gettext.h"
#include "environment.h"
#include "hex.h"
#include "repository.h"
#include "refs.h"
#include "refspec.h"
#include "object-name.h"
@ -2138,7 +2138,10 @@ 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,

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "fmt-merge-msg.h"
@ -9,7 +10,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "commit.h"
#include "config.h"
@ -16,7 +17,10 @@ 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;

View File

@ -1,9 +1,9 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"
#include "parse-options.h"
#include "path.h"
#include "repository.h"
#include "run-command.h"
#include "string-list.h"
@ -29,7 +29,10 @@ 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;

View File

@ -1,7 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "gettext.h"
#include "hex.h"
#include "repository.h"
#include "config.h"
#include "commit.h"
#include "tree.h"
@ -925,7 +925,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "config.h"
@ -10,7 +11,7 @@
#include "compat/fsmonitor/fsm-health.h"
#include "compat/fsmonitor/fsm-listen.h"
#include "fsmonitor--daemon.h"
#include "repository.h"
#include "simple-ipc.h"
#include "khash.h"
#include "run-command.h"
@ -1522,7 +1523,10 @@ 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;
@ -1585,7 +1589,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()

View File

@ -9,13 +9,12 @@
*
* Copyright (c) 2006 Shawn O. Pearce
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "date.h"
#include "environment.h"
#include "hex.h"
#include "repository.h"
#include "config.h"
#include "tempfile.h"
#include "lockfile.h"
@ -657,7 +656,10 @@ 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 +2892,10 @@ 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[] = {

View File

@ -12,7 +12,10 @@ 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;

View File

@ -3,11 +3,11 @@
*
* Copyright (c) 2006 Junio C Hamano
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "gettext.h"
#include "hex.h"
#include "repository.h"
#include "config.h"
#include "tag.h"
#include "tree-walk.h"
@ -888,7 +888,10 @@ 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;

View File

@ -4,6 +4,7 @@
* Copyright (C) Linus Torvalds, 2005
* Copyright (C) Junio C Hamano, 2005
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "config.h"
@ -84,7 +85,10 @@ 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 <type>] [-w] [--path=<file> | --no-filters]\n"

View File

@ -1,6 +1,8 @@
/*
* Builtin help command
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "exec-cmd.h"
@ -631,7 +633,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"
@ -66,7 +67,10 @@ 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[] = {

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "delta.h"
@ -1718,7 +1719,10 @@ 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;

View File

@ -3,6 +3,7 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "environment.h"
@ -11,7 +12,6 @@
#include "parse-options.h"
#include "path.h"
#include "refs.h"
#include "repository.h"
#include "setup.h"
#include "strbuf.h"
@ -70,7 +70,10 @@ 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;

View File

@ -4,7 +4,7 @@
* Copyright (c) 2013, 2014 Christian Couder <chriscool@tuxfamily.org>
*
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "gettext.h"
#include "parse-options.h"
@ -189,7 +189,10 @@ 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);

View File

@ -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"
@ -37,7 +38,7 @@
#include "mailmap.h"
#include "progress.h"
#include "commit-slab.h"
#include "repository.h"
#include "commit-reach.h"
#include "range-diff.h"
#include "tmp-objdir.h"
@ -627,7 +628,10 @@ 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;
@ -748,7 +752,10 @@ 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;
@ -864,7 +871,10 @@ 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;
@ -906,7 +916,10 @@ 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;
@ -1976,7 +1989,10 @@ 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;
@ -2609,7 +2625,10 @@ 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;

View File

@ -5,8 +5,8 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "repository.h"
#include "config.h"
#include "convert.h"
#include "quote.h"
@ -561,7 +561,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "gettext.h"
#include "hex.h"
@ -37,7 +38,10 @@ 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;

View File

@ -3,7 +3,9 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"
#include "hex.h"
@ -329,7 +331,10 @@ 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;

View File

@ -2,6 +2,7 @@
* Another stupid program, this one parsing the headers of an
* email to figure out authorship and subject
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "environment.h"
@ -48,7 +49,10 @@ 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;

View File

@ -269,7 +269,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "commit.h"
@ -5,7 +6,6 @@
#include "hex.h"
#include "object-name.h"
#include "parse-options.h"
#include "repository.h"
#include "commit-reach.h"
static int show_merge_base(struct commit **rev, int rev_nr, int show_all)
@ -143,7 +143,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "diff.h"
@ -53,7 +54,10 @@ 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 };

View File

@ -1,7 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "hex.h"
#include "read-cache-ll.h"
#include "repository.h"
#include "run-command.h"
#include "sparse-index.h"
@ -73,7 +73,10 @@ 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;

View File

@ -7,15 +7,19 @@
*
* 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"
#include "repository.h"
static const char builtin_merge_ours_usage[] =
"git merge-ours <base>... -- HEAD <remote>...";
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);

View File

@ -1,10 +1,10 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "advice.h"
#include "gettext.h"
#include "hash.h"
#include "merge-recursive.h"
#include "object-name.h"
#include "repository.h"
static const char builtin_merge_recursive_usage[] =
"git %s <base>... -- <head> <remote> ...";
@ -21,7 +21,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "tree-walk.h"
#include "xdiff-interface.h"
@ -10,7 +11,6 @@
#include "object-name.h"
#include "object-store-ll.h"
#include "parse-options.h"
#include "repository.h"
#include "blob.h"
#include "merge-blobs.h"
#include "quote.h"
@ -526,7 +526,10 @@ 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;

View File

@ -5,8 +5,9 @@
*
* Based on git-merge.sh by Junio C Hamano.
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "advice.h"
#include "config.h"
@ -1279,7 +1280,10 @@ 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;
@ -1351,7 +1355,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);
@ -1383,7 +1387,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;
}

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "gettext.h"
#include "hex.h"
@ -71,7 +72,10 @@ 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,

View File

@ -3,6 +3,7 @@
*
* Copyright (c) Junio C Hamano, 2006, 2009
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "gettext.h"
#include "hex.h"
@ -150,7 +151,10 @@ 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;
@ -199,5 +203,6 @@ int cmd_mktree(int ac, const char **av, const char *prefix)
used=0; /* reset tree entry buffer for re-use in batch mode */
}
strbuf_release(&sb);
return 0;
}

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "config.h"
@ -267,8 +268,10 @@ static int cmd_multi_pack_index_repack(int argc, const char **argv,
(size_t)opts.batch_size, opts.flags);
}
int cmd_multi_pack_index(int argc, const char **argv,
const char *prefix)
int cmd_multi_pack_index(int argc,
const char **argv,
const char *prefix,
struct repository *repo UNUSED)
{
int res;
parse_opt_subcommand_fn *fn = NULL;

View File

@ -3,6 +3,7 @@
*
* Copyright (C) 2006 Johannes Schindelin
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
@ -18,7 +19,7 @@
#include "string-list.h"
#include "parse-options.h"
#include "read-cache-ll.h"
#include "repository.h"
#include "setup.h"
#include "strvec.h"
#include "submodule.h"
@ -178,7 +179,10 @@ 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;

View File

@ -1,8 +1,8 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "repository.h"
#include "config.h"
#include "commit.h"
#include "tag.h"
@ -558,7 +558,10 @@ 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;

View File

@ -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"
@ -17,7 +17,7 @@
#include "object-name.h"
#include "object-store-ll.h"
#include "path.h"
#include "repository.h"
#include "pretty.h"
#include "refs.h"
#include "exec-cmd.h"
@ -1102,7 +1102,10 @@ 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;

View File

@ -1,8 +1,8 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "environment.h"
#include "gettext.h"
#include "hex.h"
#include "repository.h"
#include "config.h"
#include "attr.h"
#include "object.h"
@ -4312,7 +4312,10 @@ 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;

View File

@ -5,11 +5,12 @@
* This file is licensed under the GPL v2.
*
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "gettext.h"
#include "hex.h"
#include "repository.h"
#include "packfile.h"
#include "object-store-ll.h"
@ -561,11 +562,8 @@ static void load_all(void)
}
}
int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED)
{
int i;
int i_still_use_this = 0;
struct pack_list *min = NULL, *red, *pl;
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; struct pack_list *min = NULL, *red, *pl;
struct llist *ignore;
struct object_id *oid;
char buf[GIT_MAX_HEXSZ + 2]; /* hex hash + \n + \0 */

View File

@ -1,9 +1,9 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"
#include "parse-options.h"
#include "refs.h"
#include "repository.h"
#include "revision.h"
static char const * const pack_refs_usage[] = {
@ -11,7 +11,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "diff.h"
@ -214,7 +215,10 @@ 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};

View File

@ -8,7 +8,10 @@ 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[] = {

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "commit.h"
#include "diff.h"
@ -147,7 +148,10 @@ 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;

View File

@ -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"
@ -977,7 +978,10 @@ 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;

View File

@ -1,6 +1,7 @@
/*
* "git push"
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "advice.h"
#include "branch.h"
@ -13,7 +14,6 @@
#include "transport.h"
#include "parse-options.h"
#include "pkt-line.h"
#include "repository.h"
#include "submodule.h"
#include "submodule-config.h"
#include "send-pack.h"
@ -548,7 +548,10 @@ 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;

View File

@ -1,10 +1,11 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "gettext.h"
#include "object-name.h"
#include "parse-options.h"
#include "range-diff.h"
#include "config.h"
#include "repository.h"
static const char * const builtin_range_diff_usage[] = {
N_("git range-diff [<options>] <old-base>..<old-tip> <new-base>..<new-tip>"),
@ -13,7 +14,10 @@ N_("git range-diff [<options>] <base> <old-tip> <new-tip>"),
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;

View File

@ -3,7 +3,7 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"
@ -16,7 +16,6 @@
#include "cache-tree.h"
#include "unpack-trees.h"
#include "parse-options.h"
#include "repository.h"
#include "resolve-undo.h"
#include "setup.h"
#include "sparse-index.h"
@ -108,7 +107,10 @@ 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;

View File

@ -3,8 +3,9 @@
*
* Copyright (c) 2018 Pratik Karki
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "environment.h"
#include "gettext.h"
@ -1080,7 +1081,10 @@ 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;

View File

@ -1,6 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "repository.h"
#include "config.h"
#include "environment.h"
#include "gettext.h"
@ -2480,7 +2481,10 @@ 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;

View File

@ -1,7 +1,7 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"
#include "repository.h"
#include "revision.h"
#include "reachable.h"
#include "wildmatch.h"
@ -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,10 @@ 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 +469,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);
}

View File

@ -1,9 +1,9 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "fsck.h"
#include "parse-options.h"
#include "refs.h"
#include "repository.h"
#include "strbuf.h"
#define REFS_MIGRATE_USAGE \
@ -90,7 +90,10 @@ 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,

View File

@ -195,7 +195,10 @@ 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);

View File

@ -53,7 +53,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"
@ -1761,7 +1762,10 @@ 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[] = {

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "dir.h"
@ -1136,7 +1137,10 @@ 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;

View File

@ -7,7 +7,7 @@
* and Carlos Rica <jasampler@gmail.com> 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"
#include "editor.h"
@ -21,7 +21,6 @@
#include "object-name.h"
#include "object-store-ll.h"
#include "replace-object.h"
#include "repository.h"
#include "tag.h"
#include "wildmatch.h"
@ -544,7 +543,10 @@ 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;

View File

@ -4,6 +4,7 @@
#include "git-compat-util.h"
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "environment.h"
#include "hex.h"
@ -274,7 +275,10 @@ 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;

View File

@ -1,8 +1,9 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "gettext.h"
#include "parse-options.h"
#include "repository.h"
#include "string-list.h"
#include "rerere.h"
#include "xdiff/xdiff.h"
@ -48,7 +49,10 @@ 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;

View File

@ -7,7 +7,7 @@
*
* Copyright (c) 2005, 2006 Linus Torvalds and Junio C Hamano
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "advice.h"
#include "config.h"
@ -331,7 +331,10 @@ 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;

View File

@ -1,3 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "config.h"
#include "commit.h"
@ -513,7 +514,10 @@ 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;

View File

@ -3,8 +3,9 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
#define USE_THE_REPOSITORY_VARIABLE
#include "builtin.h"
#include "abspath.h"
#include "config.h"
#include "commit.h"
@ -690,7 +691,10 @@ 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;

View File

@ -1,9 +1,9 @@
#define USE_THE_REPOSITORY_VARIABLE
#include "git-compat-util.h"
#include "builtin.h"
#include "parse-options.h"
#include "diff.h"
#include "gettext.h"
#include "repository.h"
#include "revision.h"
#include "rerere.h"
#include "sequencer.h"
@ -261,7 +261,10 @@ 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 +278,10 @@ 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;

Some files were not shown because too many files have changed in this diff Show More