diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-04-22 07:00:29 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-04-27 15:05:37 -0700 |
commit | 9ba090c31fd87bdec71c4e14cae3d71c4bb07eac (patch) | |
tree | b2ef19dfac1d60060541b0b3c91db3f9fea3a8ba /core/git-access.c | |
parent | d6b36c47cb2810921ae638a9237310052d9920ef (diff) | |
download | subsurface-9ba090c31fd87bdec71c4e14cae3d71c4bb07eac.tar.gz |
git storage: init local repository
So far we didn't do that at all, we either relied on the user manually
creating a local repo, or we cloned a remote repo.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/git-access.c')
-rw-r--r-- | core/git-access.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/git-access.c b/core/git-access.c index 2b7fa0ca2..0e012b082 100644 --- a/core/git-access.c +++ b/core/git-access.c @@ -429,6 +429,11 @@ static int try_to_update(git_repository *repo, git_remote *origin, git_reference return report_error("Unable to get local or remote SHA1"); } if (git_merge_base(&base, repo, local_id, remote_id)) { + // TODO: + // if they have no merge base, they actually are different repos + // so instead merge this as merging a commit into a repo - git_merge() appears to do that + // but needs testing and cleanup afterwards + // if (is_subsurface_cloud) goto cloud_data_error; else @@ -919,3 +924,12 @@ struct git_repository *is_git_repository(const char *filename, const char **bran *branchp = branch; return repo; } + +int git_create_local_repo(const char *filename) +{ + git_repository *repo; + int ret = git_repository_init(&repo, filename, false); + if (ret != 0) + (void)report_error("Create local repo failed with error code %d", ret); + return ret; +} |