GetPublii / Publii

The most intuitive Static Site CMS designed for SEO-optimized and privacy-focused websites.
https://getpublii.com
GNU General Public License v3.0
6.06k stars 407 forks source link

[Bug]: Syncing to a Git repository doesn't rebase/merge #1341

Closed TheDevMinerTV closed 3 months ago

TheDevMinerTV commented 4 months ago

Operating system

Windows 10 22H2

Publii version

0.44.4 (build 16557)

Post editor

None

Bug description

When someone/something pushes to the underlying Git repo that Publii is syncing to, Publii will be unable to sync to the Git repo. The application will still mark the local changes up until that point as synced and therefore "finish" all syncs successfully eventhough it's not in sync yet.

Steps to reproduce

  1. Set up a Publii page with a Git repository
  2. Sync to it once
  3. Push into the repo from outside, for example adding a README or something
  4. Change something in the Publii page and try to sync it
  5. image

Relevant log output

// deployment-process.log
...
[i] Git debug: git add done
[i] Git debug: changes exists =  true
[i] Git debug: commit done
[Wed, 07 Feb 2024 19:02:21 GMT] ERROR: PushRejectedError: Push rejected because it was not a simple fast-forward. Use "force: true" to override.

// rendering-deployment-process.log
[i] Git debug: repository URL =  #####  branch = main  path = C:\Users\#####\Documents\Publii\sites\devstack\output
[i] Git debug: remotes = [{"remote":"origin","url":"https://#####"}]
[i] Git debug: not needed to add origin
[i] Git debug: origin checked
[i] Git debug: remote info = {"capabilities":["multi_ack","thin-pack","side-band","side-band-64k","ofs-delta","shallow","deepen-since","deepen-not","deepen-relative","no-progress","include-tag","multi_ack_detailed","allow-tip-sha1-in-want","allow-reachable-sha1-in-want","no-done","symref=HEAD:refs/heads/main","filter","object-format=sha1","agent=git/2.40.1"],"HEAD":"refs/heads/main","refs":{"heads":{"main":"0cc71b6bb3220abb36c77e5ac958ba4aa764a50e"}}}
...
[i] Git debug: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0

[Wed, 07 Feb 2024 19:02:20 GMT] ERROR: MergeNotSupportedError: Merges with conflicts are not supported yet.

Additional information

The code to fetch + rebase should probably happen here before the adding of the files: https://github.com/GetPublii/Publii/blob/a2ce42f248415746b279688567f511dd776e3c75/app/back-end/modules/deploy/git.js#L251

dziudek commented 4 months ago

I am not sure if it is a bug at all. If you want to:

Push into the repo from outside, for example adding a README or something

then you should do it using Tools -> File Manager -> root files

In fact repository only store the output file so these files are not expected to be modified from external entites.

The only thing to do is to detect such case and add notice which explains what is an issue in this case

dziudek commented 3 months ago

I am closing this issue due lack of reply - feel free to reopen this issue if more details will be available