Merge branch 'jk/setup-revisions-freefix'
There are double frees and leaks around setup_revisions() API used in "git stash show", which has been fixed, and setup_revisions() API gained a wrapper to make it more ergonomic when using it with strvec-manged argc/argv pairs. * jk/setup-revisions-freefix: revision: retain argv NULL invariant in setup_revisions() treewide: pass strvecs around for setup_revisions_from_strvec() treewide: use setup_revisions_from_strvec() when we have a strvec revision: add wrapper to setup_revisions() from a strvec revision: manage memory ownership of argv in setup_revisions() stash: tell setup_revisions() to free our allocated strings
This commit is contained in:
5
bisect.c
5
bisect.c
@@ -674,9 +674,6 @@ static void bisect_rev_setup(struct repository *r, struct rev_info *revs,
|
|||||||
const char *bad_format, const char *good_format,
|
const char *bad_format, const char *good_format,
|
||||||
int read_paths)
|
int read_paths)
|
||||||
{
|
{
|
||||||
struct setup_revision_opt opt = {
|
|
||||||
.free_removed_argv_elements = 1,
|
|
||||||
};
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
repo_init_revisions(r, revs, prefix);
|
repo_init_revisions(r, revs, prefix);
|
||||||
@@ -693,7 +690,7 @@ static void bisect_rev_setup(struct repository *r, struct rev_info *revs,
|
|||||||
if (read_paths)
|
if (read_paths)
|
||||||
read_bisect_paths(rev_argv);
|
read_bisect_paths(rev_argv);
|
||||||
|
|
||||||
setup_revisions(rev_argv->nr, rev_argv->v, revs, &opt);
|
setup_revisions_from_strvec(rev_argv, revs, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bisect_common(struct rev_info *revs)
|
static void bisect_common(struct rev_info *revs)
|
||||||
|
|||||||
@@ -580,7 +580,8 @@ static void describe_blob(const struct object_id *oid, struct strbuf *dst)
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
repo_init_revisions(the_repository, &revs, NULL);
|
repo_init_revisions(the_repository, &revs, NULL);
|
||||||
if (setup_revisions(args.nr, args.v, &revs, NULL) > 1)
|
setup_revisions_from_strvec(&args, &revs, NULL);
|
||||||
|
if (args.nr > 1)
|
||||||
BUG("setup_revisions could not handle all args?");
|
BUG("setup_revisions could not handle all args?");
|
||||||
|
|
||||||
if (prepare_revision_walk(&revs))
|
if (prepare_revision_walk(&revs))
|
||||||
|
|||||||
@@ -4650,7 +4650,7 @@ static void get_object_list_path_walk(struct rev_info *revs)
|
|||||||
die(_("failed to pack objects via path-walk"));
|
die(_("failed to pack objects via path-walk"));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_object_list(struct rev_info *revs, int ac, const char **av)
|
static void get_object_list(struct rev_info *revs, struct strvec *argv)
|
||||||
{
|
{
|
||||||
struct setup_revision_opt s_r_opt = {
|
struct setup_revision_opt s_r_opt = {
|
||||||
.allow_exclude_promisor_objects = 1,
|
.allow_exclude_promisor_objects = 1,
|
||||||
@@ -4660,7 +4660,7 @@ static void get_object_list(struct rev_info *revs, int ac, const char **av)
|
|||||||
int save_warning;
|
int save_warning;
|
||||||
|
|
||||||
save_commit_buffer = 0;
|
save_commit_buffer = 0;
|
||||||
setup_revisions(ac, av, revs, &s_r_opt);
|
setup_revisions_from_strvec(argv, revs, &s_r_opt);
|
||||||
|
|
||||||
/* make sure shallows are read */
|
/* make sure shallows are read */
|
||||||
is_repository_shallow(the_repository);
|
is_repository_shallow(the_repository);
|
||||||
@@ -5229,7 +5229,7 @@ int cmd_pack_objects(int argc,
|
|||||||
revs.include_check = is_not_in_promisor_pack;
|
revs.include_check = is_not_in_promisor_pack;
|
||||||
revs.include_check_obj = is_not_in_promisor_pack_obj;
|
revs.include_check_obj = is_not_in_promisor_pack_obj;
|
||||||
}
|
}
|
||||||
get_object_list(&revs, rp.nr, rp.v);
|
get_object_list(&revs, &rp);
|
||||||
release_revisions(&revs);
|
release_revisions(&revs);
|
||||||
}
|
}
|
||||||
cleanup_preferred_base();
|
cleanup_preferred_base();
|
||||||
|
|||||||
@@ -299,8 +299,7 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
|
|||||||
oid_to_hex(&opts->restrict_revision->object.oid));
|
oid_to_hex(&opts->restrict_revision->object.oid));
|
||||||
|
|
||||||
ret = sequencer_make_script(the_repository, &todo_list.buf,
|
ret = sequencer_make_script(the_repository, &todo_list.buf,
|
||||||
make_script_args.nr, make_script_args.v,
|
&make_script_args, flags);
|
||||||
flags);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
error(_("could not generate todo list"));
|
error(_("could not generate todo list"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|||||||
@@ -1015,8 +1015,8 @@ static int show_stash(int argc, const char **argv, const char *prefix,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
argc = setup_revisions(revision_args.nr, revision_args.v, &rev, NULL);
|
setup_revisions_from_strvec(&revision_args, &rev, NULL);
|
||||||
if (argc > 1)
|
if (revision_args.nr > 1)
|
||||||
goto usage;
|
goto usage;
|
||||||
if (!rev.diffopt.output_format) {
|
if (!rev.diffopt.output_format) {
|
||||||
rev.diffopt.output_format = DIFF_FORMAT_PATCH;
|
rev.diffopt.output_format = DIFF_FORMAT_PATCH;
|
||||||
|
|||||||
@@ -616,9 +616,6 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
|
|||||||
struct rev_info rev = REV_INFO_INIT;
|
struct rev_info rev = REV_INFO_INIT;
|
||||||
struct strbuf buf = STRBUF_INIT;
|
struct strbuf buf = STRBUF_INIT;
|
||||||
const char *git_dir;
|
const char *git_dir;
|
||||||
struct setup_revision_opt opt = {
|
|
||||||
.free_removed_argv_elements = 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (validate_submodule_path(path) < 0)
|
if (validate_submodule_path(path) < 0)
|
||||||
die(NULL);
|
die(NULL);
|
||||||
@@ -655,7 +652,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
|
|||||||
|
|
||||||
repo_init_revisions(the_repository, &rev, NULL);
|
repo_init_revisions(the_repository, &rev, NULL);
|
||||||
rev.abbrev = 0;
|
rev.abbrev = 0;
|
||||||
setup_revisions(diff_files_args.nr, diff_files_args.v, &rev, &opt);
|
setup_revisions_from_strvec(&diff_files_args, &rev, NULL);
|
||||||
run_diff_files(&rev, 0);
|
run_diff_files(&rev, 0);
|
||||||
|
|
||||||
if (!diff_result_code(&rev)) {
|
if (!diff_result_code(&rev)) {
|
||||||
@@ -1094,9 +1091,6 @@ static int compute_summary_module_list(struct object_id *head_oid,
|
|||||||
{
|
{
|
||||||
struct strvec diff_args = STRVEC_INIT;
|
struct strvec diff_args = STRVEC_INIT;
|
||||||
struct rev_info rev;
|
struct rev_info rev;
|
||||||
struct setup_revision_opt opt = {
|
|
||||||
.free_removed_argv_elements = 1,
|
|
||||||
};
|
|
||||||
struct module_cb_list list = MODULE_CB_LIST_INIT;
|
struct module_cb_list list = MODULE_CB_LIST_INIT;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
@@ -1114,7 +1108,7 @@ static int compute_summary_module_list(struct object_id *head_oid,
|
|||||||
repo_init_revisions(the_repository, &rev, info->prefix);
|
repo_init_revisions(the_repository, &rev, info->prefix);
|
||||||
rev.abbrev = 0;
|
rev.abbrev = 0;
|
||||||
precompose_argv_prefix(diff_args.nr, diff_args.v, NULL);
|
precompose_argv_prefix(diff_args.nr, diff_args.v, NULL);
|
||||||
setup_revisions(diff_args.nr, diff_args.v, &rev, &opt);
|
setup_revisions_from_strvec(&diff_args, &rev, NULL);
|
||||||
rev.diffopt.output_format = DIFF_FORMAT_NO_OUTPUT | DIFF_FORMAT_CALLBACK;
|
rev.diffopt.output_format = DIFF_FORMAT_NO_OUTPUT | DIFF_FORMAT_CALLBACK;
|
||||||
rev.diffopt.format_callback = submodule_summary_callback;
|
rev.diffopt.format_callback = submodule_summary_callback;
|
||||||
rev.diffopt.format_callback_data = &list;
|
rev.diffopt.format_callback_data = &list;
|
||||||
|
|||||||
@@ -1941,7 +1941,7 @@ int cmd_main(int argc, const char **argv)
|
|||||||
strvec_pushf(&commit_argv, "^%s",
|
strvec_pushf(&commit_argv, "^%s",
|
||||||
oid_to_hex(&ref->old_oid));
|
oid_to_hex(&ref->old_oid));
|
||||||
repo_init_revisions(the_repository, &revs, setup_git_directory());
|
repo_init_revisions(the_repository, &revs, setup_git_directory());
|
||||||
setup_revisions(commit_argv.nr, commit_argv.v, &revs, NULL);
|
setup_revisions_from_strvec(&commit_argv, &revs, NULL);
|
||||||
revs.edge_hint = 0; /* just in case */
|
revs.edge_hint = 0; /* just in case */
|
||||||
|
|
||||||
/* Generate a list of objects that need to be pushed */
|
/* Generate a list of objects that need to be pushed */
|
||||||
|
|||||||
5
remote.c
5
remote.c
@@ -2143,9 +2143,6 @@ static int stat_branch_pair(const char *branch_name, const char *base,
|
|||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
struct commit *ours, *theirs;
|
struct commit *ours, *theirs;
|
||||||
struct rev_info revs;
|
struct rev_info revs;
|
||||||
struct setup_revision_opt opt = {
|
|
||||||
.free_removed_argv_elements = 1,
|
|
||||||
};
|
|
||||||
struct strvec argv = STRVEC_INIT;
|
struct strvec argv = STRVEC_INIT;
|
||||||
|
|
||||||
/* Cannot stat if what we used to build on no longer exists */
|
/* Cannot stat if what we used to build on no longer exists */
|
||||||
@@ -2180,7 +2177,7 @@ static int stat_branch_pair(const char *branch_name, const char *base,
|
|||||||
strvec_push(&argv, "--");
|
strvec_push(&argv, "--");
|
||||||
|
|
||||||
repo_init_revisions(the_repository, &revs, NULL);
|
repo_init_revisions(the_repository, &revs, NULL);
|
||||||
setup_revisions(argv.nr, argv.v, &revs, &opt);
|
setup_revisions_from_strvec(&argv, &revs, NULL);
|
||||||
if (prepare_revision_walk(&revs))
|
if (prepare_revision_walk(&revs))
|
||||||
die(_("revision walk setup failed"));
|
die(_("revision walk setup failed"));
|
||||||
|
|
||||||
|
|||||||
49
revision.c
49
revision.c
@@ -2321,6 +2321,24 @@ static timestamp_t parse_age(const char *arg)
|
|||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void overwrite_argv(int *argc, const char **argv,
|
||||||
|
const char **value,
|
||||||
|
const struct setup_revision_opt *opt)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Detect the case when we are overwriting ourselves. The assignment
|
||||||
|
* itself would be a noop either way, but this lets us avoid corner
|
||||||
|
* cases around the free() and NULL operations.
|
||||||
|
*/
|
||||||
|
if (*value != argv[*argc]) {
|
||||||
|
if (opt && opt->free_removed_argv_elements)
|
||||||
|
free((char *)argv[*argc]);
|
||||||
|
argv[*argc] = *value;
|
||||||
|
*value = NULL;
|
||||||
|
}
|
||||||
|
(*argc)++;
|
||||||
|
}
|
||||||
|
|
||||||
static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv,
|
static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv,
|
||||||
int *unkc, const char **unkv,
|
int *unkc, const char **unkv,
|
||||||
const struct setup_revision_opt* opt)
|
const struct setup_revision_opt* opt)
|
||||||
@@ -2342,7 +2360,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
|
|||||||
starts_with(arg, "--branches=") || starts_with(arg, "--tags=") ||
|
starts_with(arg, "--branches=") || starts_with(arg, "--tags=") ||
|
||||||
starts_with(arg, "--remotes=") || starts_with(arg, "--no-walk="))
|
starts_with(arg, "--remotes=") || starts_with(arg, "--no-walk="))
|
||||||
{
|
{
|
||||||
unkv[(*unkc)++] = arg;
|
overwrite_argv(unkc, unkv, &argv[0], opt);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2706,7 +2724,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
|
|||||||
} else {
|
} else {
|
||||||
int opts = diff_opt_parse(&revs->diffopt, argv, argc, revs->prefix);
|
int opts = diff_opt_parse(&revs->diffopt, argv, argc, revs->prefix);
|
||||||
if (!opts)
|
if (!opts)
|
||||||
unkv[(*unkc)++] = arg;
|
overwrite_argv(unkc, unkv, &argv[0], opt);
|
||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3018,7 +3036,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
|
|||||||
|
|
||||||
if (!strcmp(arg, "--stdin")) {
|
if (!strcmp(arg, "--stdin")) {
|
||||||
if (revs->disable_stdin) {
|
if (revs->disable_stdin) {
|
||||||
argv[left++] = arg;
|
overwrite_argv(&left, argv, &argv[i], opt);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (revs->read_from_stdin++)
|
if (revs->read_from_stdin++)
|
||||||
@@ -3174,9 +3192,34 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
|
|||||||
revs->show_notes_given = 1;
|
revs->show_notes_given = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argv) {
|
||||||
|
if (opt && opt->free_removed_argv_elements)
|
||||||
|
free((char *)argv[left]);
|
||||||
|
argv[left] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return left;
|
return left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setup_revisions_from_strvec(struct strvec *argv, struct rev_info *revs,
|
||||||
|
struct setup_revision_opt *opt)
|
||||||
|
{
|
||||||
|
struct setup_revision_opt fallback_opt;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (!opt) {
|
||||||
|
memset(&fallback_opt, 0, sizeof(fallback_opt));
|
||||||
|
opt = &fallback_opt;
|
||||||
|
}
|
||||||
|
opt->free_removed_argv_elements = 1;
|
||||||
|
|
||||||
|
ret = setup_revisions(argv->nr, argv->v, revs, opt);
|
||||||
|
|
||||||
|
for (size_t i = ret; i < argv->nr; i++)
|
||||||
|
free((char *)argv->v[i]);
|
||||||
|
argv->nr = ret;
|
||||||
|
}
|
||||||
|
|
||||||
static void release_revisions_cmdline(struct rev_cmdline_info *cmdline)
|
static void release_revisions_cmdline(struct rev_cmdline_info *cmdline)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|||||||
@@ -441,6 +441,8 @@ struct setup_revision_opt {
|
|||||||
};
|
};
|
||||||
int setup_revisions(int argc, const char **argv, struct rev_info *revs,
|
int setup_revisions(int argc, const char **argv, struct rev_info *revs,
|
||||||
struct setup_revision_opt *);
|
struct setup_revision_opt *);
|
||||||
|
void setup_revisions_from_strvec(struct strvec *argv, struct rev_info *revs,
|
||||||
|
struct setup_revision_opt *);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free data allocated in a "struct rev_info" after it's been
|
* Free data allocated in a "struct rev_info" after it's been
|
||||||
|
|||||||
@@ -6052,8 +6052,8 @@ static int make_script_with_merges(struct pretty_print_context *pp,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sequencer_make_script(struct repository *r, struct strbuf *out, int argc,
|
int sequencer_make_script(struct repository *r, struct strbuf *out,
|
||||||
const char **argv, unsigned flags)
|
struct strvec *argv, unsigned flags)
|
||||||
{
|
{
|
||||||
char *format = NULL;
|
char *format = NULL;
|
||||||
struct pretty_print_context pp = {0};
|
struct pretty_print_context pp = {0};
|
||||||
@@ -6094,7 +6094,8 @@ int sequencer_make_script(struct repository *r, struct strbuf *out, int argc,
|
|||||||
pp.fmt = revs.commit_format;
|
pp.fmt = revs.commit_format;
|
||||||
pp.output_encoding = get_log_output_encoding();
|
pp.output_encoding = get_log_output_encoding();
|
||||||
|
|
||||||
if (setup_revisions(argc, argv, &revs, NULL) > 1) {
|
setup_revisions_from_strvec(argv, &revs, NULL);
|
||||||
|
if (argv->nr > 1) {
|
||||||
ret = error(_("make_script: unhandled options"));
|
ret = error(_("make_script: unhandled options"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,8 +186,8 @@ int sequencer_remove_state(struct replay_opts *opts);
|
|||||||
#define TODO_LIST_REAPPLY_CHERRY_PICKS (1U << 7)
|
#define TODO_LIST_REAPPLY_CHERRY_PICKS (1U << 7)
|
||||||
#define TODO_LIST_WARN_SKIPPED_CHERRY_PICKS (1U << 8)
|
#define TODO_LIST_WARN_SKIPPED_CHERRY_PICKS (1U << 8)
|
||||||
|
|
||||||
int sequencer_make_script(struct repository *r, struct strbuf *out, int argc,
|
int sequencer_make_script(struct repository *r, struct strbuf *out,
|
||||||
const char **argv, unsigned flags);
|
struct strvec *argv, unsigned flags);
|
||||||
|
|
||||||
int complete_action(struct repository *r, struct replay_opts *opts, unsigned flags,
|
int complete_action(struct repository *r, struct replay_opts *opts, unsigned flags,
|
||||||
const char *shortrevisions, const char *onto_name,
|
const char *shortrevisions, const char *onto_name,
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ static void show_commit(struct commit *commit, void *data)
|
|||||||
* are marked with shallow_flag. The list of border/shallow commits
|
* are marked with shallow_flag. The list of border/shallow commits
|
||||||
* are also returned.
|
* are also returned.
|
||||||
*/
|
*/
|
||||||
struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av,
|
struct commit_list *get_shallow_commits_by_rev_list(struct strvec *argv,
|
||||||
int shallow_flag,
|
int shallow_flag,
|
||||||
int not_shallow_flag)
|
int not_shallow_flag)
|
||||||
{
|
{
|
||||||
@@ -232,7 +232,7 @@ struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av,
|
|||||||
|
|
||||||
repo_init_revisions(the_repository, &revs, NULL);
|
repo_init_revisions(the_repository, &revs, NULL);
|
||||||
save_commit_buffer = 0;
|
save_commit_buffer = 0;
|
||||||
setup_revisions(ac, av, &revs, NULL);
|
setup_revisions_from_strvec(argv, &revs, NULL);
|
||||||
|
|
||||||
if (prepare_revision_walk(&revs))
|
if (prepare_revision_walk(&revs))
|
||||||
die("revision walk setup failed");
|
die("revision walk setup failed");
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "strbuf.h"
|
#include "strbuf.h"
|
||||||
|
|
||||||
struct oid_array;
|
struct oid_array;
|
||||||
|
struct strvec;
|
||||||
|
|
||||||
void set_alternate_shallow_file(struct repository *r, const char *path, int override);
|
void set_alternate_shallow_file(struct repository *r, const char *path, int override);
|
||||||
int register_shallow(struct repository *r, const struct object_id *oid);
|
int register_shallow(struct repository *r, const struct object_id *oid);
|
||||||
@@ -36,8 +37,8 @@ void rollback_shallow_file(struct repository *r, struct shallow_lock *lk);
|
|||||||
|
|
||||||
struct commit_list *get_shallow_commits(struct object_array *heads,
|
struct commit_list *get_shallow_commits(struct object_array *heads,
|
||||||
int depth, int shallow_flag, int not_shallow_flag);
|
int depth, int shallow_flag, int not_shallow_flag);
|
||||||
struct commit_list *get_shallow_commits_by_rev_list(
|
struct commit_list *get_shallow_commits_by_rev_list(struct strvec *argv,
|
||||||
int ac, const char **av, int shallow_flag, int not_shallow_flag);
|
int shallow_flag, int not_shallow_flag);
|
||||||
int write_shallow_commits(struct strbuf *out, int use_pack_protocol,
|
int write_shallow_commits(struct strbuf *out, int use_pack_protocol,
|
||||||
const struct oid_array *extra);
|
const struct oid_array *extra);
|
||||||
|
|
||||||
|
|||||||
@@ -900,7 +900,7 @@ static void collect_changed_submodules(struct repository *r,
|
|||||||
save_warning = warn_on_object_refname_ambiguity;
|
save_warning = warn_on_object_refname_ambiguity;
|
||||||
warn_on_object_refname_ambiguity = 0;
|
warn_on_object_refname_ambiguity = 0;
|
||||||
repo_init_revisions(r, &rev, NULL);
|
repo_init_revisions(r, &rev, NULL);
|
||||||
setup_revisions(argv->nr, argv->v, &rev, &s_r_opt);
|
setup_revisions_from_strvec(argv, &rev, &s_r_opt);
|
||||||
warn_on_object_refname_ambiguity = save_warning;
|
warn_on_object_refname_ambiguity = save_warning;
|
||||||
if (prepare_revision_walk(&rev))
|
if (prepare_revision_walk(&rev))
|
||||||
die(_("revision walk setup failed"));
|
die(_("revision walk setup failed"));
|
||||||
|
|||||||
@@ -1741,4 +1741,13 @@ test_expect_success 'submodules does not affect the branch recorded in stash mes
|
|||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success SANITIZE_LEAK 'stash show handles -- without leaking' '
|
||||||
|
git stash show --
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'controlled error return on unrecognized option' '
|
||||||
|
test_expect_code 129 git stash show -p --invalid 2>usage &&
|
||||||
|
grep -e "^usage: git stash show" usage
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
|||||||
@@ -913,13 +913,12 @@ static void deepen(struct upload_pack_data *data, int depth)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void deepen_by_rev_list(struct upload_pack_data *data,
|
static void deepen_by_rev_list(struct upload_pack_data *data,
|
||||||
int ac,
|
struct strvec *argv)
|
||||||
const char **av)
|
|
||||||
{
|
{
|
||||||
struct commit_list *result;
|
struct commit_list *result;
|
||||||
|
|
||||||
disable_commit_graph(the_repository);
|
disable_commit_graph(the_repository);
|
||||||
result = get_shallow_commits_by_rev_list(ac, av, SHALLOW, NOT_SHALLOW);
|
result = get_shallow_commits_by_rev_list(argv, SHALLOW, NOT_SHALLOW);
|
||||||
send_shallow(data, result);
|
send_shallow(data, result);
|
||||||
free_commit_list(result);
|
free_commit_list(result);
|
||||||
send_unshallow(data);
|
send_unshallow(data);
|
||||||
@@ -955,7 +954,7 @@ static int send_shallow_list(struct upload_pack_data *data)
|
|||||||
struct object *o = data->want_obj.objects[i].item;
|
struct object *o = data->want_obj.objects[i].item;
|
||||||
strvec_push(&av, oid_to_hex(&o->oid));
|
strvec_push(&av, oid_to_hex(&o->oid));
|
||||||
}
|
}
|
||||||
deepen_by_rev_list(data, av.nr, av.v);
|
deepen_by_rev_list(data, &av);
|
||||||
strvec_clear(&av);
|
strvec_clear(&av);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user