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:
Linus Torvalds 2015-06-16 17:37:15 -10:00 committed by Dirk Hohndel
parent eca7d998e1
commit eff3fd3261
2 changed files with 3 additions and 1 deletions

View file

@ -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;
}