Turn off autosync for new clones
(1) By Joel Dueck (joeld) on 2019-04-17 16:54:29 [link] [source]
I have a repo that I will be sharing via CGI on my website. I would like people to be able to clone this repo, but in general they will not have commit permissions. This means that if they commit any changes to their local copy, they will get permission errors when the autosync happens.
In order to improve their experience, can I arrange it so that their clones will have autosync set to 0
or pullonly
by default?
(2) By Warren Young (wyoung) on 2019-04-17 17:09:44 in reply to 1 [link] [source]
The checkin still occurs in the local repo when this happens. The warning is just telling you that the sync failed.
I'd just recommend "fossil set autosync 0
" as part of the cloning instructions.
In fact, if ease of use is the primary concern, I'd just point them at a tarball or Zip file of the repo trunk, which Fossil easily provides. See "fossil help /tarball
" and "fossil help /zip
".
(3) By Richard Hipp (drh) on 2019-04-17 17:16:42 in reply to 1 [link] [source]
The error that occurs when a user does a commit but is unable to push the changes back is not very prominent. I would be unlikely to notice it unless I was looking for it. Here is the output from a test I just conducted:
drh@bella:~/fossil/tmp$ fossil commit Autosync: https://wapp.tcl.tk/ redirect with status 302 to https://wapp.tcl.tk/index.html Round-trips: 1 Artifacts sent: 0 received: 0 Pull done, sent: 595 received: 1387 ip: 45.33.6.223 /home/drh/bin/e "./ci-comment-EC2261704446.txt" New_Version: 70cae11d68932eeb7be69190602875bfd04b407f070c0a3cda56a41810360864 Autosync: https://wapp.tcl.tk/ redirect with status 302 to https://wapp.tcl.tk/index.html Round-trips: 1 Artifacts sent: 2 received: 0 Error: not authorized to write Round-trips: 1 Artifacts sent: 2 received: 0 Sync done, sent: 3263 received: 1423 ip: 45.33.6.223 Autosync failed.
I am not yet convinced that automatically setting autosync to pullonly is a good idea. What if the permissions change later? What if the user clones using their username on the main repo, and they didn't have check-in privilege at the time of the clone, but they were granted check-in privilege later. I can foresee lots of confusing about "why aren't my check-ins being pushed back to the main repo?"
I would look with more favor on a proposal to soften the error message with additional information. Instead of just "Autosync failed" perhaps something like "Commit applied locally but unable to push changes back to $SERVER because you do not have sufficient privilege." Or perhaps something else like that, only less verbose.
Another viable option is to have the server send back a flag on the the "pull" that occurs before the commit which indicates whether or not a push would be accepted, and then omit the autopush if it would not be. In that way, the autopush would start happening automatically if the user is ever given check-in privileges.
(4) By Joel Dueck (joeld) on 2019-04-17 17:30:33 in reply to 3 [link] [source]
You raise good points. My immediate concern is that for most of my users this will be their first exposure to Fossil, they will be watching the output, and seeing "Autosync failed" will raise flags for them that they did something wrong, or missed a step, etc.
I really like both of your alternatives. A warning like "Skipping automatic push to $SERVER (user lacks commit privilege there)" might do very well for either.
I could tell potential users to turn off autosync right away as Warren suggested. Indeed, as things stand, this was my plan. But if we did either of these, they wouldn't have to, and as you point out, they also wouldn't have to remember to turn it on later if their permissions get upgraded. And it's kinder and more useful than just saying "It failed".
(5) By sean (jungleboogie) on 2019-04-17 17:44:35 in reply to 4 [link] [source]
Will any user commit to your repo? If not, then I think what Warren said about getting the latest tar/zip is a good idea.
What would be the advantage of your users cloning the repo if they won't have commit access?
(6) By Warren Young (wyoung) on 2019-04-17 17:59:45 in reply to 5 [link] [source]
I'll partially contradict myself by arguing the other side now. Ready? :)
The advantage is that new versions published on the Fossil repo are a quick sync away, which is more efficient than copying the whole tarball back down and unpacking it over your previous version.
That's how I distribute one of my public Fossil-based projects: a binary OS image that they flash onto an SD card, containing the project's software, built and ready to go, plus Fossil and a clone of it opened and ready to use. To update, they just "fossil up && make && sudo make install".
(7) By sean (jungleboogie) on 2019-04-17 18:04:00 in reply to 6 [link] [source]
advantage is that new versions published on the Fossil repo are a quick sync away
Yep, that's right. Even a shell alias is quicker. I used to have something like fossilup, which would cd into the fossil repo, fossil up trunk, config, make, make install. That saves many manual steps.
If joeld plans on having a very active repo, he could advertise the tarballs as "nightly" and make them available each night at a given time, replacing the previous build. Otherwise, like Warren said, make it a simple line item in your repo clone to disable autosync.
(10) By Joel Dueck (joeld) on 2019-04-17 18:45:22 in reply to 7 [link] [source]
I think drh's thought (about making the error more informative) is better than either of these. It makes things more seamless, both when a new user clones and down the road whenever their permissions are upgraded. I can’t see what the downside would be.
(11) By Richard Hipp (drh) on 2019-04-17 19:02:10 in reply to 10 [link] [source]
Please rebuild using the latest check-in and let me know if that works for you.
(12) By sean (jungleboogie) on 2019-04-17 21:30:24 in reply to 11 [source]
Seems to work for my testing.
If I attempt to make a change, and fails, it's saved locally. What would happen on my next 'fossil up trunk'? Especially if the file I modified is being updated on the remote end. Won't I be prompted of a fork/open leaves? I think that's what happened when attempting to make a change on my local copy of sqlite.
This is no fault of Fossil, just pointing out that new users of Fossil may not know what happened. Just something that Joel may want to explain to his users.
(8) By Joel Dueck (joeld) on 2019-04-17 18:05:18 in reply to 5 [link] [source]
Some users might get commit access later on. But even if they don't, they may wish to submit patches, and this will make that process better for both of us. They may also wish to keep their copies in a source control system for their own use. If they choose to keep it in Fossil, they'll have perpetual access to the wiki, tickets, etc.
In other words, I would like to introduce my users in a practical way to the virtues of Fossil without necessarily bringing them on board as core developers. I will probably also offer the tar/zip option as well, but I would like to try and sell them on keeping it in a Fossil repo because there are benefits to them.
(9) By sean (jungleboogie) on 2019-04-17 18:07:11 in reply to 8 [link] [source]
In other words, I would like to introduce my users in a practical way to the virtues of Fossil
Go forth and multiply the Fossil community!