summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/clone.c5
-rw-r--r--builtin/column.c2
-rw-r--r--builtin/hash-object.c2
-rw-r--r--builtin/mktree.c4
-rw-r--r--builtin/name-rev.c5
-rw-r--r--builtin/pack-objects.c8
-rw-r--r--builtin/range-diff.c2
-rw-r--r--builtin/read-tree.c4
-rw-r--r--builtin/rebase.c2
-rw-r--r--builtin/receive-pack.c5
-rw-r--r--builtin/remote.c4
-rw-r--r--builtin/rev-list.c10
-rw-r--r--builtin/rm.c6
-rw-r--r--builtin/show-branch.c3
-rw-r--r--builtin/submodule--helper.c3
-rw-r--r--builtin/upload-pack.c2
-rw-r--r--builtin/verify-commit.c23
-rw-r--r--builtin/write-tree.c12
18 files changed, 44 insertions, 58 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index 85b0d3155d..e3231864ca 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -354,8 +354,7 @@ static void setup_reference(void)
add_one_reference, &required);
}
-static void copy_alternates(struct strbuf *src, struct strbuf *dst,
- const char *src_repo)
+static void copy_alternates(struct strbuf *src, const char *src_repo)
{
/*
* Read from the source objects/info/alternates file
@@ -436,7 +435,7 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest,
/* Files that cannot be copied bit-for-bit... */
if (!strcmp(src->buf + src_baselen, "/info/alternates")) {
- copy_alternates(src, dest, src_repo);
+ copy_alternates(src, src_repo);
continue;
}
diff --git a/builtin/column.c b/builtin/column.c
index 5228ccf37a..e815e148aa 100644
--- a/builtin/column.c
+++ b/builtin/column.c
@@ -43,7 +43,7 @@ int cmd_column(int argc, const char **argv, const char *prefix)
memset(&copts, 0, sizeof(copts));
copts.padding = 1;
- argc = parse_options(argc, argv, "", options, builtin_column_usage, 0);
+ argc = parse_options(argc, argv, prefix, options, builtin_column_usage, 0);
if (argc)
usage_with_options(builtin_column_usage, options);
if (real_command || command) {
diff --git a/builtin/hash-object.c b/builtin/hash-object.c
index e055c11103..640ef4ded5 100644
--- a/builtin/hash-object.c
+++ b/builtin/hash-object.c
@@ -108,7 +108,7 @@ int cmd_hash_object(int argc, const char **argv, const char *prefix)
int i;
const char *errstr = NULL;
- argc = parse_options(argc, argv, NULL, hash_object_options,
+ argc = parse_options(argc, argv, prefix, hash_object_options,
hash_object_usage, 0);
if (flags & HASH_WRITE_OBJECT)
diff --git a/builtin/mktree.c b/builtin/mktree.c
index 94e82b8504..891991b00d 100644
--- a/builtin/mktree.c
+++ b/builtin/mktree.c
@@ -67,7 +67,7 @@ static const char *mktree_usage[] = {
NULL
};
-static void mktree_line(char *buf, size_t len, int nul_term_line, int allow_missing)
+static void mktree_line(char *buf, int nul_term_line, int allow_missing)
{
char *ptr, *ntr;
const char *p;
@@ -172,7 +172,7 @@ int cmd_mktree(int ac, const char **av, const char *prefix)
break;
die("input format error: (blank line only valid in batch mode)");
}
- mktree_line(sb.buf, sb.len, nul_term_line, allow_missing);
+ mktree_line(sb.buf, nul_term_line, allow_missing);
}
if (is_batch_mode && got_eof && used < 1) {
/*
diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index 05ccf53e00..16df43473a 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -40,9 +40,7 @@ static void set_commit_rev_name(struct commit *commit, struct rev_name *name)
}
static int is_better_name(struct rev_name *name,
- const char *tip_name,
timestamp_t taggerdate,
- int generation,
int distance,
int from_tag)
{
@@ -103,8 +101,7 @@ static void name_rev(struct commit *commit,
name = xmalloc(sizeof(rev_name));
set_commit_rev_name(commit, name);
goto copy_data;
- } else if (is_better_name(name, tip_name, taggerdate,
- generation, distance, from_tag)) {
+ } else if (is_better_name(name, taggerdate, distance, from_tag)) {
copy_data:
name->tip_name = tip_name;
name->taggerdate = taggerdate;
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 41d7fc5983..b2be8869c2 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -2899,7 +2899,7 @@ static int ofscmp(const void *a_, const void *b_)
return oidcmp(&a->object->oid, &b->object->oid);
}
-static void add_objects_in_unpacked_packs(struct rev_info *revs)
+static void add_objects_in_unpacked_packs(void)
{
struct packed_git *p;
struct in_pack in_pack;
@@ -3011,7 +3011,7 @@ static int loosened_object_can_be_discarded(const struct object_id *oid,
return 1;
}
-static void loosen_unused_packed_objects(struct rev_info *revs)
+static void loosen_unused_packed_objects(void)
{
struct packed_git *p;
uint32_t i;
@@ -3158,11 +3158,11 @@ static void get_object_list(int ac, const char **av)
}
if (keep_unreachable)
- add_objects_in_unpacked_packs(&revs);
+ add_objects_in_unpacked_packs();
if (pack_loose_unreachable)
add_unreachable_loose_objects();
if (unpack_unreachable)
- loosen_unused_packed_objects(&revs);
+ loosen_unused_packed_objects();
oid_array_clear(&recent_objects);
}
diff --git a/builtin/range-diff.c b/builtin/range-diff.c
index 784bd19321..9202e75544 100644
--- a/builtin/range-diff.c
+++ b/builtin/range-diff.c
@@ -32,7 +32,7 @@ int cmd_range_diff(int argc, const char **argv, const char *prefix)
repo_diff_setup(the_repository, &diffopt);
options = parse_options_concat(range_diff_options, diffopt.parseopts);
- argc = parse_options(argc, argv, NULL, options,
+ argc = parse_options(argc, argv, prefix, options,
builtin_range_diff_usage, 0);
diff_setup_done(&diffopt);
diff --git a/builtin/read-tree.c b/builtin/read-tree.c
index 5c9c082595..ca5e655d2f 100644
--- a/builtin/read-tree.c
+++ b/builtin/read-tree.c
@@ -111,7 +111,7 @@ static int git_read_tree_config(const char *var, const char *value, void *cb)
return git_default_config(var, value, cb);
}
-int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
+int cmd_read_tree(int argc, const char **argv, const char *cmd_prefix)
{
int i, stage = 0;
struct object_id oid;
@@ -165,7 +165,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
git_config(git_read_tree_config, NULL);
- argc = parse_options(argc, argv, unused_prefix, read_tree_options,
+ argc = parse_options(argc, argv, cmd_prefix, read_tree_options,
read_tree_usage, 0);
hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR);
diff --git a/builtin/rebase.c b/builtin/rebase.c
index db6ca9bd7d..effc2709a8 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -508,7 +508,7 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
if (argc == 1)
usage_with_options(builtin_rebase_interactive_usage, options);
- argc = parse_options(argc, argv, NULL, options,
+ argc = parse_options(argc, argv, prefix, options,
builtin_rebase_interactive_usage, PARSE_OPT_KEEP_ARGV0);
if (!is_null_oid(&squash_onto))
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 29f165d8bd..77b7122456 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1809,8 +1809,7 @@ static const char *unpack_with_sideband(struct shallow_info *si)
return ret;
}
-static void prepare_shallow_update(struct command *commands,
- struct shallow_info *si)
+static void prepare_shallow_update(struct shallow_info *si)
{
int i, j, k, bitmap_size = DIV_ROUND_UP(si->ref->nr, 32);
@@ -1876,7 +1875,7 @@ static void update_shallow_info(struct command *commands,
si->ref = ref;
if (shallow_update) {
- prepare_shallow_update(commands, si);
+ prepare_shallow_update(si);
return;
}
diff --git a/builtin/remote.c b/builtin/remote.c
index f7edf7f2cb..5591cef775 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -1407,7 +1407,7 @@ static int update(int argc, const char **argv)
return retval;
}
-static int remove_all_fetch_refspecs(const char *remote, const char *key)
+static int remove_all_fetch_refspecs(const char *key)
{
return git_config_set_multivar_gently(key, NULL, NULL, 1);
}
@@ -1437,7 +1437,7 @@ static int set_remote_branches(const char *remotename, const char **branches,
if (!remote_is_configured(remote, 1))
die(_("No such remote '%s'"), remotename);
- if (!add_mode && remove_all_fetch_refspecs(remotename, key.buf)) {
+ if (!add_mode && remove_all_fetch_refspecs(key.buf)) {
strbuf_release(&key);
return 1;
}
diff --git a/builtin/rev-list.c b/builtin/rev-list.c
index 9f31837d30..660172b014 100644
--- a/builtin/rev-list.c
+++ b/builtin/rev-list.c
@@ -77,7 +77,7 @@ static enum missing_action arg_missing_action;
#define DEFAULT_OIDSET_SIZE (16*1024)
-static void finish_commit(struct commit *commit, void *data);
+static void finish_commit(struct commit *commit);
static void show_commit(struct commit *commit, void *data)
{
struct rev_list_info *info = data;
@@ -86,7 +86,7 @@ static void show_commit(struct commit *commit, void *data)
display_progress(progress, ++progress_counter);
if (info->flags & REV_LIST_QUIET) {
- finish_commit(commit, data);
+ finish_commit(commit);
return;
}
@@ -99,7 +99,7 @@ static void show_commit(struct commit *commit, void *data)
revs->count_left++;
else
revs->count_right++;
- finish_commit(commit, data);
+ finish_commit(commit);
return;
}
@@ -188,10 +188,10 @@ static void show_commit(struct commit *commit, void *data)
putchar('\n');
}
maybe_flush_or_die(stdout, "stdout");
- finish_commit(commit, data);
+ finish_commit(commit);
}
-static void finish_commit(struct commit *commit, void *data)
+static void finish_commit(struct commit *commit)
{
if (commit->parents) {
free_commit_list(commit->parents);
diff --git a/builtin/rm.c b/builtin/rm.c
index 90cbe896c9..be8edc6d1e 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -61,7 +61,7 @@ static void print_error_files(struct string_list *files_list,
}
}
-static void submodules_absorb_gitdir_if_needed(const char *prefix)
+static void submodules_absorb_gitdir_if_needed(void)
{
int i;
for (i = 0; i < list.nr; i++) {
@@ -83,7 +83,7 @@ static void submodules_absorb_gitdir_if_needed(const char *prefix)
continue;
if (!submodule_uses_gitfile(name))
- absorb_git_dir_into_superproject(prefix, name,
+ absorb_git_dir_into_superproject(name,
ABSORB_GITDIR_RECURSE_SUBMODULES);
}
}
@@ -313,7 +313,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
}
if (!index_only)
- submodules_absorb_gitdir_if_needed(prefix);
+ submodules_absorb_gitdir_if_needed();
/*
* If not forced, the file, the index and the HEAD (if exists)
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index 082daeac32..35d7f51c23 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -514,7 +514,6 @@ static int show_merge_base(struct commit_list *seen, int num_rev)
static int show_independent(struct commit **rev,
int num_rev,
- char **ref_name,
unsigned int *rev_mask)
{
int i;
@@ -862,7 +861,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
return show_merge_base(seen, num_rev);
if (independent)
- return show_independent(rev, num_rev, ref_name, rev_mask);
+ return show_independent(rev, num_rev, rev_mask);
/* Show list; --more=-1 means list-only */
if (1 < num_rev || extra < 0) {
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 0bf4aa088e..13da32d3b7 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -2107,8 +2107,7 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
return 1;
for (i = 0; i < list.nr; i++)
- absorb_git_dir_into_superproject(prefix,
- list.entries[i]->name, flags);
+ absorb_git_dir_into_superproject(list.entries[i]->name, flags);
return 0;
}
diff --git a/builtin/upload-pack.c b/builtin/upload-pack.c
index 42dc4da5a1..6da8fa2607 100644
--- a/builtin/upload-pack.c
+++ b/builtin/upload-pack.c
@@ -33,7 +33,7 @@ int cmd_upload_pack(int argc, const char **argv, const char *prefix)
packet_trace_identity("upload-pack");
read_replace_refs = 0;
- argc = parse_options(argc, argv, NULL, options, upload_pack_usage, 0);
+ argc = parse_options(argc, argv, prefix, options, upload_pack_usage, 0);
if (argc != 1)
usage_with_options(upload_pack_usage, options);
diff --git a/builtin/verify-commit.c b/builtin/verify-commit.c
index 7772c07ed7..4b9e823f8f 100644
--- a/builtin/verify-commit.c
+++ b/builtin/verify-commit.c
@@ -21,15 +21,14 @@ static const char * const verify_commit_usage[] = {
NULL
};
-static int run_gpg_verify(const struct object_id *oid, const char *buf, unsigned long size, unsigned flags)
+static int run_gpg_verify(struct commit *commit, unsigned flags)
{
struct signature_check signature_check;
int ret;
memset(&signature_check, 0, sizeof(signature_check));
- ret = check_commit_signature(lookup_commit(the_repository, oid),
- &signature_check);
+ ret = check_commit_signature(commit, &signature_check);
print_signature_buffer(&signature_check, flags);
signature_check_clear(&signature_check);
@@ -38,26 +37,20 @@ static int run_gpg_verify(const struct object_id *oid, const char *buf, unsigned
static int verify_commit(const char *name, unsigned flags)
{
- enum object_type type;
struct object_id oid;
- char *buf;
- unsigned long size;
- int ret;
+ struct object *obj;
if (get_oid(name, &oid))
return error("commit '%s' not found.", name);
- buf = read_object_file(&oid, &type, &size);
- if (!buf)
+ obj = parse_object(the_repository, &oid);
+ if (!obj)
return error("%s: unable to read file.", name);
- if (type != OBJ_COMMIT)
+ if (obj->type != OBJ_COMMIT)
return error("%s: cannot verify a non-commit object of type %s.",
- name, type_name(type));
-
- ret = run_gpg_verify(&oid, buf, size, flags);
+ name, type_name(obj->type));
- free(buf);
- return ret;
+ return run_gpg_verify((struct commit *)obj, flags);
}
static int git_verify_commit_config(const char *var, const char *value, void *cb)
diff --git a/builtin/write-tree.c b/builtin/write-tree.c
index 3d46d22ee5..45d61707e7 100644
--- a/builtin/write-tree.c
+++ b/builtin/write-tree.c
@@ -16,16 +16,16 @@ static const char * const write_tree_usage[] = {
NULL
};
-int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
+int cmd_write_tree(int argc, const char **argv, const char *cmd_prefix)
{
int flags = 0, ret;
- const char *prefix = NULL;
+ const char *tree_prefix = NULL;
struct object_id oid;
const char *me = "git-write-tree";
struct option write_tree_options[] = {
OPT_BIT(0, "missing-ok", &flags, N_("allow missing objects"),
WRITE_TREE_MISSING_OK),
- OPT_STRING(0, "prefix", &prefix, N_("<prefix>/"),
+ OPT_STRING(0, "prefix", &tree_prefix, N_("<prefix>/"),
N_("write tree object for a subdirectory <prefix>")),
{ OPTION_BIT, 0, "ignore-cache-tree", &flags, NULL,
N_("only useful for debugging"),
@@ -35,10 +35,10 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
};
git_config(git_default_config, NULL);
- argc = parse_options(argc, argv, unused_prefix, write_tree_options,
+ argc = parse_options(argc, argv, cmd_prefix, write_tree_options,
write_tree_usage, 0);
- ret = write_cache_as_tree(&oid, flags, prefix);
+ ret = write_cache_as_tree(&oid, flags, tree_prefix);
switch (ret) {
case 0:
printf("%s\n", oid_to_hex(&oid));
@@ -50,7 +50,7 @@ int cmd_write_tree(int argc, const char **argv, const char *unused_prefix)
die("%s: error building trees", me);
break;
case WRITE_TREE_PREFIX_ERROR:
- die("%s: prefix %s not found", me, prefix);
+ die("%s: prefix %s not found", me, tree_prefix);
break;
}
return ret;