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

Re: [PATCH 0/5] gitweb: Support for arbitrary diffs

From
MKMartin Koegler <mkoegler@auto.tuwien.ac.at>
Date
Sep 4, 2007, 06:31 UTC
Message-ID
<20070904063151.GA17799@auto.tuwien.ac.at>
In-Reply-To
<200709031023.42366.jnareb@gmail.com>
On Mon, Sep 03, 2007 at 10:23:41AM +0200, Jakub Narebski wrote:
Show 7 quoted lines
> On Mon, 3 September 2007, Petr "Pasky" Baudis wrote:
> 
> > To hijack this post a bit, another patch in the queue (the incremental
> > blame thingie) introduces blame.js. Do you think that we should keep the
> > .js files separate, or instead have one big gitweb.js with everything?
> > I'm inclined to the second possibility in order to reduce the number of
> > requests, but it comes at a price of slightly worse maintainability.
Why is the maintainablility reduced?

gitweb.perl is also a collection of different function, which are kept in one file. Where is the difference to a javascript file?

Keeping everything into one file will make it more likely, that the code is not developed totally different (in the terms of code style, variable/function names, ...).

In the moment, there is the problem, which patch should introduce the js file. We need a common base patch, which introduces an empty gitweb.js.

Keeping the two functions separate has problems. Every patch need to hook into the onload event. To avoid merge conflicts, my current patch saves the old handler and overwrite it with its on version, which calls back into the saved handler.

If we would have on js file, we can add in the base patch an empty JavaScript function for this.

Then Hooking in the onload event would mean, to only add some new lines to the function. The resulting merge conflicts are easier to resolve (as they affect independet lines) compared to the current '<body onload="hook1(); hook2();">'

Show 8 quoted lines
> On the other hand if we have blame.js separate, we could load it
> (require it) only for the 'blame' view, it means only when needed.
> 
> gitweb.js would contain JavaScript code used by all (or almost all)
> views, then...
> 
> I don't think gitweb.js would be as large as gitweb.perl, if we are
> talking about maintability ;-)

The size of gitweb.js should not matter. On a modern browser, the first request will fetch the whole Javascript file. For subseqent request, the webserver returns "not modified". Having two javascript file means two checks.

mfg Martin Kögler
Previous: Jakub NarebskiNext: Catalin Marinas
Message 11 of 12 in “gitweb: Support for arbitrary diffs”
  1. 0/5 gitweb: Support for arbitrary diffsMartin Koegler, Sep 2, 2007
  2. 1/5 gitweb: Support comparing blobs with different namesMartin Koegler, Sep 2, 2007
  3. 2/5 gitweb: support filename prefix in git_patchset_body/git_difftree_bodyMartin Koegler, Sep 2, 2007
  4. 3/5 gitweb: Add treediff viewMartin Koegler, Sep 2, 2007
  5. 4/5 gitweb: Selecting diffs in JavaScriptMartin Koegler, Sep 2, 2007
  6. 5/5 Show Difflinks in an other colorMartin Koegler, Sep 2, 2007
  7. Jakub NarebskiSep 3, 2007
  8. Petr BaudisSep 3, 2007
  9. Junio C HamanoSep 3, 2007
  10. Jakub NarebskiSep 3, 2007
  11. Martin KoeglerSep 4, 2007
  12. Catalin MarinasSep 3, 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.