<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote">On Wed, Aug 7, 2013 at 2:57 PM, Stefan Tauner <span dir="ltr"><<a href="mailto:stefan.tauner@student.tuwien.ac.at" target="_blank">stefan.tauner@student.tuwien.ac.at</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>> $ sh getrevision.sh -U<br></div></div><div>
> fatal: ambiguous argument 'HEAD..->': unknown revision or path not in the<br>
> working tree.<br>
> Use '--' to separate paths from revisions, like this:<br>
> 'git <command> [<revision>...] -- [<file>...]'<br>
> getrevision.sh: line 115: [: -ge: unary operator expected<br>
> getrevision.sh: line 115: [: 0: unary operator expected<br>
> <a href="http://git.chromium.org/chromiumos/third_party/flashrom.git" target="_blank">http://git.chromium.org/chromiumos/third_party/flashrom.git</a> master<br>
><br>
> What about something like:<br>
> git ls-remote --exit-code --get-url | sed 's/.*\/\///'<br>
><br>
> That looks simpler and works better, at least in my testing...<br>
<br>
</div>The problem is the output of git branch -r --contains HEAD:<br>
  origin/HEAD -> origin/master<br>
  origin/master<br>
<br>
Namely the origin/HEAD pointing to another branch which specifies the<br>
branch one checks out automatically when cloning the repository. I do<br>
not have this in my working repository where I was testing because i did<br>
add the chromium tree as a plain remote only...<br>
<br>
I have attached another approach, now with:<br>
        branches=$(git branch -r --contains HEAD | sed 's/[\t ]*//;/.*->.*/d')</blockquote><div><br></div><div>That works nicely for my test cases. Anyone else?</div><div><br></div><div>Now to bikeshed the appearance of the the version string...</div>


</div><div><br></div>-- <br>David Hendricks (dhendrix)<br>Systems Software Engineer, Google Inc.
</div></div>