mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
If saving to a git repository fails, don't create oddly named XML file
Before this change when the user gave a git style filename, say /tmp/mydives[myname], if Subsurface couldn't create a repository with that branch, it instead saved an XML file to this exact name, with '[' and ']'. That clearly is not the desired behavior, so report an error instead. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
8650a6ef6c
commit
e70bbb637e
1 changed files with 6 additions and 1 deletions
|
@ -606,7 +606,12 @@ int save_dives_logic(const char *filename, const bool select_only)
|
||||||
git = is_git_repository(filename, &branch);
|
git = is_git_repository(filename, &branch);
|
||||||
if (git)
|
if (git)
|
||||||
return git_save_dives(git, branch, select_only);
|
return git_save_dives(git, branch, select_only);
|
||||||
|
/* if the syntax is for a git save but saving we didn't find a
|
||||||
|
* repository, throw error */
|
||||||
|
if (strchr(filename, '[')) {
|
||||||
|
report_error("Save failed, invalid git repository %s", filename);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
try_to_backup(filename);
|
try_to_backup(filename);
|
||||||
|
|
||||||
save_dives_buffer(&buf, select_only);
|
save_dives_buffer(&buf, select_only);
|
||||||
|
|
Loading…
Reference in a new issue