{"thread":{"id":"14655","subject":"Git Gui bug calling gitk","startedAt":"2008-07-24T13:01:48Z","lastAt":"2008-07-30T05:42:57Z","messageCount":6,"participants":["Murphy, John","Abhijit Menon-Sen","Shawn O. Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"84711","messageId":"80915B5E107BED488500050294C6F48712136B@ex2k.bankofamerica.com","threadId":"14655","inReplyTo":null,"subject":"Git Gui bug calling gitk","fromName":"Murphy, John","fromEmail":"john.murphy@bankofamerica.com","sentAt":"2008-07-24T13:01:48Z","receivedAt":"2008-07-24T13:01:48Z","isPatch":false,"sender":{"key":"john.murphy@bankofamerica.com","avatar":null},"body":"I have recently installed git: v1.5.6.1-167-gbf270ab and git gui:\ngitgui-0.10.2-8-g2add5cb\n\n>From Git Gui we try to run Visualize Branch History and get the\nfollowing error:\n\nUnable to start gitk:\nc:/cygwin/usr/local/git/libexec/git-core/gitk does not exist\n\nI presume this was just an oversight when git- commands were removed\nfrom the bin directory.\n\n-John Murphy\n"},{"id":"84712","messageId":"20080724132853.GA25313@toroid.org","threadId":"14655","inReplyTo":"80915B5E107BED488500050294C6F48712136B@ex2k.bankofamerica.com","subject":"[PATCH] git-gui: Look for gitk in $PATH, not $LIBEXEC/git-core","fromName":"Abhijit Menon-Sen","fromEmail":"ams@toroid.org","sentAt":"2008-07-24T13:28:53Z","receivedAt":"2008-07-24T13:28:53Z","isPatch":true,"sender":{"key":"ams@toroid.org","avatar":null},"body":"Signed-off-by: Abhijit Menon-Sen <ams@toroid.org>\n---\n\nAt 2008-07-24 09:01:48 -0400, john.murphy@bankofamerica.com wrote:\n>\n> I presume this was just an oversight when git- commands were removed\n> from the bin directory.\n\nLooks like it. The following patch fixes it for me. Does it work for\nyou on Windows?\n\n-- ams\n\n git-gui/git-gui.sh |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex 940677c..a70fa67 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -1670,10 +1670,10 @@ proc do_gitk {revs} {\n \t# -- Always start gitk through whatever we were loaded with.  This\n \t#    lets us bypass using shell process on Windows systems.\n \t#\n-\tset exe [file join [file dirname $::_git] gitk]\n+\tset exe [_which gitk]\n \tset cmd [list [info nameofexecutable] $exe]\n-\tif {! [file exists $exe]} {\n-\t\terror_popup [mc \"Unable to start gitk:\\n\\n%s does not exist\" $exe]\n+\tif {$exe eq {}} {\n+\t\terror_popup [mc \"Couldn't find gitk in PATH\"]\n \t} else {\n \t\tglobal env\n \n-- \n1.5.6.GIT\n"},{"id":"84961","messageId":"20080725220544.GD23202@spearce.org","threadId":"14655","inReplyTo":"20080724132853.GA25313@toroid.org","subject":"Re: [PATCH] git-gui: Look for gitk in $PATH, not $LIBEXEC/git-core","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-07-25T22:05:44Z","receivedAt":"2008-07-25T22:05:44Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Abhijit Menon-Sen <ams@toroid.org> wrote:\n> At 2008-07-24 09:01:48 -0400, john.murphy@bankofamerica.com wrote:\n> >\n> > I presume this was just an oversight when git- commands were removed\n> > from the bin directory.\n> \n> Looks like it. The following patch fixes it for me. Does it work for\n> you on Windows?\n\nThanks.\n\nThis patch is obviously correct on any platform except Mac OS X.\nOn Mac OS X it gets confusing because [info nameofexecutable] is\na wrapper .app which loads its own main script.  That main script\nneeds to use the gitk location it receives from git-gui, and not\nthe location it computes from gitexecdir.  So I'm following up\nyour patch with this:\n\ndiff --git a/macosx/AppMain.tcl b/macosx/AppMain.tcl\nindex 41ca08e..ddbe633 100644\n--- a/macosx/AppMain.tcl\n+++ b/macosx/AppMain.tcl\n@@ -7,7 +7,7 @@ if {[string first -psn [lindex $argv 0]] == 0} {\n }\n \n if {[file tail [lindex $argv 0]] eq {gitk}} {\n-\tset argv0 [file join $gitexecdir gitk]\n+\tset argv0 [lindex $argv 0]\n \tset AppMain_source $argv0\n } else {\n \tset argv0 [file join $gitexecdir [file tail [lindex $argv 0]]]\n \n-- \nShawn.\n"},{"id":"85460","messageId":"80915B5E107BED488500050294C6F48712137A@ex2k.bankofamerica.com","threadId":"14655","inReplyTo":"20080725220544.GD23202@spearce.org","subject":"RE: [PATCH] git-gui: Look for gitk in $PATH, not $LIBEXEC/git-core","fromName":"Murphy, John","fromEmail":"john.murphy@bankofamerica.com","sentAt":"2008-07-29T12:40:16Z","receivedAt":"2008-07-29T12:40:16Z","isPatch":true,"sender":{"key":"john.murphy@bankofamerica.com","avatar":null},"body":"I have rebuilt git-gui with version 0.10.2.18.gc629 it is still not finding gitk.\nI have done some debugging in proc _which\nI have found the issue is with the following line:\n\nset p [file join $p $what$_search_exe]\n\nThe variable $p = gitk.exe\n\nAnd there is no such animal\n\nWhen I copy gitk to gitk.exe in /usr/local/git/bin, it works fine.\n\nSo, not sure if this is a git issue or a git-gui issue.\n\n-John \n-----Original Message-----\nFrom: spearce@spearce.org [mailto:spearce@spearce.org] \nSent: Friday, July 25, 2008 6:06 PM\nTo: Abhijit Menon-Sen\nCc: Murphy, John; git@vger.kernel.org\nSubject: Re: [PATCH] git-gui: Look for gitk in $PATH, not $LIBEXEC/git-core\n\nAbhijit Menon-Sen <ams@toroid.org> wrote:\n> At 2008-07-24 09:01:48 -0400, john.murphy@bankofamerica.com wrote:\n> >\n> > I presume this was just an oversight when git- commands were removed\n> > from the bin directory.\n> \n> Looks like it. The following patch fixes it for me. Does it work for\n> you on Windows?\n\nThanks.\n\nThis patch is obviously correct on any platform except Mac OS X.\nOn Mac OS X it gets confusing because [info nameofexecutable] is\na wrapper .app which loads its own main script.  That main script\nneeds to use the gitk location it receives from git-gui, and not\nthe location it computes from gitexecdir.  So I'm following up\nyour patch with this:\n\ndiff --git a/macosx/AppMain.tcl b/macosx/AppMain.tcl\nindex 41ca08e..ddbe633 100644\n--- a/macosx/AppMain.tcl\n+++ b/macosx/AppMain.tcl\n@@ -7,7 +7,7 @@ if {[string first -psn [lindex $argv 0]] == 0} {\n }\n \n if {[file tail [lindex $argv 0]] eq {gitk}} {\n-\tset argv0 [file join $gitexecdir gitk]\n+\tset argv0 [lindex $argv 0]\n \tset AppMain_source $argv0\n } else {\n \tset argv0 [file join $gitexecdir [file tail [lindex $argv 0]]]\n \n-- \nShawn.\n"},{"id":"85489","messageId":"20080729164856.GB1730@spearce.org","threadId":"14655","inReplyTo":"80915B5E107BED488500050294C6F48712137A@ex2k.bankofamerica.com","subject":"Re: [PATCH] git-gui: Look for gitk in $PATH, not $LIBEXEC/git-core","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-07-29T16:48:56Z","receivedAt":"2008-07-29T16:48:56Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"\"Murphy, John\" <john.murphy@bankofamerica.com> wrote:\n> I have rebuilt git-gui with version 0.10.2.18.gc629 it is still not finding gitk.\n> I have done some debugging in proc _which\n> I have found the issue is with the following line:\n> \n> set p [file join $p $what$_search_exe]\n> \n> The variable $p = gitk.exe\n> \n> And there is no such animal\n> \n> When I copy gitk to gitk.exe in /usr/local/git/bin, it works fine.\n> \n> So, not sure if this is a git issue or a git-gui issue.\n\nSince you are new to the list, I will politely point out we do\nnot top-post.  (http://www.html-faq.com/etiquette/?toppost) and\nmuch prefer inline posting.  (Yea, I know, its Outlook.  Switch to\ntext only message format and then edit inline in the reply.)\n\nThis is definately a git-gui bug.  _which should search not just\n.exe extensions, but also the base name itself in case it is a\nshell script or perl script.  git-gui already has special cases\nto handle executing those through their interpreters even on a\npure Win32 Tcl/Tk process.\n\nIts wrong to install gitk as gitk.exe, it is not a Win32 executable\nprocess and the Windows kernel cannot load it into memory on its own.\n\n \n> From: spearce@spearce.org [mailto:spearce@spearce.org] \n> Abhijit Menon-Sen <ams@toroid.org> wrote:\n> > At 2008-07-24 09:01:48 -0400, john.murphy@bankofamerica.com wrote:\n> > >\n> > > I presume this was just an oversight when git- commands were removed\n> > > from the bin directory.\n> > \n> > Looks like it. The following patch fixes it for me. Does it work for\n> > you on Windows?\n> \n> Thanks.\n> \n> This patch is obviously correct on any platform except Mac OS X.\n> On Mac OS X it gets confusing because [info nameofexecutable] is\n> a wrapper .app which loads its own main script.  That main script\n> needs to use the gitk location it receives from git-gui, and not\n> the location it computes from gitexecdir.  So I'm following up\n> your patch with this:\n> \n> diff --git a/macosx/AppMain.tcl b/macosx/AppMain.tcl\n> index 41ca08e..ddbe633 100644\n> --- a/macosx/AppMain.tcl\n> +++ b/macosx/AppMain.tcl\n> @@ -7,7 +7,7 @@ if {[string first -psn [lindex $argv 0]] == 0} {\n>  }\n>  \n>  if {[file tail [lindex $argv 0]] eq {gitk}} {\n> -\tset argv0 [file join $gitexecdir gitk]\n> +\tset argv0 [lindex $argv 0]\n>  \tset AppMain_source $argv0\n>  } else {\n>  \tset argv0 [file join $gitexecdir [file tail [lindex $argv 0]]]\n\n-- \nShawn.\n"},{"id":"85580","messageId":"20080730054257.GG7225@spearce.org","threadId":"14655","inReplyTo":"20080729164856.GB1730@spearce.org","subject":"Re: [PATCH] git-gui: Look for gitk in $PATH, not $LIBEXEC/git-core","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2008-07-30T05:42:57Z","receivedAt":"2008-07-30T05:42:57Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> wrote:\n> \"Murphy, John\" <john.murphy@bankofamerica.com> wrote:\n> > I have rebuilt git-gui with version 0.10.2.18.gc629 it is still not finding gitk.\n> > I have done some debugging in proc _which\n> > I have found the issue is with the following line:\n> > \n> > set p [file join $p $what$_search_exe]\n> > \n> > The variable $p = gitk.exe\n> > \n> > And there is no such animal\n> > \n> > When I copy gitk to gitk.exe in /usr/local/git/bin, it works fine.\n> \n> This is definately a git-gui bug.\n\nAnd this should fix it.\n\n--8<--\ngit-gui: Fix gitk search in $PATH to work on Windows\n\nBack in 15430be5a1 (\"Look for gitk in $PATH, not $LIBEXEC/git-core\")\ngit-gui learned to use [_which gitk] to locate where gitk's script\nis as Git 1.6 will install gitk to $prefix/bin (in $PATH) and all\nof the other tools are in $gitexecdir.\n\nThis failed on Windows because _which adds the \".exe\" suffix as it\nsearches for the program on $PATH, under the assumption that we can\nonly execute something from Tcl if it is a proper Windows executable.\n\nWhen scanning for gitk on Windows we need to omit the \".exe\" suffix.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n git-gui.sh |   12 +++++++++---\n 1 files changed, 9 insertions(+), 3 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex ce941ad..14b2d9a 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -317,7 +317,7 @@ proc _git_cmd {name} {\n \treturn $v\n }\n \n-proc _which {what} {\n+proc _which {what args} {\n \tglobal env _search_exe _search_path\n \n \tif {$_search_path eq {}} {\n@@ -340,8 +340,14 @@ proc _which {what} {\n \t\t}\n \t}\n \n+\tif {[is_Windows] && [lsearch -exact $args -script] >= 0} {\n+\t\tset suffix {}\n+\t} else {\n+\t\tset suffix $_search_exe\n+\t}\n+\n \tforeach p $_search_path {\n-\t\tset p [file join $p $what$_search_exe]\n+\t\tset p [file join $p $what$suffix]\n \t\tif {[file exists $p]} {\n \t\t\treturn [file normalize $p]\n \t\t}\n@@ -1686,7 +1692,7 @@ proc do_gitk {revs} {\n \t# -- Always start gitk through whatever we were loaded with.  This\n \t#    lets us bypass using shell process on Windows systems.\n \t#\n-\tset exe [_which gitk]\n+\tset exe [_which gitk -script]\n \tset cmd [list [info nameofexecutable] $exe]\n \tif {$exe eq {}} {\n \t\terror_popup [mc \"Couldn't find gitk in PATH\"]\n-- \n1.6.0.rc1.166.gbbfa8\n\n\n-- \nShawn.\n"}]}