Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DenisFlorin
Copy link
Contributor

No description provided.

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();
Copy link
Member

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().

Copy link
Member

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.

Copy link
Member

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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$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;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants