diff options
Diffstat (limited to 'core/git-access.c')
-rw-r--r-- | core/git-access.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/core/git-access.c b/core/git-access.c index dba9cbec5..fe3a918ac 100644 --- a/core/git-access.c +++ b/core/git-access.c @@ -450,6 +450,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 @@ -940,3 +945,17 @@ 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; + char *path = strdup(filename); + char *branch = strchr(path, '['); + if (branch) + *branch = '\0'; + int ret = git_repository_init(&repo, path, false); + free(path); + if (ret != 0) + (void)report_error("Create local repo failed with error code %d", ret); + return ret; +} |