Problems cloning and discovering remote bookmarks other than main/master
The following may need to be split up in several issues, but they all seem to hang together.
1. When doing sl clone and the repository does not have a main or master branch, no revisions will be pulled.
For example, the following command will not pull any revisions, because the main branch is called gh-pages
$ sl clone https://github.com/git/git-reference
Using the -u option for sl clone does not seem to have any effect, either:
$ sl clone https://github.com/git/git-reference -u gh-pages
abort: unknown revision 'gh-pages'!
In order to get the actual content, you have to switch to the repository and pull from gh-pages:
$ sl clone https://github.com/git/git-reference
$ cd git-reference
$ sl pull -B gh-pages -u
I tried to tweak the various settings of the remotenames extension, such as selectivepull and selectivepulldefaults, but that didn't seem to have any effect.
2. Second, there is no way (at least none that I could find out) to discover remote bookmarks (i.e. git branches) or the remote HEAD. If the repository is not hosted on GitHub etc., this makes it difficult to find out which bookmark you need to pull in the first place. I worked around it with the following aliases, but they are obviously less than ideal.
[alias]
remote-bookmarks = !"$CHGHG" root >/dev/null && git ls-remote --refs "$("$CHGHG" showconfig paths.default)" | awk '$$2 ~ /refs\/heads\// { print substr($$2, 12) }'
remote-tags = !"$CHGHG" root >/dev/null && git ls-remote --tags "$("$CHGHG" showconfig paths.default)" | awk '$$2 ~ /refs\/tags\// { print substr($$2, 11) }'
remote-head = !"$CHGHG" root >/dev/null && git ls-remote --symref "$("$CHGHG" showconfig paths.default)" HEAD | awk '$$1 == "ref:" { print substr($$2, 12) }'
3. One of the underlying reasons is that unlike a normal git clone, only the head commit plus all its ancestors are being fetched, so remote bookmarks can't be discovered via something analogous to git branch -r.
But aside from that, it's often convenient to not have to pull all branches one by one, e.g. if you want to diff a file vs. various release branches.
/cc @muirdm
the -u option for sl clone does not seem to have any effect
I'll send a change to fix that.
$ sl pull -B gh-pages -u
Note that "autopull" works for branches, so you can simply sl go remote/gh-pages.
I tried to tweak the various settings of the remotenames extension
This works with the current version: sl clone --git https://github.com/git/git-reference --config remotenames.selectivepulldefault=gh-pages
there is no way (at least none that I could find out) to discover remote bookmarks
I'll try to make "sl bookmark --all ..." support this.
Closing via 9804c66bb8190a5ab4566c576db391ebe34c2d6b and e8f57d7902c800bec7ded3c567d9e370460df24e (please try it out!).