git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] gitweb: Try harder in parse_tag; perhaps it was given ambiguous name

From
Jakub Narebski <jnareb@gmail.com>
Date
Dec 5, 2007, 21:02 UTC
Message-ID
<200712052202.27111.jnareb@gmail.com>
In-Reply-To
<7v7ijsq5zm.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
Show 14 quoted lines
> Jakub Narebski <jnareb@gmail.com> writes:
> 
> > It would be quite easy I think to add checking if gitweb returns
> > expected HTTP return code (HTTP status). So what is the portable way
> > to check if first line of some output matches given regexp (given fixed
> > string)?
> 
> Huh?  Wouldn't something like this be enough?
> 
> 	>expect.empty &&
> 	cmd >actual.out 2>actual.err &&
>         diff -u expect.empty actual.err &&
>         first=$(sed -e '1q' <actual.out) &&
> 	test "z$first" = "I like it"

Well, actually that is even better idea. We can go for one of the three levels of HTTP status checking:

1. Check if we got "Status: 200 OK" when we expect it, and not have it
   when we expect other HTTP status, e.g. when requesting nonexistent
   file. The above code is enough for that.
2. We can check if we got expected status number, for example 200 for
   when we expect no error, or 404 when object is not found, or 403
   if there is no such object etc. I was thinking about using this version
   the need to check not full first line, but fragment of it.
3. We can check full first line, for example
     Status: 200 OK
     Status: 403 Forbidden
     Status: 404 Not Found
     Status: 400 Bad Request
   but this might tie gitweb test too tightly with minute details of
   gitweb output. The above code is good for that too.
What do you think, which route we should go in test?
-- 
Jakub Narebski
Poland
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 8 in “gitweb: disambiguate heads and tags withs the same name”
  1. gitweb: disambiguate heads and tags withs the same nameJakub Narebski, Dec 1, 2007
  2. gitweb: Try harder in parse_tag; perhaps it was given ambiguous nameJakub Narebski, Dec 1, 2007
  3. Jakub NarebskiDec 1, 2007
  4. Junio C HamanoDec 5, 2007
  5. Jakub NarebskiDec 5, 2007
  6. Junio C HamanoDec 5, 2007
  7. Jakub NarebskiDec 5, 2007
  8. Junio C HamanoDec 5, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.