pull = fetch/merge
This commit is contained in:
parent
7aed1eed11
commit
feeaab1ebe
@ -67,10 +67,8 @@ int PushRepositoryInternal(char const *localRepoName, char const *branchName,
|
|||||||
return GitLibrary::PushRepository(localRepoName, branchName, userName, userPassword);
|
return GitLibrary::PushRepository(localRepoName, branchName, userName, userPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
int PullRepositoryInternal(char const *localRepoName,
|
int PullRepositoryInternal(char const *localRepoName, char const *remoteRepoName) {
|
||||||
char const *branchName, char const *user,
|
return GitLibrary::PullRepository(localRepoName, remoteRepoName);
|
||||||
char const *password) {
|
|
||||||
return GitLibrary::PullRepository(localRepoName, branchName, user, password);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <local_git_repository.h>
|
#include <local_git_repository.h>
|
||||||
|
@ -33,7 +33,7 @@ int CloneRepositoryInternal(char const *url, char const *local_path) CALCULATOR_
|
|||||||
int CheckoutRepositoryInternal(char const *url, char const *localRepoName, char const *branchName) CALCULATOR_C_INTERFACE_LIB_EXPORT;
|
int CheckoutRepositoryInternal(char const *url, char const *localRepoName, char const *branchName) CALCULATOR_C_INTERFACE_LIB_EXPORT;
|
||||||
int CommitFileInternal(char const *local_path, char const *branch_name, char const *file_name, char const *commit_message) CALCULATOR_C_INTERFACE_LIB_EXPORT;
|
int CommitFileInternal(char const *local_path, char const *branch_name, char const *file_name, char const *commit_message) CALCULATOR_C_INTERFACE_LIB_EXPORT;
|
||||||
int PushRepositoryInternal(char const *local_path, char const *branch_name, char const *user, char const *password) CALCULATOR_C_INTERFACE_LIB_EXPORT;
|
int PushRepositoryInternal(char const *local_path, char const *branch_name, char const *user, char const *password) CALCULATOR_C_INTERFACE_LIB_EXPORT;
|
||||||
int PullRepositoryInternal(char const *localRepoName, char const *branchName, char const *user, char const *password) CALCULATOR_C_INTERFACE_LIB_EXPORT;
|
int PullRepositoryInternal(char const *localRepoName, char const *remoteRepoName) CALCULATOR_C_INTERFACE_LIB_EXPORT;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -521,7 +521,7 @@ static int create_merge_commit(git_repository *repo, git_index *index, struct me
|
|||||||
git_commit **parents = (git_commit **)calloc(opts->annotated_count + 1, sizeof(git_commit *));
|
git_commit **parents = (git_commit **)calloc(opts->annotated_count + 1, sizeof(git_commit *));
|
||||||
|
|
||||||
if (!parents) {
|
if (!parents) {
|
||||||
qCritical() << HEADER << 'calloc failed';
|
qCritical() << HEADER << "calloc failed";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,7 +534,7 @@ static int create_merge_commit(git_repository *repo, git_index *index, struct me
|
|||||||
/* Grab our needed references */
|
/* Grab our needed references */
|
||||||
check(git_repository_head(&head_ref, repo), "failed to get repo HEAD", NULL);
|
check(git_repository_head(&head_ref, repo), "failed to get repo HEAD", NULL);
|
||||||
if (resolve_refish(&merge_commit, repo, opts->heads[0])) {
|
if (resolve_refish(&merge_commit, repo, opts->heads[0])) {
|
||||||
qCritical() << HEADER << QString("failed to resolve refish %s").args(opts->heads[0]);
|
qCritical() << HEADER << QString("failed to resolve refish %s").arg(opts->heads[0]);
|
||||||
free(parents);
|
free(parents);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -642,7 +642,7 @@ static int merge(git_repository *repo) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Since this is a fast-forward, there can be only one merge head */
|
/* Since this is a fast-forward, there can be only one merge head */
|
||||||
target_oid = git_annotated_commit_id(opts.annotated[0]);
|
target_oid = git_annotated_commit_id(*opts.annotated);
|
||||||
assert(opts.annotated_count == 1);
|
assert(opts.annotated_count == 1);
|
||||||
|
|
||||||
return perform_fastforward(repo, target_oid, (analysis & GIT_MERGE_ANALYSIS_UNBORN));
|
return perform_fastforward(repo, target_oid, (analysis & GIT_MERGE_ANALYSIS_UNBORN));
|
||||||
@ -1013,12 +1013,12 @@ int GitLibrary::PullRepository(char const *localRepoName, char const *remoteRepo
|
|||||||
if ((error = fetch(repo, remoteRepoName)) != 0) {
|
if ((error = fetch(repo, remoteRepoName)) != 0) {
|
||||||
// error
|
// error
|
||||||
}
|
}
|
||||||
if ((error = merge(repo) {
|
if ((error = merge(repo)) != 0) {
|
||||||
// error
|
// error
|
||||||
}
|
}
|
||||||
|
|
||||||
if (repo) {
|
if (repo) {
|
||||||
git_repository_free(repo);
|
git_repository_free(repo);
|
||||||
}
|
}
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
|
Loading…
Reference in New Issue
Block a user