All of lore.kernel.org
 help / color / mirror / Atom feed
* Is there a way to fetch commits that are detached
@ 2012-04-24 21:49 Allan Caffee
  2012-04-24 22:15 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Allan Caffee @ 2012-04-24 21:49 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Is there a way to fetch commits that are detached
  2012-04-24 21:49 Is there a way to fetch commits that are detached Allan Caffee
@ 2012-04-24 22:15 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2012-04-24 22:15 UTC (permalink / raw)
  To: Allan Caffee; +Cc: git

Allan Caffee <allan.caffee@gmail.com> writes:

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

One security principle built into git is that any object that is
unreachable from refs/* is not to be exposed to outside world.  If the
commit is not on any ref, you shouldn't be able to obtain it remotely.

So you need to know which branch (or it could be a tag) the commit you
want is on, fetch that branch or tag and then check the commit out.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-24 22:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-24 21:49 Is there a way to fetch commits that are detached Allan Caffee
2012-04-24 22:15 ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.