Correctly set default repository name. #1122
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If the ODK seeding configuration file does not define the name of the repository (
repo
) and if no name is explicitly given on the command line, we want to set a default repository name ("noname") to prevent a crash when generating the files.Unfortunately, the way this was done (#1097) makes any
repo
value defined in the configuration ignored, because we:repo
to "noname" if we didn't get anything from the command line;load_config
with whatever value we have forrepo
(hether it comes from the command line or from our default), andload_config
takes whatever value we give it and overrides any value it may have found in the config file.So here, we define a default value for
project.repo
at the moment that field is declared (as for all other default values), and do not set a default value in the main function.This way:
repo
argument is given in the command line, we get the value from the configuration file, or the default value if there isrepo
key in the config file;repo
argument is given in the command line, it overrides both any value that may be set in the configuration file, and the default value.