Merge branch 'jk/unused-params-even-more'
Code cleanup. * jk/unused-params-even-more: parse_opt_ref_sorting: always use with NONEG flag pretty: drop unused strbuf from parse_padding_placeholder() pretty: drop unused "type" parameter in needs_rfc2047_encoding() parse-options: drop unused ctx parameter from show_gitcomp() fetch_pack(): drop unused parameters report_path_error(): drop unused prefix parameter unpack-trees: drop unused error_type parameters unpack-trees: drop name_entry from traverse_by_cache_tree() test-date: drop unused "now" parameter from parse_dates() update-index: drop unused prefix_length parameter from do_reupdate() log: drop unused "len" from show_tagger() log: drop unused rev_info from early output revision: drop some unused "revs" parametersmaint
commit
4284497396
|
@ -644,8 +644,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
|
||||||
OPT_MERGED(&filter, N_("print only branches that are merged")),
|
OPT_MERGED(&filter, N_("print only branches that are merged")),
|
||||||
OPT_NO_MERGED(&filter, N_("print only branches that are not merged")),
|
OPT_NO_MERGED(&filter, N_("print only branches that are not merged")),
|
||||||
OPT_COLUMN(0, "column", &colopts, N_("list branches in columns")),
|
OPT_COLUMN(0, "column", &colopts, N_("list branches in columns")),
|
||||||
OPT_CALLBACK(0 , "sort", sorting_tail, N_("key"),
|
OPT_REF_SORT(sorting_tail),
|
||||||
N_("field name to sort on"), &parse_opt_ref_sorting),
|
|
||||||
{
|
{
|
||||||
OPTION_CALLBACK, 0, "points-at", &filter.points_at, N_("object"),
|
OPTION_CALLBACK, 0, "points-at", &filter.points_at, N_("object"),
|
||||||
N_("print only branches of the object"), 0, parse_opt_object_name
|
N_("print only branches of the object"), 0, parse_opt_object_name
|
||||||
|
|
|
@ -376,7 +376,7 @@ static int checkout_paths(const struct checkout_opts *opts,
|
||||||
ps_matched,
|
ps_matched,
|
||||||
opts);
|
opts);
|
||||||
|
|
||||||
if (report_path_error(ps_matched, &opts->pathspec, opts->prefix)) {
|
if (report_path_error(ps_matched, &opts->pathspec)) {
|
||||||
free(ps_matched);
|
free(ps_matched);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,7 +235,7 @@ static int commit_index_files(void)
|
||||||
* and return the paths that match the given pattern in list.
|
* and return the paths that match the given pattern in list.
|
||||||
*/
|
*/
|
||||||
static int list_paths(struct string_list *list, const char *with_tree,
|
static int list_paths(struct string_list *list, const char *with_tree,
|
||||||
const char *prefix, const struct pathspec *pattern)
|
const struct pathspec *pattern)
|
||||||
{
|
{
|
||||||
int i, ret;
|
int i, ret;
|
||||||
char *m;
|
char *m;
|
||||||
|
@ -264,7 +264,7 @@ static int list_paths(struct string_list *list, const char *with_tree,
|
||||||
item->util = item; /* better a valid pointer than a fake one */
|
item->util = item; /* better a valid pointer than a fake one */
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = report_path_error(m, pattern, prefix);
|
ret = report_path_error(m, pattern);
|
||||||
free(m);
|
free(m);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -454,7 +454,7 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix
|
||||||
die(_("cannot do a partial commit during a cherry-pick."));
|
die(_("cannot do a partial commit during a cherry-pick."));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (list_paths(&partial, !current_head ? NULL : "HEAD", prefix, &pathspec))
|
if (list_paths(&partial, !current_head ? NULL : "HEAD", &pathspec))
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
discard_cache();
|
discard_cache();
|
||||||
|
|
|
@ -234,7 +234,7 @@ int cmd_fetch_pack(int argc, const char **argv, const char *prefix)
|
||||||
BUG("unknown protocol version");
|
BUG("unknown protocol version");
|
||||||
}
|
}
|
||||||
|
|
||||||
ref = fetch_pack(&args, fd, conn, ref, dest, sought, nr_sought,
|
ref = fetch_pack(&args, fd, ref, sought, nr_sought,
|
||||||
&shallow, pack_lockfile_ptr, version);
|
&shallow, pack_lockfile_ptr, version);
|
||||||
if (pack_lockfile) {
|
if (pack_lockfile) {
|
||||||
printf("lock %s\n", pack_lockfile);
|
printf("lock %s\n", pack_lockfile);
|
||||||
|
|
|
@ -37,8 +37,7 @@ int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
|
||||||
OPT_INTEGER( 0 , "count", &maxcount, N_("show only <n> matched refs")),
|
OPT_INTEGER( 0 , "count", &maxcount, N_("show only <n> matched refs")),
|
||||||
OPT_STRING( 0 , "format", &format.format, N_("format"), N_("format to use for the output")),
|
OPT_STRING( 0 , "format", &format.format, N_("format"), N_("format to use for the output")),
|
||||||
OPT__COLOR(&format.use_color, N_("respect format colors")),
|
OPT__COLOR(&format.use_color, N_("respect format colors")),
|
||||||
OPT_CALLBACK(0 , "sort", sorting_tail, N_("key"),
|
OPT_REF_SORT(sorting_tail),
|
||||||
N_("field name to sort on"), &parse_opt_ref_sorting),
|
|
||||||
OPT_CALLBACK(0, "points-at", &filter.points_at,
|
OPT_CALLBACK(0, "points-at", &filter.points_at,
|
||||||
N_("object"), N_("print only refs which points at the given object"),
|
N_("object"), N_("print only refs which points at the given object"),
|
||||||
parse_opt_object_name),
|
parse_opt_object_name),
|
||||||
|
|
|
@ -251,7 +251,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
|
||||||
* This gives a rough estimate for how many commits we
|
* This gives a rough estimate for how many commits we
|
||||||
* will print out in the list.
|
* will print out in the list.
|
||||||
*/
|
*/
|
||||||
static int estimate_commit_count(struct rev_info *rev, struct commit_list *list)
|
static int estimate_commit_count(struct commit_list *list)
|
||||||
{
|
{
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ static void log_show_early(struct rev_info *revs, struct commit_list *list)
|
||||||
switch (simplify_commit(revs, commit)) {
|
switch (simplify_commit(revs, commit)) {
|
||||||
case commit_show:
|
case commit_show:
|
||||||
if (show_header) {
|
if (show_header) {
|
||||||
int n = estimate_commit_count(revs, list);
|
int n = estimate_commit_count(list);
|
||||||
show_early_header(revs, "incomplete", n);
|
show_early_header(revs, "incomplete", n);
|
||||||
show_header = 0;
|
show_header = 0;
|
||||||
}
|
}
|
||||||
|
@ -333,7 +333,7 @@ static void early_output(int signal)
|
||||||
show_early_output = log_show_early;
|
show_early_output = log_show_early;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setup_early_output(struct rev_info *rev)
|
static void setup_early_output(void)
|
||||||
{
|
{
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
|
@ -364,7 +364,7 @@ static void setup_early_output(struct rev_info *rev)
|
||||||
|
|
||||||
static void finish_early_output(struct rev_info *rev)
|
static void finish_early_output(struct rev_info *rev)
|
||||||
{
|
{
|
||||||
int n = estimate_commit_count(rev, rev->commits);
|
int n = estimate_commit_count(rev->commits);
|
||||||
signal(SIGALRM, SIG_IGN);
|
signal(SIGALRM, SIG_IGN);
|
||||||
show_early_header(rev, "done", n);
|
show_early_header(rev, "done", n);
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ static int cmd_log_walk(struct rev_info *rev)
|
||||||
int saved_dcctc = 0, close_file = rev->diffopt.close_file;
|
int saved_dcctc = 0, close_file = rev->diffopt.close_file;
|
||||||
|
|
||||||
if (rev->early_output)
|
if (rev->early_output)
|
||||||
setup_early_output(rev);
|
setup_early_output();
|
||||||
|
|
||||||
if (prepare_revision_walk(rev))
|
if (prepare_revision_walk(rev))
|
||||||
die(_("revision walk setup failed"));
|
die(_("revision walk setup failed"));
|
||||||
|
@ -490,7 +490,7 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix)
|
||||||
return cmd_log_walk(&rev);
|
return cmd_log_walk(&rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_tagger(char *buf, int len, struct rev_info *rev)
|
static void show_tagger(const char *buf, struct rev_info *rev)
|
||||||
{
|
{
|
||||||
struct strbuf out = STRBUF_INIT;
|
struct strbuf out = STRBUF_INIT;
|
||||||
struct pretty_print_context pp = {0};
|
struct pretty_print_context pp = {0};
|
||||||
|
@ -546,11 +546,11 @@ static int show_tag_object(const struct object_id *oid, struct rev_info *rev)
|
||||||
assert(type == OBJ_TAG);
|
assert(type == OBJ_TAG);
|
||||||
while (offset < size && buf[offset] != '\n') {
|
while (offset < size && buf[offset] != '\n') {
|
||||||
int new_offset = offset + 1;
|
int new_offset = offset + 1;
|
||||||
|
const char *ident;
|
||||||
while (new_offset < size && buf[new_offset++] != '\n')
|
while (new_offset < size && buf[new_offset++] != '\n')
|
||||||
; /* do nothing */
|
; /* do nothing */
|
||||||
if (starts_with(buf + offset, "tagger "))
|
if (skip_prefix(buf + offset, "tagger ", &ident))
|
||||||
show_tagger(buf + offset + 7,
|
show_tagger(ident, rev);
|
||||||
new_offset - offset - 7, rev);
|
|
||||||
offset = new_offset;
|
offset = new_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -680,7 +680,7 @@ int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix)
|
||||||
|
|
||||||
if (ps_matched) {
|
if (ps_matched) {
|
||||||
int bad;
|
int bad;
|
||||||
bad = report_path_error(ps_matched, &pathspec, prefix);
|
bad = report_path_error(ps_matched, &pathspec);
|
||||||
if (bad)
|
if (bad)
|
||||||
fprintf(stderr, "Did you forget to 'git add'?\n");
|
fprintf(stderr, "Did you forget to 'git add'?\n");
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,7 @@ int cmd_ls_remote(int argc, const char **argv, const char *prefix)
|
||||||
OPT_BIT(0, "refs", &flags, N_("do not show peeled tags"), REF_NORMAL),
|
OPT_BIT(0, "refs", &flags, N_("do not show peeled tags"), REF_NORMAL),
|
||||||
OPT_BOOL(0, "get-url", &get_url,
|
OPT_BOOL(0, "get-url", &get_url,
|
||||||
N_("take url.<base>.insteadOf into account")),
|
N_("take url.<base>.insteadOf into account")),
|
||||||
OPT_CALLBACK(0 , "sort", sorting_tail, N_("key"),
|
OPT_REF_SORT(sorting_tail),
|
||||||
N_("field name to sort on"), &parse_opt_ref_sorting),
|
|
||||||
OPT_SET_INT_F(0, "exit-code", &status,
|
OPT_SET_INT_F(0, "exit-code", &status,
|
||||||
N_("exit with exit code 2 if no matching refs are found"),
|
N_("exit with exit code 2 if no matching refs are found"),
|
||||||
2, PARSE_OPT_NOCOMPLETE),
|
2, PARSE_OPT_NOCOMPLETE),
|
||||||
|
|
|
@ -1280,7 +1280,7 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
|
||||||
ce_path_match(&the_index, active_cache[i], ps,
|
ce_path_match(&the_index, active_cache[i], ps,
|
||||||
ps_matched);
|
ps_matched);
|
||||||
|
|
||||||
if (report_path_error(ps_matched, ps, NULL)) {
|
if (report_path_error(ps_matched, ps)) {
|
||||||
fprintf_ln(stderr, _("Did you forget to 'git add'?"));
|
fprintf_ln(stderr, _("Did you forget to 'git add'?"));
|
||||||
ret = -1;
|
ret = -1;
|
||||||
free(ps_matched);
|
free(ps_matched);
|
||||||
|
|
|
@ -348,7 +348,7 @@ static int module_list_compute(int argc, const char **argv,
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps_matched && report_path_error(ps_matched, pathspec, prefix))
|
if (ps_matched && report_path_error(ps_matched, pathspec))
|
||||||
result = -1;
|
result = -1;
|
||||||
|
|
||||||
free(ps_matched);
|
free(ps_matched);
|
||||||
|
|
|
@ -412,8 +412,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
|
||||||
OPT_WITHOUT(&filter.no_commit, N_("print only tags that don't contain the commit")),
|
OPT_WITHOUT(&filter.no_commit, N_("print only tags that don't contain the commit")),
|
||||||
OPT_MERGED(&filter, N_("print only tags that are merged")),
|
OPT_MERGED(&filter, N_("print only tags that are merged")),
|
||||||
OPT_NO_MERGED(&filter, N_("print only tags that are not merged")),
|
OPT_NO_MERGED(&filter, N_("print only tags that are not merged")),
|
||||||
OPT_CALLBACK(0 , "sort", sorting_tail, N_("key"),
|
OPT_REF_SORT(sorting_tail),
|
||||||
N_("field name to sort on"), &parse_opt_ref_sorting),
|
|
||||||
{
|
{
|
||||||
OPTION_CALLBACK, 0, "points-at", &filter.points_at, N_("object"),
|
OPTION_CALLBACK, 0, "points-at", &filter.points_at, N_("object"),
|
||||||
N_("print only tags of the object"), PARSE_OPT_LASTARG_DEFAULT,
|
N_("print only tags of the object"), PARSE_OPT_LASTARG_DEFAULT,
|
||||||
|
|
|
@ -724,7 +724,7 @@ static int do_unresolve(int ac, const char **av,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_reupdate(int ac, const char **av,
|
static int do_reupdate(int ac, const char **av,
|
||||||
const char *prefix, int prefix_length)
|
const char *prefix)
|
||||||
{
|
{
|
||||||
/* Read HEAD and run update-index on paths that are
|
/* Read HEAD and run update-index on paths that are
|
||||||
* merged and already different between index and HEAD.
|
* merged and already different between index and HEAD.
|
||||||
|
@ -940,8 +940,7 @@ static enum parse_opt_result reupdate_callback(
|
||||||
|
|
||||||
/* consume remaining arguments. */
|
/* consume remaining arguments. */
|
||||||
setup_work_tree();
|
setup_work_tree();
|
||||||
*has_errors = do_reupdate(ctx->argc, ctx->argv,
|
*has_errors = do_reupdate(ctx->argc, ctx->argv, prefix);
|
||||||
prefix, prefix ? strlen(prefix) : 0);
|
|
||||||
if (*has_errors)
|
if (*has_errors)
|
||||||
active_cache_changed = 0;
|
active_cache_changed = 0;
|
||||||
|
|
||||||
|
|
3
dir.c
3
dir.c
|
@ -502,8 +502,7 @@ int submodule_path_match(const struct index_state *istate,
|
||||||
}
|
}
|
||||||
|
|
||||||
int report_path_error(const char *ps_matched,
|
int report_path_error(const char *ps_matched,
|
||||||
const struct pathspec *pathspec,
|
const struct pathspec *pathspec)
|
||||||
const char *prefix)
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Make sure all pathspec matched; otherwise it is an error.
|
* Make sure all pathspec matched; otherwise it is an error.
|
||||||
|
|
2
dir.h
2
dir.h
|
@ -220,7 +220,7 @@ extern int match_pathspec(const struct index_state *istate,
|
||||||
const struct pathspec *pathspec,
|
const struct pathspec *pathspec,
|
||||||
const char *name, int namelen,
|
const char *name, int namelen,
|
||||||
int prefix, char *seen, int is_dir);
|
int prefix, char *seen, int is_dir);
|
||||||
extern int report_path_error(const char *ps_matched, const struct pathspec *pathspec, const char *prefix);
|
extern int report_path_error(const char *ps_matched, const struct pathspec *pathspec);
|
||||||
extern int within_depth(const char *name, int namelen, int depth, int max_depth);
|
extern int within_depth(const char *name, int namelen, int depth, int max_depth);
|
||||||
|
|
||||||
extern int fill_directory(struct dir_struct *dir,
|
extern int fill_directory(struct dir_struct *dir,
|
||||||
|
|
|
@ -1615,9 +1615,8 @@ static int iterate_ref_map(void *cb_data, struct object_id *oid)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ref *fetch_pack(struct fetch_pack_args *args,
|
struct ref *fetch_pack(struct fetch_pack_args *args,
|
||||||
int fd[], struct child_process *conn,
|
int fd[],
|
||||||
const struct ref *ref,
|
const struct ref *ref,
|
||||||
const char *dest,
|
|
||||||
struct ref **sought, int nr_sought,
|
struct ref **sought, int nr_sought,
|
||||||
struct oid_array *shallow,
|
struct oid_array *shallow,
|
||||||
char **pack_lockfile,
|
char **pack_lockfile,
|
||||||
|
|
|
@ -78,9 +78,8 @@ struct fetch_pack_args {
|
||||||
* marked as such.
|
* marked as such.
|
||||||
*/
|
*/
|
||||||
struct ref *fetch_pack(struct fetch_pack_args *args,
|
struct ref *fetch_pack(struct fetch_pack_args *args,
|
||||||
int fd[], struct child_process *conn,
|
int fd[],
|
||||||
const struct ref *ref,
|
const struct ref *ref,
|
||||||
const char *dest,
|
|
||||||
struct ref **sought,
|
struct ref **sought,
|
||||||
int nr_sought,
|
int nr_sought,
|
||||||
struct oid_array *shallow,
|
struct oid_array *shallow,
|
||||||
|
|
|
@ -529,8 +529,7 @@ static void show_negated_gitcomp(const struct option *opts, int nr_noopts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int show_gitcomp(struct parse_opt_ctx_t *ctx,
|
static int show_gitcomp(const struct option *opts)
|
||||||
const struct option *opts)
|
|
||||||
{
|
{
|
||||||
const struct option *original_opts = opts;
|
const struct option *original_opts = opts;
|
||||||
int nr_noopts = 0;
|
int nr_noopts = 0;
|
||||||
|
@ -609,7 +608,7 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
|
||||||
|
|
||||||
/* lone --git-completion-helper is asked by git-completion.bash */
|
/* lone --git-completion-helper is asked by git-completion.bash */
|
||||||
if (ctx->total == 1 && !strcmp(arg + 1, "-git-completion-helper"))
|
if (ctx->total == 1 && !strcmp(arg + 1, "-git-completion-helper"))
|
||||||
return show_gitcomp(ctx, options);
|
return show_gitcomp(options);
|
||||||
|
|
||||||
if (arg[1] != '-') {
|
if (arg[1] != '-') {
|
||||||
ctx->opt = arg + 1;
|
ctx->opt = arg + 1;
|
||||||
|
|
12
pretty.c
12
pretty.c
|
@ -343,8 +343,7 @@ static int is_rfc2047_special(char ch, enum rfc2047_type type)
|
||||||
return !(isalnum(ch) || ch == '!' || ch == '*' || ch == '+' || ch == '-' || ch == '/');
|
return !(isalnum(ch) || ch == '!' || ch == '*' || ch == '+' || ch == '-' || ch == '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
static int needs_rfc2047_encoding(const char *line, int len,
|
static int needs_rfc2047_encoding(const char *line, int len)
|
||||||
enum rfc2047_type type)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -470,7 +469,7 @@ void pp_user_info(struct pretty_print_context *pp,
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_addstr(sb, "From: ");
|
strbuf_addstr(sb, "From: ");
|
||||||
if (needs_rfc2047_encoding(namebuf, namelen, RFC2047_ADDRESS)) {
|
if (needs_rfc2047_encoding(namebuf, namelen)) {
|
||||||
add_rfc2047(sb, namebuf, namelen,
|
add_rfc2047(sb, namebuf, namelen,
|
||||||
encoding, RFC2047_ADDRESS);
|
encoding, RFC2047_ADDRESS);
|
||||||
max_length = 76; /* per rfc2047 */
|
max_length = 76; /* per rfc2047 */
|
||||||
|
@ -989,8 +988,7 @@ static size_t parse_color(struct strbuf *sb, /* in UTF-8 */
|
||||||
return rest - placeholder;
|
return rest - placeholder;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t parse_padding_placeholder(struct strbuf *sb,
|
static size_t parse_padding_placeholder(const char *placeholder,
|
||||||
const char *placeholder,
|
|
||||||
struct format_commit_context *c)
|
struct format_commit_context *c)
|
||||||
{
|
{
|
||||||
const char *ch = placeholder;
|
const char *ch = placeholder;
|
||||||
|
@ -1195,7 +1193,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
|
||||||
|
|
||||||
case '<':
|
case '<':
|
||||||
case '>':
|
case '>':
|
||||||
return parse_padding_placeholder(sb, placeholder, c);
|
return parse_padding_placeholder(placeholder, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* these depend on the commit */
|
/* these depend on the commit */
|
||||||
|
@ -1728,7 +1726,7 @@ void pp_title_line(struct pretty_print_context *pp,
|
||||||
if (pp->print_email_subject) {
|
if (pp->print_email_subject) {
|
||||||
if (pp->rev)
|
if (pp->rev)
|
||||||
fmt_output_email_subject(sb, pp->rev);
|
fmt_output_email_subject(sb, pp->rev);
|
||||||
if (needs_rfc2047_encoding(title.buf, title.len, RFC2047_SUBJECT))
|
if (needs_rfc2047_encoding(title.buf, title.len))
|
||||||
add_rfc2047(sb, title.buf, title.len,
|
add_rfc2047(sb, title.buf, title.len,
|
||||||
encoding, RFC2047_SUBJECT);
|
encoding, RFC2047_SUBJECT);
|
||||||
else
|
else
|
||||||
|
|
|
@ -2337,8 +2337,13 @@ void parse_ref_sorting(struct ref_sorting **sorting_tail, const char *arg)
|
||||||
|
|
||||||
int parse_opt_ref_sorting(const struct option *opt, const char *arg, int unset)
|
int parse_opt_ref_sorting(const struct option *opt, const char *arg, int unset)
|
||||||
{
|
{
|
||||||
if (!arg) /* should --no-sort void the list ? */
|
/*
|
||||||
return -1;
|
* NEEDSWORK: We should probably clear the list in this case, but we've
|
||||||
|
* already munged the global used_atoms list, which would need to be
|
||||||
|
* undone.
|
||||||
|
*/
|
||||||
|
BUG_ON_OPT_NEG(unset);
|
||||||
|
|
||||||
parse_ref_sorting(opt->value, arg);
|
parse_ref_sorting(opt->value, arg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,11 @@ struct ref_format {
|
||||||
#define OPT_MERGED(f, h) _OPT_MERGED_NO_MERGED("merged", f, h)
|
#define OPT_MERGED(f, h) _OPT_MERGED_NO_MERGED("merged", f, h)
|
||||||
#define OPT_NO_MERGED(f, h) _OPT_MERGED_NO_MERGED("no-merged", f, h)
|
#define OPT_NO_MERGED(f, h) _OPT_MERGED_NO_MERGED("no-merged", f, h)
|
||||||
|
|
||||||
|
#define OPT_REF_SORT(var) \
|
||||||
|
OPT_CALLBACK_F(0, "sort", (var), \
|
||||||
|
N_("key"), N_("field name to sort on"), \
|
||||||
|
PARSE_OPT_NONEG, parse_opt_ref_sorting)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* API for filtering a set of refs. Based on the type of refs the user
|
* API for filtering a set of refs. Based on the type of refs the user
|
||||||
* has requested, we iterate through those refs and apply filters
|
* has requested, we iterate through those refs and apply filters
|
||||||
|
|
12
revision.c
12
revision.c
|
@ -1894,7 +1894,7 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs, int flags, unsi
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_pathspec_from_stdin(struct rev_info *revs, struct strbuf *sb,
|
static void read_pathspec_from_stdin(struct strbuf *sb,
|
||||||
struct argv_array *prune)
|
struct argv_array *prune)
|
||||||
{
|
{
|
||||||
while (strbuf_getline(sb, stdin) != EOF)
|
while (strbuf_getline(sb, stdin) != EOF)
|
||||||
|
@ -1928,7 +1928,7 @@ static void read_revisions_from_stdin(struct rev_info *revs,
|
||||||
die("bad revision '%s'", sb.buf);
|
die("bad revision '%s'", sb.buf);
|
||||||
}
|
}
|
||||||
if (seen_dashdash)
|
if (seen_dashdash)
|
||||||
read_pathspec_from_stdin(revs, &sb, prune);
|
read_pathspec_from_stdin(&sb, prune);
|
||||||
|
|
||||||
strbuf_release(&sb);
|
strbuf_release(&sb);
|
||||||
warn_on_object_refname_ambiguity = save_warning;
|
warn_on_object_refname_ambiguity = save_warning;
|
||||||
|
@ -2752,7 +2752,7 @@ static struct merge_simplify_state *locate_simplify_state(struct rev_info *revs,
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mark_redundant_parents(struct rev_info *revs, struct commit *commit)
|
static int mark_redundant_parents(struct commit *commit)
|
||||||
{
|
{
|
||||||
struct commit_list *h = reduce_heads(commit->parents);
|
struct commit_list *h = reduce_heads(commit->parents);
|
||||||
int i = 0, marked = 0;
|
int i = 0, marked = 0;
|
||||||
|
@ -2788,7 +2788,7 @@ static int mark_redundant_parents(struct rev_info *revs, struct commit *commit)
|
||||||
return marked;
|
return marked;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mark_treesame_root_parents(struct rev_info *revs, struct commit *commit)
|
static int mark_treesame_root_parents(struct commit *commit)
|
||||||
{
|
{
|
||||||
struct commit_list *p;
|
struct commit_list *p;
|
||||||
int marked = 0;
|
int marked = 0;
|
||||||
|
@ -2980,8 +2980,8 @@ static struct commit_list **simplify_one(struct rev_info *revs, struct commit *c
|
||||||
* Detect and simplify both cases.
|
* Detect and simplify both cases.
|
||||||
*/
|
*/
|
||||||
if (1 < cnt) {
|
if (1 < cnt) {
|
||||||
int marked = mark_redundant_parents(revs, commit);
|
int marked = mark_redundant_parents(commit);
|
||||||
marked += mark_treesame_root_parents(revs, commit);
|
marked += mark_treesame_root_parents(commit);
|
||||||
if (marked)
|
if (marked)
|
||||||
marked -= leave_one_treesame_to_parent(revs, commit);
|
marked -= leave_one_treesame_to_parent(revs, commit);
|
||||||
if (marked)
|
if (marked)
|
||||||
|
|
|
@ -55,7 +55,7 @@ static void show_dates(const char **argv, const char *format)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_dates(const char **argv, struct timeval *now)
|
static void parse_dates(const char **argv)
|
||||||
{
|
{
|
||||||
struct strbuf result = STRBUF_INIT;
|
struct strbuf result = STRBUF_INIT;
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ int cmd__date(int argc, const char **argv)
|
||||||
else if (skip_prefix(*argv, "show:", &x))
|
else if (skip_prefix(*argv, "show:", &x))
|
||||||
show_dates(argv+1, x);
|
show_dates(argv+1, x);
|
||||||
else if (!strcmp(*argv, "parse"))
|
else if (!strcmp(*argv, "parse"))
|
||||||
parse_dates(argv+1, &now);
|
parse_dates(argv+1);
|
||||||
else if (!strcmp(*argv, "approxidate"))
|
else if (!strcmp(*argv, "approxidate"))
|
||||||
parse_approxidate(argv+1, &now);
|
parse_approxidate(argv+1, &now);
|
||||||
else if (!strcmp(*argv, "timestamp"))
|
else if (!strcmp(*argv, "timestamp"))
|
||||||
|
|
10
transport.c
10
transport.c
|
@ -314,7 +314,6 @@ static int fetch_refs_via_pack(struct transport *transport,
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct git_transport_data *data = transport->data;
|
struct git_transport_data *data = transport->data;
|
||||||
struct ref *refs = NULL;
|
struct ref *refs = NULL;
|
||||||
char *dest = xstrdup(transport->url);
|
|
||||||
struct fetch_pack_args args;
|
struct fetch_pack_args args;
|
||||||
struct ref *refs_tmp = NULL;
|
struct ref *refs_tmp = NULL;
|
||||||
|
|
||||||
|
@ -356,16 +355,16 @@ static int fetch_refs_via_pack(struct transport *transport,
|
||||||
|
|
||||||
switch (data->version) {
|
switch (data->version) {
|
||||||
case protocol_v2:
|
case protocol_v2:
|
||||||
refs = fetch_pack(&args, data->fd, data->conn,
|
refs = fetch_pack(&args, data->fd,
|
||||||
refs_tmp ? refs_tmp : transport->remote_refs,
|
refs_tmp ? refs_tmp : transport->remote_refs,
|
||||||
dest, to_fetch, nr_heads, &data->shallow,
|
to_fetch, nr_heads, &data->shallow,
|
||||||
&transport->pack_lockfile, data->version);
|
&transport->pack_lockfile, data->version);
|
||||||
break;
|
break;
|
||||||
case protocol_v1:
|
case protocol_v1:
|
||||||
case protocol_v0:
|
case protocol_v0:
|
||||||
refs = fetch_pack(&args, data->fd, data->conn,
|
refs = fetch_pack(&args, data->fd,
|
||||||
refs_tmp ? refs_tmp : transport->remote_refs,
|
refs_tmp ? refs_tmp : transport->remote_refs,
|
||||||
dest, to_fetch, nr_heads, &data->shallow,
|
to_fetch, nr_heads, &data->shallow,
|
||||||
&transport->pack_lockfile, data->version);
|
&transport->pack_lockfile, data->version);
|
||||||
break;
|
break;
|
||||||
case protocol_unknown_version:
|
case protocol_unknown_version:
|
||||||
|
@ -389,7 +388,6 @@ static int fetch_refs_via_pack(struct transport *transport,
|
||||||
|
|
||||||
free_refs(refs_tmp);
|
free_refs(refs_tmp);
|
||||||
free_refs(refs);
|
free_refs(refs);
|
||||||
free(dest);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -707,7 +707,6 @@ static int index_pos_by_traverse_info(struct name_entry *names,
|
||||||
* instead of ODB since we already know what these trees contain.
|
* instead of ODB since we already know what these trees contain.
|
||||||
*/
|
*/
|
||||||
static int traverse_by_cache_tree(int pos, int nr_entries, int nr_names,
|
static int traverse_by_cache_tree(int pos, int nr_entries, int nr_names,
|
||||||
struct name_entry *names,
|
|
||||||
struct traverse_info *info)
|
struct traverse_info *info)
|
||||||
{
|
{
|
||||||
struct cache_entry *src[MAX_UNPACK_TREES + 1] = { NULL, };
|
struct cache_entry *src[MAX_UNPACK_TREES + 1] = { NULL, };
|
||||||
|
@ -797,7 +796,7 @@ static int traverse_trees_recursive(int n, unsigned long dirmask,
|
||||||
* unprocessed entries before 'pos'.
|
* unprocessed entries before 'pos'.
|
||||||
*/
|
*/
|
||||||
bottom = o->cache_bottom;
|
bottom = o->cache_bottom;
|
||||||
ret = traverse_by_cache_tree(pos, nr_entries, n, names, info);
|
ret = traverse_by_cache_tree(pos, nr_entries, n, info);
|
||||||
o->cache_bottom = bottom;
|
o->cache_bottom = bottom;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1761,7 +1760,6 @@ static void invalidate_ce_path(const struct cache_entry *ce,
|
||||||
*/
|
*/
|
||||||
static int verify_clean_submodule(const char *old_sha1,
|
static int verify_clean_submodule(const char *old_sha1,
|
||||||
const struct cache_entry *ce,
|
const struct cache_entry *ce,
|
||||||
enum unpack_trees_error_types error_type,
|
|
||||||
struct unpack_trees_options *o)
|
struct unpack_trees_options *o)
|
||||||
{
|
{
|
||||||
if (!submodule_from_ce(ce))
|
if (!submodule_from_ce(ce))
|
||||||
|
@ -1772,7 +1770,6 @@ static int verify_clean_submodule(const char *old_sha1,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int verify_clean_subdirectory(const struct cache_entry *ce,
|
static int verify_clean_subdirectory(const struct cache_entry *ce,
|
||||||
enum unpack_trees_error_types error_type,
|
|
||||||
struct unpack_trees_options *o)
|
struct unpack_trees_options *o)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
|
@ -1795,7 +1792,7 @@ static int verify_clean_subdirectory(const struct cache_entry *ce,
|
||||||
if (!sub_head && oideq(&oid, &ce->oid))
|
if (!sub_head && oideq(&oid, &ce->oid))
|
||||||
return 0;
|
return 0;
|
||||||
return verify_clean_submodule(sub_head ? NULL : oid_to_hex(&oid),
|
return verify_clean_submodule(sub_head ? NULL : oid_to_hex(&oid),
|
||||||
ce, error_type, o);
|
ce, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1891,7 +1888,7 @@ static int check_ok_to_remove(const char *name, int len, int dtype,
|
||||||
* files that are in "foo/" we would lose
|
* files that are in "foo/" we would lose
|
||||||
* them.
|
* them.
|
||||||
*/
|
*/
|
||||||
if (verify_clean_subdirectory(ce, error_type, o) < 0)
|
if (verify_clean_subdirectory(ce, o) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue