Add force push implementation

This commit is contained in:
Twarit Waikar
2021-10-07 04:26:42 +05:30
parent 15c3bd0ad8
commit ac32fcc708
3 changed files with 4 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
change4
extends Node

View File

@@ -585,7 +585,7 @@ void GitAPI::_pull(String remote, String username, String password) {
Godot::print("GitAPI: Pull ended");
}
void GitAPI::_push(String remote, String username, String password) {
void GitAPI::_push(const String remote, const String username, const String password, const bool force) {
Godot::print("GitAPI: Performing push to " + remote);
git_remote_ptr remote_object;
@@ -614,7 +614,7 @@ void GitAPI::_push(String remote, String username, String password) {
String branch_name = _get_current_branch_name(true);
CString pushspec(String() + branch_name);
CString pushspec(String() + (force ? "+" : "") + branch_name);
const git_strarray refspec = { &pushspec.data, 1 };
git_push_options push_options = GIT_PUSH_OPTIONS_INIT;

View File

@@ -91,7 +91,7 @@ class GitAPI : public EditorVCSInterface {
bool _initialize(const String project_root_path);
bool _is_vcs_initialized();
void _pull(const String remote, const String username, const String password);
void _push(const String remote, const String username, const String password);
void _push(const String remote, const String username, const String password, const bool force);
bool _shut_down();
void _stage_file(const String file_path);
void _unstage_file(const String file_path);