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

Re: [PATCH 1/2] gitk: show part of submodule log instead of empty pane when listing trees

From
Stefan Beller <sbeller@google.com>
Date
May 8, 2018, 17:07 UTC
Message-ID
<CAGZ79kYxZ43kJwS_odhNwCO2e_n-8JLNynAZj0+Hp3ugzYbqUg@mail.gmail.com>
In-Reply-To
<20180508122229.k3n3ccpa5g3g4dxa@pflmari>

On Tue, May 8, 2018 at 5:22 AM, Alex Riesen <alexander.riesen@cetitec.com> wrote:

Show 5 quoted lines
> From: Alex Riesen <raa.lkml@gmail.com>
>
> Currently, the submodules either are not shown at all (if listing a
> committed tree) or a Tcl error appears (when clicking on a submodule
> from the index list).

I do not understand where this appears, yet. Where do I have to click to see the effects of this patch?

Show 31 quoted lines
>
> This will make it show first arbitrarily chosen number of commits,
> which might be only marginally better.
>
> Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
> ---
>  gitk | 42 ++++++++++++++++++++++++++++++++----------
>  1 file changed, 32 insertions(+), 10 deletions(-)
>
> diff --git a/gitk b/gitk
> index a14d7a1..d34833f 100755
> --- a/gitk
> +++ b/gitk
> @@ -7627,9 +7627,10 @@ proc gettreeline {gtf id} {
>             if {$i < 0} continue
>             set fname [string range $line [expr {$i+1}] end]
>             set line [string range $line 0 [expr {$i-1}]]
> -           if {$diffids ne $nullid2 && [lindex $line 1] ne "blob"} continue
> +           set objtype [lindex $line 1]
> +           if {$diffids ne $nullid2 && $objtype ne "blob" && $objtype ne "commit" } { continue }
>             set sha1 [lindex $line 2]
> -           lappend treeidlist($id) $sha1
> +           lappend treeidlist($id) "$sha1 $objtype"
>         }
>         if {[string index $fname 0] eq "\""} {
>             set fname [lindex $fname 0]
> @@ -7659,21 +7660,42 @@ proc showfile {f} {
>      global ctext_file_names ctext_file_lines
>      global ctext commentend
>
> +    set submodlog "git\\ log\\ --format='%h\\ %aN:\\ %s'\\ -100"

Do we want to respect the config option diff.submodule here? The -100 is chosen rather arbitrarily. Ideally we'd only walk to the previous entry?

Show 13 quoted lines
> +    set fcmt ""
>      set i [lsearch -exact $treefilelist($diffids) $f]
>      if {$i < 0} {
>         puts "oops, $f not in list for id $diffids"
>         return
>      }
>      if {$diffids eq $nullid} {
> -       if {[catch {set bf [open $f r]} err]} {
> -           puts "oops, can't read $f: $err"
> -           return
> +       if {[file isdirectory $f]} {
> +           # a submodule
> +           if {[catch {set bf [open "| sh -c cd\\ \"$f\"&&$submodlog" r]} err]} {

Can we have $submodlog use the "git -C <path> command" option, then we could save the "cd &&" part, which might even save us from spawning a shell?

Thanks, Stefan

Previous: Alex RiesenNext: Alex Riesen
Message 3 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.