From 5b02ca38a30298a963b3595f2cd884e11cf10c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 10 Nov 2018 06:48:49 +0100 Subject: wt-status.c: remove implicit dependency on the_index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/commit.c | 2 +- builtin/pull.c | 3 ++- builtin/rebase.c | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'builtin') diff --git a/builtin/commit.c b/builtin/commit.c index 074bd9a551..6637a928a7 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -185,7 +185,7 @@ static void determine_whence(struct wt_status *s) static void status_init_config(struct wt_status *s, config_fn_t fn) { - wt_status_prepare(s); + wt_status_prepare(the_repository, s); init_diff_ui_defaults(); git_config(fn, s); determine_whence(s); diff --git a/builtin/pull.c b/builtin/pull.c index c21aa276f1..6026ce1a69 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -888,7 +888,8 @@ int cmd_pull(int argc, const char **argv, const char *prefix) die(_("Updating an unborn branch with changes added to the index.")); if (!autostash) - require_clean_work_tree(N_("pull with rebase"), + require_clean_work_tree(the_repository, + N_("pull with rebase"), _("please commit or stash them."), 1, 0); if (get_rebase_fork_point(&rebase_fork_point, repo, *refspecs)) diff --git a/builtin/rebase.c b/builtin/rebase.c index 0ee06aa363..b9eb958454 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -983,7 +983,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) &lock_file); rollback_lock_file(&lock_file); - if (has_unstaged_changes(1)) { + if (has_unstaged_changes(the_repository, 1)) { puts(_("You must edit all merge conflicts and then\n" "mark them as resolved using git add")); exit(1); @@ -1351,7 +1351,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) update_index_if_able(&the_index, &lock_file); rollback_lock_file(&lock_file); - if (has_unstaged_changes(1) || has_uncommitted_changes(1)) { + if (has_unstaged_changes(the_repository, 1) || + has_uncommitted_changes(the_repository, 1)) { const char *autostash = state_dir_path("autostash", &options); struct child_process stash = CHILD_PROCESS_INIT; @@ -1397,7 +1398,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) } } - if (require_clean_work_tree("rebase", + if (require_clean_work_tree(the_repository, "rebase", _("Please commit or stash them."), 1, 1)) { ret = 1; goto cleanup; -- cgit v1.2.3 From 5684200fe3572cf70b7260d1f835d801ff6dd14e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 10 Nov 2018 06:48:53 +0100 Subject: notes-merge.c: remove implicit dependency on the_index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/notes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/notes.c b/builtin/notes.c index c05cd004ab..15a6c78855 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -808,7 +808,7 @@ static int merge(int argc, const char **argv, const char *prefix) usage_with_options(git_notes_merge_usage, options); } - init_notes_merge_options(&o); + init_notes_merge_options(the_repository, &o); o.verbosity = verbosity + NOTES_MERGE_VERBOSITY_DEFAULT; if (do_abort) -- cgit v1.2.3 From 6c6d5d0776b5eb60dc206691fc1fde755e94da20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 10 Nov 2018 06:48:55 +0100 Subject: transport.c: remove implicit dependency on the_index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit note, there's still another hidden dependency related to this: even though we pass a repo to transport_push() we still use is_bare_repository() which pretty much assumes the_repository (and some other global state). Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/push.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/push.c b/builtin/push.c index d09a42062c..efb3e38a8d 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -355,7 +355,8 @@ static int push_with_options(struct transport *transport, struct refspec *rs, if (verbosity > 0) fprintf(stderr, _("Pushing to %s\n"), transport->url); - err = transport_push(transport, rs, flags, &reject_reasons); + err = transport_push(the_repository, transport, + rs, flags, &reject_reasons); if (err != 0) { fprintf(stderr, "%s", push_get_color(PUSH_COLOR_ERROR)); error(_("failed to push some refs to '%s'"), transport->url); -- cgit v1.2.3 From f11c95805495fcb588f767ffab193f2aed328eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 10 Nov 2018 06:48:56 +0100 Subject: sequencer.c: remove implicit dependency on the_index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since we're going to pass 'struct repository *' around most of the time instead of 'struct index_state *' because most sequencer.c operations need more than just the index, the_repository is replaced as well in the functions that now take 'struct repository *'. the_repository is still present in this file, but total clean up will be done later. It's not the main focus of this patch. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/commit.c | 3 ++- builtin/merge.c | 2 +- builtin/rebase--interactive.c | 4 ++-- builtin/revert.c | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) (limited to 'builtin') diff --git a/builtin/commit.c b/builtin/commit.c index 6637a928a7..e89bf35634 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1679,7 +1679,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix) flags |= SUMMARY_INITIAL_COMMIT; if (author_date_is_interesting()) flags |= SUMMARY_SHOW_AUTHOR_DATE; - print_commit_summary(prefix, &oid, flags); + print_commit_summary(the_repository, prefix, + &oid, flags); } UNLEAK(err); diff --git a/builtin/merge.c b/builtin/merge.c index 4aa6071598..db22119c93 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -896,7 +896,7 @@ static int suggest_conflicts(void) filename = git_path_merge_msg(the_repository); fp = xfopen(filename, "a"); - append_conflicts_hint(&msgbuf); + append_conflicts_hint(&the_index, &msgbuf); fputs(msgbuf.buf, fp); strbuf_release(&msgbuf); fclose(fp); diff --git a/builtin/rebase--interactive.c b/builtin/rebase--interactive.c index a2ab68ed06..b7ce48a1ec 100644 --- a/builtin/rebase--interactive.c +++ b/builtin/rebase--interactive.c @@ -105,7 +105,7 @@ static int do_interactive_rebase(struct replay_opts *opts, unsigned flags, if (restrict_revision) argv_array_push(&make_script_args, restrict_revision); - ret = sequencer_make_script(todo_list, + ret = sequencer_make_script(the_repository, todo_list, make_script_args.argc, make_script_args.argv, flags); fclose(todo_list); @@ -235,7 +235,7 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix) rerere_clear(&merge_rr); /* fallthrough */ case CONTINUE: - ret = sequencer_continue(&opts); + ret = sequencer_continue(the_repository, &opts); break; } case EDIT_TODO: diff --git a/builtin/revert.c b/builtin/revert.c index c93393c89b..cd9f068195 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -199,10 +199,10 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts) return ret; } if (cmd == 'c') - return sequencer_continue(opts); + return sequencer_continue(the_repository, opts); if (cmd == 'a') return sequencer_rollback(opts); - return sequencer_pick_revisions(opts); + return sequencer_pick_revisions(the_repository, opts); } int cmd_revert(int argc, const char **argv, const char *prefix) -- cgit v1.2.3 From 005af339c9ad292f9ae2fe3555d8d362a225ca45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 10 Nov 2018 06:48:57 +0100 Subject: sequencer.c: remove implicit dependency on the_repository MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note that the_hash_algo stays, even if we can easily replace it with repo->hash_algo. My reason is I still believe tying hash_algo to a struct repository is a wrong move. But if I'm wrong, we can always go for another round of conversion. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/rebase--interactive.c | 11 ++++++----- builtin/revert.c | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'builtin') diff --git a/builtin/rebase--interactive.c b/builtin/rebase--interactive.c index b7ce48a1ec..d867050fd2 100644 --- a/builtin/rebase--interactive.c +++ b/builtin/rebase--interactive.c @@ -114,7 +114,8 @@ static int do_interactive_rebase(struct replay_opts *opts, unsigned flags, error(_("could not generate todo list")); else { discard_cache(); - ret = complete_action(opts, flags, shortrevisions, onto_name, onto, + ret = complete_action(the_repository, opts, flags, + shortrevisions, onto_name, onto, head_hash, cmd, autosquash); } @@ -252,16 +253,16 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix) } case SHORTEN_OIDS: case EXPAND_OIDS: - ret = transform_todos(flags); + ret = transform_todos(the_repository, flags); break; case CHECK_TODO_LIST: - ret = check_todo_list(); + ret = check_todo_list(the_repository); break; case REARRANGE_SQUASH: - ret = rearrange_squash(); + ret = rearrange_squash(the_repository); break; case ADD_EXEC: - ret = sequencer_add_exec_commands(cmd); + ret = sequencer_add_exec_commands(the_repository, cmd); break; default: BUG("invalid command '%d'", command); diff --git a/builtin/revert.c b/builtin/revert.c index cd9f068195..1fa75b2773 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -201,7 +201,7 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts) if (cmd == 'c') return sequencer_continue(the_repository, opts); if (cmd == 'a') - return sequencer_rollback(opts); + return sequencer_rollback(the_repository, opts); return sequencer_pick_revisions(the_repository, opts); } -- cgit v1.2.3 From 69d2cfe6e84fbcd77872191b6f433d38362c23d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 10 Nov 2018 06:48:59 +0100 Subject: bisect.c: remove the_repository reference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/bisect--helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index 4b5fadcbe1..417d141c09 100644 --- a/builtin/bisect--helper.c +++ b/builtin/bisect--helper.c @@ -137,7 +137,7 @@ int cmd_bisect__helper(int argc, const char **argv, const char *prefix) switch (cmdmode) { case NEXT_ALL: - return bisect_next_all(prefix, no_checkout); + return bisect_next_all(the_repository, prefix, no_checkout); case WRITE_TERMS: if (argc != 2) return error(_("--write-terms requires two arguments")); -- cgit v1.2.3 From 4edce1729a257ec9a420ff108e3b832b14d113c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 10 Nov 2018 06:49:00 +0100 Subject: branch.c: remove the_repository reference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/am.c | 2 +- builtin/branch.c | 6 ++++-- builtin/checkout.c | 5 +++-- builtin/reset.c | 2 +- builtin/revert.c | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) (limited to 'builtin') diff --git a/builtin/am.c b/builtin/am.c index 3ee9a9d2a9..232f3962d7 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -2022,7 +2022,7 @@ static int clean_index(const struct object_id *head, const struct object_id *rem if (merge_tree(remote_tree)) return -1; - remove_branch_state(); + remove_branch_state(the_repository); return 0; } diff --git a/builtin/branch.c b/builtin/branch.c index 0c55f7f065..1be727209b 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -783,7 +783,8 @@ int cmd_branch(int argc, const char **argv, const char *prefix) * create_branch takes care of setting up the tracking * info and making sure new_upstream is correct */ - create_branch(branch->name, new_upstream, 0, 0, 0, quiet, BRANCH_TRACK_OVERRIDE); + create_branch(the_repository, branch->name, new_upstream, + 0, 0, 0, quiet, BRANCH_TRACK_OVERRIDE); } else if (unset_upstream) { struct branch *branch = branch_get(argv[0]); struct strbuf buf = STRBUF_INIT; @@ -814,7 +815,8 @@ int cmd_branch(int argc, const char **argv, const char *prefix) if (track == BRANCH_TRACK_OVERRIDE) die(_("the '--set-upstream' option is no longer supported. Please use '--track' or '--set-upstream-to' instead.")); - create_branch(argv[0], (argc == 2) ? argv[1] : head, + create_branch(the_repository, + argv[0], (argc == 2) ? argv[1] : head, force, 0, reflog, quiet, track); } else diff --git a/builtin/checkout.c b/builtin/checkout.c index acdafc6e4c..169e797675 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -753,7 +753,8 @@ static void update_refs_for_switch(const struct checkout_opts *opts, free(refname); } else - create_branch(opts->new_branch, new_branch_info->name, + create_branch(the_repository, + opts->new_branch, new_branch_info->name, opts->new_branch_force ? 1 : 0, opts->new_branch_force ? 1 : 0, opts->new_branch_log, @@ -811,7 +812,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts, delete_reflog(old_branch_info->path); } } - remove_branch_state(); + remove_branch_state(the_repository); strbuf_release(&msg); if (!opts->quiet && (new_branch_info->path || (!opts->force_detach && !strcmp(new_branch_info->name, "HEAD")))) diff --git a/builtin/reset.c b/builtin/reset.c index 6d37a35e2e..5b4bbb0fb5 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -400,7 +400,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix) print_new_head_line(lookup_commit_reference(the_repository, &oid)); } if (!pathspec.nr) - remove_branch_state(); + remove_branch_state(the_repository); return update_ref_status; } diff --git a/builtin/revert.c b/builtin/revert.c index 1fa75b2773..df662d4324 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -195,7 +195,7 @@ static int run_sequencer(int argc, const char **argv, struct replay_opts *opts) if (cmd == 'q') { int ret = sequencer_remove_state(opts); if (!ret) - remove_branch_state(); + remove_branch_state(the_repository); return ret; } if (cmd == 'c') -- cgit v1.2.3 From 74ae4b638d0acf6ab155422152d7ad98fdbe6f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 10 Nov 2018 06:49:01 +0100 Subject: bundle.c: remove the_repository references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/bundle.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'builtin') diff --git a/builtin/bundle.c b/builtin/bundle.c index d0de59b94f..9e9c65d9c6 100644 --- a/builtin/bundle.c +++ b/builtin/bundle.c @@ -40,7 +40,7 @@ int cmd_bundle(int argc, const char **argv, const char *prefix) usage(builtin_bundle_usage); return 1; } - if (verify_bundle(&header, 1)) + if (verify_bundle(the_repository, &header, 1)) return 1; fprintf(stderr, _("%s is okay\n"), bundle_file); return 0; @@ -56,11 +56,12 @@ int cmd_bundle(int argc, const char **argv, const char *prefix) } if (!startup_info->have_repository) die(_("Need a repository to create a bundle.")); - return !!create_bundle(&header, bundle_file, argc, argv); + return !!create_bundle(the_repository, &header, + bundle_file, argc, argv); } else if (!strcmp(cmd, "unbundle")) { if (!startup_info->have_repository) die(_("Need a repository to unbundle.")); - return !!unbundle(&header, bundle_fd, 0) || + return !!unbundle(the_repository, &header, bundle_fd, 0) || list_bundle_refs(&header, argc, argv); } else usage(builtin_bundle_usage); -- cgit v1.2.3 From c207e9e1f6dd1802f0deadae51af5615d855edc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 10 Nov 2018 06:49:02 +0100 Subject: cache-tree.c: remove the_repository references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This case is more interesting than other boring "remove the_repo" commits because while we need access to the object database, we cannot simply use r->index because unpack-trees.c can operate on a temporary index, not $GIT_DIR/index. Ideally we should be able to pass an object database to lookup_tree() but that ship has sailed. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/read-tree.c | 4 +++- builtin/rebase.c | 2 +- builtin/reset.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'builtin') diff --git a/builtin/read-tree.c b/builtin/read-tree.c index fbbc98e516..c05c12d034 100644 --- a/builtin/read-tree.c +++ b/builtin/read-tree.c @@ -255,7 +255,9 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) * what came from the tree. */ if (nr_trees == 1 && !opts.prefix) - prime_cache_tree(&the_index, trees[0]); + prime_cache_tree(the_repository, + the_repository->index, + trees[0]); if (write_locked_index(&the_index, &lock_file, COMMIT_LOCK)) die("unable to write new index file"); diff --git a/builtin/rebase.c b/builtin/rebase.c index b9eb958454..d9bedecf86 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -582,7 +582,7 @@ static int reset_head(struct object_id *oid, const char *action, } 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) ret = error(_("could not write index")); diff --git a/builtin/reset.c b/builtin/reset.c index 5b4bbb0fb5..161b5e0cae 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -93,7 +93,7 @@ static int reset_index(const struct object_id *oid, int reset_type, int quiet) if (reset_type == MIXED || reset_type == HARD) { tree = parse_tree_indirect(oid); - prime_cache_tree(&the_index, tree); + prime_cache_tree(the_repository, the_repository->index, tree); } ret = 0; -- cgit v1.2.3 From 385cb64ff3598451ac3019443b364f49b8395e82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 10 Nov 2018 06:49:03 +0100 Subject: delta-islands.c: remove the_repository references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/pack-objects.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'builtin') diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index c99ee79c31..7812c2b1f3 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -2628,7 +2628,7 @@ static void prepare_pack(int window, int depth) unsigned n; if (use_delta_islands) - resolve_tree_islands(progress, &to_pack); + resolve_tree_islands(the_repository, progress, &to_pack); get_object_details(); @@ -3143,7 +3143,7 @@ static void get_object_list(int ac, const char **av) return; if (use_delta_islands) - load_delta_islands(); + load_delta_islands(the_repository); if (prepare_revision_walk(&revs)) die(_("revision walk setup failed")); -- cgit v1.2.3 From ffc00a48efe8f591a05f8e7b61f632bcaf098dde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 10 Nov 2018 06:49:04 +0100 Subject: diff-lib.c: remove the_repository references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/commit.c | 3 ++- builtin/merge-ours.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'builtin') diff --git a/builtin/commit.c b/builtin/commit.c index e89bf35634..91b1920255 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -908,7 +908,8 @@ static int prepare_to_commit(const char *index_file, const char *prefix, if (ignore_submodule_arg && !strcmp(ignore_submodule_arg, "all")) flags.ignore_submodules = 1; - committable = index_differs_from(parent, &flags, 1); + committable = index_differs_from(the_repository, + parent, &flags, 1); } } strbuf_release(&committer_ident); diff --git a/builtin/merge-ours.c b/builtin/merge-ours.c index c84c6e05e9..0b07263415 100644 --- a/builtin/merge-ours.c +++ b/builtin/merge-ours.c @@ -26,7 +26,7 @@ int cmd_merge_ours(int argc, const char **argv, const char *prefix) */ if (read_cache() < 0) die_errno("read_cache failed"); - if (index_differs_from("HEAD", NULL, 0)) + if (index_differs_from(the_repository, "HEAD", NULL, 0)) exit(2); exit(0); } -- cgit v1.2.3 From 94e10825bd72660548956a6d5fb260642ffb6386 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 10 Nov 2018 06:49:07 +0100 Subject: pack-check.c: remove the_repository references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/fsck.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/fsck.c b/builtin/fsck.c index 06eb421720..8ea2823864 100644 --- a/builtin/fsck.c +++ b/builtin/fsck.c @@ -752,7 +752,8 @@ int cmd_fsck(int argc, const char **argv, const char *prefix) for (p = get_all_packs(the_repository); p; p = p->next) { /* verify gives error messages itself */ - if (verify_pack(p, fsck_obj_buffer, + if (verify_pack(the_repository, + p, fsck_obj_buffer, progress, count)) errors_found |= ERROR_PACK; count += p->num_objects; -- cgit v1.2.3 From 7c14112741b81366cfbbc3b98e0b92422fcce83d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 10 Nov 2018 06:49:08 +0100 Subject: pack-*.c: remove the_repository references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/pack-objects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 7812c2b1f3..8abfb69e2d 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -3481,7 +3481,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) } } - prepare_packing_data(&to_pack); + prepare_packing_data(the_repository, &to_pack); if (progress) progress_state = start_progress(_("Enumerating objects"), 0); -- cgit v1.2.3 From 55e6b3547d4a678e56e3aef16ad3a3c90351325a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 10 Nov 2018 06:49:09 +0100 Subject: rerere.c: remove the_repository references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/am.c | 2 +- builtin/rebase--interactive.c | 2 +- builtin/rebase.c | 4 ++-- builtin/rerere.c | 10 ++++++---- 4 files changed, 10 insertions(+), 8 deletions(-) (limited to 'builtin') diff --git a/builtin/am.c b/builtin/am.c index 232f3962d7..f0eeec82a9 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -2033,7 +2033,7 @@ static int clean_index(const struct object_id *head, const struct object_id *rem static void am_rerere_clear(void) { struct string_list merge_rr = STRING_LIST_INIT_DUP; - rerere_clear(&merge_rr); + rerere_clear(the_repository, &merge_rr); string_list_clear(&merge_rr, 1); } diff --git a/builtin/rebase--interactive.c b/builtin/rebase--interactive.c index d867050fd2..bd7d39e2af 100644 --- a/builtin/rebase--interactive.c +++ b/builtin/rebase--interactive.c @@ -233,7 +233,7 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix) case SKIP: { struct string_list merge_rr = STRING_LIST_INIT_DUP; - rerere_clear(&merge_rr); + rerere_clear(the_repository, &merge_rr); /* fallthrough */ case CONTINUE: ret = sequencer_continue(the_repository, &opts); diff --git a/builtin/rebase.c b/builtin/rebase.c index d9bedecf86..bc07d932a5 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -997,7 +997,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) options.action = "skip"; - 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) @@ -1010,7 +1010,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) struct string_list merge_rr = STRING_LIST_INIT_DUP; options.action = "abort"; - rerere_clear(&merge_rr); + rerere_clear(the_repository, &merge_rr); string_list_clear(&merge_rr, 1); if (read_basic_state(&options)) diff --git a/builtin/rerere.c b/builtin/rerere.c index e89ccbc524..6f28c19b20 100644 --- a/builtin/rerere.c +++ b/builtin/rerere.c @@ -82,11 +82,12 @@ int cmd_rerere(int argc, const char **argv, const char *prefix) } if (!strcmp(argv[0], "clear")) { - rerere_clear(&merge_rr); + rerere_clear(the_repository, &merge_rr); } else if (!strcmp(argv[0], "gc")) - rerere_gc(&merge_rr); + rerere_gc(the_repository, &merge_rr); else if (!strcmp(argv[0], "status")) { - if (setup_rerere(&merge_rr, flags | RERERE_READONLY) < 0) + if (setup_rerere(the_repository, &merge_rr, + flags | RERERE_READONLY) < 0) return 0; for (i = 0; i < merge_rr.nr; i++) printf("%s\n", merge_rr.items[i].string); @@ -101,7 +102,8 @@ int cmd_rerere(int argc, const char **argv, const char *prefix) merge_rr.items[i].util = NULL; } } else if (!strcmp(argv[0], "diff")) { - if (setup_rerere(&merge_rr, flags | RERERE_READONLY) < 0) + if (setup_rerere(the_repository, &merge_rr, + flags | RERERE_READONLY) < 0) return 0; for (i = 0; i < merge_rr.nr; i++) { const char *path = merge_rr.items[i].string; -- cgit v1.2.3 From 36e7ed69de2c07a0214e79bde45714b92ac30ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Sat, 10 Nov 2018 06:49:10 +0100 Subject: rebase-interactive.c: remove the_repository references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While at there add a forward declaration for struct strbuf. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- builtin/rebase--interactive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin') diff --git a/builtin/rebase--interactive.c b/builtin/rebase--interactive.c index bd7d39e2af..dd2a55ab1d 100644 --- a/builtin/rebase--interactive.c +++ b/builtin/rebase--interactive.c @@ -240,7 +240,7 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix) break; } case EDIT_TODO: - ret = edit_todo_list(flags); + ret = edit_todo_list(the_repository, flags); break; case SHOW_CURRENT_PATCH: { struct child_process cmd = CHILD_PROCESS_INIT; -- cgit v1.2.3