add-interactive: stop using the_repository
Stop using `the_repository` in the "add-interactive" subsystem by reusing the repository we already have available via parameters or in the `add_i_state` structure. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
727c71a112
commit
1b374ad71f
@@ -1,4 +1,3 @@
|
|||||||
#define USE_THE_REPOSITORY_VARIABLE
|
|
||||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||||
|
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
@@ -72,14 +71,14 @@ void init_add_i_state(struct add_i_state *s, struct repository *r)
|
|||||||
s->use_color ? GIT_COLOR_RESET : "", COLOR_MAXLEN);
|
s->use_color ? GIT_COLOR_RESET : "", COLOR_MAXLEN);
|
||||||
|
|
||||||
FREE_AND_NULL(s->interactive_diff_filter);
|
FREE_AND_NULL(s->interactive_diff_filter);
|
||||||
git_config_get_string("interactive.difffilter",
|
repo_config_get_string(r, "interactive.difffilter",
|
||||||
&s->interactive_diff_filter);
|
&s->interactive_diff_filter);
|
||||||
|
|
||||||
FREE_AND_NULL(s->interactive_diff_algorithm);
|
FREE_AND_NULL(s->interactive_diff_algorithm);
|
||||||
git_config_get_string("diff.algorithm",
|
repo_config_get_string(r, "diff.algorithm",
|
||||||
&s->interactive_diff_algorithm);
|
&s->interactive_diff_algorithm);
|
||||||
|
|
||||||
git_config_get_bool("interactive.singlekey", &s->use_single_key);
|
repo_config_get_bool(r, "interactive.singlekey", &s->use_single_key);
|
||||||
if (s->use_single_key)
|
if (s->use_single_key)
|
||||||
setbuf(stdin, NULL);
|
setbuf(stdin, NULL);
|
||||||
}
|
}
|
||||||
@@ -535,7 +534,7 @@ static int get_modified_files(struct repository *r,
|
|||||||
size_t *binary_count)
|
size_t *binary_count)
|
||||||
{
|
{
|
||||||
struct object_id head_oid;
|
struct object_id head_oid;
|
||||||
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(the_repository),
|
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(r),
|
||||||
"HEAD", RESOLVE_REF_READING,
|
"HEAD", RESOLVE_REF_READING,
|
||||||
&head_oid, NULL);
|
&head_oid, NULL);
|
||||||
struct collection_status s = { 0 };
|
struct collection_status s = { 0 };
|
||||||
@@ -560,7 +559,7 @@ static int get_modified_files(struct repository *r,
|
|||||||
s.skip_unseen = filter && i;
|
s.skip_unseen = filter && i;
|
||||||
|
|
||||||
opt.def = is_initial ?
|
opt.def = is_initial ?
|
||||||
empty_tree_oid_hex(the_repository->hash_algo) : oid_to_hex(&head_oid);
|
empty_tree_oid_hex(r->hash_algo) : oid_to_hex(&head_oid);
|
||||||
|
|
||||||
repo_init_revisions(r, &rev, NULL);
|
repo_init_revisions(r, &rev, NULL);
|
||||||
setup_revisions(0, NULL, &rev, &opt);
|
setup_revisions(0, NULL, &rev, &opt);
|
||||||
@@ -765,7 +764,7 @@ static int run_revert(struct add_i_state *s, const struct pathspec *ps,
|
|||||||
size_t count, i, j;
|
size_t count, i, j;
|
||||||
|
|
||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(the_repository),
|
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(s->r),
|
||||||
"HEAD", RESOLVE_REF_READING,
|
"HEAD", RESOLVE_REF_READING,
|
||||||
&oid,
|
&oid,
|
||||||
NULL);
|
NULL);
|
||||||
@@ -996,7 +995,7 @@ static int run_diff(struct add_i_state *s, const struct pathspec *ps,
|
|||||||
ssize_t count, i;
|
ssize_t count, i;
|
||||||
|
|
||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(the_repository),
|
int is_initial = !refs_resolve_ref_unsafe(get_main_ref_store(s->r),
|
||||||
"HEAD", RESOLVE_REF_READING,
|
"HEAD", RESOLVE_REF_READING,
|
||||||
&oid,
|
&oid,
|
||||||
NULL);
|
NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user