-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix maintenance problem when changes are only on remote #201
base: master
Are you sure you want to change the base?
Conversation
gitium_enable_maintenance_mode() or wp_die( __( 'Could not enable the maintenance mode!', 'gitium' ) ); | ||
|
||
// Check if the local repository is behind the remote | ||
$behind_commits = $this->git->get_behind_commits(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_behind_commits
runs git rev-list
which comparse only commits that exists localy. In order to check comits on remote you have to run a git fetch
first, there is a function that I think does that fetch_ref()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can inspire from gitium_merge_and_push
function and call merge_with_accept_mine
but there is a lock that it should be aquired. You can try caling gitium_merge_and_push
directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I see that gitium_merge_and_push
is called below at line 143.
What is then issue that you try to fix? Do you have some STR, or maybe some errors messages ?
Maybe only calling gitium_disable_maintenace_mode is enough?
I see that this function save_changes
only when Save changes
button is pressed? Where problems with this?
return; | ||
} | ||
|
||
// Add all changes in the working directory | ||
$this->git->add(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->git->add(); | |
if ($this->add() == 0) { | |
gitium_disable_maintenance_mode(); | |
$this->success_redirect( __( 'No changes to commit, repository is up-to-date.', 'gitium' ) ); | |
return; | |
} |
No description provided.