mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
git save: fix crash with no remote
Commit e21cae2d46
("Cloud storage: sync the remote after save") broke
regular git saving without any remotes: it would never initialize the
"remote" pointer, and then use that uninitialized remote pointer to see
if it was a cloud storage remote that it should try to sync.
Fix it.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
eca7d998e1
commit
eff3fd3261
2 changed files with 3 additions and 1 deletions
|
@ -568,6 +568,8 @@ struct git_repository *is_git_repository(const char *filename, const char **bran
|
|||
free(branch);
|
||||
return dummy_git_repository;
|
||||
}
|
||||
if (remote)
|
||||
*remote = NULL;
|
||||
*branchp = branch;
|
||||
return repo;
|
||||
}
|
||||
|
|
|
@ -1139,7 +1139,7 @@ int do_git_save(git_repository *repo, const char *branch, const char *remote, bo
|
|||
if (create_new_commit(repo, branch, &id))
|
||||
return report_error("creating commit failed");
|
||||
|
||||
if (prefs.cloud_background_sync) {
|
||||
if (remote && prefs.cloud_background_sync) {
|
||||
/* now sync the tree with the cloud server */
|
||||
if (strstr(remote, prefs.cloud_git_url)) {
|
||||
return sync_with_remote(repo, remote, branch, RT_HTTPS);
|
||||
|
|
Loading…
Add table
Reference in a new issue