Skip to content

Commit

Permalink
Merge branch 'jl/some-submodule-config-are-not-boolean'
Browse files Browse the repository at this point in the history
* jl/some-submodule-config-are-not-boolean:
  avoid segfault on submodule.*.path set to an empty "true"
  • Loading branch information
Junio C Hamano committed Sep 4, 2013
2 parents baa8d42 + 4b05440 commit 5fb0e08
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions submodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ int parse_submodule_config_option(const char *var, const char *value)
return 0;

if (!strcmp(key, "path")) {
if (!value)
return config_error_nonbool(var);

config = unsorted_string_list_lookup(&config_name_for_path, value);
if (config)
free(config->util);
Expand All @@ -151,6 +154,9 @@ int parse_submodule_config_option(const char *var, const char *value)
} else if (!strcmp(key, "ignore")) {
char *name_cstr;

if (!value)
return config_error_nonbool(var);

if (strcmp(value, "untracked") && strcmp(value, "dirty") &&
strcmp(value, "all") && strcmp(value, "none")) {
warning("Invalid parameter \"%s\" for config option \"submodule.%s.ignore\"", value, var);
Expand Down
10 changes: 10 additions & 0 deletions t/t7400-submodule-basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ test_expect_success 'setup - initial commit' '
git branch initial
'

test_expect_success 'configuration parsing' '
test_when_finished "rm -f .gitmodules" &&
cat >.gitmodules <<-\EOF &&
[submodule "s"]
path
ignore
EOF
test_must_fail git status
'

test_expect_success 'setup - repository in init subdirectory' '
mkdir init &&
(
Expand Down

0 comments on commit 5fb0e08

Please sign in to comment.