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

Add posibility to syncronize only in one direction #224

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions blueprints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ form:
validate:
type: bool

sync.direction:
type: select
label: Sync direction
size: medium
default: both
options:
pull: One-way (Pull only)
both: Both-ways (Pull and Push)

folders:
type: select
multiple: true
Expand Down
4 changes: 3 additions & 1 deletion classes/GitSync.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,9 @@ public function sync($name = null, $branch = null)

$this->fetch($name, $branch);
$this->pull($name, $branch);
$this->push($name, $branch);
if ($this->grav['config']->get('plugins.git-sync.sync.direction', 'both') == 'both') {
$this->push($name, $branch);
}

$this->addRemote();

Expand Down
1 change: 1 addition & 0 deletions git-sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ public function onAdminAfterSave(Event $event)

if ($isPluginRoute) {
$this->git->setConfig($obj->toArray());
$this->config->reload();

// initialize git if not done yet
$this->git->initializeRepository();
Expand Down