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

Re: [PATCH/RFC 1/x] gitweb: Use git-diff-tree patch output for commitdiff

From
Jakub Narebski <jnareb@gmail.com>
Date
Aug 24, 2006, 11:10 UTC
Message-ID
<eck1em$p8b$1@sea.gmane.org>
In-Reply-To
<7v3bbmhoa2.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
Show 8 quoted lines
> Jakub Narebski <jnareb@gmail.com> writes:
> 
>> Converting "blobdiff" and "blobdiff_plain" format would be much easier
>> if git-diff-tree and friends had -L <label>/--label=<label> option,
>> like GNU diff has.
> 
> I am not sure how that would be useful, given that you would
> disect the header line-by-line to colorize anyway.

gitweb could output patch directly (slurp-print) in blobdiff_plain, if there were -L <label>/--label=<label> option to git-diff. As it is now git_blobdiff_plain (or git_blobdiff('plain')) would have to process diff header, replacing hashes by file names.

Anyway to get full information you need commits to diff, not only blobs to diff, otherwise the mode change information is lost, I think. And then we would be able to reus git_patchset_body for git_blobdiff...

Show 12 quoted lines
>> Current patch preserves much of current output; the question is if for
>> example generate if 'plain' format should generate patch which could
>> be appplied by ordinary patch which do not understand git diff
>> extensions (including renaming and copying), as it is done in current
>> version, and if 'html' version should detect renames and copying.
> 
> I would say html is definitely for human consumption; does
> anybody cut&paste html patch and expect to apply that?  Plain
> format I am easy but probably enabling rename is fine.  You can
> edit the header or tell patch to apply to which file anyway, and
> I think the value of being able to view the real changes outweigh
> that inconvenience.

Or I we can add another format/option, 'broken' to git_commitdiff and friends.

Show 5 quoted lines
>>  * "commitdiff" now products patches with renaming and copying
>>    detection (git-diff-tree is invoked with -M and -C options).
> 
> You do not have to give -M and -C; a single -C is enough.
> I wonder if -B is also useful as a default (i.e. -B -C).
So -C implies -M?
> For a merge, I often would want to see --cc just like gitk does,
> but it is probably just me.

Planned. The problem is that raw format for --cc differs, and parser has to be improved (and similarity is lost)

> I do not know we would want to slurp the entier diff in an
> array before processing.  Is this easy to streamify by passing
> an pipe fd to the formatting sub?

That was one question I meant to ask: slurp entire diff (process then output rule) or streamify (streamify larger output for faster result)? Will do (quite easy).

>>    Empty patches (mode changes and pure renames and copying)
>>    are not written currently.
> 
> That's quite bad.

This can be easily changed. Question: what format? Current "gitweb diff header" (<filetype>:<sha1 link> -> <filetype>:<sha1 link>) has no place for that. Can be easily changed.

Another question: do output difftree in commitdiff, like in commit view? Do write out extended header, perhaps except index line (repeats information in "gitweb diff header")?

Show 16 quoted lines
>>  * "commitdiff_plain" now only generates X-Git-Tag: line only if there
>>    is tag pointing to the current commit.
> 
> Hmph...
> 
>>    ...; besides we are
>>    interested rather in tags _preceding_ the commit, and _heads_
>>    following the commit.
> 
> Interesting observation.  When somebody says "feature X was
> introduced in such and such commit", people would want to know (1) the
> point release they are using has the feature -- which means you
> would want to know the earliest tag that comes after the commit,
> or (2) if the branch they are working on already has that
> feature -- which again means if the head follows the commit.  So
> I am not sure when preceding tag is interesting...

Qgit and gitk both show "Follows:" listing followed = preceding tag(s). This answers question if given commit has given feature.

I have planned separating generation of first/all preceding/following tags/heads (from git_get_references) into subroutines anyway.

I will add 'X-Git-Tag-After:' then.
-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 53 in “gitweb: Use git-diff-tree patch output for commitdiff”
  1. gitweb: Use git-diff-tree patch output for commitdiffJakub Narebski, Aug 23, 2006
  2. gitweb: Replace git_commitdiff_plain by anonymous subroutineJakub Narebski, Aug 23, 2006
  3. gitweb: Show information about incomplete lines in commitdiffJakub Narebski, Aug 23, 2006
  4. Junio C HamanoAug 24, 2006
  5. Jakub NarebskiAug 24, 2006
  6. Junio C HamanoAug 24, 2006
  7. Jakub NarebskiAug 24, 2006
  8. Junio C HamanoAug 24, 2006
  9. Jakub NarebskiAug 24, 2006
  10. Marco CostalbaAug 25, 2006
  11. Jakub NarebskiAug 25, 2006
  12. gitweb: Remove invalid comment in format_diff_lineJakub Narebski, Aug 24, 2006
  13. gitweb: Streamify patch output in git_commitdiffJakub Narebski, Aug 24, 2006
  14. gitweb: Add git_get_{following,preceding}_references functionsJakub Narebski, Aug 24, 2006
  15. gitweb: Faster return from git_get_preceding_references if possibleJakub Narebski, Aug 24, 2006
  16. gitweb: Add git_get_rev_name_tags functionJakub Narebski, Aug 24, 2006
  17. gitweb: Use git_get_name_rev_tags for commitdiff_plain X-Git-Tag: headerJakub Narebski, Aug 24, 2006
  18. gitweb: Add support for hash_parent_base parameter for blobdiffsJakub Narebski, Aug 24, 2006
  19. gitweb: Add support for hash_parent_base parameter for blobdiffsJakub Narebski, Aug 24, 2006
  20. 11/19 gitweb: Allow for pre-parsed difftree info in git_patchset_bodyJakub Narebski, Aug 25, 2006
  21. 12/19 gitweb: Parse two-line from-file/to-file diff header in git_patchset_bodyJakub Narebski, Aug 25, 2006
  22. 13/19 gitweb: Add invisible hyperlink to from-file/to-file diff headerJakub Narebski, Aug 25, 2006
  23. Linus TorvaldsAug 27, 2006
  24. 14/19 gitweb: Always display link to blobdiff_plain in git_blobdiffJakub Narebski, Aug 25, 2006
  25. 15/19 gitweb: Change here-doc back for style consistency in git_blobdiffJakub Narebski, Aug 25, 2006
  26. 16/19 gitweb: Use git-diff-tree or git-diff patch output for blobdiffJakub Narebski, Aug 25, 2006
  27. Jakub NarebskiAug 26, 2006
  28. Junio C HamanoAug 26, 2006
  29. Jakub NarebskiAug 26, 2006
  30. gitweb: Remove workaround for git-diff bug fixed in f82cd3cJakub Narebski, Aug 26, 2006
  31. 17/19 gitweb: git_blobdiff_plain is git_blobdiff('plain')Jakub Narebski, Aug 25, 2006
  32. 18/19 gitweb: Remove git_diff_print subroutineJakub Narebski, Aug 25, 2006
  33. 19/19 gitweb: Remove creating directory for temporary filesJakub Narebski, Aug 25, 2006
  34. Marco CostalbaAug 25, 2006
  35. Jakub NarebskiAug 25, 2006
  36. Junio C HamanoAug 26, 2006
  37. Marco CostalbaAug 26, 2006
  38. Junio C HamanoAug 26, 2006
  39. Marco CostalbaAug 26, 2006
  40. Marco CostalbaAug 26, 2006
  41. Shawn PearceAug 26, 2006
  42. Josef WeidendorferAug 26, 2006
  43. Jakub NarebskiAug 26, 2006
  44. Junio C HamanoAug 26, 2006
  45. Jakub NarebskiAug 26, 2006
  46. Junio C HamanoAug 27, 2006
  47. Junio C HamanoAug 27, 2006
  48. Jakub NarebskiAug 27, 2006
  49. 00/19 gitweb: Remove dependency on external diff and need for temporary filesJakub Narebski, Aug 25, 2006
  50. Linus TorvaldsAug 27, 2006
  51. David MillerAug 27, 2006
  52. Linus TorvaldsAug 27, 2006
  53. Jakub NarebskiAug 27, 2006

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.