diff options
| author | Ian Hattendorf <ianh@axosoft.com> | 2019-03-20 12:28:45 -0700 |
|---|---|---|
| committer | Ian Hattendorf <ianh@axosoft.com> | 2019-04-29 17:10:55 -0700 |
| commit | e44110dbbfc9d50b883d73fbb6c9e3b53732ec9d (patch) | |
| tree | 5adfbe69fab7002c51e99f4fa31b2bcd708a64ac /src | |
| parent | bc5b19e60406b2b0b7173d866a808313fca2b4ce (diff) | |
| download | libgit2-e44110dbbfc9d50b883d73fbb6c9e3b53732ec9d.tar.gz | |
Correctly write to missing locked global config
Opening a default config when ~/.gitconfig doesn't exist, locking it,
and attempting to write to it causes an assertion failure.
Treat non-existent global config file content as an empty string.
Diffstat (limited to 'src')
| -rw-r--r-- | src/config_file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/config_file.c b/src/config_file.c index a36c0aa02..48a9a26d4 100644 --- a/src/config_file.c +++ b/src/config_file.c @@ -1133,7 +1133,7 @@ static int config_write(diskfile_backend *cfg, const char *orig_key, const char reader.file = &cfg->file; if (cfg->locked) { - result = git_buf_puts(&contents, git_buf_cstr(&cfg->locked_content)); + result = git_buf_puts(&contents, git_buf_cstr(&cfg->locked_content) == NULL ? "" : git_buf_cstr(&cfg->locked_content)); } else { /* Lock the file */ if ((result = git_filebuf_open( |
