raco pkg: adjust the way a local clone is made for updates

When a clone-linked package is updated, a temporary extra clone
is created to checkout the target commit for dependency and conflict
checking.

The current strategy for cloning a repository doesn't work for some
Git versions. The problem is that the target commit is unlikely to
be reachable from any current branch or tag, and so it might not
get carried along in the clone (depending on the Git version).
Originally, a `git fetch <commit>` compensated for that problem,
but fetching a particular commit doesn't work for all Git versions,
either.

The new strategy is to clone with `--shared`, which ensures that
just-fetched commits are all available in the temporary clone (and
it also avoids a little unnecessary copying work).
This commit is contained in:
Matthew Flatt 2015-01-15 05:30:41 -07:00
parent 900e788a3a
commit dbba480ad3

View File

@ -172,11 +172,13 @@
[tmp-dir
;; Make a clone of the [to-be-]linked checkout so that
;; we can check dependencies, etc., before changing
;; the checkout.
;; the checkout. By using `--shared` for the clone, all
;; the commits that we've fetched will be available to
;; checkout (even though they may be unreachable at this
;; point, since we haven't merged the fetched commits).
(download-printf "Cloning repository locally for staging\n")
(git #:status status "clone" clone-dir tmp-dir)
(git #:status status "clone" "--shared" clone-dir tmp-dir)
(parameterize ([current-directory tmp-dir])
(git #:status status "fetch" clone-dir branch)
(git #:status status "checkout" (or checksum branch)))
(lift-git-directory-content tmp-dir path)]
[else