[racket-dev] Using `git submodule` vs. `git pull --ff-only upstream master`

From: Greg Hendershott (greghendershott at gmail.com)
Date: Tue Dec 17 16:48:42 EST 2013

To answer my own question, back in July Matthew had posted here:

On Sat, Jul 27, 2013 at 9:10 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> Nothing has been split out of the current git repository, but there is
> now a "native-pkgs" git submodule for the native-library packages.
>
> If you build on Mac OS X or Windows or if you run a snapshot build,
> then you'll need to use
>
>   git pull
>   git submodule init
>   git submodule update
>
> once on each repository checkout from now on, and
>
>   git pull
>   git submodule update
>
> for updates after the first checkout.
>
> If you just `git pull' without the submodule commands, then you'll have
> an empty "native-pkgs" directory. That's fine if you're building on,
> say, Linux. If you're on Mac OS X or Windows, then the makefile should
> give you a good error message and suggest using `git submodule init'
> and `git submodule update'.
>
> If you use `git submodule update' today and forget to use it in the
> future, probably things will be fine for a long time, because
> "native-pkgs" doesn't change often. If "native-pkgs" does change and
> you forget `git submodule update', then (as I understand things) `git
> status' will tell you that there's a mismatch. The mismatch report
> might take a form that's not entirely clear, but it should be enough to
> remind you to run `git submodule update'.

It turned out that it wasn't enough to remind _me_. :)  Running `git
submodule update` resolved this for me.


On Fri, Sep 20, 2013 at 2:30 PM, Greg Hendershott
<greghendershott at gmail.com> wrote:
> I build Racket while keeping my forked repo's `master` branch an
> exact, fast-forwardable copy of PLT's remote upstream `master`. [1]
>
> This has worked fine building Racket on Linux, and continues to do so.
>
> But on OS X, I need to follow these instructions from INSTALL.TXT, wrt
> the pkg re-org:
>
>>>>
> On Mac OS X and Windows, you'll need native-library packages in the
> "native-pkgs" directory. In the git repostory, "native-pkgs" is a git
> submodule, so you'll need
>    git submodule init
>    git submodule update
> to get it set up.
> <<<
>
> After I do so, the resulting build works great.
>
> However it introduces a change:
>
>>>>
> greg at mbp in ~/src/plt/racket on master*
> $ git diff
> diff --git a/native-pkgs b/native-pkgs
> index f367c0c..f8c8984 160000
> --- a/native-pkgs
> +++ b/native-pkgs
> @@ -1 +1 @@
> -Subproject commit f367c0c4b05b91401d68b0180b416d616b31720d
> +Subproject commit f8c8984ebe8a442d474558dced0eb824cbb24772
> <<<
>
> If I commit this, my master wouldn't be a FF copy anymore (AFIK). So I don't.
>
> But as a result, if I switch to a topic branch without committing
> (normally a no-no), it's a bit weird:
>
>>>>
> greg at mbp in ~/src/plt/racket on master*
> $ git checkout imap-append-flags
> warning: unable to rmdir native-pkgs: Directory not empty
> Switched to branch 'imap-append-flags'
> <<<
>
> After switching back to master, everything seems OK:
>
>>>>
> greg at mbp in ~/src/plt/racket on imap-append-flags*
> $ git checkout master
> M native-pkgs
> Switched to branch 'master'
> Your branch is ahead of 'origin/master' by 771 commits.
> <<<
>
> Is this -- the warning about native-pkgs -- something I should just
> learn to ignore and treat as the new normal?
>
>
> [1]: http://www.greghendershott.com/2013/04/a-guide-for-infrequent-contributors-to-racket.html

Posted on the dev mailing list.