List for cgit developers and users
 help / color / mirror / Atom feed
Subject: Return "404 Not found" if a repo doesn't exist (any more).
Date: Fri, 01 Feb 2013 18:48:21 +0100	[thread overview]
Message-ID: <87obg4ylga.fsf@topper.koldfront.dk> (raw)
In-Reply-To: <CAHmME9raNC542b1kWy3njdtKotT2aGZSgz8Lh=YH80A3KFa5xQ@mail.gmail.com>

On Fri, 1 Feb 2013 12:58:25 +0100, Jason wrote:

> On Sat, Dec 1, 2012 at 11:02 PM, Adam Sj?gren <asjo at koldfront.dk> wrote:

>> @@ -247,6 +247,17 @@ void cgit_print_repolist()

>> +       for (i=0; i<cgit_repolist.count; i++) {
>> +               if (!(is_match(&cgit_repolist.repos[i]) && is_in_url(&cgit_repolist.repos[i])))
>> +                       continue;
>> +               hits++;
>> +        }

>> +       if (!hits) {
>> +                ctx.page.status = 404;

> I like the idea of this, but I hate to duplicate the loop logic like that.

Yeah, that is ugly.

> But in fact we do need to know whether there are any hits before
> sending headers.

That's how far I got...

> Tricky. I'll see if I can refactor things to be a bit nicer.

Sounds great!


  Best regards,

    Adam

-- 
 "Ge mig en vinterdrog, ge mig allt du har                    Adam Sj?gren
  Kom nu jag ?r kroniskt l?g, bara m?rkret h?rs"         asjo at koldfront.dk





      reply	other threads:[~2013-02-01 17:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-01 22:02 [PATCH] " 
2013-02-01 11:58 ` Jason
2013-02-01 17:48   `  [this message]

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=87obg4ylga.fsf@topper.koldfront.dk \
    --to=cgit@lists.zx2c4.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).