Re: cgit, invalid branches, and HTTP error code



On Thu, 2009-04-16 at 08:53 +0200, Frederic Peters wrote:
> Hello,
> 
> JHBuild has a script that pass over every modules, checking if they
> have branched for the stable release; it is currently really trivial,
> it checks that http://svn.gnome.org/svn/$modulename/branches/$branchname
> exists (ie doesn't return a 404), and voila.
> 
> I was updating it for git, but
>   http://git.gnome.org/cgit/glib/log/?h=glib-2-10
>   http://git.gnome.org/cgit/glib/log/?h=foobar
> both return with HTTP 200.
> 
> Could it be changed so that it fails with HTTP 404 ?

Hmm, cgit isn't *really* meant as a programmatic web interface to git.
You can use 'git ls-remote' to check for existence. In shell:

  git ls-remote git://git.gnome.org/gtk+ refs/heads/$branchname | \
     grep -q .  && echo "Branch exists"

I'll forward your request to Lars though - it does make sense.

- Owen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]