All of lore.kernel.org
 help / color / mirror / Atom feed
* git show on bare repository?
@ 2009-08-02  3:51 skillzero
  2009-08-02  4:44 ` Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: skillzero @ 2009-08-02  3:51 UTC (permalink / raw)
  To: git

I could have sworn I used to be able to use git show to display the
contents of a file from the server, but now it always says this (if I
use -- then it doesn't show anything):

fatal: ambiguous argument 'master:file.txt': unknown revision or path
not in the working tree.
Use '--' to separate paths from revisions

What I'm trying to do is allow people to get a single file without
having to clone the entirely repository, like this:

ssh git.example.com "cd /MyRepo.git && git show master:File.txt"

If I do this with a non-bare repository, it works. The server is
running git version 1.6.3.2 (I'm running 1.6.4 locally where it
works).

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

* Re: git show on bare repository?
  2009-08-02  3:51 git show on bare repository? skillzero
@ 2009-08-02  4:44 ` Jeff King
  2009-08-02  6:08   ` skillzero
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2009-08-02  4:44 UTC (permalink / raw)
  To: skillzero; +Cc: git

On Sat, Aug 01, 2009 at 08:51:45PM -0700, skillzero@gmail.com wrote:

> I could have sworn I used to be able to use git show to display the
> contents of a file from the server, but now it always says this (if I
> use -- then it doesn't show anything):

It should work fine.

> fatal: ambiguous argument 'master:file.txt': unknown revision or path
> not in the working tree.
> Use '--' to separate paths from revisions

Either you don't have a 'master' ref, or the commit there doesn't have
'file.txt'. Try "git show master" and "git show master^{tree}" to see
which.

It would be nice if the error were more descriptive ("master resolved,
but does not contain file.txt"). The vagueness is an artifact of the way
the code is structured, I think (we try a lot of different things and
then barf at the toplevel, which doesn't know any of the details of how
far we got into each possibility).

> What I'm trying to do is allow people to get a single file without
> having to clone the entirely repository, like this:
> 
> ssh git.example.com "cd /MyRepo.git && git show master:File.txt"

I don't know if this is a cut and past error, but you say "File" here
and "file" above. That could cause the error you are seeing.

> If I do this with a non-bare repository, it works. The server is
> running git version 1.6.3.2 (I'm running 1.6.4 locally where it
> works).

The bareness of the repo shouldn't matter, as the filename is coming
from the tree pointed to by 'master'. Unless it is a bug, it is probably
just that the refs are different between the two repos.

-Peff

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

* Re: git show on bare repository?
  2009-08-02  4:44 ` Jeff King
@ 2009-08-02  6:08   ` skillzero
  0 siblings, 0 replies; 3+ messages in thread
From: skillzero @ 2009-08-02  6:08 UTC (permalink / raw)
  To: Jeff King; +Cc: git

On Sat, Aug 1, 2009 at 9:44 PM, Jeff King<peff@peff.net> wrote:
> Either you don't have a 'master' ref, or the commit there doesn't have
> 'file.txt'. Try "git show master" and "git show master^{tree}" to see
> which.

It turns out the file just didn't exist because the repository is at a
slight different path.

Thanks for the help. I didn't know about the ^{tree} thing.

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

end of thread, other threads:[~2009-08-02  6:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-02  3:51 git show on bare repository? skillzero
2009-08-02  4:44 ` Jeff King
2009-08-02  6:08   ` skillzero

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.