woolfg / dokuwiki-plugin-gitbacked

Plugin for DokuWiki to store/sync files and media with a git repo
GNU General Public License v2.0
74 stars 26 forks source link

Update remote when only using periodic pull #48

Closed fbartels closed 3 years ago

fbartels commented 5 years ago

At this point in time the only (builtin) way of pushing local changes is when "push after commit" is active. But this can lead to errors when there are remote changes (since you always have to pull before you can push).

This change adds a pull to the periodic task to push changes.

Alternatively the "push after commit" could be extended to always pull in changes before pushing.

woolfg commented 5 years ago

Thanks a lot for the contribution. I agree, a pull before push would make more sense. The push in the pull function changes the functionality which implies that the functionality no longer adhering to the purpose defined by the name of the function "periodic pull". Could you change it to a pull rebase before push?

fbartels commented 5 years ago

Hi @woolfg,

thanks for your feedback. Just to be clear you are asking to rename the current function and not add a new one, right?

woolfg commented 5 years ago

Hey @fbartels, I think it doesn't make sense to push without any change periodically but I see the problem that you should pull before push which can be done in the edit function.

fbartels commented 5 years ago

Like this? (sorry not a php developer at all)

woolfg commented 5 years ago

Hey @fbartels, thanks for the new push. Why do you need a periodic push? You only have something to push after a commit, so you could just push after commit and do a pull right before the push to be on the safe side? Or do I miss something?

fbartels commented 5 years ago

My main motivation for doing it with the periodic push is that pushing after commit runs in the foreground and will directly show any git failures to the user editing the page. I have stored the credentials of my git repo in the push url, which would then expose these to the editing user.

woolfg commented 5 years ago

Ok, I see. You run into the problem that every single error would lead to this behavior and therefore, it is not recommended at all to store the creds in the url. You should use ssh keys if possible. I think a periodic push is not really intuitive and is just a quick workaround for your very specific problem and would not help all other users. I would recommend using ssh keys and in case of conflicts to pull before push which would be definitely useful for other users as well.

woolfg commented 3 years ago

closed, as no update.