sync-all
Herbert Valerio Riedel
hvriedel at gmail.com
Thu Oct 2 08:20:38 UTC 2014
On 2014-10-02 at 09:49:11 +0200, Simon Peyton Jones wrote:
> Herbert says (in bold font) "do not ever use sync-all", in this post http://www.reddit.com/r/haskell/comments/2hes8m/the_ghc_source_code_contains_1088_todos_please/.
>
> If that's really true, we should either nuke it altogether, or change
> it to do something correct. The idea that it might "set up your tree
> in subtly different ways" is alarming.
To clarify what I mean by that:
For users just wanting to clone ghc.git now and just wanting to keep
their tree updated, I'd recommend doing the following one-shot
convenience configuration setup (see [1] for more details):
git config --global alias.pullall '!f(){ git pull "$@" && git submodule update --init --recursive; }; f'
And then clone simply via
git clone --recursive http://ghc.haskell.org/ghc.git
(or use https:// or git:// or whatever) and to keep the tree simply use
git pullall --rebase
(`pullall` just saves you from having to call
`git pull`+`git submodule update --init` yourself)
In contrast, `sync-all` is a multi-step process:
1.) you need to clone ghc.git,
2.) then you have a sync-all, which when called
will `git submodule init` (which doesn't yet download the
submodules)
3.) rewrites the fetch-urls in each initialised submodule
4.) finally calls `git submodule update` to fetch the submodule and
checkout the commits registered in ghc.git
The difference become apparent when wanting to use github instead; my
recommended approach is to use the URL rewriting feature of GitHub which
even allows you to easily switch between git.haskell.org and github.com
with a single command, or in its simpler form (as described on [2]):
Only needed once, and idempotent setup step:
git config --global url."git://github.com/ghc/packages-".insteadOf git://github.com/ghc/packages/
And then just as before:
git clone --recursive git://github.com/ghc/ghc
So long story short; I've mostly got a bad gut feeling recommending to
use a 1000-line Perl script
http://git.haskell.org/ghc.git/blob/HEAD:/sync-all
to accomplish what the 2 `git config` commands and the the day-to-day
`git` commands I mentioned in this email can do in a more Git-idiomatic
way.
So I'm not saying `sync-all` is doing something wrong, but rather that's
overly complex for the task at hand, and we've had support issues with
`sync-all` due to subtle bugs in it (just check the git history for
sync-all to see the tweaks we needed). Moreover, IMHO, if someone's
already proficient with Git, telling them to use `sync-all` will rather
confuse than help as it's not that transparent what it really does.
[1]: https://ghc.haskell.org/trac/ghc/wiki/WorkingConventions/Git/Submodules#UsingaGitalias
[2]: https://ghc.haskell.org/trac/ghc/wiki/Newcomers
More information about the ghc-devs
mailing list