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

Re: [PATCH v4 2/3] gitweb: refactor If-Modified-Since handling

From
W. Trevor King <wking@drexel.edu>
Date
Mar 26, 2012, 17:36 UTC
Message-ID
<20120326173646.GA6524@odin.tremily.us>
In-Reply-To
<7v8vinqoaj.fsf@alter.siamese.dyndns.org>
On Mon, Mar 26, 2012 at 10:12:36AM -0700, Junio C Hamano wrote:
> It might make more sense to call the helper *after* stuffing %latest_date
> and pass the $latest_date{'rfc2822'} as parameter to the new helper
> function, so that the helper function do not have to call parse_date().
I did something closer to your suggestion in my v1 patch, but
On Tue, Mar 20, 2012 at 04:55:45AM -0700, Jakub Narebski wrote:
Show 15 quoted lines
> Shouldn't we pass \%latest_date (or rather \%modification_date to be
> more generic)?  Ah, I see that parse_date() subroutine does not store
> original epoch not original timezone.
> 
> By the way, for $latest_date{'rfc2822'} we don't need $timezone
> argument, and I think we should not pass it to generic
> modified_since() function (or whatever it will be called).
> 
> …
> 
> I think a better idea would be to make this function/subroutine (named
> e.g. if_modified_since() or something like that) to work more like
> die_error() -- it should simply end request instead of having caller
> to use complcated calling convention, and care about eraly termination
> by itself.

Only passing in the epoch. We could reduce computation at the expense of complication by passing in both the epoch and a formatted time string, but after Jakub's suggestions, I felt like a simpler interface was the better approach. I don't feel particularly committed to either way, so just tell me which you'd like best ;).

> The verb "die" everywhere else in the codebase of Git not just means an
> immediate exit, but means an imediate _error_ exit.  The new helper
> function is not about failure, but merely is an early return.  Perhaps
> rename it to exit_if_unmodified_since() or something?
Will fix in v5.
> Missing " &&" at the end (same in 3/3).
Oops.  I wonder why my tests still passed :p.  Will fix in v5.
> Other than that, the patch looks cleanly done.
> 
> Thanks.
You're welcome.  Thanks for shepherding me through it ;).
-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
Previous: Junio C HamanoNext: Junio C Hamano
Message 23 of 43 in “What's cooking in git.git (Mar 2012, #07; Mon, 19)”
  1. Junio C HamanoMar 20, 2012
  2. W. Trevor KingMar 20, 2012
  3. Junio C HamanoMar 20, 2012
  4. Incremental updates to What's cookingJunio C Hamano, Mar 20, 2012
  5. Isolate If-Modified-Since handling in gitwebW. Trevor King, Mar 21, 2012
  6. Jakub NarebskiMar 21, 2012
  7. W. Trevor KingMar 21, 2012
  8. Jakub NarebskiMar 21, 2012
  9. W. Trevor KingMar 21, 2012
  10. Junio C HamanoMar 21, 2012
  11. W. Trevor KingMar 21, 2012
  12. Jakub NarebskiMar 21, 2012
  13. Junio C HamanoMar 21, 2012
  14. W. Trevor KingMar 21, 2012
  15. Jakub NarebskiMar 22, 2012
  16. Junio C HamanoMar 21, 2012
  17. Jakub NarebskiMar 22, 2012
  18. Junio C HamanoMar 22, 2012
  19. W. Trevor KingMar 26, 2012
  20. 1/3 gitweb: add `status` headers to git_feed() responses.W. Trevor King, Mar 26, 2012
  21. 2/3 gitweb: refactor If-Modified-Since handlingW. Trevor King, Mar 26, 2012
  22. Junio C HamanoMar 26, 2012
  23. W. Trevor KingMar 26, 2012
  24. Junio C HamanoMar 26, 2012
  25. W. Trevor KingMar 26, 2012
  26. Jakub NarebskiMar 27, 2012
  27. W. Trevor KingMar 28, 2012
  28. Jakub NarebskiMar 28, 2012
  29. 0/3 gitweb: refactor If-Modified-Since handlingwking@tremily.us, Mar 28, 2012
  30. W. Trevor KingMar 28, 2012
  31. 1/3 gitweb: add `status` headers to git_feed() responses.wking@tremily.us, Mar 28, 2012
  32. 2/3 gitweb: refactor If-Modified-Since handlingwking@tremily.us, Mar 28, 2012
  33. 3/3 gitweb: add If-Modified-Since handling to git_snapshot().wking@tremily.us, Mar 28, 2012
  34. Jakub NarebskiMar 28, 2012
  35. W. Trevor KingMar 26, 2012
  36. Jakub NarebskiMar 27, 2012
  37. W. Trevor KingMar 28, 2012
  38. 3/3 gitweb: add If-Modified-Since handling to git_snapshot().W. Trevor King, Mar 26, 2012
  39. Jakub NarebskiMar 27, 2012
  40. W. Trevor KingMar 27, 2012
  41. Jakub NarebskiMar 27, 2012
  42. W. Trevor KingMar 27, 2012
  43. Junio C HamanoMar 27, 2012

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.