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

Re: FFmpeg considering GIT

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
May 5, 2007, 22:30 UTC
Message-ID
<alpine.LFD.0.98.0705051524300.17381@woody.linux-foundation.org>
In-Reply-To
<alpine.LFD.0.98.0705051511020.17381@woody.linux-foundation.org>
On Sat, 5 May 2007, Linus Torvalds wrote:
Show 10 quoted lines
> 
> (It also shows that my "gitk" patch was incorrectly getting the commit 
> name from character 6 onward, even though it should have been 7, but I'll 
> also try to make gitk understand the "<" and ">" markers, and make it 
> possible to say
> 
> 	gitk --left-right a...b
> 
> and have the commits colored appropriately. That would be cool, but it 
> might need more tcl/tk knowledge than I actually possess).
Ok, that turned out to be the case.

Here's an updated patch to gitk, which at least *parses* the "--left-right" data properly, it just doesn't use it. But with the fix to "git log" I just posted, and this, you at least have the same capabilities gitk used to have, and it should be fairly easy for somebody who knows tcltk to squirrel away the "leftright" data per commit and use that to color the commit lines in the top-most pane.

I'm also sure the "if first character is one of '-'/'<'/'>'" test can be written more prettily, rather than have three if-statements on it.

Finally, it realy _should_ check that the first 7 characters of the commit log (the ones it ignores by just asking for substring 7..) are actually the exact characters "commit ", but I'll blame my lack of comfort with the language again.

Somebody? Please? It really should be pretty cool. Do
	gitk --left-right commit^1...commit^2

for an appropriate 'commit' that is a merge, and the two sides getting merged should show up with different colors!

		Linus
----
 gitk |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/gitk b/gitk
index b1c65d7..0bf00ee 100755
--- a/gitk
+++ b/gitk
@@ -33,8 +33,8 @@ proc start_rev_list {view} {
 	set order "--date-order"
     }
     if {[catch {
-	set fd [open [concat | git rev-list --header $order \
-			  --parents --boundary --default HEAD $args] r]
+	set fd [open [concat | git log -z --pretty=raw $order \
+			  --parents --boundary $args] r]
     } err]} {
 	puts stderr "Error executing git rev-list: $err"
 	exit 1
@@ -127,13 +127,23 @@ proc getcommitlines {fd view}  {
 	set start [expr {$i + 1}]
 	set j [string first "\n" $cmit]
 	set ok 0
+	set leftright 0
 	set listed 1
 	if {$j >= 0} {
-	    set ids [string range $cmit 0 [expr {$j - 1}]]
+	    # start with 'commit '
+	    set ids [string range $cmit 7 [expr {$j - 1}]]
 	    if {[string range $ids 0 0] == "-"} {
 		set listed 0
 		set ids [string range $ids 1 end]
 	    }
+	    if {[string range $ids 0 0] == "<"} {
+		set leftright -1
+		set ids [string range $ids 1 end]
+	    }
+	    if {[string range $ids 0 0] == ">"} {
+		set leftright 1
+		set ids [string range $ids 1 end]
+	    }
 	    set ok 1
 	    foreach id $ids {
 		if {[string length $id] != 40} {
@@ -147,7 +157,7 @@ proc getcommitlines {fd view}  {
 	    if {[string length $shortcmit] > 80} {
 		set shortcmit "[string range $shortcmit 0 80]..."
 	    }
-	    error_popup "Can't parse git rev-list output: {$shortcmit}"
+	    error_popup "Can't parse git git log output: {$shortcmit}"
 	    exit 1
 	}
 	set id [lindex $ids 0]
Previous: Linus TorvaldsNext: Junio C Hamano
Message 34 of 66 in “FFmpeg considering GIT”
  1. Panagiotis IssarisMay 2, 2007
  2. Jakub NarebskiMay 2, 2007
  3. Petr BaudisMay 3, 2007
  4. Jakub NarebskiMay 4, 2007
  5. [RFC?] Telling git about more complex relationships between commits (Was: Re: FFmpeg considering GIT)Johan Herland, May 4, 2007
  6. Alex RiesenMay 4, 2007
  7. Andy ParkinsMay 4, 2007
  8. Andrew RuderMay 4, 2007
  9. Johan HerlandMay 4, 2007
  10. Johan HerlandMay 4, 2007
  11. Alex RiesenMay 4, 2007
  12. Johan HerlandMay 5, 2007
  13. Alex RiesenMay 5, 2007
  14. Johan HerlandMay 5, 2007
  15. Petr BaudisMay 4, 2007
  16. Johan HerlandMay 4, 2007
  17. Martin LanghoffMay 3, 2007
  18. Uwe Kleine-KönigMay 3, 2007
  19. Petr BaudisMay 3, 2007
  20. david@lang.hmMay 3, 2007
  21. Petr BaudisMay 3, 2007
  22. Michael NiedermayerMay 4, 2007
  23. Andy ParkinsMay 4, 2007
  24. Johannes SixtMay 4, 2007
  25. Florian WeimerMay 4, 2007
  26. Nicolas PitreMay 4, 2007
  27. Carl WorthMay 4, 2007
  28. Johan HerlandMay 4, 2007
  29. Michael NiedermayerMay 4, 2007
  30. Linus TorvaldsMay 5, 2007
  31. Karl HasselströmMay 5, 2007
  32. Linus TorvaldsMay 5, 2007
  33. Linus TorvaldsMay 5, 2007
  34. Linus TorvaldsMay 5, 2007
  35. Junio C HamanoMay 6, 2007
  36. Paul MackerrasMay 7, 2007
  37. Karl HasselströmMay 7, 2007
  38. Johan HerlandMay 7, 2007
  39. Alex RiesenMay 7, 2007
  40. Marco CostalbaMay 8, 2007
  41. Paul MackerrasMay 9, 2007
  42. Marco CostalbaMay 9, 2007
  43. Robin RosenbergMay 9, 2007
  44. Jan HudecMay 9, 2007
  45. Fredrik KuivinenMay 9, 2007
  46. Jan HudecMay 9, 2007
  47. Marco CostalbaMay 10, 2007
  48. Jan HudecMay 10, 2007
  49. Jan HudecMay 7, 2007
  50. Gábor FarkasMay 7, 2007
  51. Randal L. SchwartzMay 7, 2007
  52. Junio C HamanoMay 7, 2007
  53. Shawn O. PearceMay 8, 2007
  54. Jeff KingMay 8, 2007
  55. Karl HasselströmMay 6, 2007
  56. Karl HasselströmMay 6, 2007
  57. Linus TorvaldsMay 6, 2007
  58. Marco CostalbaMay 6, 2007
  59. Karl HasselströmMay 6, 2007
  60. Marco CostalbaMay 6, 2007
  61. Karl HasselströmMay 6, 2007
  62. Marco CostalbaMay 6, 2007
  63. Karl HasselströmMay 6, 2007
  64. Karl HasselströmMay 6, 2007
  65. Pavel RoskinMay 9, 2007
  66. Gábor FarkasMay 8, 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.