git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Determining if a file exists in a bare repo
@ 2010-05-04 16:11 Adam Mercer
  2010-05-04 16:18 ` Jacob Helwig
  2010-05-04 16:39 ` Junio C Hamano
  0 siblings, 2 replies; 5+ messages in thread
From: Adam Mercer @ 2010-05-04 16:11 UTC (permalink / raw)
  To: git

Hi

I'm trying to write a post-receive hook that generates some HTML files
from reStructured text files stored in a repository. Essentially I'm
doing this with

git show master:INSTALL | rst2html --no-raw --no-file-insertion >
/path/to/INSTALL.html

However I would like this script to fail gracefully if the INSTALL
file is not available in the repository so would like to check if this
file exists. The problem I'm having is that git-show seems to return a
zero return code even if the file you request doesn't exist, e.g.:

$ git show master:NoneExistantFile
fatal: ambiguous argument 'master:NoneExistantFile': unknown revision
or path not in the working tree.
Use '--' to separate paths from revisions
$ echo $?
0
$

is there another, scriptable, way to determine if a given file exists
in a given branch of a bare repository?

Cheers

Adam

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

end of thread, other threads:[~2010-05-04 16:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-04 16:11 Determining if a file exists in a bare repo Adam Mercer
2010-05-04 16:18 ` Jacob Helwig
2010-05-04 16:26   ` Adam Mercer
2010-05-04 16:39 ` Junio C Hamano
2010-05-04 16:57   ` Adam Mercer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).