mirror of
https://github.com/godotengine/godot-git-plugin.git
synced 2026-01-03 10:09:43 +03:00
Push worked!
This commit is contained in:
Binary file not shown.
@@ -456,29 +456,6 @@ void GitAPI::_pull(String remote, String username, String password) {
|
||||
String branch_name = _get_current_branch_name(false);
|
||||
|
||||
CString ref_name("refs/heads/" + branch_name + ":refs/remotes/" + remote + "/" + branch_name);
|
||||
// git_buf* upstream_buf;
|
||||
// Godot::print_warning(branch_name, __FUNCTION__, __FILE__, __LINE__);
|
||||
// if (git_branch_upstream_name(upstream_buf, repo, CString(branch_name).data) == GIT_ENOTFOUND)
|
||||
// {
|
||||
// Godot::print_warning("GitAPI: The current branch " + branch_name + " has no upstream branch. Setting the upstream to " + branch_name, __FUNCTION__, __FILE__, __LINE__);
|
||||
|
||||
// git_reference *head;
|
||||
// git_reference *branch;
|
||||
|
||||
// GIT2_CALL(git_repository_head(&head, repo), "Could not find repository HEAD");
|
||||
// GIT2_CALL(git_reference_resolve(&branch, head), "Could not resolve HEAD reference to " + branch_name + " branch");
|
||||
// GIT2_CALL(git_branch_set_upstream(branch, CString(branch_name).data), "Could not set " + branch_name + " upstream");
|
||||
|
||||
// GIT2_CALL(git_branch_upstream_name(&upstream_buf, repo, CString(branch_name).data), "Could not get upstream for " + branch_name + " branch");
|
||||
// Godot::print_warning("yo", __FUNCTION__, __FILE__, __LINE__);
|
||||
|
||||
// git_reference_free(head);
|
||||
// git_reference_free(branch);
|
||||
// }
|
||||
// else {
|
||||
// // Redo the operation in case we missed an actual error
|
||||
// GIT2_CALL(git_branch_upstream_name(&upstream_buf, repo, CString(branch_name).data), "Could not get current branch upstream name");
|
||||
// }
|
||||
|
||||
char *ref[] = { ref_name.data };
|
||||
git_strarray refspec = { ref, 1 };
|
||||
@@ -581,31 +558,9 @@ void GitAPI::_push(String remote, String username, String password) {
|
||||
git_push_options push_opts = GIT_PUSH_OPTIONS_INIT;
|
||||
push_opts.callbacks = remote_cbs;
|
||||
|
||||
String branch_name = _get_current_branch_name(false);
|
||||
CString full_branch_name(_get_current_branch_name(true));
|
||||
|
||||
git_buf upstream_buf;
|
||||
if (git_branch_upstream_name(&upstream_buf, repo, CString(branch_name).data) == GIT_ENOTFOUND)
|
||||
{
|
||||
Godot::print_warning("GitAPI: The current branch " + branch_name + " has no upstream branch. Setting the upstream to " + branch_name, __FUNCTION__, __FILE__, __LINE__);
|
||||
|
||||
git_reference *head;
|
||||
git_reference *branch;
|
||||
|
||||
GIT2_CALL(git_repository_head(&head, repo), "Could not find repository HEAD");
|
||||
GIT2_CALL(git_reference_resolve(&branch, head), "Could not resolve HEAD reference to " + branch_name + " branch");
|
||||
GIT2_CALL(git_branch_set_upstream(branch, CString(branch_name).data), "Could not set " + branch_name + " upstream");
|
||||
|
||||
GIT2_CALL(git_branch_upstream_name(&upstream_buf, repo, CString(branch_name).data), "Could not get upstream for " + branch_name + " branch");
|
||||
|
||||
git_reference_free(head);
|
||||
git_reference_free(branch);
|
||||
}
|
||||
else {
|
||||
// Redo the operation in case we missed an actual error
|
||||
GIT2_CALL(git_branch_upstream_name(&upstream_buf, repo, CString(branch_name).data), "Could not get current branch upstream name.");
|
||||
}
|
||||
|
||||
char *ref[] = { upstream_buf.ptr };
|
||||
char *ref[] = { full_branch_name.data };
|
||||
git_strarray refspecs = { ref, 1 };
|
||||
|
||||
GIT2_CALL(git_remote_upload(remote_object, &refspecs, &push_opts), "Failed to push");
|
||||
|
||||
Reference in New Issue
Block a user