Is there a way to fetch commits that are detached

From: Allan Caffee <hidden>
Date: 2016-06-15 22:53:39

First some context: I'm trying to use the pre-receive hook to run some tests
on a Hudson server before accepting the updates to a branch. At the moment I'm
trying to have the Hudson job clone the repository (using the "git" protocol)
and checkout the new ref as a detached head e.g.

$ git clone $GIT_REPOSITORY repository
$ cd repository
$ git checkout $GIT_COMMIT

But the checkout fails, apparently because the commit object hasn't been
pulled into the local repository. Only a pack file is present in the local
repository's objects directory which presumably doesn't have the commit.

Is there a way to explicitly fetch whatever objects are necessary to checkout
the commit?

Would I be better off using git-archive to tar up a copy of the source
instead, or some other means of copying the codebase over for testing?

Thanks,
Allan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help