From: Adam Mercer Date: Tue, 04 May 2010 16:11:57 GMT Subject: Determining if a file exists in a bare repo Message-ID: 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