Wednesday, 9 July 2025

Broken gitk in Ubuntu

At work, we use Ubuntu both on our servers and workstations. Today, I was startled by the command gitk not showing git history, but instead an error:

Error executing git log: wrong # args:
   sholuld be
"safe_open_command_redirect cmd redir"

Fortunately, I've already seen the source code of gitk (and learned some tcl to understand and modify it), so I copied it to ~/bin and quickly found a fix.

 --- /usr/bin/gitk    2025-07-03 19:57:43.000000000 +0200
+++ /home/choroba/bin/gitk    2025-07-09 13:33:00.523588093 +0200
@@ -497,7 +497,7 @@
     }
 
     if {[catch {
-        set fd [safe_open_command_redirect [concat git log --no-color -z --pretty=raw $show_notes \
+        set fd [safe_open_command [concat git log --no-color -z --pretty=raw $show_notes \
                         --parents --boundary $args "--" $files]]
     } err]} {
         error_popup "[mc "Error executing git log:"] $err"
@@ -645,7 +645,7 @@
         set args $vorigargs($view)
     }
     if {[catch {
-        set fd [safe_open_command_redirect [concat git log --no-color -z --pretty=raw $show_notes \
+        set fd [safe_open_command [concat git log --no-color -z --pretty=raw $show_notes \
                         --parents --boundary $args "--" $vfilelimit($view)]]
     } err]} {
         error_popup "[mc "Error executing git log:"] $err"
 

I checked the gitk at GitHub and it seems Ubuntu released a version in the middle of a refactoring that wraps calls to open

No comments:

Post a Comment