From: Jacob Helwig <jacob.helwig@gmail.com>
To: Adam Mercer <ramercer@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Determining if a file exists in a bare repo
Date: Tue, 4 May 2010 09:18:09 -0700 [thread overview]
Message-ID: <h2z8c9a061005040918s33bd5020sa89e95aedb7b8cb@mail.gmail.com> (raw)
In-Reply-To: <w2q799406d61005040911p8fd7c234s5e6382298129985f@mail.gmail.com>
On Tue, May 4, 2010 at 09:11, Adam Mercer <ramercer@gmail.com> wrote:
> 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
What about using "git ls-tree master" to get a file listing?
next prev parent reply other threads:[~2010-05-04 16:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-04 16:11 Determining if a file exists in a bare repo Adam Mercer
2010-05-04 16:18 ` Jacob Helwig [this message]
2010-05-04 16:26 ` Adam Mercer
2010-05-04 16:39 ` Junio C Hamano
2010-05-04 16:57 ` Adam Mercer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=h2z8c9a061005040918s33bd5020sa89e95aedb7b8cb@mail.gmail.com \
--to=jacob.helwig@gmail.com \
--cc=git@vger.kernel.org \
--cc=ramercer@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).