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

Re: [PATCH/RFC 10/10] gitweb: Create links leading to 'blame_incremental' using JavaScript

From
MKMartin Koegler <mkoegler@auto.tuwien.ac.at>
Date
Jul 27, 2009, 18:10 UTC
Message-ID
<20090727181046.GA30365@auto.tuwien.ac.at>
In-Reply-To
<200907261206.15646.jnareb@gmail.com>
On Sun, Jul 26, 2009 at 12:06:11PM +0200, Jakub Narebski wrote:
Show 14 quoted lines
> On Sat, 25 Jul 2009, Martin Koegler wrote:
> > On Sat, Jul 25, 2009 at 12:44:10AM +0200, Jakub Narebski wrote:
> 
> > > TODO list:
> > > * Perhaps put fixLinks() function in separate file gitweb.js.
> > >   Should gitweb use single JavaScript file, or should it be split into
> > >   more than one file?
> > 
> > The same question can be asked for gitweb itself:
> 
> Well, there is one important difference: gitweb itself is not send
> over network to client.  JavaScript is.  (Although I'm not sure how
> great it is of an issue, with browsers caching JavaScript.  Perhaps
> one single file would be better idea.)

More files mean more request on the server. If the browser is configured to check at each request, it will issue a GET for each JavaScript file, which will be answered by a 304 after the first request. In the "automatic mode", the browser waits for some time (determined by a heuristic), before it will issue a GET for each file request again.

So in my option, on (bigger) file is better, as it means fewer request.
Show 10 quoted lines
> > 
> > Why is it a single perl file and not splited in many different
> > modules?
> 
> 2. Having it all in single file make its easy to install and update.
>    Well, it made more sense when only way to configure gitweb was to
>    edit gitweb.cgi.  Now building gitweb.cgi is the task for build
>    system, and the only thing left is to copy files in correct place
>    (I think that there are distribution specific packages which makes
>    installing gitweb as easy as "xxx install gitweb").

Yes, there are gitweb packages, which automaticially server repositories under a specific path (eg. /srv/git). For such packages, the js layout is irrelavant.

When manually installing, copying only one javascript file simplifies the deployment.

> 3. You would have to decide _how_ to split it into many different 
>    modules.  Do you know any good examples?

Javascript uses on global namespace. If it is one file, its implicitly clear, that everything (functions, variables) are in one scope. If you split it into multiple files, you have to remember, what the other files contain.

mfg Martin Kögler
Previous: Jakub NarebskiNext: Jakub Narebski
Message 18 of 21 in “[PATCHv2 00/10] gitweb: 'blame' view improvements”
  1. Jakub NarebskiJul 24, 2009
  2. 01/10 gitweb: Make .error style genericJakub Narebski, Jul 24, 2009
  3. 02/10 gitweb: Mark boundary commits in 'blame' viewJakub Narebski, Jul 24, 2009
  4. Junio C HamanoJul 25, 2009
  5. Jakub NarebskiJul 25, 2009
  6. Junio C HamanoJul 25, 2009
  7. 03/10 gitweb: Use "previous" header of git-blame -p in 'blame' viewJakub Narebski, Jul 24, 2009
  8. 04/10 gitweb: Mark commits with no "previous" in 'blame' viewJakub Narebski, Jul 24, 2009
  9. 05/10 gitweb: Add author initials in 'blame' view, a la "git gui blame"Jakub Narebski, Jul 24, 2009
  10. 06/10 gitweb: Use light/dark for class names also in 'blame' viewJakub Narebski, Jul 24, 2009
  11. 07/10 gitweb: Add -partial_query option to href() subroutineJakub Narebski, Jul 24, 2009
  12. 08/10 gitweb: Add optional "time to generate page" info in footerJakub Narebski, Jul 24, 2009
  13. 09/10 gitweb: Incremental blame (proof of concept)Jakub Narebski, Jul 24, 2009
  14. Jakub NarebskiJul 25, 2009
  15. 10/10 gitweb: Create links leading to 'blame_incremental' using JavaScriptJakub Narebski, Jul 24, 2009
  16. Martin KoeglerJul 25, 2009
  17. Jakub NarebskiJul 26, 2009
  18. Martin KoeglerJul 27, 2009
  19. Jakub NarebskiJul 27, 2009
  20. Junio C HamanoJul 24, 2009
  21. Jakub NarebskiJul 25, 2009

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.