Re: [PATCH 2/2] gitk: add an option to run gitk on an item in the file list
On Tue, May 8, 2018 at 3:39 PM, Alex Riesenwrote: > Bert Wesarg, Tue, May 08, 2018 15:17:03 +0200: >> On Tue, May 8, 2018 at 2:22 PM, Alex Riesen >> wrote: >> > +proc flist_gitk {} { >> > +global flist_menu_file findstring gdttype >> > + >> > +set x [shellquote $flist_menu_file] >> >> this needs to handle cdup, i.e., if gitk is run from a subdirectory, >> all paths needs to be prefixed with $cdup, like: [file join $cdup >> $flist_menu_file] > > That, indeed, is easily done: > > set x [shellquote [file join $cdup $flist_menu_file]] > if {[file isdirectory $flist_menu_file]} { > exec sh -c "cd $x&" & > } else { > exec gitk -- $x & > } > > > It just doesn't seem to work: gitk does not find any commits! > Maybe that's because the file panel lists only files for the current > subdirectory (without the path from the repo top-level)? E.g. > > mkdir tst > cd tst > git init > mkdir a > touch top-file a/sub-file > git add -A ; git commit -m. > cd a > gitk > > Gitk lists only sub-file. > > Frankly, this listing limited to just a sub-directory confuses me a bit. Is > there anyway to get to display full repository without changing to the top > level? I noticed that too, while testing your patch and I'm also confused. But was not able to send a request to Paul yet. ls-tree --full-tree seems to be one that should be used here, I think. Bert
Re: [PATCH 2/2] gitk: add an option to run gitk on an item in the file list
Bert Wesarg, Tue, May 08, 2018 15:17:03 +0200: > On Tue, May 8, 2018 at 2:22 PM, Alex Riesen> wrote: > > +proc flist_gitk {} { > > +global flist_menu_file findstring gdttype > > + > > +set x [shellquote $flist_menu_file] > > this needs to handle cdup, i.e., if gitk is run from a subdirectory, > all paths needs to be prefixed with $cdup, like: [file join $cdup > $flist_menu_file] That, indeed, is easily done: set x [shellquote [file join $cdup $flist_menu_file]] if {[file isdirectory $flist_menu_file]} { exec sh -c "cd $x&" & } else { exec gitk -- $x & } It just doesn't seem to work: gitk does not find any commits! Maybe that's because the file panel lists only files for the current subdirectory (without the path from the repo top-level)? E.g. mkdir tst cd tst git init mkdir a touch top-file a/sub-file git add -A ; git commit -m. cd a gitk Gitk lists only sub-file. Frankly, this listing limited to just a sub-directory confuses me a bit. Is there anyway to get to display full repository without changing to the top level? --- Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft. https://www.avast.com/antivirus
Re: [PATCH 2/2] gitk: add an option to run gitk on an item in the file list
On Tue, May 8, 2018 at 2:22 PM, Alex Riesenwrote: > From: Alex Riesen > > Similar to a git gui feature which visualizes history in a submodule, > the submodules cause the gitk be started inside the submodule. > > Signed-off-by: Alex Riesen > --- > gitk | 12 > 1 file changed, 12 insertions(+) > > diff --git a/gitk b/gitk > index d34833f..1ec545e 100755 > --- a/gitk > +++ b/gitk > @@ -2682,6 +2682,7 @@ proc makewindow {} { > {mc "External diff" command {external_diff}} > {mc "Blame parent commit" command {external_blame 1}} > {mc "Copy path" command {clipboard clear; clipboard append > $flist_menu_file}} > + {mc "Run gitk on this" command {flist_gitk}} > } > $flist_menu configure -tearoff 0 > > @@ -3555,6 +3556,17 @@ proc flist_hl {only} { > set gdttype [mc "touching paths:"] > } > > +proc flist_gitk {} { > +global flist_menu_file findstring gdttype > + > +set x [shellquote $flist_menu_file] this needs to handle cdup, i.e., if gitk is run from a subdirectory, all paths needs to be prefixed with $cdup, like: [file join $cdup $flist_menu_file] Bert > +if {[file isdirectory $flist_menu_file]} { > + exec sh -c "cd $x&" & > +} else { > + exec gitk -- $x & > +} > +} > + > proc gitknewtmpdir {} { > global diffnum gitktmpdir gitdir env >
[PATCH 2/2] gitk: add an option to run gitk on an item in the file list
From: Alex RiesenSimilar to a git gui feature which visualizes history in a submodule, the submodules cause the gitk be started inside the submodule. Signed-off-by: Alex Riesen --- gitk | 12 1 file changed, 12 insertions(+) diff --git a/gitk b/gitk index d34833f..1ec545e 100755 --- a/gitk +++ b/gitk @@ -2682,6 +2682,7 @@ proc makewindow {} { {mc "External diff" command {external_diff}} {mc "Blame parent commit" command {external_blame 1}} {mc "Copy path" command {clipboard clear; clipboard append $flist_menu_file}} + {mc "Run gitk on this" command {flist_gitk}} } $flist_menu configure -tearoff 0 @@ -3555,6 +3556,17 @@ proc flist_hl {only} { set gdttype [mc "touching paths:"] } +proc flist_gitk {} { +global flist_menu_file findstring gdttype + +set x [shellquote $flist_menu_file] +if {[file isdirectory $flist_menu_file]} { + exec sh -c "cd $x&" & +} else { + exec gitk -- $x & +} +} + proc gitknewtmpdir {} { global diffnum gitktmpdir gitdir env -- 2.17.0.rc1.56.gb9824190bd --- Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft. https://www.avast.com/antivirus