зеркало из https://github.com/microsoft/git.git
Merge branch 'ab/plug-leak-in-revisions'
Plug the memory leaks from the trickiest API of all, the revision walker. * ab/plug-leak-in-revisions: (27 commits) revisions API: add a TODO for diff_free(&revs->diffopt) revisions API: have release_revisions() release "topo_walk_info" revisions API: have release_revisions() release "date_mode" revisions API: call diff_free(&revs->pruning) in revisions_release() revisions API: release "reflog_info" in release revisions() revisions API: clear "boundary_commits" in release_revisions() revisions API: have release_revisions() release "prune_data" revisions API: have release_revisions() release "grep_filter" revisions API: have release_revisions() release "filter" revisions API: have release_revisions() release "cmdline" revisions API: have release_revisions() release "mailmap" revisions API: have release_revisions() release "commits" revisions API users: use release_revisions() for "prune_data" users revisions API users: use release_revisions() with UNLEAK() revisions API users: use release_revisions() in builtin/log.c revisions API users: use release_revisions() in http-push.c revisions API users: add "goto cleanup" for release_revisions() stash: always have the owner of "stash_info" free it revisions API users: use release_revisions() needing REV_INFO_INIT revision.[ch]: document and move code declared around "init" ...
This commit is contained in:
Коммит
2da81d1efb
|
@ -568,8 +568,7 @@ static int get_modified_files(struct repository *r,
|
||||||
run_diff_files(&rev, 0);
|
run_diff_files(&rev, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps)
|
release_revisions(&rev);
|
||||||
clear_pathspec(&rev.prune_data);
|
|
||||||
}
|
}
|
||||||
hashmap_clear_and_free(&s.file_map, struct pathname_entry, ent);
|
hashmap_clear_and_free(&s.file_map, struct pathname_entry, ent);
|
||||||
if (unmerged_count)
|
if (unmerged_count)
|
||||||
|
|
20
bisect.c
20
bisect.c
|
@ -884,6 +884,7 @@ static int check_ancestors(struct repository *r, int rev_nr,
|
||||||
/* Clean up objects used, as they will be reused. */
|
/* Clean up objects used, as they will be reused. */
|
||||||
clear_commit_marks_many(rev_nr, rev, ALL_REV_FLAGS);
|
clear_commit_marks_many(rev_nr, rev, ALL_REV_FLAGS);
|
||||||
|
|
||||||
|
release_revisions(&revs);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -964,6 +965,7 @@ static void show_diff_tree(struct repository *r,
|
||||||
|
|
||||||
setup_revisions(ARRAY_SIZE(argv) - 1, argv, &opt, NULL);
|
setup_revisions(ARRAY_SIZE(argv) - 1, argv, &opt, NULL);
|
||||||
log_tree_commit(&opt, commit);
|
log_tree_commit(&opt, commit);
|
||||||
|
release_revisions(&opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1008,7 +1010,7 @@ void read_bisect_terms(const char **read_bad, const char **read_good)
|
||||||
*/
|
*/
|
||||||
enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
|
enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
|
||||||
{
|
{
|
||||||
struct rev_info revs;
|
struct rev_info revs = REV_INFO_INIT;
|
||||||
struct commit_list *tried;
|
struct commit_list *tried;
|
||||||
int reaches = 0, all = 0, nr, steps;
|
int reaches = 0, all = 0, nr, steps;
|
||||||
enum bisect_error res = BISECT_OK;
|
enum bisect_error res = BISECT_OK;
|
||||||
|
@ -1033,7 +1035,7 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
|
||||||
|
|
||||||
res = check_good_are_ancestors_of_bad(r, prefix, no_checkout);
|
res = check_good_are_ancestors_of_bad(r, prefix, no_checkout);
|
||||||
if (res)
|
if (res)
|
||||||
return res;
|
goto cleanup;
|
||||||
|
|
||||||
bisect_rev_setup(r, &revs, prefix, "%s", "^%s", 1);
|
bisect_rev_setup(r, &revs, prefix, "%s", "^%s", 1);
|
||||||
|
|
||||||
|
@ -1058,14 +1060,16 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
|
||||||
term_good,
|
term_good,
|
||||||
term_bad);
|
term_bad);
|
||||||
|
|
||||||
return BISECT_FAILED;
|
res = BISECT_FAILED;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!all) {
|
if (!all) {
|
||||||
fprintf(stderr, _("No testable commit found.\n"
|
fprintf(stderr, _("No testable commit found.\n"
|
||||||
"Maybe you started with bad path arguments?\n"));
|
"Maybe you started with bad path arguments?\n"));
|
||||||
|
|
||||||
return BISECT_NO_TESTABLE_COMMIT;
|
res = BISECT_NO_TESTABLE_COMMIT;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
bisect_rev = &revs.commits->item->object.oid;
|
bisect_rev = &revs.commits->item->object.oid;
|
||||||
|
@ -1085,7 +1089,8 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
|
||||||
* for negative return values for early returns up
|
* for negative return values for early returns up
|
||||||
* until the cmd_bisect__helper() caller.
|
* until the cmd_bisect__helper() caller.
|
||||||
*/
|
*/
|
||||||
return BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND;
|
res = BISECT_INTERNAL_SUCCESS_1ST_BAD_FOUND;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
nr = all - reaches - 1;
|
nr = all - reaches - 1;
|
||||||
|
@ -1104,7 +1109,10 @@ enum bisect_error bisect_next_all(struct repository *r, const char *prefix)
|
||||||
/* Clean up objects used, as they will be reused. */
|
/* Clean up objects used, as they will be reused. */
|
||||||
repo_clear_commit_marks(r, ALL_REV_FLAGS);
|
repo_clear_commit_marks(r, ALL_REV_FLAGS);
|
||||||
|
|
||||||
return bisect_checkout(bisect_rev, no_checkout);
|
res = bisect_checkout(bisect_rev, no_checkout);
|
||||||
|
cleanup:
|
||||||
|
release_revisions(&revs);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int log2i(int n)
|
static inline int log2i(int n)
|
||||||
|
|
|
@ -151,7 +151,7 @@ int add_files_to_cache(const char *prefix,
|
||||||
run_diff_files(&rev, DIFF_RACY_IS_MODIFIED);
|
run_diff_files(&rev, DIFF_RACY_IS_MODIFIED);
|
||||||
end_odb_transaction();
|
end_odb_transaction();
|
||||||
|
|
||||||
clear_pathspec(&rev.prune_data);
|
release_revisions(&rev);
|
||||||
return !!data.add_errors;
|
return !!data.add_errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,6 +344,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
unlink(file);
|
unlink(file);
|
||||||
free(file);
|
free(file);
|
||||||
|
release_revisions(&rev);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1397,6 +1397,7 @@ static void write_commit_patch(const struct am_state *state, struct commit *comm
|
||||||
add_pending_object(&rev_info, &commit->object, "");
|
add_pending_object(&rev_info, &commit->object, "");
|
||||||
diff_setup_done(&rev_info.diffopt);
|
diff_setup_done(&rev_info.diffopt);
|
||||||
log_tree_commit(&rev_info, commit);
|
log_tree_commit(&rev_info, commit);
|
||||||
|
release_revisions(&rev_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1429,6 +1430,7 @@ static void write_index_patch(const struct am_state *state)
|
||||||
add_pending_object(&rev_info, &tree->object, "");
|
add_pending_object(&rev_info, &tree->object, "");
|
||||||
diff_setup_done(&rev_info.diffopt);
|
diff_setup_done(&rev_info.diffopt);
|
||||||
run_diff_index(&rev_info, 1);
|
run_diff_index(&rev_info, 1);
|
||||||
|
release_revisions(&rev_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1582,6 +1584,7 @@ static int fall_back_threeway(const struct am_state *state, const char *index_pa
|
||||||
add_pending_oid(&rev_info, "HEAD", &our_tree, 0);
|
add_pending_oid(&rev_info, "HEAD", &our_tree, 0);
|
||||||
diff_setup_done(&rev_info.diffopt);
|
diff_setup_done(&rev_info.diffopt);
|
||||||
run_diff_index(&rev_info, 1);
|
run_diff_index(&rev_info, 1);
|
||||||
|
release_revisions(&rev_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (run_apply(state, index_path))
|
if (run_apply(state, index_path))
|
||||||
|
|
|
@ -596,6 +596,7 @@ static int bisect_skipped_commits(struct bisect_terms *terms)
|
||||||
reset_revision_walk();
|
reset_revision_walk();
|
||||||
|
|
||||||
strbuf_release(&commit_name);
|
strbuf_release(&commit_name);
|
||||||
|
release_revisions(&revs);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1084,6 +1085,7 @@ static enum bisect_error bisect_skip(struct bisect_terms *terms, const char **ar
|
||||||
oid_to_hex(&commit->object.oid));
|
oid_to_hex(&commit->object.oid));
|
||||||
|
|
||||||
reset_revision_walk();
|
reset_revision_walk();
|
||||||
|
release_revisions(&revs);
|
||||||
} else {
|
} else {
|
||||||
strvec_push(&argv_state, argv[i]);
|
strvec_push(&argv_state, argv[i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1171,7 +1171,7 @@ parse_done:
|
||||||
if (!incremental)
|
if (!incremental)
|
||||||
setup_pager();
|
setup_pager();
|
||||||
else
|
else
|
||||||
return 0;
|
goto cleanup;
|
||||||
|
|
||||||
blame_sort_final(&sb);
|
blame_sort_final(&sb);
|
||||||
|
|
||||||
|
@ -1205,6 +1205,8 @@ parse_done:
|
||||||
printf("num commits: %d\n", sb.num_commits);
|
printf("num commits: %d\n", sb.num_commits);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
cleanup_scoreboard(&sb);
|
cleanup_scoreboard(&sb);
|
||||||
|
release_revisions(&revs);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -629,7 +629,7 @@ static void show_local_changes(struct object *head,
|
||||||
diff_setup_done(&rev.diffopt);
|
diff_setup_done(&rev.diffopt);
|
||||||
add_pending_object(&rev, head, NULL);
|
add_pending_object(&rev, head, NULL);
|
||||||
run_diff_index(&rev, 0);
|
run_diff_index(&rev, 0);
|
||||||
object_array_clear(&rev.pending);
|
release_revisions(&rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void describe_detached_head(const char *msg, struct commit *commit)
|
static void describe_detached_head(const char *msg, struct commit *commit)
|
||||||
|
@ -1082,6 +1082,7 @@ static void orphaned_commit_warning(struct commit *old_commit, struct commit *ne
|
||||||
|
|
||||||
/* Clean up objects used, as they will be reused. */
|
/* Clean up objects used, as they will be reused. */
|
||||||
repo_clear_commit_marks(the_repository, ALL_REV_FLAGS);
|
repo_clear_commit_marks(the_repository, ALL_REV_FLAGS);
|
||||||
|
release_revisions(&revs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int switch_branches(const struct checkout_opts *opts,
|
static int switch_branches(const struct checkout_opts *opts,
|
||||||
|
|
|
@ -1100,7 +1100,6 @@ static const char *find_author_by_nickname(const char *name)
|
||||||
struct rev_info revs;
|
struct rev_info revs;
|
||||||
struct commit *commit;
|
struct commit *commit;
|
||||||
struct strbuf buf = STRBUF_INIT;
|
struct strbuf buf = STRBUF_INIT;
|
||||||
struct string_list mailmap = STRING_LIST_INIT_NODUP;
|
|
||||||
const char *av[20];
|
const char *av[20];
|
||||||
int ac = 0;
|
int ac = 0;
|
||||||
|
|
||||||
|
@ -1111,7 +1110,8 @@ static const char *find_author_by_nickname(const char *name)
|
||||||
av[++ac] = buf.buf;
|
av[++ac] = buf.buf;
|
||||||
av[++ac] = NULL;
|
av[++ac] = NULL;
|
||||||
setup_revisions(ac, av, &revs, NULL);
|
setup_revisions(ac, av, &revs, NULL);
|
||||||
revs.mailmap = &mailmap;
|
revs.mailmap = xmalloc(sizeof(struct string_list));
|
||||||
|
string_list_init_nodup(revs.mailmap);
|
||||||
read_mailmap(revs.mailmap);
|
read_mailmap(revs.mailmap);
|
||||||
|
|
||||||
if (prepare_revision_walk(&revs))
|
if (prepare_revision_walk(&revs))
|
||||||
|
@ -1122,7 +1122,7 @@ static const char *find_author_by_nickname(const char *name)
|
||||||
ctx.date_mode.type = DATE_NORMAL;
|
ctx.date_mode.type = DATE_NORMAL;
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
format_commit_message(commit, "%aN <%aE>", &buf, &ctx);
|
format_commit_message(commit, "%aN <%aE>", &buf, &ctx);
|
||||||
clear_mailmap(&mailmap);
|
release_revisions(&revs);
|
||||||
return strbuf_detach(&buf, NULL);
|
return strbuf_detach(&buf, NULL);
|
||||||
}
|
}
|
||||||
die(_("--author '%s' is not 'Name <email>' and matches no existing author"), name);
|
die(_("--author '%s' is not 'Name <email>' and matches no existing author"), name);
|
||||||
|
|
|
@ -517,6 +517,7 @@ static void describe_blob(struct object_id oid, struct strbuf *dst)
|
||||||
|
|
||||||
traverse_commit_list(&revs, process_commit, process_object, &pcd);
|
traverse_commit_list(&revs, process_commit, process_object, &pcd);
|
||||||
reset_revision_walk();
|
reset_revision_walk();
|
||||||
|
release_revisions(&revs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void describe(const char *arg, int last_one)
|
static void describe(const char *arg, int last_one)
|
||||||
|
@ -667,6 +668,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
|
||||||
suffix = NULL;
|
suffix = NULL;
|
||||||
else
|
else
|
||||||
suffix = dirty;
|
suffix = dirty;
|
||||||
|
release_revisions(&revs);
|
||||||
}
|
}
|
||||||
describe("HEAD", 1);
|
describe("HEAD", 1);
|
||||||
} else if (dirty) {
|
} else if (dirty) {
|
||||||
|
|
|
@ -77,8 +77,12 @@ int cmd_diff_files(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
if (read_cache_preload(&rev.diffopt.pathspec) < 0) {
|
if (read_cache_preload(&rev.diffopt.pathspec) < 0) {
|
||||||
perror("read_cache_preload");
|
perror("read_cache_preload");
|
||||||
return -1;
|
result = -1;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
cleanup:
|
||||||
result = run_diff_files(&rev, options);
|
result = run_diff_files(&rev, options);
|
||||||
return diff_result_code(&rev.diffopt, result);
|
result = diff_result_code(&rev.diffopt, result);
|
||||||
|
release_revisions(&rev);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,7 @@ int cmd_diff_index(int argc, const char **argv, const char *prefix)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
result = run_diff_index(&rev, option);
|
result = run_diff_index(&rev, option);
|
||||||
UNLEAK(rev);
|
result = diff_result_code(&rev.diffopt, result);
|
||||||
return diff_result_code(&rev.diffopt, result);
|
release_revisions(&rev);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -594,7 +594,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
|
||||||
result = diff_result_code(&rev.diffopt, result);
|
result = diff_result_code(&rev.diffopt, result);
|
||||||
if (1 < rev.diffopt.skip_stat_unmatch)
|
if (1 < rev.diffopt.skip_stat_unmatch)
|
||||||
refresh_index_quietly();
|
refresh_index_quietly();
|
||||||
UNLEAK(rev);
|
release_revisions(&rev);
|
||||||
UNLEAK(ent);
|
UNLEAK(ent);
|
||||||
UNLEAK(blob);
|
UNLEAK(blob);
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -1276,6 +1276,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
|
||||||
printf("done\n");
|
printf("done\n");
|
||||||
|
|
||||||
refspec_clear(&refspecs);
|
refspec_clear(&refspecs);
|
||||||
|
release_revisions(&revs);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,7 +231,8 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mailmap) {
|
if (mailmap) {
|
||||||
rev->mailmap = xcalloc(1, sizeof(struct string_list));
|
rev->mailmap = xmalloc(sizeof(struct string_list));
|
||||||
|
string_list_init_nodup(rev->mailmap);
|
||||||
read_mailmap(rev->mailmap);
|
read_mailmap(rev->mailmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,6 +295,12 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
|
||||||
cmd_log_init_finish(argc, argv, prefix, rev, opt);
|
cmd_log_init_finish(argc, argv, prefix, rev, opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int cmd_log_deinit(int ret, struct rev_info *rev)
|
||||||
|
{
|
||||||
|
release_revisions(rev);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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.
|
||||||
|
@ -565,7 +572,7 @@ int cmd_whatchanged(int argc, const char **argv, const char *prefix)
|
||||||
cmd_log_init(argc, argv, prefix, &rev, &opt);
|
cmd_log_init(argc, argv, prefix, &rev, &opt);
|
||||||
if (!rev.diffopt.output_format)
|
if (!rev.diffopt.output_format)
|
||||||
rev.diffopt.output_format = DIFF_FORMAT_RAW;
|
rev.diffopt.output_format = DIFF_FORMAT_RAW;
|
||||||
return cmd_log_walk(&rev);
|
return cmd_log_deinit(cmd_log_walk(&rev), &rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_tagger(const char *buf, struct rev_info *rev)
|
static void show_tagger(const char *buf, struct rev_info *rev)
|
||||||
|
@ -689,7 +696,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
|
||||||
cmd_log_init(argc, argv, prefix, &rev, &opt);
|
cmd_log_init(argc, argv, prefix, &rev, &opt);
|
||||||
|
|
||||||
if (!rev.no_walk)
|
if (!rev.no_walk)
|
||||||
return cmd_log_walk(&rev);
|
return cmd_log_deinit(cmd_log_walk(&rev), &rev);
|
||||||
|
|
||||||
count = rev.pending.nr;
|
count = rev.pending.nr;
|
||||||
objects = rev.pending.objects;
|
objects = rev.pending.objects;
|
||||||
|
@ -749,8 +756,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
|
||||||
rev.diffopt.no_free = 0;
|
rev.diffopt.no_free = 0;
|
||||||
diff_free(&rev.diffopt);
|
diff_free(&rev.diffopt);
|
||||||
|
|
||||||
free(objects);
|
return cmd_log_deinit(ret, &rev);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -778,7 +784,7 @@ int cmd_log_reflog(int argc, const char **argv, const char *prefix)
|
||||||
rev.always_show_header = 1;
|
rev.always_show_header = 1;
|
||||||
cmd_log_init_finish(argc, argv, prefix, &rev, &opt);
|
cmd_log_init_finish(argc, argv, prefix, &rev, &opt);
|
||||||
|
|
||||||
return cmd_log_walk(&rev);
|
return cmd_log_deinit(cmd_log_walk(&rev), &rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void log_setup_revisions_tweak(struct rev_info *rev,
|
static void log_setup_revisions_tweak(struct rev_info *rev,
|
||||||
|
@ -809,7 +815,7 @@ int cmd_log(int argc, const char **argv, const char *prefix)
|
||||||
opt.revarg_opt = REVARG_COMMITTISH;
|
opt.revarg_opt = REVARG_COMMITTISH;
|
||||||
opt.tweak = log_setup_revisions_tweak;
|
opt.tweak = log_setup_revisions_tweak;
|
||||||
cmd_log_init(argc, argv, prefix, &rev, &opt);
|
cmd_log_init(argc, argv, prefix, &rev, &opt);
|
||||||
return cmd_log_walk(&rev);
|
return cmd_log_deinit(cmd_log_walk(&rev), &rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* format-patch */
|
/* format-patch */
|
||||||
|
@ -1764,6 +1770,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
||||||
struct commit *commit;
|
struct commit *commit;
|
||||||
struct commit **list = NULL;
|
struct commit **list = NULL;
|
||||||
struct rev_info rev;
|
struct rev_info rev;
|
||||||
|
char *to_free = NULL;
|
||||||
struct setup_revision_opt s_r_opt;
|
struct setup_revision_opt s_r_opt;
|
||||||
int nr = 0, total, i;
|
int nr = 0, total, i;
|
||||||
int use_stdout = 0;
|
int use_stdout = 0;
|
||||||
|
@ -1965,7 +1972,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
||||||
strbuf_addch(&buf, '\n');
|
strbuf_addch(&buf, '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
rev.extra_headers = strbuf_detach(&buf, NULL);
|
rev.extra_headers = to_free = strbuf_detach(&buf, NULL);
|
||||||
|
|
||||||
if (from) {
|
if (from) {
|
||||||
if (split_ident_line(&rev.from_ident, from, strlen(from)))
|
if (split_ident_line(&rev.from_ident, from, strlen(from)))
|
||||||
|
@ -2186,8 +2193,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
|
||||||
prepare_bases(&bases, base, list, nr);
|
prepare_bases(&bases, base, list, nr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_reply_to || thread || cover_letter)
|
if (in_reply_to || thread || cover_letter) {
|
||||||
rev.ref_message_ids = xcalloc(1, sizeof(struct string_list));
|
rev.ref_message_ids = xmalloc(sizeof(*rev.ref_message_ids));
|
||||||
|
string_list_init_nodup(rev.ref_message_ids);
|
||||||
|
}
|
||||||
if (in_reply_to) {
|
if (in_reply_to) {
|
||||||
const char *msgid = clean_message_id(in_reply_to);
|
const char *msgid = clean_message_id(in_reply_to);
|
||||||
string_list_append(rev.ref_message_ids, msgid);
|
string_list_append(rev.ref_message_ids, msgid);
|
||||||
|
@ -2294,8 +2303,11 @@ done:
|
||||||
strbuf_release(&rdiff1);
|
strbuf_release(&rdiff1);
|
||||||
strbuf_release(&rdiff2);
|
strbuf_release(&rdiff2);
|
||||||
strbuf_release(&rdiff_title);
|
strbuf_release(&rdiff_title);
|
||||||
UNLEAK(rev);
|
free(to_free);
|
||||||
return 0;
|
if (rev.ref_message_ids)
|
||||||
|
string_list_clear(rev.ref_message_ids, 0);
|
||||||
|
free(rev.ref_message_ids);
|
||||||
|
return cmd_log_deinit(0, &rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int add_pending_commit(const char *arg, struct rev_info *revs, int flags)
|
static int add_pending_commit(const char *arg, struct rev_info *revs, int flags)
|
||||||
|
|
|
@ -443,6 +443,7 @@ static void squash_message(struct commit *commit, struct commit_list *remotehead
|
||||||
}
|
}
|
||||||
write_file_buf(git_path_squash_msg(the_repository), out.buf, out.len);
|
write_file_buf(git_path_squash_msg(the_repository), out.buf, out.len);
|
||||||
strbuf_release(&out);
|
strbuf_release(&out);
|
||||||
|
release_revisions(&rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void finish(struct commit *head_commit,
|
static void finish(struct commit *head_commit,
|
||||||
|
@ -998,6 +999,7 @@ static int evaluate_result(void)
|
||||||
*/
|
*/
|
||||||
cnt += count_unmerged_entries();
|
cnt += count_unmerged_entries();
|
||||||
|
|
||||||
|
release_revisions(&rev);
|
||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4464,11 +4464,13 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
|
||||||
read_object_list_from_stdin();
|
read_object_list_from_stdin();
|
||||||
} else if (pfd.have_revs) {
|
} else if (pfd.have_revs) {
|
||||||
get_object_list(&pfd.revs, rp.nr, rp.v);
|
get_object_list(&pfd.revs, rp.nr, rp.v);
|
||||||
|
release_revisions(&pfd.revs);
|
||||||
} else {
|
} else {
|
||||||
struct rev_info revs;
|
struct rev_info revs;
|
||||||
|
|
||||||
repo_init_revisions(the_repository, &revs, NULL);
|
repo_init_revisions(the_repository, &revs, NULL);
|
||||||
get_object_list(&revs, rp.nr, rp.v);
|
get_object_list(&revs, rp.nr, rp.v);
|
||||||
|
release_revisions(&revs);
|
||||||
}
|
}
|
||||||
cleanup_preferred_base();
|
cleanup_preferred_base();
|
||||||
if (include_tag && nr_result)
|
if (include_tag && nr_result)
|
||||||
|
|
|
@ -196,5 +196,6 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
|
||||||
prune_shallow(show_only ? PRUNE_SHOW_ONLY : 0);
|
prune_shallow(show_only ? PRUNE_SHOW_ONLY : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
release_revisions(&revs);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -293,6 +293,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf(_("Marking reachable objects..."));
|
printf(_("Marking reachable objects..."));
|
||||||
mark_reachable_objects(&revs, 0, 0, NULL);
|
mark_reachable_objects(&revs, 0, 0, NULL);
|
||||||
|
release_revisions(&revs);
|
||||||
if (verbose)
|
if (verbose)
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,10 +213,8 @@ static void show_commit(struct commit *commit, void *data)
|
||||||
|
|
||||||
static void finish_commit(struct commit *commit)
|
static void finish_commit(struct commit *commit)
|
||||||
{
|
{
|
||||||
if (commit->parents) {
|
free_commit_list(commit->parents);
|
||||||
free_commit_list(commit->parents);
|
commit->parents = NULL;
|
||||||
commit->parents = NULL;
|
|
||||||
}
|
|
||||||
free_commit_buffer(the_repository->parsed_objects,
|
free_commit_buffer(the_repository->parsed_objects,
|
||||||
commit);
|
commit);
|
||||||
}
|
}
|
||||||
|
@ -502,6 +500,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||||
int use_bitmap_index = 0;
|
int use_bitmap_index = 0;
|
||||||
int filter_provided_objects = 0;
|
int filter_provided_objects = 0;
|
||||||
const char *show_progress = NULL;
|
const char *show_progress = NULL;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
if (argc == 2 && !strcmp(argv[1], "-h"))
|
if (argc == 2 && !strcmp(argv[1], "-h"))
|
||||||
usage(rev_list_usage);
|
usage(rev_list_usage);
|
||||||
|
@ -585,7 +584,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||||
}
|
}
|
||||||
if (!strcmp(arg, "--test-bitmap")) {
|
if (!strcmp(arg, "--test-bitmap")) {
|
||||||
test_bitmap_walk(&revs);
|
test_bitmap_walk(&revs);
|
||||||
return 0;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (skip_prefix(arg, "--progress=", &arg)) {
|
if (skip_prefix(arg, "--progress=", &arg)) {
|
||||||
show_progress = arg;
|
show_progress = arg;
|
||||||
|
@ -674,11 +673,11 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
if (use_bitmap_index) {
|
if (use_bitmap_index) {
|
||||||
if (!try_bitmap_count(&revs, filter_provided_objects))
|
if (!try_bitmap_count(&revs, filter_provided_objects))
|
||||||
return 0;
|
goto cleanup;
|
||||||
if (!try_bitmap_disk_usage(&revs, filter_provided_objects))
|
if (!try_bitmap_disk_usage(&revs, filter_provided_objects))
|
||||||
return 0;
|
goto cleanup;
|
||||||
if (!try_bitmap_traversal(&revs, filter_provided_objects))
|
if (!try_bitmap_traversal(&revs, filter_provided_objects))
|
||||||
return 0;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prepare_revision_walk(&revs))
|
if (prepare_revision_walk(&revs))
|
||||||
|
@ -698,8 +697,10 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
find_bisection(&revs.commits, &reaches, &all, bisect_flags);
|
find_bisection(&revs.commits, &reaches, &all, bisect_flags);
|
||||||
|
|
||||||
if (bisect_show_vars)
|
if (bisect_show_vars) {
|
||||||
return show_bisect_vars(&info, reaches, all);
|
ret = show_bisect_vars(&info, reaches, all);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter_provided_objects) {
|
if (filter_provided_objects) {
|
||||||
|
@ -754,5 +755,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
|
||||||
if (show_disk_usage)
|
if (show_disk_usage)
|
||||||
printf("%"PRIuMAX"\n", (uintmax_t)total_disk_usage);
|
printf("%"PRIuMAX"\n", (uintmax_t)total_disk_usage);
|
||||||
|
|
||||||
return 0;
|
cleanup:
|
||||||
|
release_revisions(&revs);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,8 +81,10 @@ static void insert_one_record(struct shortlog *log,
|
||||||
format_subject(&subject, oneline, " ");
|
format_subject(&subject, oneline, " ");
|
||||||
buffer = strbuf_detach(&subject, NULL);
|
buffer = strbuf_detach(&subject, NULL);
|
||||||
|
|
||||||
if (!item->util)
|
if (!item->util) {
|
||||||
item->util = xcalloc(1, sizeof(struct string_list));
|
item->util = xmalloc(sizeof(struct string_list));
|
||||||
|
string_list_init_nodup(item->util);
|
||||||
|
}
|
||||||
string_list_append(item->util, buffer);
|
string_list_append(item->util, buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -420,6 +422,8 @@ parse_done:
|
||||||
else
|
else
|
||||||
get_from_rev(&rev, &log);
|
get_from_rev(&rev, &log);
|
||||||
|
|
||||||
|
release_revisions(&rev);
|
||||||
|
|
||||||
shortlog_output(&log);
|
shortlog_output(&log);
|
||||||
if (log.file != stdout)
|
if (log.file != stdout)
|
||||||
fclose(log.file);
|
fclose(log.file);
|
||||||
|
|
115
builtin/stash.c
115
builtin/stash.c
|
@ -117,6 +117,10 @@ struct stash_info {
|
||||||
int has_u;
|
int has_u;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define STASH_INFO_INIT { \
|
||||||
|
.revision = STRBUF_INIT, \
|
||||||
|
}
|
||||||
|
|
||||||
static void free_stash_info(struct stash_info *info)
|
static void free_stash_info(struct stash_info *info)
|
||||||
{
|
{
|
||||||
strbuf_release(&info->revision);
|
strbuf_release(&info->revision);
|
||||||
|
@ -158,10 +162,8 @@ static int get_stash_info(struct stash_info *info, int argc, const char **argv)
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
commit = argv[0];
|
commit = argv[0];
|
||||||
|
|
||||||
strbuf_init(&info->revision, 0);
|
|
||||||
if (!commit) {
|
if (!commit) {
|
||||||
if (!ref_exists(ref_stash)) {
|
if (!ref_exists(ref_stash)) {
|
||||||
free_stash_info(info);
|
|
||||||
fprintf_ln(stderr, _("No stash entries found."));
|
fprintf_ln(stderr, _("No stash entries found."));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -175,11 +177,8 @@ static int get_stash_info(struct stash_info *info, int argc, const char **argv)
|
||||||
|
|
||||||
revision = info->revision.buf;
|
revision = info->revision.buf;
|
||||||
|
|
||||||
if (get_oid(revision, &info->w_commit)) {
|
if (get_oid(revision, &info->w_commit))
|
||||||
error(_("%s is not a valid reference"), revision);
|
return error(_("%s is not a valid reference"), revision);
|
||||||
free_stash_info(info);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
assert_stash_like(info, revision);
|
assert_stash_like(info, revision);
|
||||||
|
|
||||||
|
@ -198,7 +197,7 @@ static int get_stash_info(struct stash_info *info, int argc, const char **argv)
|
||||||
info->is_stash_ref = !strcmp(expanded_ref, ref_stash);
|
info->is_stash_ref = !strcmp(expanded_ref, ref_stash);
|
||||||
break;
|
break;
|
||||||
default: /* Invalid or ambiguous */
|
default: /* Invalid or ambiguous */
|
||||||
free_stash_info(info);
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(expanded_ref);
|
free(expanded_ref);
|
||||||
|
@ -616,10 +615,10 @@ restore_untracked:
|
||||||
|
|
||||||
static int apply_stash(int argc, const char **argv, const char *prefix)
|
static int apply_stash(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = -1;
|
||||||
int quiet = 0;
|
int quiet = 0;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
struct stash_info info;
|
struct stash_info info = STASH_INFO_INIT;
|
||||||
struct option options[] = {
|
struct option options[] = {
|
||||||
OPT__QUIET(&quiet, N_("be quiet, only report errors")),
|
OPT__QUIET(&quiet, N_("be quiet, only report errors")),
|
||||||
OPT_BOOL(0, "index", &index,
|
OPT_BOOL(0, "index", &index,
|
||||||
|
@ -631,9 +630,10 @@ static int apply_stash(int argc, const char **argv, const char *prefix)
|
||||||
git_stash_apply_usage, 0);
|
git_stash_apply_usage, 0);
|
||||||
|
|
||||||
if (get_stash_info(&info, argc, argv))
|
if (get_stash_info(&info, argc, argv))
|
||||||
return -1;
|
goto cleanup;
|
||||||
|
|
||||||
ret = do_apply_stash(prefix, &info, index, quiet);
|
ret = do_apply_stash(prefix, &info, index, quiet);
|
||||||
|
cleanup:
|
||||||
free_stash_info(&info);
|
free_stash_info(&info);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -669,20 +669,25 @@ static int do_drop_stash(struct stash_info *info, int quiet)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void assert_stash_ref(struct stash_info *info)
|
static int get_stash_info_assert(struct stash_info *info, int argc,
|
||||||
|
const char **argv)
|
||||||
{
|
{
|
||||||
if (!info->is_stash_ref) {
|
int ret = get_stash_info(info, argc, argv);
|
||||||
error(_("'%s' is not a stash reference"), info->revision.buf);
|
|
||||||
free_stash_info(info);
|
if (ret < 0)
|
||||||
exit(1);
|
return ret;
|
||||||
}
|
|
||||||
|
if (!info->is_stash_ref)
|
||||||
|
return error(_("'%s' is not a stash reference"), info->revision.buf);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int drop_stash(int argc, const char **argv, const char *prefix)
|
static int drop_stash(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = -1;
|
||||||
int quiet = 0;
|
int quiet = 0;
|
||||||
struct stash_info info;
|
struct stash_info info = STASH_INFO_INIT;
|
||||||
struct option options[] = {
|
struct option options[] = {
|
||||||
OPT__QUIET(&quiet, N_("be quiet, only report errors")),
|
OPT__QUIET(&quiet, N_("be quiet, only report errors")),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
|
@ -691,22 +696,21 @@ static int drop_stash(int argc, const char **argv, const char *prefix)
|
||||||
argc = parse_options(argc, argv, prefix, options,
|
argc = parse_options(argc, argv, prefix, options,
|
||||||
git_stash_drop_usage, 0);
|
git_stash_drop_usage, 0);
|
||||||
|
|
||||||
if (get_stash_info(&info, argc, argv))
|
if (get_stash_info_assert(&info, argc, argv))
|
||||||
return -1;
|
goto cleanup;
|
||||||
|
|
||||||
assert_stash_ref(&info);
|
|
||||||
|
|
||||||
ret = do_drop_stash(&info, quiet);
|
ret = do_drop_stash(&info, quiet);
|
||||||
|
cleanup:
|
||||||
free_stash_info(&info);
|
free_stash_info(&info);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pop_stash(int argc, const char **argv, const char *prefix)
|
static int pop_stash(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = -1;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
int quiet = 0;
|
int quiet = 0;
|
||||||
struct stash_info info;
|
struct stash_info info = STASH_INFO_INIT;
|
||||||
struct option options[] = {
|
struct option options[] = {
|
||||||
OPT__QUIET(&quiet, N_("be quiet, only report errors")),
|
OPT__QUIET(&quiet, N_("be quiet, only report errors")),
|
||||||
OPT_BOOL(0, "index", &index,
|
OPT_BOOL(0, "index", &index,
|
||||||
|
@ -717,25 +721,25 @@ static int pop_stash(int argc, const char **argv, const char *prefix)
|
||||||
argc = parse_options(argc, argv, prefix, options,
|
argc = parse_options(argc, argv, prefix, options,
|
||||||
git_stash_pop_usage, 0);
|
git_stash_pop_usage, 0);
|
||||||
|
|
||||||
if (get_stash_info(&info, argc, argv))
|
if (get_stash_info_assert(&info, argc, argv))
|
||||||
return -1;
|
goto cleanup;
|
||||||
|
|
||||||
assert_stash_ref(&info);
|
|
||||||
if ((ret = do_apply_stash(prefix, &info, index, quiet)))
|
if ((ret = do_apply_stash(prefix, &info, index, quiet)))
|
||||||
printf_ln(_("The stash entry is kept in case "
|
printf_ln(_("The stash entry is kept in case "
|
||||||
"you need it again."));
|
"you need it again."));
|
||||||
else
|
else
|
||||||
ret = do_drop_stash(&info, quiet);
|
ret = do_drop_stash(&info, quiet);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
free_stash_info(&info);
|
free_stash_info(&info);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int branch_stash(int argc, const char **argv, const char *prefix)
|
static int branch_stash(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = -1;
|
||||||
const char *branch = NULL;
|
const char *branch = NULL;
|
||||||
struct stash_info info;
|
struct stash_info info = STASH_INFO_INIT;
|
||||||
struct child_process cp = CHILD_PROCESS_INIT;
|
struct child_process cp = CHILD_PROCESS_INIT;
|
||||||
struct option options[] = {
|
struct option options[] = {
|
||||||
OPT_END()
|
OPT_END()
|
||||||
|
@ -752,7 +756,7 @@ static int branch_stash(int argc, const char **argv, const char *prefix)
|
||||||
branch = argv[0];
|
branch = argv[0];
|
||||||
|
|
||||||
if (get_stash_info(&info, argc - 1, argv + 1))
|
if (get_stash_info(&info, argc - 1, argv + 1))
|
||||||
return -1;
|
goto cleanup;
|
||||||
|
|
||||||
cp.git_cmd = 1;
|
cp.git_cmd = 1;
|
||||||
strvec_pushl(&cp.args, "checkout", "-b", NULL);
|
strvec_pushl(&cp.args, "checkout", "-b", NULL);
|
||||||
|
@ -764,8 +768,8 @@ static int branch_stash(int argc, const char **argv, const char *prefix)
|
||||||
if (!ret && info.is_stash_ref)
|
if (!ret && info.is_stash_ref)
|
||||||
ret = do_drop_stash(&info, 0);
|
ret = do_drop_stash(&info, 0);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
free_stash_info(&info);
|
free_stash_info(&info);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -843,8 +847,8 @@ static void diff_include_untracked(const struct stash_info *info, struct diff_op
|
||||||
static int show_stash(int argc, const char **argv, const char *prefix)
|
static int show_stash(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int ret = 0;
|
int ret = -1;
|
||||||
struct stash_info info;
|
struct stash_info info = STASH_INFO_INIT;
|
||||||
struct rev_info rev;
|
struct rev_info rev;
|
||||||
struct strvec stash_args = STRVEC_INIT;
|
struct strvec stash_args = STRVEC_INIT;
|
||||||
struct strvec revision_args = STRVEC_INIT;
|
struct strvec revision_args = STRVEC_INIT;
|
||||||
|
@ -862,6 +866,7 @@ static int show_stash(int argc, const char **argv, const char *prefix)
|
||||||
UNTRACKED_ONLY, PARSE_OPT_NONEG),
|
UNTRACKED_ONLY, PARSE_OPT_NONEG),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
int do_usage = 0;
|
||||||
|
|
||||||
init_diff_ui_defaults();
|
init_diff_ui_defaults();
|
||||||
git_config(git_diff_ui_config, NULL);
|
git_config(git_diff_ui_config, NULL);
|
||||||
|
@ -879,10 +884,8 @@ static int show_stash(int argc, const char **argv, const char *prefix)
|
||||||
strvec_push(&revision_args, argv[i]);
|
strvec_push(&revision_args, argv[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = get_stash_info(&info, stash_args.nr, stash_args.v);
|
if (get_stash_info(&info, stash_args.nr, stash_args.v))
|
||||||
strvec_clear(&stash_args);
|
goto cleanup;
|
||||||
if (ret)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The config settings are applied only if there are not passed
|
* The config settings are applied only if there are not passed
|
||||||
|
@ -896,16 +899,14 @@ static int show_stash(int argc, const char **argv, const char *prefix)
|
||||||
rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
|
rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
|
||||||
|
|
||||||
if (!show_stat && !show_patch) {
|
if (!show_stat && !show_patch) {
|
||||||
free_stash_info(&info);
|
ret = 0;
|
||||||
return 0;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
argc = setup_revisions(revision_args.nr, revision_args.v, &rev, NULL);
|
argc = setup_revisions(revision_args.nr, revision_args.v, &rev, NULL);
|
||||||
if (argc > 1) {
|
if (argc > 1)
|
||||||
free_stash_info(&info);
|
goto usage;
|
||||||
usage_with_options(git_stash_show_usage, options);
|
|
||||||
}
|
|
||||||
if (!rev.diffopt.output_format) {
|
if (!rev.diffopt.output_format) {
|
||||||
rev.diffopt.output_format = DIFF_FORMAT_PATCH;
|
rev.diffopt.output_format = DIFF_FORMAT_PATCH;
|
||||||
diff_setup_done(&rev.diffopt);
|
diff_setup_done(&rev.diffopt);
|
||||||
|
@ -930,8 +931,17 @@ static int show_stash(int argc, const char **argv, const char *prefix)
|
||||||
}
|
}
|
||||||
log_tree_diff_flush(&rev);
|
log_tree_diff_flush(&rev);
|
||||||
|
|
||||||
|
ret = diff_result_code(&rev.diffopt, 0);
|
||||||
|
cleanup:
|
||||||
|
strvec_clear(&stash_args);
|
||||||
free_stash_info(&info);
|
free_stash_info(&info);
|
||||||
return diff_result_code(&rev.diffopt, 0);
|
release_revisions(&rev);
|
||||||
|
if (do_usage)
|
||||||
|
usage_with_options(git_stash_show_usage, options);
|
||||||
|
return ret;
|
||||||
|
usage:
|
||||||
|
do_usage = 1;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int do_store_stash(const struct object_id *w_commit, const char *stash_msg,
|
static int do_store_stash(const struct object_id *w_commit, const char *stash_msg,
|
||||||
|
@ -1065,7 +1075,6 @@ static int check_changes_tracked_files(const struct pathspec *ps)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
object_array_clear(&rev.pending);
|
|
||||||
result = run_diff_files(&rev, 0);
|
result = run_diff_files(&rev, 0);
|
||||||
if (diff_result_code(&rev.diffopt, result)) {
|
if (diff_result_code(&rev.diffopt, result)) {
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
@ -1073,7 +1082,7 @@ static int check_changes_tracked_files(const struct pathspec *ps)
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
clear_pathspec(&rev.prune_data);
|
release_revisions(&rev);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1284,9 +1293,7 @@ static int stash_working_tree(struct stash_info *info, const struct pathspec *ps
|
||||||
|
|
||||||
done:
|
done:
|
||||||
discard_index(&istate);
|
discard_index(&istate);
|
||||||
UNLEAK(rev);
|
release_revisions(&rev);
|
||||||
object_array_clear(&rev.pending);
|
|
||||||
clear_pathspec(&rev.prune_data);
|
|
||||||
strbuf_release(&diff_output);
|
strbuf_release(&diff_output);
|
||||||
remove_path(stash_index_path.buf);
|
remove_path(stash_index_path.buf);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1428,9 +1435,9 @@ done:
|
||||||
|
|
||||||
static int create_stash(int argc, const char **argv, const char *prefix)
|
static int create_stash(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret;
|
||||||
struct strbuf stash_msg_buf = STRBUF_INIT;
|
struct strbuf stash_msg_buf = STRBUF_INIT;
|
||||||
struct stash_info info;
|
struct stash_info info = STASH_INFO_INIT;
|
||||||
struct pathspec ps;
|
struct pathspec ps;
|
||||||
|
|
||||||
/* Starting with argv[1], since argv[0] is "create" */
|
/* Starting with argv[1], since argv[0] is "create" */
|
||||||
|
@ -1445,6 +1452,7 @@ static int create_stash(int argc, const char **argv, const char *prefix)
|
||||||
if (!ret)
|
if (!ret)
|
||||||
printf_ln("%s", oid_to_hex(&info.w_commit));
|
printf_ln("%s", oid_to_hex(&info.w_commit));
|
||||||
|
|
||||||
|
free_stash_info(&info);
|
||||||
strbuf_release(&stash_msg_buf);
|
strbuf_release(&stash_msg_buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1453,7 +1461,7 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
|
||||||
int keep_index, int patch_mode, int include_untracked, int only_staged)
|
int keep_index, int patch_mode, int include_untracked, int only_staged)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct stash_info info;
|
struct stash_info info = STASH_INFO_INIT;
|
||||||
struct strbuf patch = STRBUF_INIT;
|
struct strbuf patch = STRBUF_INIT;
|
||||||
struct strbuf stash_msg_buf = STRBUF_INIT;
|
struct strbuf stash_msg_buf = STRBUF_INIT;
|
||||||
struct strbuf untracked_files = STRBUF_INIT;
|
struct strbuf untracked_files = STRBUF_INIT;
|
||||||
|
@ -1652,6 +1660,7 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
free_stash_info(&info);
|
||||||
strbuf_release(&stash_msg_buf);
|
strbuf_release(&stash_msg_buf);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -649,7 +649,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
|
||||||
{
|
{
|
||||||
char *displaypath;
|
char *displaypath;
|
||||||
struct strvec diff_files_args = STRVEC_INIT;
|
struct strvec diff_files_args = STRVEC_INIT;
|
||||||
struct rev_info rev;
|
struct rev_info rev = REV_INFO_INIT;
|
||||||
int diff_files_result;
|
int diff_files_result;
|
||||||
struct strbuf buf = STRBUF_INIT;
|
struct strbuf buf = STRBUF_INIT;
|
||||||
const char *git_dir;
|
const char *git_dir;
|
||||||
|
@ -736,6 +736,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
|
||||||
cleanup:
|
cleanup:
|
||||||
strvec_clear(&diff_files_args);
|
strvec_clear(&diff_files_args);
|
||||||
free(displaypath);
|
free(displaypath);
|
||||||
|
release_revisions(&rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void status_submodule_cb(const struct cache_entry *list_item,
|
static void status_submodule_cb(const struct cache_entry *list_item,
|
||||||
|
@ -1114,6 +1115,7 @@ 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 module_cb_list list = MODULE_CB_LIST_INIT;
|
struct module_cb_list list = MODULE_CB_LIST_INIT;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
strvec_push(&diff_args, get_diff_cmd(diff_cmd));
|
strvec_push(&diff_args, get_diff_cmd(diff_cmd));
|
||||||
if (info->cached)
|
if (info->cached)
|
||||||
|
@ -1139,11 +1141,13 @@ static int compute_summary_module_list(struct object_id *head_oid,
|
||||||
setup_work_tree();
|
setup_work_tree();
|
||||||
if (read_cache_preload(&rev.diffopt.pathspec) < 0) {
|
if (read_cache_preload(&rev.diffopt.pathspec) < 0) {
|
||||||
perror("read_cache_preload");
|
perror("read_cache_preload");
|
||||||
return -1;
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
} else if (read_cache() < 0) {
|
} else if (read_cache() < 0) {
|
||||||
perror("read_cache");
|
perror("read_cache");
|
||||||
return -1;
|
ret = -1;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (diff_cmd == DIFF_INDEX)
|
if (diff_cmd == DIFF_INDEX)
|
||||||
|
@ -1151,8 +1155,10 @@ static int compute_summary_module_list(struct object_id *head_oid,
|
||||||
else
|
else
|
||||||
run_diff_files(&rev, 0);
|
run_diff_files(&rev, 0);
|
||||||
prepare_submodule_summary(info, &list);
|
prepare_submodule_summary(info, &list);
|
||||||
|
cleanup:
|
||||||
strvec_clear(&diff_args);
|
strvec_clear(&diff_args);
|
||||||
return 0;
|
release_revisions(&rev);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int module_summary(int argc, const char **argv, const char *prefix)
|
static int module_summary(int argc, const char **argv, const char *prefix)
|
||||||
|
|
12
bundle.c
12
bundle.c
|
@ -196,14 +196,16 @@ int verify_bundle(struct repository *r,
|
||||||
* to be verbose about the errors
|
* to be verbose about the errors
|
||||||
*/
|
*/
|
||||||
struct string_list *p = &header->prerequisites;
|
struct string_list *p = &header->prerequisites;
|
||||||
struct rev_info revs;
|
struct rev_info revs = REV_INFO_INIT;
|
||||||
const char *argv[] = {NULL, "--all", NULL};
|
const char *argv[] = {NULL, "--all", NULL};
|
||||||
struct commit *commit;
|
struct commit *commit;
|
||||||
int i, ret = 0, req_nr;
|
int i, ret = 0, req_nr;
|
||||||
const char *message = _("Repository lacks these prerequisite commits:");
|
const char *message = _("Repository lacks these prerequisite commits:");
|
||||||
|
|
||||||
if (!r || !r->objects || !r->objects->odb)
|
if (!r || !r->objects || !r->objects->odb) {
|
||||||
return error(_("need a repository to verify a bundle"));
|
ret = error(_("need a repository to verify a bundle"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
repo_init_revisions(r, &revs, NULL);
|
repo_init_revisions(r, &revs, NULL);
|
||||||
for (i = 0; i < p->nr; i++) {
|
for (i = 0; i < p->nr; i++) {
|
||||||
|
@ -221,7 +223,7 @@ int verify_bundle(struct repository *r,
|
||||||
error("%s %s", oid_to_hex(oid), name);
|
error("%s %s", oid_to_hex(oid), name);
|
||||||
}
|
}
|
||||||
if (revs.pending.nr != p->nr)
|
if (revs.pending.nr != p->nr)
|
||||||
return ret;
|
goto cleanup;
|
||||||
req_nr = revs.pending.nr;
|
req_nr = revs.pending.nr;
|
||||||
setup_revisions(2, argv, &revs, NULL);
|
setup_revisions(2, argv, &revs, NULL);
|
||||||
|
|
||||||
|
@ -284,6 +286,8 @@ int verify_bundle(struct repository *r,
|
||||||
printf_ln("The bundle uses this filter: %s",
|
printf_ln("The bundle uses this filter: %s",
|
||||||
list_objects_filter_spec(&header->filter));
|
list_objects_filter_spec(&header->filter));
|
||||||
}
|
}
|
||||||
|
cleanup:
|
||||||
|
release_revisions(&revs);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
19
commit.c
19
commit.c
|
@ -407,17 +407,14 @@ int parse_commit_buffer(struct repository *r, struct commit *item, const void *b
|
||||||
|
|
||||||
if (item->object.parsed)
|
if (item->object.parsed)
|
||||||
return 0;
|
return 0;
|
||||||
|
/*
|
||||||
if (item->parents) {
|
* Presumably this is leftover from an earlier failed parse;
|
||||||
/*
|
* clear it out in preparation for us re-parsing (we'll hit the
|
||||||
* Presumably this is leftover from an earlier failed parse;
|
* same error, but that's good, since it lets our caller know
|
||||||
* clear it out in preparation for us re-parsing (we'll hit the
|
* the result cannot be trusted.
|
||||||
* same error, but that's good, since it lets our caller know
|
*/
|
||||||
* the result cannot be trusted.
|
free_commit_list(item->parents);
|
||||||
*/
|
item->parents = NULL;
|
||||||
free_commit_list(item->parents);
|
|
||||||
item->parents = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
tail += size;
|
tail += size;
|
||||||
if (tail <= bufptr + tree_entry_len + 1 || memcmp(bufptr, "tree ", 5) ||
|
if (tail <= bufptr + tree_entry_len + 1 || memcmp(bufptr, "tree ", 5) ||
|
||||||
|
|
|
@ -2,13 +2,21 @@
|
||||||
expression E;
|
expression E;
|
||||||
@@
|
@@
|
||||||
- if (E)
|
- if (E)
|
||||||
|
(
|
||||||
free(E);
|
free(E);
|
||||||
|
|
|
||||||
|
free_commit_list(E);
|
||||||
|
)
|
||||||
|
|
||||||
@@
|
@@
|
||||||
expression E;
|
expression E;
|
||||||
@@
|
@@
|
||||||
- if (!E)
|
- if (!E)
|
||||||
|
(
|
||||||
free(E);
|
free(E);
|
||||||
|
|
|
||||||
|
free_commit_list(E);
|
||||||
|
)
|
||||||
|
|
||||||
@@
|
@@
|
||||||
expression E;
|
expression E;
|
||||||
|
@ -16,3 +24,22 @@ expression E;
|
||||||
- free(E);
|
- free(E);
|
||||||
+ FREE_AND_NULL(E);
|
+ FREE_AND_NULL(E);
|
||||||
- E = NULL;
|
- E = NULL;
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E;
|
||||||
|
@@
|
||||||
|
- if (E)
|
||||||
|
- {
|
||||||
|
free_commit_list(E);
|
||||||
|
E = NULL;
|
||||||
|
- }
|
||||||
|
|
||||||
|
@@
|
||||||
|
expression E;
|
||||||
|
statement S;
|
||||||
|
@@
|
||||||
|
- if (E) {
|
||||||
|
+ if (E)
|
||||||
|
S
|
||||||
|
free_commit_list(E);
|
||||||
|
- }
|
||||||
|
|
|
@ -641,7 +641,7 @@ int do_diff_cache(const struct object_id *tree_oid, struct diff_options *opt)
|
||||||
|
|
||||||
if (diff_cache(&revs, tree_oid, NULL, 1))
|
if (diff_cache(&revs, tree_oid, NULL, 1))
|
||||||
exit(128);
|
exit(128);
|
||||||
clear_pathspec(&revs.prune_data);
|
release_revisions(&revs);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -651,6 +651,7 @@ int index_differs_from(struct repository *r,
|
||||||
{
|
{
|
||||||
struct rev_info rev;
|
struct rev_info rev;
|
||||||
struct setup_revision_opt opt;
|
struct setup_revision_opt opt;
|
||||||
|
unsigned has_changes;
|
||||||
|
|
||||||
repo_init_revisions(r, &rev, NULL);
|
repo_init_revisions(r, &rev, NULL);
|
||||||
memset(&opt, 0, sizeof(opt));
|
memset(&opt, 0, sizeof(opt));
|
||||||
|
@ -662,8 +663,9 @@ int index_differs_from(struct repository *r,
|
||||||
diff_flags_or(&rev.diffopt.flags, flags);
|
diff_flags_or(&rev.diffopt.flags, flags);
|
||||||
rev.diffopt.ita_invisible_in_index = ita_invisible_in_index;
|
rev.diffopt.ita_invisible_in_index = ita_invisible_in_index;
|
||||||
run_diff_index(&rev, 1);
|
run_diff_index(&rev, 1);
|
||||||
object_array_clear(&rev.pending);
|
has_changes = rev.diffopt.flags.has_changes;
|
||||||
return (rev.diffopt.flags.has_changes != 0);
|
release_revisions(&rev);
|
||||||
|
return (has_changes != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct strbuf *idiff_prefix_cb(struct diff_options *opt, void *data)
|
static struct strbuf *idiff_prefix_cb(struct diff_options *opt, void *data)
|
||||||
|
|
|
@ -699,6 +699,7 @@ int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
|
||||||
shortlog(origins.items[i].string,
|
shortlog(origins.items[i].string,
|
||||||
origins.items[i].util,
|
origins.items[i].util,
|
||||||
head, &rev, opts, out);
|
head, &rev, opts, out);
|
||||||
|
release_revisions(&rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_complete_line(out);
|
strbuf_complete_line(out);
|
||||||
|
|
|
@ -1689,7 +1689,6 @@ int cmd_main(int argc, const char **argv)
|
||||||
struct refspec rs = REFSPEC_INIT_PUSH;
|
struct refspec rs = REFSPEC_INIT_PUSH;
|
||||||
struct remote_lock *ref_lock = NULL;
|
struct remote_lock *ref_lock = NULL;
|
||||||
struct remote_lock *info_ref_lock = NULL;
|
struct remote_lock *info_ref_lock = NULL;
|
||||||
struct rev_info revs;
|
|
||||||
int delete_branch = 0;
|
int delete_branch = 0;
|
||||||
int force_delete = 0;
|
int force_delete = 0;
|
||||||
int objects_to_send;
|
int objects_to_send;
|
||||||
|
@ -1825,6 +1824,7 @@ int cmd_main(int argc, const char **argv)
|
||||||
|
|
||||||
new_refs = 0;
|
new_refs = 0;
|
||||||
for (ref = remote_refs; ref; ref = ref->next) {
|
for (ref = remote_refs; ref; ref = ref->next) {
|
||||||
|
struct rev_info revs;
|
||||||
struct strvec commit_argv = STRVEC_INIT;
|
struct strvec commit_argv = STRVEC_INIT;
|
||||||
|
|
||||||
if (!ref->peer_ref)
|
if (!ref->peer_ref)
|
||||||
|
@ -1941,6 +1941,7 @@ int cmd_main(int argc, const char **argv)
|
||||||
unlock_remote(ref_lock);
|
unlock_remote(ref_lock);
|
||||||
check_locks();
|
check_locks();
|
||||||
strvec_clear(&commit_argv);
|
strvec_clear(&commit_argv);
|
||||||
|
release_revisions(&revs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update remote server info if appropriate */
|
/* Update remote server info if appropriate */
|
||||||
|
|
|
@ -1594,6 +1594,7 @@ static int find_first_merges(struct repository *repo,
|
||||||
}
|
}
|
||||||
|
|
||||||
object_array_clear(&merges);
|
object_array_clear(&merges);
|
||||||
|
release_revisions(&revs);
|
||||||
return result->nr;
|
return result->nr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -522,10 +522,10 @@ static struct stage_data *insert_stage_data(struct repository *r,
|
||||||
*/
|
*/
|
||||||
static struct string_list *get_unmerged(struct index_state *istate)
|
static struct string_list *get_unmerged(struct index_state *istate)
|
||||||
{
|
{
|
||||||
struct string_list *unmerged = xcalloc(1, sizeof(struct string_list));
|
struct string_list *unmerged = xmalloc(sizeof(struct string_list));
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
unmerged->strdup_strings = 1;
|
string_list_init_dup(unmerged);
|
||||||
|
|
||||||
/* TODO: audit for interaction with sparse-index. */
|
/* TODO: audit for interaction with sparse-index. */
|
||||||
ensure_full_index(istate);
|
ensure_full_index(istate);
|
||||||
|
@ -1160,6 +1160,7 @@ static int find_first_merges(struct repository *repo,
|
||||||
}
|
}
|
||||||
|
|
||||||
object_array_clear(&merges);
|
object_array_clear(&merges);
|
||||||
|
release_revisions(&revs);
|
||||||
return result->nr;
|
return result->nr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
midx.c
1
midx.c
|
@ -1049,6 +1049,7 @@ static struct commit **find_commits_for_midx_bitmap(uint32_t *indexed_commits_nr
|
||||||
if (indexed_commits_nr_p)
|
if (indexed_commits_nr_p)
|
||||||
*indexed_commits_nr_p = cb.commits_nr;
|
*indexed_commits_nr_p = cb.commits_nr;
|
||||||
|
|
||||||
|
release_revisions(&revs);
|
||||||
return cb.commits;
|
return cb.commits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -326,6 +326,7 @@ next:
|
||||||
trace2_data_intmax("pack-bitmap-write", the_repository,
|
trace2_data_intmax("pack-bitmap-write", the_repository,
|
||||||
"num_maximal_commits", num_maximal);
|
"num_maximal_commits", num_maximal);
|
||||||
|
|
||||||
|
release_revisions(&revs);
|
||||||
free_commit_list(reusable);
|
free_commit_list(reusable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -596,6 +596,6 @@ int is_range_diff_range(const char *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
free(copy);
|
free(copy);
|
||||||
object_array_clear(&revs.pending);
|
release_revisions(&revs);
|
||||||
return negative > 0 && positive > 0;
|
return negative > 0 && positive > 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2392,6 +2392,7 @@ static void reach_filter(struct ref_array *array,
|
||||||
clear_commit_marks(merge_commit, ALL_REV_FLAGS);
|
clear_commit_marks(merge_commit, ALL_REV_FLAGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
release_revisions(&revs);
|
||||||
free(to_clear);
|
free(to_clear);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
struct complete_reflogs {
|
struct complete_reflogs {
|
||||||
char *ref;
|
char *ref;
|
||||||
const char *short_ref;
|
char *short_ref;
|
||||||
struct reflog_info {
|
struct reflog_info {
|
||||||
struct object_id ooid, noid;
|
struct object_id ooid, noid;
|
||||||
char *email;
|
char *email;
|
||||||
|
@ -51,9 +51,16 @@ static void free_complete_reflog(struct complete_reflogs *array)
|
||||||
}
|
}
|
||||||
free(array->items);
|
free(array->items);
|
||||||
free(array->ref);
|
free(array->ref);
|
||||||
|
free(array->short_ref);
|
||||||
free(array);
|
free(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void complete_reflogs_clear(void *util, const char *str)
|
||||||
|
{
|
||||||
|
struct complete_reflogs *array = util;
|
||||||
|
free_complete_reflog(array);
|
||||||
|
}
|
||||||
|
|
||||||
static struct complete_reflogs *read_complete_reflog(const char *ref)
|
static struct complete_reflogs *read_complete_reflog(const char *ref)
|
||||||
{
|
{
|
||||||
struct complete_reflogs *reflogs =
|
struct complete_reflogs *reflogs =
|
||||||
|
@ -116,6 +123,21 @@ void init_reflog_walk(struct reflog_walk_info **info)
|
||||||
(*info)->complete_reflogs.strdup_strings = 1;
|
(*info)->complete_reflogs.strdup_strings = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reflog_walk_info_release(struct reflog_walk_info *info)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if (!info)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0; i < info->nr; i++)
|
||||||
|
free(info->logs[i]);
|
||||||
|
string_list_clear_func(&info->complete_reflogs,
|
||||||
|
complete_reflogs_clear);
|
||||||
|
free(info->logs);
|
||||||
|
free(info);
|
||||||
|
}
|
||||||
|
|
||||||
int add_reflog_for_walk(struct reflog_walk_info *info,
|
int add_reflog_for_walk(struct reflog_walk_info *info,
|
||||||
struct commit *commit, const char *name)
|
struct commit *commit, const char *name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,7 @@ struct reflog_walk_info;
|
||||||
struct date_mode;
|
struct date_mode;
|
||||||
|
|
||||||
void init_reflog_walk(struct reflog_walk_info **info);
|
void init_reflog_walk(struct reflog_walk_info **info);
|
||||||
|
void reflog_walk_info_release(struct reflog_walk_info *info);
|
||||||
int add_reflog_for_walk(struct reflog_walk_info *info,
|
int add_reflog_for_walk(struct reflog_walk_info *info,
|
||||||
struct commit *commit, const char *name);
|
struct commit *commit, const char *name);
|
||||||
void show_reflog_message(struct reflog_walk_info *info, int,
|
void show_reflog_message(struct reflog_walk_info *info, int,
|
||||||
|
|
1
remote.c
1
remote.c
|
@ -2175,6 +2175,7 @@ static int stat_branch_pair(const char *branch_name, const char *base,
|
||||||
clear_commit_marks(theirs, ALL_REV_FLAGS);
|
clear_commit_marks(theirs, ALL_REV_FLAGS);
|
||||||
|
|
||||||
strvec_clear(&argv);
|
strvec_clear(&argv);
|
||||||
|
release_revisions(&revs);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
70
revision.c
70
revision.c
|
@ -606,6 +606,10 @@ static struct commit *one_relevant_parent(const struct rev_info *revs,
|
||||||
*
|
*
|
||||||
* 2. We saw anything except REV_TREE_NEW.
|
* 2. We saw anything except REV_TREE_NEW.
|
||||||
*/
|
*/
|
||||||
|
#define REV_TREE_SAME 0
|
||||||
|
#define REV_TREE_NEW 1 /* Only new files */
|
||||||
|
#define REV_TREE_OLD 2 /* Only files removed */
|
||||||
|
#define REV_TREE_DIFFERENT 3 /* Mixed changes */
|
||||||
static int tree_difference = REV_TREE_SAME;
|
static int tree_difference = REV_TREE_SAME;
|
||||||
|
|
||||||
static void file_add_remove(struct diff_options *options,
|
static void file_add_remove(struct diff_options *options,
|
||||||
|
@ -1459,10 +1463,9 @@ static int limit_list(struct rev_info *revs)
|
||||||
if (revs->left_only || revs->right_only)
|
if (revs->left_only || revs->right_only)
|
||||||
limit_left_right(newlist, revs);
|
limit_left_right(newlist, revs);
|
||||||
|
|
||||||
if (bottom) {
|
if (bottom)
|
||||||
limit_to_ancestry(bottom, newlist);
|
limit_to_ancestry(bottom, newlist);
|
||||||
free_commit_list(bottom);
|
free_commit_list(bottom);
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if any commits have become TREESAME by some of their parents
|
* Check if any commits have become TREESAME by some of their parents
|
||||||
|
@ -2930,6 +2933,42 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
|
||||||
return left;
|
return left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void release_revisions_cmdline(struct rev_cmdline_info *cmdline)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < cmdline->nr; i++)
|
||||||
|
free((char *)cmdline->rev[i].name);
|
||||||
|
free(cmdline->rev);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void release_revisions_mailmap(struct string_list *mailmap)
|
||||||
|
{
|
||||||
|
if (!mailmap)
|
||||||
|
return;
|
||||||
|
clear_mailmap(mailmap);
|
||||||
|
free(mailmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void release_revisions_topo_walk_info(struct topo_walk_info *info);
|
||||||
|
|
||||||
|
void release_revisions(struct rev_info *revs)
|
||||||
|
{
|
||||||
|
free_commit_list(revs->commits);
|
||||||
|
object_array_clear(&revs->pending);
|
||||||
|
object_array_clear(&revs->boundary_commits);
|
||||||
|
release_revisions_cmdline(&revs->cmdline);
|
||||||
|
list_objects_filter_release(&revs->filter);
|
||||||
|
clear_pathspec(&revs->prune_data);
|
||||||
|
date_mode_release(&revs->date_mode);
|
||||||
|
release_revisions_mailmap(revs->mailmap);
|
||||||
|
free_grep_patterns(&revs->grep_filter);
|
||||||
|
/* TODO (need to handle "no_free"): diff_free(&revs->diffopt) */
|
||||||
|
diff_free(&revs->pruning);
|
||||||
|
reflog_walk_info_release(revs->reflog_info);
|
||||||
|
release_revisions_topo_walk_info(revs->topo_walk_info);
|
||||||
|
}
|
||||||
|
|
||||||
static void add_child(struct rev_info *revs, struct commit *parent, struct commit *child)
|
static void add_child(struct rev_info *revs, struct commit *parent, struct commit *child)
|
||||||
{
|
{
|
||||||
struct commit_list *l = xcalloc(1, sizeof(*l));
|
struct commit_list *l = xcalloc(1, sizeof(*l));
|
||||||
|
@ -3440,17 +3479,22 @@ static void compute_indegrees_to_depth(struct rev_info *revs,
|
||||||
indegree_walk_step(revs);
|
indegree_walk_step(revs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reset_topo_walk(struct rev_info *revs)
|
static void release_revisions_topo_walk_info(struct topo_walk_info *info)
|
||||||
{
|
{
|
||||||
struct topo_walk_info *info = revs->topo_walk_info;
|
if (!info)
|
||||||
|
return;
|
||||||
clear_prio_queue(&info->explore_queue);
|
clear_prio_queue(&info->explore_queue);
|
||||||
clear_prio_queue(&info->indegree_queue);
|
clear_prio_queue(&info->indegree_queue);
|
||||||
clear_prio_queue(&info->topo_queue);
|
clear_prio_queue(&info->topo_queue);
|
||||||
clear_indegree_slab(&info->indegree);
|
clear_indegree_slab(&info->indegree);
|
||||||
clear_author_date_slab(&info->author_date);
|
clear_author_date_slab(&info->author_date);
|
||||||
|
free(info);
|
||||||
|
}
|
||||||
|
|
||||||
FREE_AND_NULL(revs->topo_walk_info);
|
static void reset_topo_walk(struct rev_info *revs)
|
||||||
|
{
|
||||||
|
release_revisions_topo_walk_info(revs->topo_walk_info);
|
||||||
|
revs->topo_walk_info = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_topo_walk(struct rev_info *revs)
|
static void init_topo_walk(struct rev_info *revs)
|
||||||
|
@ -4090,10 +4134,8 @@ static void create_boundary_commit_list(struct rev_info *revs)
|
||||||
* boundary commits anyway. (This is what the code has always
|
* boundary commits anyway. (This is what the code has always
|
||||||
* done.)
|
* done.)
|
||||||
*/
|
*/
|
||||||
if (revs->commits) {
|
free_commit_list(revs->commits);
|
||||||
free_commit_list(revs->commits);
|
revs->commits = NULL;
|
||||||
revs->commits = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Put all of the actual boundary commits from revs->boundary_commits
|
* Put all of the actual boundary commits from revs->boundary_commits
|
||||||
|
@ -4230,10 +4272,8 @@ struct commit *get_revision(struct rev_info *revs)
|
||||||
graph_update(revs->graph, c);
|
graph_update(revs->graph, c);
|
||||||
if (!c) {
|
if (!c) {
|
||||||
free_saved_parents(revs);
|
free_saved_parents(revs);
|
||||||
if (revs->previous_parents) {
|
free_commit_list(revs->previous_parents);
|
||||||
free_commit_list(revs->previous_parents);
|
revs->previous_parents = NULL;
|
||||||
revs->previous_parents = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
73
revision.h
73
revision.h
|
@ -330,31 +330,24 @@ struct rev_info {
|
||||||
struct tmp_objdir *remerge_objdir;
|
struct tmp_objdir *remerge_objdir;
|
||||||
};
|
};
|
||||||
|
|
||||||
int ref_excluded(struct string_list *, const char *path);
|
/**
|
||||||
void clear_ref_exclusion(struct string_list **);
|
* Initialize the "struct rev_info" structure with a macro.
|
||||||
void add_ref_exclusion(struct string_list **, const char *exclude);
|
*
|
||||||
|
* This will not fully initialize a "struct rev_info", the
|
||||||
|
* repo_init_revisions() function needs to be called before
|
||||||
#define REV_TREE_SAME 0
|
* setup_revisions() and any revision walking takes place.
|
||||||
#define REV_TREE_NEW 1 /* Only new files */
|
*
|
||||||
#define REV_TREE_OLD 2 /* Only files removed */
|
* Use REV_INFO_INIT to make the "struct rev_info" safe for passing to
|
||||||
#define REV_TREE_DIFFERENT 3 /* Mixed changes */
|
* release_revisions() when it's inconvenient (e.g. due to a "goto
|
||||||
|
* cleanup" pattern) to arrange for repo_init_revisions() to be called
|
||||||
/* revision.c */
|
* before release_revisions() is called.
|
||||||
typedef void (*show_early_output_fn_t)(struct rev_info *, struct commit_list *);
|
*
|
||||||
extern volatile show_early_output_fn_t show_early_output;
|
* Initializing with this REV_INFO_INIT is redundant to invoking
|
||||||
|
* repo_init_revisions(). If repo_init_revisions() is guaranteed to be
|
||||||
struct setup_revision_opt {
|
* called before release_revisions() the "struct rev_info" can be left
|
||||||
const char *def;
|
* uninitialized.
|
||||||
void (*tweak)(struct rev_info *, struct setup_revision_opt *);
|
*/
|
||||||
unsigned int assume_dashdash:1,
|
#define REV_INFO_INIT { 0 }
|
||||||
allow_exclude_promisor_objects:1;
|
|
||||||
unsigned revarg_opt;
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
|
|
||||||
#define init_revisions(revs, prefix) repo_init_revisions(the_repository, revs, prefix)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize a rev_info structure with default values. The third parameter may
|
* Initialize a rev_info structure with default values. The third parameter may
|
||||||
|
@ -367,6 +360,9 @@ struct setup_revision_opt {
|
||||||
void repo_init_revisions(struct repository *r,
|
void repo_init_revisions(struct repository *r,
|
||||||
struct rev_info *revs,
|
struct rev_info *revs,
|
||||||
const char *prefix);
|
const char *prefix);
|
||||||
|
#ifndef NO_THE_REPOSITORY_COMPATIBILITY_MACROS
|
||||||
|
#define init_revisions(revs, prefix) repo_init_revisions(the_repository, revs, prefix)
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse revision information, filling in the `rev_info` structure, and
|
* Parse revision information, filling in the `rev_info` structure, and
|
||||||
|
@ -375,9 +371,22 @@ void repo_init_revisions(struct repository *r,
|
||||||
* head of the argument list. The last parameter is used in case no
|
* head of the argument list. The last parameter is used in case no
|
||||||
* parameter given by the first two arguments.
|
* parameter given by the first two arguments.
|
||||||
*/
|
*/
|
||||||
|
struct setup_revision_opt {
|
||||||
|
const char *def;
|
||||||
|
void (*tweak)(struct rev_info *, struct setup_revision_opt *);
|
||||||
|
unsigned int assume_dashdash:1,
|
||||||
|
allow_exclude_promisor_objects:1;
|
||||||
|
unsigned revarg_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 *);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free data allocated in a "struct rev_info" after it's been
|
||||||
|
* initialized with repo_init_revisions() or REV_INFO_INIT.
|
||||||
|
*/
|
||||||
|
void release_revisions(struct rev_info *revs);
|
||||||
|
|
||||||
void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx,
|
void parse_revision_opt(struct rev_info *revs, struct parse_opt_ctx_t *ctx,
|
||||||
const struct option *options,
|
const struct option *options,
|
||||||
const char * const usagestr[]);
|
const char * const usagestr[]);
|
||||||
|
@ -418,6 +427,14 @@ void mark_trees_uninteresting_sparse(struct repository *r, struct oidset *trees)
|
||||||
|
|
||||||
void show_object_with_name(FILE *, struct object *, const char *);
|
void show_object_with_name(FILE *, struct object *, const char *);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helpers to check if a "struct string_list" item matches with
|
||||||
|
* wildmatch().
|
||||||
|
*/
|
||||||
|
int ref_excluded(struct string_list *, const char *path);
|
||||||
|
void clear_ref_exclusion(struct string_list **);
|
||||||
|
void add_ref_exclusion(struct string_list **, const char *exclude);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function can be used if you want to add commit objects as revision
|
* This function can be used if you want to add commit objects as revision
|
||||||
* information. You can use the `UNINTERESTING` object flag to indicate if
|
* information. You can use the `UNINTERESTING` object flag to indicate if
|
||||||
|
@ -473,4 +490,10 @@ int rewrite_parents(struct rev_info *revs,
|
||||||
*/
|
*/
|
||||||
struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit);
|
struct commit_list *get_saved_parents(struct rev_info *revs, const struct commit *commit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global for the (undocumented) "--early-output" flag for "git log".
|
||||||
|
*/
|
||||||
|
typedef void (*show_early_output_fn_t)(struct rev_info *, struct commit_list *);
|
||||||
|
extern volatile show_early_output_fn_t show_early_output;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
26
sequencer.c
26
sequencer.c
|
@ -1346,6 +1346,7 @@ void print_commit_summary(struct repository *r,
|
||||||
log_tree_commit(&rev, commit);
|
log_tree_commit(&rev, commit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
release_revisions(&rev);
|
||||||
strbuf_release(&format);
|
strbuf_release(&format);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3414,6 +3415,7 @@ static int make_patch(struct repository *r,
|
||||||
unuse_commit_buffer(commit, commit_buffer);
|
unuse_commit_buffer(commit, commit_buffer);
|
||||||
}
|
}
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
|
release_revisions(&log_tree_opt);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -4524,6 +4526,7 @@ cleanup_head_ref:
|
||||||
&log_tree_opt.diffopt);
|
&log_tree_opt.diffopt);
|
||||||
log_tree_diff_flush(&log_tree_opt);
|
log_tree_diff_flush(&log_tree_opt);
|
||||||
}
|
}
|
||||||
|
release_revisions(&log_tree_opt);
|
||||||
}
|
}
|
||||||
flush_rewritten_pending();
|
flush_rewritten_pending();
|
||||||
if (!stat(rebase_path_rewritten_list(), &st) &&
|
if (!stat(rebase_path_rewritten_list(), &st) &&
|
||||||
|
@ -5350,6 +5353,7 @@ int sequencer_make_script(struct repository *r, struct strbuf *out, int argc,
|
||||||
int rebase_merges = flags & TODO_LIST_REBASE_MERGES;
|
int rebase_merges = flags & TODO_LIST_REBASE_MERGES;
|
||||||
int reapply_cherry_picks = flags & TODO_LIST_REAPPLY_CHERRY_PICKS;
|
int reapply_cherry_picks = flags & TODO_LIST_REAPPLY_CHERRY_PICKS;
|
||||||
int skipped_commit = 0;
|
int skipped_commit = 0;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
repo_init_revisions(r, &revs, NULL);
|
repo_init_revisions(r, &revs, NULL);
|
||||||
revs.verbose_header = 1;
|
revs.verbose_header = 1;
|
||||||
|
@ -5373,14 +5377,20 @@ 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)
|
if (setup_revisions(argc, argv, &revs, NULL) > 1) {
|
||||||
return error(_("make_script: unhandled options"));
|
ret = error(_("make_script: unhandled options"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if (prepare_revision_walk(&revs) < 0)
|
if (prepare_revision_walk(&revs) < 0) {
|
||||||
return error(_("make_script: error preparing revisions"));
|
ret = error(_("make_script: error preparing revisions"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
if (rebase_merges)
|
if (rebase_merges) {
|
||||||
return make_script_with_merges(&pp, &revs, out, flags);
|
ret = make_script_with_merges(&pp, &revs, out, flags);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
while ((commit = get_revision(&revs))) {
|
while ((commit = get_revision(&revs))) {
|
||||||
int is_empty = is_original_commit_empty(commit);
|
int is_empty = is_original_commit_empty(commit);
|
||||||
|
@ -5404,7 +5414,9 @@ int sequencer_make_script(struct repository *r, struct strbuf *out, int argc,
|
||||||
if (skipped_commit)
|
if (skipped_commit)
|
||||||
advise_if_enabled(ADVICE_SKIPPED_CHERRY_PICKS,
|
advise_if_enabled(ADVICE_SKIPPED_CHERRY_PICKS,
|
||||||
_("use --reapply-cherry-picks to include skipped commits"));
|
_("use --reapply-cherry-picks to include skipped commits"));
|
||||||
return 0;
|
cleanup:
|
||||||
|
release_revisions(&revs);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -262,6 +262,7 @@ struct commit_list *get_shallow_commits_by_rev_list(int ac, const char **av,
|
||||||
if ((o->flags & both_flags) == both_flags)
|
if ((o->flags & both_flags) == both_flags)
|
||||||
o->flags &= ~not_shallow_flag;
|
o->flags &= ~not_shallow_flag;
|
||||||
}
|
}
|
||||||
|
release_revisions(&revs);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
11
submodule.c
11
submodule.c
|
@ -619,7 +619,7 @@ void show_submodule_diff_summary(struct diff_options *o, const char *path,
|
||||||
struct object_id *one, struct object_id *two,
|
struct object_id *one, struct object_id *two,
|
||||||
unsigned dirty_submodule)
|
unsigned dirty_submodule)
|
||||||
{
|
{
|
||||||
struct rev_info rev;
|
struct rev_info rev = REV_INFO_INIT;
|
||||||
struct commit *left = NULL, *right = NULL;
|
struct commit *left = NULL, *right = NULL;
|
||||||
struct commit_list *merge_bases = NULL;
|
struct commit_list *merge_bases = NULL;
|
||||||
struct repository *sub;
|
struct repository *sub;
|
||||||
|
@ -645,8 +645,8 @@ void show_submodule_diff_summary(struct diff_options *o, const char *path,
|
||||||
print_submodule_diff_summary(sub, &rev, o);
|
print_submodule_diff_summary(sub, &rev, o);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (merge_bases)
|
free_commit_list(merge_bases);
|
||||||
free_commit_list(merge_bases);
|
release_revisions(&rev);
|
||||||
clear_commit_marks(left, ~0);
|
clear_commit_marks(left, ~0);
|
||||||
clear_commit_marks(right, ~0);
|
clear_commit_marks(right, ~0);
|
||||||
if (sub) {
|
if (sub) {
|
||||||
|
@ -735,8 +735,7 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
|
||||||
|
|
||||||
done:
|
done:
|
||||||
strbuf_release(&sb);
|
strbuf_release(&sb);
|
||||||
if (merge_bases)
|
free_commit_list(merge_bases);
|
||||||
free_commit_list(merge_bases);
|
|
||||||
if (left)
|
if (left)
|
||||||
clear_commit_marks(left, ~0);
|
clear_commit_marks(left, ~0);
|
||||||
if (right)
|
if (right)
|
||||||
|
@ -925,9 +924,11 @@ static void collect_changed_submodules(struct repository *r,
|
||||||
diff_rev.diffopt.format_callback_data = &data;
|
diff_rev.diffopt.format_callback_data = &data;
|
||||||
diff_rev.dense_combined_merges = 1;
|
diff_rev.dense_combined_merges = 1;
|
||||||
diff_tree_combined_merge(commit, &diff_rev);
|
diff_tree_combined_merge(commit, &diff_rev);
|
||||||
|
release_revisions(&diff_rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
reset_revision_walk();
|
reset_revision_walk();
|
||||||
|
release_revisions(&rev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void free_submodules_data(struct string_list *submodules)
|
static void free_submodules_data(struct string_list *submodules)
|
||||||
|
|
|
@ -99,6 +99,7 @@ int cmd__fast_rebase(int argc, const char **argv)
|
||||||
struct merge_result result;
|
struct merge_result result;
|
||||||
struct strbuf reflog_msg = STRBUF_INIT;
|
struct strbuf reflog_msg = STRBUF_INIT;
|
||||||
struct strbuf branch_name = STRBUF_INIT;
|
struct strbuf branch_name = STRBUF_INIT;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* test-tool stuff doesn't set up the git directory by default; need to
|
* test-tool stuff doesn't set up the git directory by default; need to
|
||||||
|
@ -137,13 +138,17 @@ int cmd__fast_rebase(int argc, const char **argv)
|
||||||
revs.topo_order = 1;
|
revs.topo_order = 1;
|
||||||
strvec_pushl(&rev_walk_args, "", argv[4], "--not", argv[3], NULL);
|
strvec_pushl(&rev_walk_args, "", argv[4], "--not", argv[3], NULL);
|
||||||
|
|
||||||
if (setup_revisions(rev_walk_args.nr, rev_walk_args.v, &revs, NULL) > 1)
|
if (setup_revisions(rev_walk_args.nr, rev_walk_args.v, &revs, NULL) > 1) {
|
||||||
return error(_("unhandled options"));
|
ret = error(_("unhandled options"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
strvec_clear(&rev_walk_args);
|
strvec_clear(&rev_walk_args);
|
||||||
|
|
||||||
if (prepare_revision_walk(&revs) < 0)
|
if (prepare_revision_walk(&revs) < 0) {
|
||||||
return error(_("error preparing revisions"));
|
ret = error(_("error preparing revisions"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
init_merge_options(&merge_opt, the_repository);
|
init_merge_options(&merge_opt, the_repository);
|
||||||
memset(&result, 0, sizeof(result));
|
memset(&result, 0, sizeof(result));
|
||||||
|
@ -201,8 +206,6 @@ int cmd__fast_rebase(int argc, const char **argv)
|
||||||
}
|
}
|
||||||
if (create_symref("HEAD", branch_name.buf, reflog_msg.buf) < 0)
|
if (create_symref("HEAD", branch_name.buf, reflog_msg.buf) < 0)
|
||||||
die(_("unable to update HEAD"));
|
die(_("unable to update HEAD"));
|
||||||
strbuf_release(&reflog_msg);
|
|
||||||
strbuf_release(&branch_name);
|
|
||||||
|
|
||||||
prime_cache_tree(the_repository, the_repository->index,
|
prime_cache_tree(the_repository, the_repository->index,
|
||||||
result.tree);
|
result.tree);
|
||||||
|
@ -221,5 +224,11 @@ int cmd__fast_rebase(int argc, const char **argv)
|
||||||
if (write_locked_index(&the_index, &lock,
|
if (write_locked_index(&the_index, &lock,
|
||||||
COMMIT_LOCK | SKIP_IF_UNCHANGED))
|
COMMIT_LOCK | SKIP_IF_UNCHANGED))
|
||||||
die(_("unable to write %s"), get_index_file());
|
die(_("unable to write %s"), get_index_file());
|
||||||
return (result.clean == 0);
|
|
||||||
|
ret = (result.clean == 0);
|
||||||
|
cleanup:
|
||||||
|
strbuf_release(&reflog_msg);
|
||||||
|
strbuf_release(&branch_name);
|
||||||
|
release_revisions(&revs);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ static int run_revision_walk(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
reset_revision_walk();
|
reset_revision_walk();
|
||||||
|
release_revisions(&rev);
|
||||||
return got_revision;
|
return got_revision;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
if test -z "$TEST_FAILS_SANITIZE_LEAK"
|
||||||
|
then
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
|
fi
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
if test -n "$NO_SVN_TESTS"
|
if test -n "$NO_SVN_TESTS"
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='"-C <path>" option and its effects on other path-related options'
|
test_description='"-C <path>" option and its effects on other path-related options'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success '"git -C <path>" runs git from the directory <path>' '
|
test_expect_success '"git -C <path>" runs git from the directory <path>' '
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
test_description='Test revision walking api'
|
test_description='Test revision walking api'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
cat >run_twice_expected <<-EOF
|
cat >run_twice_expected <<-EOF
|
||||||
|
|
|
@ -5,6 +5,7 @@ test_description='previous branch syntax @{-n}'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'branch -d @{-1}' '
|
test_expect_success 'branch -d @{-1}' '
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='various @{whatever} syntax tests'
|
test_description='various @{whatever} syntax tests'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
|
|
|
@ -21,6 +21,7 @@ In the test, these paths are used:
|
||||||
yomin - not in H or M
|
yomin - not in H or M
|
||||||
'
|
'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-read-tree.sh
|
. "$TEST_DIRECTORY"/lib-read-tree.sh
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ This is identical to t1001, but uses -u to update the work tree as well.
|
||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-read-tree.sh
|
. "$TEST_DIRECTORY"/lib-read-tree.sh
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='see how we handle various forms of corruption'
|
test_description='see how we handle various forms of corruption'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
# convert "1234abcd" to ".git/objects/12/34abcd"
|
# convert "1234abcd" to ".git/objects/12/34abcd"
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='basic symbolic-ref tests'
|
test_description='basic symbolic-ref tests'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
# If the tests munging HEAD fail, they can break detection of
|
# If the tests munging HEAD fail, they can break detection of
|
||||||
|
|
|
@ -4,6 +4,7 @@ test_description='Test reflog display routines'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='reflog walk shows repeated commits again'
|
test_description='reflog walk shows repeated commits again'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup commits' '
|
test_expect_success 'setup commits' '
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='per-worktree refs'
|
test_description='per-worktree refs'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
|
|
|
@ -4,6 +4,7 @@ test_description='checkout from unborn branch'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
|
|
|
@ -14,6 +14,7 @@ only the updates to dir/sub.
|
||||||
Also tested are "git add -u" without limiting, and "git add -u"
|
Also tested are "git add -u" without limiting, and "git add -u"
|
||||||
without contents changes, and other conditions'
|
without contents changes, and other conditions'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success setup '
|
test_expect_success setup '
|
||||||
|
|
|
@ -8,6 +8,7 @@ test_description='Test commit notes index (expensive!)'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
create_repo () {
|
create_repo () {
|
||||||
|
|
|
@ -5,6 +5,7 @@ test_description='Test commit notes organized in subtrees'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
number_of_commits=100
|
number_of_commits=100
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='Test that adding/removing many notes triggers automatic fanout restructuring'
|
test_description='Test that adding/removing many notes triggers automatic fanout restructuring'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
path_has_fanout() {
|
path_has_fanout() {
|
||||||
|
|
|
@ -5,6 +5,7 @@ test_description='rebasing a commit with multi-line first paragraph.'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success setup '
|
test_expect_success setup '
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
test_description='Format-patch numbering options'
|
test_description='Format-patch numbering options'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success setup '
|
test_expect_success setup '
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='difference in submodules'
|
test_description='difference in submodules'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-diff.sh
|
. "$TEST_DIRECTORY"/lib-diff.sh
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='format-patch mime headers and extra headers do not conflict'
|
test_description='format-patch mime headers and extra headers do not conflict'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'create commit with utf-8 body' '
|
test_expect_success 'create commit with utf-8 body' '
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='format-patch -s should force MIME encoding as needed'
|
test_description='format-patch -s should force MIME encoding as needed'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success setup '
|
test_expect_success setup '
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='diff with assume-unchanged entries'
|
test_description='diff with assume-unchanged entries'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
# external diff has been tested in t4020-diff-external.sh
|
# external diff has been tested in t4020-diff-external.sh
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
test_description='diff.context configuration'
|
test_description='diff.context configuration'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
|
|
|
@ -4,6 +4,7 @@ test_description='test combined/stat/moved interaction'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
# This test covers a weird 3-way interaction between "--cc -p", which will run
|
# This test covers a weird 3-way interaction between "--cc -p", which will run
|
||||||
|
|
|
@ -4,6 +4,7 @@ test_description='apply to deeper directory without getting fooled with symlink'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success setup '
|
test_expect_success setup '
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
test_description='apply empty'
|
test_description='apply empty'
|
||||||
|
|
||||||
|
|
||||||
TEST_PASSES_SANITIZE_LEAK=true
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='apply same filename'
|
test_description='apply same filename'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
test_description='Test --follow should always find copies hard in git log.
|
test_description='Test --follow should always find copies hard in git log.
|
||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-diff.sh
|
. "$TEST_DIRECTORY"/lib-diff.sh
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ test_description='Test for "git log --decorate" colors'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success setup '
|
test_expect_success setup '
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='git log with invalid commit headers'
|
test_description='git log with invalid commit headers'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
test_description='mmap sliding window tests'
|
test_description='mmap sliding window tests'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success \
|
test_expect_success \
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='bounds-checking of access to mmapped on-disk file formats'
|
test_description='bounds-checking of access to mmapped on-disk file formats'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
clear_base () {
|
clear_base () {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='pack-objects breaks long cross-pack delta chains'
|
test_description='pack-objects breaks long cross-pack delta chains'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
# This mirrors a repeated push setup:
|
# This mirrors a repeated push setup:
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='exercise delta islands'
|
test_description='exercise delta islands'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
# returns true iff $1 is a delta based on $2
|
# returns true iff $1 is a delta based on $2
|
||||||
|
|
|
@ -4,6 +4,7 @@ test_description='pack-objects object selection using sparse algorithm'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup repo' '
|
test_expect_success 'setup repo' '
|
||||||
|
|
|
@ -4,6 +4,7 @@ test_description='git remote group handling'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
mark() {
|
mark() {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='fetch follows remote-tracking branches correctly'
|
test_description='fetch follows remote-tracking branches correctly'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success setup '
|
test_expect_success setup '
|
||||||
|
|
|
@ -14,6 +14,7 @@ export GIT_TEST_PROTOCOL_VERSION
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
build_script () {
|
build_script () {
|
||||||
|
|
|
@ -8,6 +8,7 @@ test_description='fetch exit status test'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success setup '
|
test_expect_success setup '
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='fetching via git:// using core.gitproxy'
|
test_description='fetching via git:// using core.gitproxy'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup remote repo' '
|
test_expect_success 'setup remote repo' '
|
||||||
|
|
|
@ -13,6 +13,7 @@ Unless the directory already exists, in which case we clean up only what we
|
||||||
wrote.
|
wrote.
|
||||||
'
|
'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
corrupt_repo () {
|
corrupt_repo () {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='selecting remote repo in ambiguous cases'
|
test_description='selecting remote repo in ambiguous cases'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
reset() {
|
reset() {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#
|
#
|
||||||
test_description='Tests git rev-list --bisect functionality'
|
test_description='Tests git rev-list --bisect functionality'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions
|
. "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
test_description='Tests git rev-list --topo-order functionality'
|
test_description='Tests git rev-list --topo-order functionality'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions
|
. "$TEST_DIRECTORY"/lib-t6000.sh # t6xxx specific functions
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='git rev-list --max-count and --skip test'
|
test_description='git rev-list --max-count and --skip test'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
|
|
|
@ -5,6 +5,7 @@ test_description='rev-list/rev-parse --glob'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
commit () {
|
commit () {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
test_description='rev-list testing in-commit-order'
|
test_description='rev-list testing in-commit-order'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup a commit history with trees, blobs' '
|
test_expect_success 'setup a commit history with trees, blobs' '
|
||||||
|
|
|
@ -8,6 +8,7 @@ test_description='Test git rev-parse with different parent options'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_cmp_rev_output () {
|
test_cmp_rev_output () {
|
||||||
|
|
|
@ -4,6 +4,7 @@ test_description='operations that cull histories in unusual ways'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success setup '
|
test_expect_success setup '
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='rev-list with .keep packs'
|
test_description='rev-list with .keep packs'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup' '
|
test_expect_success 'setup' '
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='test case insensitive pathspec limiting'
|
test_description='test case insensitive pathspec limiting'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
if test_have_prereq CASE_INSENSITIVE_FS
|
if test_have_prereq CASE_INSENSITIVE_FS
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
test_description='filter-branch removal of trees with null sha1'
|
test_description='filter-branch removal of trees with null sha1'
|
||||||
|
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success 'setup: base commits' '
|
test_expect_success 'setup: base commits' '
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
test_description='repack involving cyclic alternate'
|
test_description='repack involving cyclic alternate'
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
test_expect_success setup '
|
test_expect_success setup '
|
||||||
|
|
|
@ -4,6 +4,7 @@ test_description='git send-email'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_PASSES_SANITIZE_LEAK=true
|
||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
|
|
||||||
# May be altered later in the test
|
# May be altered later in the test
|
||||||
|
|
|
@ -8,6 +8,7 @@ test_description='git svn basic tests'
|
||||||
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
|
||||||
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
|
||||||
|
|
||||||
|
TEST_FAILS_SANITIZE_LEAK=true
|
||||||
. ./lib-git-svn.sh
|
. ./lib-git-svn.sh
|
||||||
|
|
||||||
prepare_utf8_locale
|
prepare_utf8_locale
|
||||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче