threads / discuss / 43101

Re: gitk broken or user error?

Subject: Re: gitk broken or user error?

## tl;dr

6 messages between Nov 12, 2006 and Nov 13, 2006.

replies: 5people: 3as markdown or json

Seth Falcon· Nov 12, 2006, 17:00 UTC · lore

gitk broken or user error?

Hi,

I get the following error when invoking gitk with any command line argument, for example, 'gitk --all':

    ziti:~/proj/R-devel seth$ gitk --all
    Error in startup script: unknown option "-state"
        while executing
    ".bar.view entryconf 3 -state normal"
        invoked from within
    "if {$cmdline_files ne {} || $revtreeargs ne {}} {
        # create a view for the files/dirs specified on the command line
        set curview 1
        set selec..."
        (file "/Users/seth/scm/bin/gitk" line 6298)

I tried a certainly incorrect thing; just commenting out the offending lines:

diff --git a/gitk b/gitk
index ab383b3..a6c0a9f 100755
--- a/gitk
+++ b/gitk
@@ -6305,8 +6305,8 @@ if {$cmdline_files ne {} || $revtreeargs
     set viewargs(1) $revtreeargs
     set viewperm(1) 0
     addviewmenu 1
-    .bar.view entryconf 2 -state normal
-    .bar.view entryconf 3 -state normal
+#    .bar.view entryconf 2 -state normal
+#    .bar.view entryconf 3 -state normal
 }
 
 if {[info exists permviews]} {

And now gitk _seems_ to work.  No error message, and I can pass
argument to gitk like --all (wow, very useful).

I posted about this in October [*1*], but didn't get any response.
I'd like to be able to use gitk without my must-be-wrong patch.  This
is on OS X ppc (git version 1.4.4.rc1.g73347) with Tcl & Tk at 8.4.7.
Can I provide more info?  Have I missed a configuration step?

Thanks,

+ seth
Shawn Pearce· Nov 13, 2006, 05:20 UTC · re: Seth Falcon · lore
Seth Falcon <sethfalcon@gmail.com> wrote:
Show 13 quoted lines
> I get the following error when invoking gitk with any command line
> argument, for example, 'gitk --all':
> 
>     ziti:~/proj/R-devel seth$ gitk --all
>     Error in startup script: unknown option "-state"
>         while executing
>     ".bar.view entryconf 3 -state normal"
>         invoked from within
>     "if {$cmdline_files ne {} || $revtreeargs ne {}} {
>         # create a view for the files/dirs specified on the command line
>         set curview 1
>         set selec..."
>         (file "/Users/seth/scm/bin/gitk" line 6298)

You are not alone on this. I see the same thing on my Mac and it makes it quite difficult to use gitk. However the same version of gitk does not have this problem on Windows. Its clearly related to platform differences.

Of course Windows is unable to open a gitk window without it being collapsed down to only the titlebar, and is also unable to sucessfully reread the user's ~/.gitk file, but that's another bug...

I really should try to figure out what these problems are, but gitk is 6323 lines of Tcl/Tk code which I'm not all too familiar with, and I've got my own growing mass of ~2473 lines of Tcl/Tk code in git-gui to worry about right now...

Paul Mackerras· Nov 13, 2006, 22:05 UTC · re: Seth Falcon · lore
Seth Falcon writes:
> I tried a certainly incorrect thing; just commenting out the offending
> lines:
[snip]
Show 10 quoted lines
> -    .bar.view entryconf 2 -state normal
> -    .bar.view entryconf 3 -state normal
> +#    .bar.view entryconf 2 -state normal
> +#    .bar.view entryconf 3 -state normal
>  }
>  
>  if {[info exists permviews]} {
> 
> And now gitk _seems_ to work.  No error message, and I can pass
> argument to gitk like --all (wow, very useful).

Those lines are intended to enable the "Edit view" and "Delete view" entries in the View menu. Those entries start out disabled and are supposed to be disabled when the "All files" view is displayed, and enabled when any other view is displayed.

I suspect that under OSX, the menu gets an extra entry, or something, that throws off the numbering. Instead of commenting out those lines, could you instead try changing the 2 and 3 to "Edit*" and "Delete*" instead? If that works I'll do a patch to fix the problem properly.

> I posted about this in October [*1*], but didn't get any response.

I tend to read the git list intermittently (lkml and linuxppc-dev keep me pretty much occupied :). Please cc me on any gitk bug reports.

Seth Falcon· Nov 13, 2006, 22:28 UTC · re: Paul Mackerras · lore
Paul Mackerras <paulus@samba.org> writes:
Show 9 quoted lines
> Those lines are intended to enable the "Edit view" and "Delete view"
> entries in the View menu.  Those entries start out disabled and are
> supposed to be disabled when the "All files" view is displayed, and
> enabled when any other view is displayed.
>
> I suspect that under OSX, the menu gets an extra entry, or something,
> that throws off the numbering.  Instead of commenting out those lines,
> could you instead try changing the 2 and 3 to "Edit*" and "Delete*"
> instead?  If that works I'll do a patch to fix the problem properly.
I tried this patch:
diff --git a/gitk b/gitk
index ab383b3..e7ea4e2 100755
--- a/gitk
+++ b/gitk
@@ -6305,8 +6305,8 @@ if {$cmdline_files ne {} || $revtreeargs
     set viewargs(1) $revtreeargs
     set viewperm(1) 0
     addviewmenu 1
-    .bar.view entryconf 2 -state normal
-    .bar.view entryconf 3 -state normal
+    .bar.view entryconf "Edit*" -state normal
+    .bar.view entryconf "Delete*" -state normal
 }
 
 if {[info exists permviews]} {

And, yes, this allows gitk to load up and be useful.  So this is much
better than the current behavior.  However, if I try clicking on the
"All files" view in the view menu, I get an error box along these
lines:

    unknown option "-state"
    unknown option "-state"
        while executing
    ".bar.view entryconf 3 -state [expr {$n == 0? "disabled": "normal"}]"
        (procedure "showview" line 56)
        invoked from within
    "showview 0"
        (menu invoke)

Perhaps a similar fix is needed in other parts of the code.  

+ seth
Seth Falcon· Nov 13, 2006, 22:38 UTC · re: Seth Falcon · lore
Seth Falcon <sethfalcon@gmail.com> writes:
> I tried this patch:
And then I used grep :-)

This patch seems to get the view menu items working. The only strange thing I see now is that if I create a new view and then try to delete it, it stays around in the menu.

+ seth
diff --git a/gitk b/gitk
index ab383b3..d9df0a3 100755
--- a/gitk
+++ b/gitk
@@ -1632,8 +1632,8 @@ proc showview {n} {
 
     set curview $n
     set selectedview $n
-    .bar.view entryconf 2 -state [expr {$n == 0? "disabled": "normal"}]
-    .bar.view entryconf 3 -state [expr {$n == 0? "disabled": "normal"}]
+    .bar.view entryconf "Edit*" -state [expr {$n == 0? "disabled": "normal"}]
+    .bar.view entryconf "Delete*" -state [expr {$n == 0? "disabled": "normal"}]
 
     if {![info exists viewdata($n)]} {
        set pending_select $selid
@@ -6305,8 +6305,8 @@ if {$cmdline_files ne {} || $revtreeargs
     set viewargs(1) $revtreeargs
     set viewperm(1) 0
     addviewmenu 1
-    .bar.view entryconf 2 -state normal
-    .bar.view entryconf 3 -state normal
+    .bar.view entryconf "Edit*" -state normal
+    .bar.view entryconf "Delete*" -state normal
 }
 

← back to recent threads