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

[PATCH] gitk: do not limit tree mode listing in the file list panel to current sub-directory

From
Alex Riesen <alexander.riesen@cetitec.com>
Date
May 9, 2018, 10:59 UTC
Message-ID
<56ccabf699cdc6e15c5dcb73db5692180c79906d.1525863290.git.raa.lkml@gmail.com>
In-Reply-To
<CAKPyHN1bGtCBZUh7cDAN-t+5DTutvyL6FLwynALTGZA5ijqwrA@mail.gmail.com>
From: Alex Riesen <raa.lkml@gmail.com>

The previous behavior conflicts with the "Patch" mode of the panel, which always shows the changes from the top-level of the repository. It is also impossible to get back to the full listing without restarting gitk. ---

Bert Wesarg, Wed, May 09, 2018 09:19:55 +0200:
Show 7 quoted lines
> > 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.

Well, I just tried your suggestion. 'ls-files' doesn't have --full-tree, so for those it is just cd-up.

It is on top of the re-sent series.
 gitk | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/gitk b/gitk
index c430dfe..03ead98 100755
--- a/gitk
+++ b/gitk
@@ -7600,18 +7600,18 @@ proc go_to_parent {i} {
 
 proc gettree {id} {
     global treefilelist treeidlist diffids diffmergeid treepending
-    global nullid nullid2
+    global nullid nullid2 cdup
 
     set diffids $id
     unset -nocomplain diffmergeid
     if {![info exists treefilelist($id)]} {
 	if {![info exists treepending]} {
 	    if {$id eq $nullid} {
-		set cmd [list | git ls-files]
+		set cmd [list | git -C $cdup ls-files]
 	    } elseif {$id eq $nullid2} {
-		set cmd [list | git ls-files --stage -t]
+		set cmd [list | git -C $cdup ls-files --stage -t]
 	    } else {
-		set cmd [list | git ls-tree -r $id]
+		set cmd [list | git ls-tree --full-tree -r $id]
 	    }
 	    if {[catch {set gtf [open $cmd r]}]} {
 		return
@@ -7670,7 +7670,7 @@ proc gettreeline {gtf id} {
 proc showfile {f} {
     global treefilelist treeidlist diffids nullid nullid2
     global ctext_file_names ctext_file_lines
-    global ctext commentend
+    global ctext commentend cdup
 
     set submodlog "log --format=%h\\ %aN:\\ %s -100"
     set fcmt ""
@@ -7680,15 +7680,15 @@ proc showfile {f} {
 	return
     }
     if {$diffids eq $nullid} {
-	if {[file isdirectory $f]} {
+	if {[file isdirectory "$cdup$f"]} {
 	    # a submodule
-	    set qf [shellquote $f]
+	    set qf [shellquote "$cdup$f"]
 	    if {[catch {set bf [open "| git -C $qf $submodlog" r]} err]} {
 		puts "oops, can't read submodule $f: $err"
 		return
 	    }
         } else {
-	    if {[catch {set bf [open $f r]} err]} {
+	    if {[catch {set bf [open "$cdup$f" r]} err]} {
 		puts "oops, can't read $f: $err"
 		return
 	    }
@@ -7704,7 +7704,7 @@ proc showfile {f} {
 	    }
 	} else {
 	    # also a submodule
-	    set qf [shellquote $f]
+	    set qf [shellquote "$cdup$f"]
 	    if {[catch {set bf [open "| git -C $qf $submodlog $blob" r]} err]} {
 		puts "oops, error reading submodule commit: $err"
 		return
-- 
2.17.0.593.g2029711e64


---
Diese E-Mail wurde von Avast Antivirus-Software auf Viren geprüft.
https://www.avast.com/antivirus
Previous: Bert WesargNext: Bert Wesarg
Message 9 of 15 in “gitk: improve handling of submodules in the file list panel”
  1. 0/2 gitk: improve handling of submodules in the file list panelAlex Riesen, May 8, 2018
  2. 1/2 gitk: show part of submodule log instead of empty pane when listing treesAlex Riesen, May 8, 2018
  3. Stefan BellerMay 8, 2018
  4. Alex RiesenMay 9, 2018
  5. 2/2 gitk: add an option to run gitk on an item in the file listAlex Riesen, May 8, 2018
  6. Bert WesargMay 8, 2018
  7. Alex RiesenMay 8, 2018
  8. Bert WesargMay 9, 2018
  9. gitk: do not limit tree mode listing in the file list panel to current sub-directoryAlex Riesen, May 9, 2018
  10. Bert WesargMay 9, 2018
  11. Alex RiesenMay 9, 2018
  12. 0/2 gitk: improve handling of submodules in the file list panelAlex Riesen, May 9, 2018
  13. 2/2 gitk: add an option to run gitk on an item in the file listAlex Riesen, May 9, 2018
  14. 1/2 gitk: show part of submodule log instead of empty pane when listing treesAlex Riesen, May 9, 2018
  15. Stefan BellerMay 9, 2018

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.