From: Junio C Hamano Date: Fri, 28 Dec 2018 18:41:41 +0000 (-0800) Subject: Merge branch 'nd/the-index' into md/list-objects-filter-by-depth X-Git-Tag: v2.21.0-rc0~55^2~3 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fgit.git;a=commitdiff_plain;h=0aa9d8aa6ce429f0fa04e1ca819ed766c211e242 Merge branch 'nd/the-index' into md/list-objects-filter-by-depth --- 0aa9d8aa6ce429f0fa04e1ca819ed766c211e242 diff --cc builtin/rebase.c index b5c99ec10c,bc07d932a5..00de70365e --- a/builtin/rebase.c +++ b/builtin/rebase.c @@@ -598,12 -582,14 +598,12 @@@ static int reset_head(struct object_id } tree = parse_tree_indirect(oid); - prime_cache_tree(the_repository->index, tree); + prime_cache_tree(the_repository, the_repository->index, tree); - if (write_locked_index(the_repository->index, &lock, COMMIT_LOCK) < 0) + if (write_locked_index(the_repository->index, &lock, COMMIT_LOCK) < 0) { ret = error(_("could not write index")); - free((void *)desc.buffer); - - if (ret) - return ret; + goto leave_reset_head; + } reflog_action = getenv(GIT_REFLOG_ACTION_ENVIRONMENT); strbuf_addf(&msg, "%s: ", reflog_action ? reflog_action : "rebase"); @@@ -1037,15 -996,12 +1037,15 @@@ int cmd_rebase(int argc, const char **a struct string_list merge_rr = STRING_LIST_INIT_DUP; options.action = "skip"; + set_reflog_action(&options); - rerere_clear(&merge_rr); + rerere_clear(the_repository, &merge_rr); string_list_clear(&merge_rr, 1); - if (reset_head(NULL, "reset", NULL, 0, NULL, NULL) < 0) + if (reset_head(NULL, "reset", NULL, RESET_HEAD_HARD, + NULL, NULL) < 0) die(_("could not discard worktree changes")); - remove_branch_state(); ++ remove_branch_state(the_repository); if (read_basic_state(&options)) exit(1); goto run_rebase; @@@ -1053,19 -1009,16 +1053,19 @@@ case ACTION_ABORT: { struct string_list merge_rr = STRING_LIST_INIT_DUP; options.action = "abort"; + set_reflog_action(&options); - rerere_clear(&merge_rr); + rerere_clear(the_repository, &merge_rr); string_list_clear(&merge_rr, 1); if (read_basic_state(&options)) exit(1); if (reset_head(&options.orig_head, "reset", - options.head_name, 0, NULL, NULL) < 0) + options.head_name, RESET_HEAD_HARD, + NULL, NULL) < 0) die(_("could not move back to %s"), oid_to_hex(&options.orig_head)); - remove_branch_state(); ++ remove_branch_state(the_repository); ret = finish_rebase(&options); goto cleanup; } diff --cc sequencer.c index e1a4dd15f1,d726f77e11..b68bca0bef --- a/sequencer.c +++ b/sequencer.c @@@ -1969,7 -1942,7 +1992,7 @@@ static int read_and_refresh_cache(struc { struct lock_file index_lock = LOCK_INIT; int index_fd = hold_locked_index(&index_lock, 0); - if (read_index(&the_index) < 0) { - if (read_index_preload(r->index, NULL, 0) < 0) { ++ if (read_index(r->index) < 0) { rollback_lock_file(&index_lock); return error(_("git %s: failed to read the index"), _(action_name(opts))); @@@ -3252,10 -3241,6 +3290,10 @@@ static int do_merge(struct repository * goto leave_merge; } + write_message(oid_to_hex(&merge_commit->object.oid), GIT_SHA1_HEXSZ, - git_path_merge_head(the_repository), 0); - write_message("no-ff", 5, git_path_merge_mode(the_repository), 0); ++ git_path_merge_head(r), 0); ++ write_message("no-ff", 5, git_path_merge_mode(r), 0); + for (j = bases; j; j = j->next) commit_list_insert(j->item, &reversed); free_commit_list(bases); @@@ -4901,11 -4893,11 +4948,11 @@@ int complete_action(struct repository * if (checkout_onto(opts, onto_name, oid_to_hex(&oid), orig_head)) return -1; -; + - if (require_clean_work_tree("rebase", "", 1, 1)) + if (require_clean_work_tree(r, "rebase", "", 1, 1)) return -1; - return sequencer_continue(opts); + return sequencer_continue(r, opts); } struct subject2item_entry { diff --cc sequencer.h index 5071a73563,d2c18edd3a..9d83f0f3e9 --- a/sequencer.h +++ b/sequencer.h @@@ -128,11 -131,10 +131,13 @@@ int prepare_branch_to_be_rebased(struc #define SUMMARY_INITIAL_COMMIT (1 << 0) #define SUMMARY_SHOW_AUTHOR_DATE (1 << 1) - void print_commit_summary(const char *prefix, const struct object_id *oid, + void print_commit_summary(struct repository *repo, + const char *prefix, + const struct object_id *oid, unsigned int flags); + +int read_author_script(const char *path, char **name, char **email, char **date, + int allow_missing); #endif void parse_strategy_opts(struct replay_opts *opts, char *raw_opts); diff --cc wt-status.c index a24711374c,e582c54238..0fe3bcd4cd --- a/wt-status.c +++ b/wt-status.c @@@ -1558,8 -1564,7 +1564,8 @@@ void wt_status_get_state(struct reposit struct stat st; struct object_id oid; - if (!stat(git_path_merge_head(the_repository), &st)) { + if (!stat(git_path_merge_head(r), &st)) { + wt_status_check_rebase(NULL, state); state->merge_in_progress = 1; } else if (wt_status_check_rebase(NULL, state)) { ; /* all set */