newbie: "fake" README for remote of a `vcsh` repo?

Bruce Schultz bruce.schultz at gmail.com
Thu Feb 12 03:16:46 CET 2015



On 12 February 2015 10:19:37 AM AEST, Tom Roche <Tom_Roche at pobox.com> wrote:
>
>summary: Testing the Demeester hook[1] shows that it does not solve the
>"input-side" problem (more below), though it may solve the
>"output-side" problem. The "input-side"/"output-side" dichotomy is
>detailed below.
>I sketch below what an input-side solution might look like. Is there a
>hook (or other solution) that would solve the input-side problem? 

Whoa! Your details below look way too complicated, I suspect you're trying to make it too complex.

Someone the other day posted what I think is the solution.... use straight up git to clone a copy to somewhere like ~/src. Something like this (sorry, untested)

cd ~/src
git clone https://bitbucket.com/tlroche/vcsh-bash
cd ~/src/vcsh-bash
edit README.rst
git add README.rst
git commit
git push

That should solve your input-side problem, ie add the readme to the remote repo.

The output-side, I think you have the details correct, ie create the sparse checkout which excludes all ~/README.rst files. To edit the readme, you'll need to create a non-sparse clone as described above.

Also note that you seem to have ~/.bashrc in both your bash and emacs vcsh repos. That is going to cause trouble. You only ever want a specific file in one vcsh repo.

Hope that helps

Bruce



>
>details:
>
>Tom Roche Tue Feb 10 19:46:36 CET 2015 [2]
>>> note the "newbie" in the Subject line :-) I'm a beginner-level `git`
>user and a totally-novice-level `vcsh` user.
>
>Vincent Demeester Tue, 10 Feb 2015 21:27:51 +0100 [1]
>> I [don't think this is] a newbie question
>
>I installed vcsh (via debian package) late Monday night (9 Feb). It's
>now early Wednesday night (11 Feb). How I could be much more newbie?
>
>That I've gotten to this point with vcsh is also a tribute to vcsh's
>ease of use, e.g., that the "30 Second How-to"[3] works so well. (And
>that the vcsh team has done the packaging work, which is non-trivial.)
>
>input-side vs output-side
>=========================
>
>> vcsh looks for executable file as hooks in
>$XDG_CONFIG_HOME/vcsh/hooks-enabled
>> (usually $XDG_CONFIG_HOME is $HOME/.config so
>~/.config/vcsh/hooks-enabled).
>> Let's create an executable script :
>~/.config/vcsh/hooks-enabled/setUpSparseCheckout.sh
>
>Hmm ... 'checkout' seems to imply this hook is meant to solve the
>"output-side" problem rather than the "input-side" problem. This is
>understandable in that there seems to be much more interest in the
>output-side than the input-side[4]; however, I have tried to make clear
>that I am concerned with the input-side and *not* the output-side:
>
>Tom Roche Tue Feb 10 19:00:07 CET 2015 [4] (rearranged)
>>>> a lotta people, for a long time, has been concerned with what I
>would call
>>>> [the "output-side"] (or, temporally, post-commit): they don't want
>[to checkout]
>>>> extraneous content to checkout into their $HOME. [But] I'm asking
>about the
>>>> *input* side, or *pre-commit*: how can I get a README into the root
>of a [local] repo
>>>> (to make it available for a remote/web repo) *without* putting it
>into ${HOME} pre-commit?
>
>Here's a sketch of an input-side problem (reproduced in detail below):
>
>>>> 1. I create repo=vcsh-bash to VC files including ~/.bash* . I add a
>~/README.rst to make it available to its remote/web repo, then commit
>and push.
>
>>>> 2. I create repo=vcsh-emacs to VC files including ~/.authinfo ,
>~/bin/emacsclient_helper.sh , ~/emacs/init.el , etc . I rewrite
>~/README.rst to make that available to the remote for vcsh-emacs, then
>commit and push.
>
>>>> 3. I make a change to ~/.bashrc , which I seek to commit to
>vcsh-bash. `vcsh vcsh-bash status` shows as modified=
>
>>>> * ~/.bashrc    [<- that I intend]
>>>> * ~/README.rst [<- that I want to avoid]
>
>handwaving an input-side solution
>=================================
>
>Here's a sketch (adapted from this vcsh issue[5]) of a workflow enable
>by an input-side solution. My guesses about what would need done to
>implement such a solution are indicated by '(TODO)':
>
>1. `mkdir -p ~/path/to/input-side-soln/fakeroot/`
>2. create/edit ~/path/to/input-side-soln/fakeroot/README.rst
>3. `vcsh init input-side-soln`
>4. (TODO) tell repo=input-side-soln that its filetree has *2* roots:
>4.1. (TODO) a "real root" @ ~/
>4.1. (TODO) a "fake root" @ ~/path/to/input-side-soln/fakeroot/
>5. `vcsh input-side-soln add ~/.bashrc
>~/path/to/input-side-soln/fakeroot/README.rst`
>
>6. input-side-soln now "believes":
>6.1. it has staged ./.bashrc
>6.2. it should checkout ./.bashrc to ~/.bashrc
>6.3. it should look for changes to ./.bashrc @ ~/.bashrc
>6.4. (TODO) it has staged ./README.rst
>6.5. (TODO) it should checkout ./README.rst to
>~/path/to/input-side-soln/fakeroot/README.rst
>6.6. (TODO) it should look for changes to ./README.rst @
>~/path/to/input-side-soln/fakeroot/README.rst
>
>7. `vcsh input-side-soln status | head -n 20`
>...
>> Changes to be committed:
>...
>>       new file:   .bashrc
>>       new file:   README.rst
>8. `vcsh input-side-soln commit ...`
>...
> > create mode 100644 .bashrc
> > create mode 100644 README.rst
>
>9. create remote==https://bitbucket.com/tlroche/input-side-soln
>10. `vcsh input-side-soln remote add ...`
>11. `vcsh input-side-soln push ...`
>12. I see an Overview @ https://bitbucket.com/tlroche/input-side-soln
>!-)
>
>13. `mkdir -p ~/path/to/input-side-test/fakeroot/`
>14. create/edit ~/path/to/input-side-test/fakeroot/README.rst
>15. `vcsh init input-side-test`
>16. (TODO) tell repo=input-side-test that its filetree has *2* roots:
>16.1. (TODO) a "real root" @ ~/
>16.1. (TODO) a "fake root" @ ~/path/to/input-side-test/fakeroot/
>17. `vcsh input-side-test add ~/.emacs
>~/path/to/input-side-test/fakeroot/README.rst`
>
>18. input-side-test now "believes":
>18.1. it has staged ./.emacs
>18.2. it should checkout ./.emacs to ~/.emacs
>18.3. it should look for changes to ./.emacs @ ~/.emacs
>18.4. (TODO) it has staged ./README.rst
>18.5. (TODO) it should checkout ./README.rst to
>~/path/to/input-side-test/fakeroot/README.rst
>18.6. (TODO) it should look for changes to ./README.rst @
>~/path/to/input-side-test/fakeroot/README.rst
>
>19. `vcsh input-side-test status | head -n 20`
>...
>> Changes to be committed:
>...
>>       new file:   .emacs
>>       new file:   README.rst
>20. `vcsh input-side-test commit ...`
>...
> > create mode 100644 .emacs
> > create mode 100644 README.rst
>
>21. create remote==https://bitbucket.com/tlroche/input-side-test
>22. `vcsh input-side-test remote add ...`
>23. `vcsh input-side-test push ...`
>24. I see an Overview @ https://bitbucket.com/tlroche/input-side-test
>!-)
>
>25. Any future changes to ~/path/to/input-side-soln/fakeroot/README.rst
>* will show in `vcsh input-side-soln status`
>* will NOT show in `vcsh input-side-test status`
>26. Any future changes to ~/path/to/input-side-test/fakeroot/README.rst
>* will NOT show in `vcsh input-side-soln status`
>* will show in `vcsh input-side-test status`
>27. Anything that happens @ ~/README.rst will be ignored by both
>input-side-soln and input-side-test
>
>testing the Demeester hook
>==========================
>
>~/.config/vcsh/hooks-enabled/setUpSparseCheckout.sh below is "the
>Demeester hook."
>
>0. setup
>--------
>
>Starting out, I have
>
>$ lsalh ~/.config/vcsh/
>> drwxr-xr-x  4 me me 4.0K Feb 11 12:47 .
>> drwxr-xr-x 27 me me 4.0K Feb  9 16:31 ..
>> drwxr-xr-x  2 me me 4.0K Feb 11 12:50 hooks-enabled
>> drwxr-xr-x  4 me me 4.0K Feb  9 23:12 repo.d
>
>$ ls -al ~/.config/vcsh/hooks-enabled/
>> drwxr-xr-x 2 me me 4096 Feb 11 12:50 .
>> drwxr-xr-x 4 me me 4096 Feb 11 12:47 ..
>> -rwxr-xr-x 1 me me  475 Feb 11 12:50 setUpSparseCheckout.sh
>
>$ cat ~/.config/vcsh/hooks-enabled/setUpSparseCheckout.sh
>> #!/bin/sh
>> ### From
>http://lists.madduck.net/pipermail/vcs-home/2015-February/000993.html
>> ### Thanks, Vincent Demeester!
>
>> if ! test "$(git config core.sparseCheckout)" = "true"; then
>>   # Enable sparseCheckout for the repository
>>   git config core.sparseCheckout true
>>   # And write the sparseCheckout configuration where it's needed
>>   cat >> $GIT_DIR/info/sparse-checkout << EOF
>> # vcsh automatic sparse-checkout configuration
>> *
>> !README
>> !README.rst
>> !README.md
>> !README.org
>> EOF
>> fi
>
>Cleanup what I have already:
>
>$ vcsh delete vcsh-bash
>> vcsh: info: This operation WILL DESTROY DATA!
>> These files will be deleted:
>>
>> .bash_aliases
>> .bash_history
>> .bash_logout
>> .bash_profile
>> .bashrc
>> .profile
>
>@#$%^&! Don't do that!
>
>$ ls -al ~/.config/vcsh/repo.d/
>drwxr-xr-x 4 me me 4096 Feb  9 23:12 .
>drwxr-xr-x 4 me me 4096 Feb 11 12:47 ..
>drwxr-xr-x 8 me me 4096 Feb  9 22:44 vcsh-bash.git
>drwxr-xr-x 8 me me 4096 Feb  9 23:33 vcsh-emacs.git
>
>$ rm -fr ~/.config/vcsh/repo.d/vcsh-bash.git
>$ rm -fr ~/.config/vcsh/repo.d/vcsh-emacs.git
>
><whew/> Perhaps there could be API (e.g., a commandline flag) to say,
>"just delete the repo, NOT what it's pointing to"?
>
>1. start vcsh-bash
>------------------
>
># check for what I want to add
>ls -al \
>~/README.rst \
>~/.bash_aliases \
>~/.bash_logout \
>~/.bash_profile \
>~/.bashrc \
>~/.profile
>
>$ vcsh init vcsh-bash
>> Initialized empty Git repository in
>/home/me/.config/vcsh/repo.d/vcsh-bash.git/
>
>$ vcsh vcsh-bash add \
>~/README.rst \
>~/.bash_aliases \
>~/.bash_logout \
>~/.bash_profile \
>~/.bashrc \
>~/.profile
>
>$ vcsh vcsh-bash status | head -n 20
>...
>> Changes to be committed:
>...
>>       new file:   .bash_aliases
>>       new file:   .bash_logout
>>       new file:   .bash_profile
>>       new file:   .bashrc
>>       new file:   .profile
>>       new file:   README.rst
>
>$ vcsh vcsh-bash commit -m 'initial commit, testing Demeester hook: see
>http://lists.madduck.net/pipermail/vcs-home/2015-February/000993.html'
>...
> > create mode 100644 .bash_aliases
> > create mode 100644 .bash_logout
> > create mode 100644 .bash_profile
> > create mode 100644 .bashrc
> > create mode 100644 .profile
> > create mode 100644 README.rst
>
># create remote==https://bitbucket.com/tlroche/vcsh-bash
>$ vcsh vcsh-bash remote add bbg git at bitbucket.org:tlroche/vcsh-bash.git
>$ vcsh vcsh-bash remote add bbh
>https://tlroche@bitbucket.org/tlroche/vcsh-bash.git
>
>$ vcsh vcsh-bash push bbg master
># and now I see an Overview @ https://bitbucket.com/tlroche/vcsh-bash
>!-)
># so far, so good
>
>2. start vcsh-emacs
>-------------------
>
># check for what I want to add
>ls -al \
>~/README.rst \
>~/.authinfo \
>~/.bashrc \
>~/bin/emacs-nw-q.sh \
>~/.emacs.d/.emacs.bmk \
>~/.emacs.d/abbrev_defs \
>~/.emacs.d/init.el \
>~/.emacs.d/linux_desktop
>
>$ vcsh init vcsh-emacs
>> Initialized empty Git repository in
>/home/me/.config/vcsh/repo.d/vcsh-emacs.git/
>
>$ vcsh vcsh-emacs add \
>~/README.rst \
>~/.authinfo \
>~/.bashrc \
>~/bin/emacs-nw-q.sh \
>~/.emacs.d/.emacs.bmk \
>~/.emacs.d/abbrev_defs \
>~/.emacs.d/init.el \
>~/.emacs.d/linux_desktop
>
>$ vcsh vcsh-emacs status | head -n 20
>...
>> Changes to be committed:
>...
>>       new file:   .authinfo
>>       new file:   .bashrc
>>       new file:   .emacs.d/.emacs.bmk
>>       new file:   .emacs.d/abbrev_defs
>>       new file:   .emacs.d/init.el
>>       new file:   .emacs.d/linux_desktop
>>       new file:   README.rst
>>       new file:   bin/emacs-nw-q.sh
>
>$ vcsh vcsh-emacs commit -m 'initial commit, testing Demeester hook:
>see
>http://lists.madduck.net/pipermail/vcs-home/2015-February/000993.html'
>...
>
># create remote==https://bitbucket.com/tlroche/vcsh-emacs
>$ vcsh vcsh-emacs remote add bbg
>git at bitbucket.org:tlroche/vcsh-emacs.git
>$ vcsh vcsh-emacs remote add bbh
>https://tlroche@bitbucket.org/tlroche/vcsh-emacs.git
>
>$ vcsh vcsh-emacs push bbg master
># and now I see an Overview @ https://bitbucket.com/tlroche/vcsh-emacs
>!-)
># so far, so good!
>
>3. change vcsh-bash
>-------------------
>
># make very minor change to .bashrc
>
>tlroche at tlrW510:~$ vcsh vcsh-bash status | head -n 20
>..
>> Changes not staged for commit:
>...
>> 	modified:   .bashrc
>> 	modified:   README.rst # currently contains content appropriate to
>repo=vcsh-emacs
>
>So obviously the Demeester hook does not solve the input-side problem,
>though it may very well solve the output-side problem.
>
>Your assistance is appreciated, Tom Roche <Tom_Roche at pobox.com>
>
>[1]:
>http://lists.madduck.net/pipermail/vcs-home/2015-February/000993.html
>[2]:
>http://lists.madduck.net/pipermail/vcs-home/2015-February/000989.html
>[3]: https://github.com/RichiH/vcsh#30-second-how-to
>[4]:
>http://lists.madduck.net/pipermail/vcs-home/2015-February/000985.html
>[5]: https://github.com/RichiH/vcsh/issues/147#issue-57104673
>_______________________________________________
>vcs-home mailing list
>vcs-home at lists.madduck.net
>http://lists.madduck.net/listinfo/vcs-home



More information about the vcs-home mailing list