mirror of
https://github.com/git/git
synced 2024-10-01 06:05:20 +00:00
Merge branch 'ps/builtin-config-cleanup'
Code clean-up to reduce inter-function communication inside builtin/config.c done via the use of global variables. * ps/builtin-config-cleanup: (21 commits) builtin/config: pass data between callbacks via local variables builtin/config: convert flags to a local variable builtin/config: track "fixed value" option via flags only builtin/config: convert `key` to a local variable builtin/config: convert `key_regexp` to a local variable builtin/config: convert `regexp` to a local variable builtin/config: convert `value_pattern` to a local variable builtin/config: convert `do_not_match` to a local variable builtin/config: move `respect_includes_opt` into location options builtin/config: move default value into display options builtin/config: move type options into display options builtin/config: move display options into local variables builtin/config: move location options into local variables builtin/config: refactor functions to have common exit paths config: make the config source const builtin/config: check for writeability after source is set up builtin/config: move actions into `cmd_config_actions()` builtin/config: move legacy options into `cmd_config()` builtin/config: move subcommand options into `cmd_config()` builtin/config: move legacy mode into its own function ...
This commit is contained in:
commit
00ffa1cb1c
964
builtin/config.c
964
builtin/config.c
File diff suppressed because it is too large
Load diff
4
config.c
4
config.c
|
@ -125,7 +125,7 @@ struct config_include_data {
|
|||
config_fn_t fn;
|
||||
void *data;
|
||||
const struct config_options *opts;
|
||||
struct git_config_source *config_source;
|
||||
const struct git_config_source *config_source;
|
||||
struct repository *repo;
|
||||
|
||||
/*
|
||||
|
@ -2117,7 +2117,7 @@ static int do_git_config_sequence(const struct config_options *opts,
|
|||
}
|
||||
|
||||
int config_with_options(config_fn_t fn, void *data,
|
||||
struct git_config_source *config_source,
|
||||
const struct git_config_source *config_source,
|
||||
struct repository *repo,
|
||||
const struct config_options *opts)
|
||||
{
|
||||
|
|
2
config.h
2
config.h
|
@ -232,7 +232,7 @@ void git_config(config_fn_t fn, void *);
|
|||
* sets `opts.respect_includes` to `1` by default.
|
||||
*/
|
||||
int config_with_options(config_fn_t fn, void *,
|
||||
struct git_config_source *config_source,
|
||||
const struct git_config_source *config_source,
|
||||
struct repository *repo,
|
||||
const struct config_options *opts);
|
||||
|
||||
|
|
|
@ -596,7 +596,8 @@ test_expect_success 'get bool variable with empty value' '
|
|||
|
||||
test_expect_success 'no arguments, but no crash' '
|
||||
test_must_fail git config >output 2>&1 &&
|
||||
test_grep usage output
|
||||
echo "error: no action specified" >expect &&
|
||||
test_cmp expect output
|
||||
'
|
||||
|
||||
cat > .git/config << EOF
|
||||
|
@ -2834,6 +2835,12 @@ test_expect_success 'specifying multiple modes causes failure' '
|
|||
test_cmp expect err
|
||||
'
|
||||
|
||||
test_expect_success 'writing to stdin is rejected' '
|
||||
echo "fatal: writing to stdin is not supported" >expect &&
|
||||
test_must_fail git config ${mode_set} --file - foo.bar baz 2>err &&
|
||||
test_cmp expect err
|
||||
'
|
||||
|
||||
done
|
||||
|
||||
test_done
|
||||
|
|
Loading…
Reference in a new issue