git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitk: fix history window panes position
@ 2025-12-02 13:08 tobias.boesch
  2025-12-03  9:35 ` AW: " tobias.boesch
  2025-12-03 10:15 ` Johannes Sixt
  0 siblings, 2 replies; 8+ messages in thread
From: tobias.boesch @ 2025-12-02 13:08 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Johannes Sixt

From b2ca7abc7d7efffc7312859b700780abb927e0b3 Mon Sep 17 00:00:00 2001
From: Tobias Boesch <tobias.boesch@miele.com>
Date: Thu, 27 Nov 2025 11:27:16 +0100
Subject: [PATCH] gitk: fix history window panes position

When the history window panes in are resized
by moving either of the two sashes and then
the gitk window is vertically resized,
the sashes fall back into their previous
position without respecting the users wish
for resizing.
Save the sash position when the sashes are
moved to make them keep their position when
the window is resized afterwards.

When the gitk window is opened and maximized
on a screen, then closed and opened on a
screen smaller than the previously used one,
the author pane and time pane of the history
window only are a few pixels wide and their
contents are barely visible.
Widen the two panes on start of gitk to a
reasonable fixed size that shows a good amount
of text of authors and time.

Signed-off-by: Tobias Boesch <tobias.boesch@miele.com>
---

Notes:
    Debug print statements are left in the code for easier
    testing by maintainers.
    They will be removed when the review is finished.

 gitk-git/gitk | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 7f62c8041d..6fbc2588fb 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -2471,6 +2471,23 @@ proc makewindow {} {
         -xscrollincr $linespc \
         -yscrollincr $linespc -yscrollcommand "scrollcanv $cscroll"
     .tf.histframe.pwclist add $canv
+    bind .tf.histframe.pwclist.canv <Configure> {
+        global oldsash
+        set parent [regsub {\.[A-Za-z]+$} %W ""]
+        puts "Canvas (pwclist) configuration changed saving sash \
+                position if parent panedwindow $parent is initialised \
+                (oldsash exist)"
+        if {[info exists oldsash($parent)]} {
+            set s0 [$parent sashpos 0]
+            set s1 [$parent sashpos 1]
+            puts "   Sash0 is $s0"
+            puts "   Sash1 is $s1"
+            set oldsash($parent) [list $s0 $s1]
+            puts "   oldsash saved for $parent"
+        } else {
+            puts "   oldsash not yet existing so oldsash is not saved for $parent"
+        }
+    }
     set canv2 .tf.histframe.pwclist.canv2
     canvas $canv2 \
         -selectbackground $selectbgcolor \
@@ -3116,30 +3133,53 @@ proc savestuff {w} {

 proc resizeclistpanes {win w} {
     global oldwidth oldsash
+    puts "Starting resizeclistpanes..."
     if {[info exists oldwidth($win)]} {
         if {[info exists oldsash($win)]} {
+            puts "   Using oldsash from window"
             set s0 [lindex $oldsash($win) 0]
             set s1 [lindex $oldsash($win) 1]
+            puts "   Sash0 is $s0"
+            puts "   Sash1 is $s1"
         } else {
+            puts "   New window creation detected"
+            puts "   Width is $w"
+            puts "   Using sash from window sashpos directly"
             set s0 [$win sashpos 0]
             set s1 [$win sashpos 1]
+            puts "   Sash0 is $s0"
+            puts "   Sash1 is $s1"
+            if {$s1 > $w - 140} {
+                puts "      Sash1 greater than width - 140, setting max size"
+                set s1 [expr {$w - 140}]
+                if {$s0 > $s1 - 300} {
+                    puts "         Sash0 greater than sash1 - 300, setting max size"
+                    set s0 [expr {$s1 - 300}]
+                }
+            }
         }
         if {$w < 60} {
+            puts "   Narrow window ($w), scaling sash in dependency to window width"
             set sash0 [expr {int($w/2 - 2)}]
             set sash1 [expr {int($w*5/6 - 2)}]
         } else {
+            puts "   Wide window ($w), scaling sash in dependency to old width, oldsash and window width"
             set factor [expr {1.0 * $w / $oldwidth($win)}]
             set sash0 [expr {int($factor * [lindex $s0 0])}]
             set sash1 [expr {int($factor * [lindex $s1 0])}]
             if {$sash0 < 30} {
+                puts "      Sash0 too small, setting min size"
                 set sash0 30
             }
             if {$sash1 < $sash0 + 20} {
+                puts "      Sash1 smaller than sash0 + 20, setting min size"
                 set sash1 [expr {$sash0 + 20}]
             }
             if {$sash1 > $w - 10} {
+                puts "      Sash1 greater than width - 140, setting max size"
                 set sash1 [expr {$w - 10}]
                 if {$sash0 > $sash1 - 20} {
+                    puts "         Sash0 greater than sash1 - 300, setting max size"
                     set sash0 [expr {$sash1 - 20}]
                 }
             }
@@ -3149,6 +3189,7 @@ proc resizeclistpanes {win w} {
         set oldsash($win) [list $sash0 $sash1]
     }
     set oldwidth($win) $w
+    puts "Finished resizeclistpanes..."
 }

 proc resizecdetpanes {win w} {
--
2.47.1.windows.2




-------------------------------------------------------------------------------------------------
imperial-Werke oHG, Sitz Bünde, Registergericht Bad Oeynhausen - HRA 4825

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* AW: [PATCH] gitk: fix history window panes position
  2025-12-02 13:08 [PATCH] gitk: fix history window panes position tobias.boesch
@ 2025-12-03  9:35 ` tobias.boesch
  2025-12-03 10:15 ` Johannes Sixt
  1 sibling, 0 replies; 8+ messages in thread
From: tobias.boesch @ 2025-12-03  9:35 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Johannes Sixt

An addition for testing:

To test or simulate the usage of a smaller monitor
one can move both sashes of the history window all
the way to the right. Then close the application.
That are the same conditions as if using a smaller
screen, after using a bigger screen.
On restart of gitk the panes should then be resized
automatically to a reasonable size.

> -----Ursprüngliche Nachricht-----
> Von: Boesch, Tobias
> Gesendet: Dienstag, 2. Dezember 2025 14:08
> An: Git Mailing List <git@vger.kernel.org>
> Cc: Johannes Sixt <j6t@kdbg.org>
> Betreff: [PATCH] gitk: fix history window panes position
>
> From b2ca7abc7d7efffc7312859b700780abb927e0b3 Mon Sep 17 00:00:00
> 2001
> From: Tobias Boesch <tobias.boesch@miele.com>
> Date: Thu, 27 Nov 2025 11:27:16 +0100
> Subject: [PATCH] gitk: fix history window panes position
>
> When the history window panes in are resized by moving either of the two
> sashes and then the gitk window is vertically resized, the sashes fall back into
> their previous position without respecting the users wish for resizing.
> Save the sash position when the sashes are moved to make them keep their
> position when the window is resized afterwards.
>
> When the gitk window is opened and maximized on a screen, then closed and
> opened on a screen smaller than the previously used one, the author pane and
> time pane of the history window only are a few pixels wide and their contents
> are barely visible.
> Widen the two panes on start of gitk to a reasonable fixed size that shows a
> good amount of text of authors and time.
>
> Signed-off-by: Tobias Boesch <tobias.boesch@miele.com>
> ---
>
> Notes:
>     Debug print statements are left in the code for easier
>     testing by maintainers.
>     They will be removed when the review is finished.
>
>  gitk-git/gitk | 41 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
>
> diff --git a/gitk-git/gitk b/gitk-git/gitk index 7f62c8041d..6fbc2588fb 100755
> --- a/gitk-git/gitk
> +++ b/gitk-git/gitk
> @@ -2471,6 +2471,23 @@ proc makewindow {} {
>          -xscrollincr $linespc \
>          -yscrollincr $linespc -yscrollcommand "scrollcanv $cscroll"
>      .tf.histframe.pwclist add $canv
> +    bind .tf.histframe.pwclist.canv <Configure> {
> +        global oldsash
> +        set parent [regsub {\.[A-Za-z]+$} %W ""]
> +        puts "Canvas (pwclist) configuration changed saving sash \
> +                position if parent panedwindow $parent is initialised \
> +                (oldsash exist)"
> +        if {[info exists oldsash($parent)]} {
> +            set s0 [$parent sashpos 0]
> +            set s1 [$parent sashpos 1]
> +            puts "   Sash0 is $s0"
> +            puts "   Sash1 is $s1"
> +            set oldsash($parent) [list $s0 $s1]
> +            puts "   oldsash saved for $parent"
> +        } else {
> +            puts "   oldsash not yet existing so oldsash is not saved for $parent"
> +        }
> +    }
>      set canv2 .tf.histframe.pwclist.canv2
>      canvas $canv2 \
>          -selectbackground $selectbgcolor \ @@ -3116,30 +3133,53 @@ proc
> savestuff {w} {
>
>  proc resizeclistpanes {win w} {
>      global oldwidth oldsash
> +    puts "Starting resizeclistpanes..."
>      if {[info exists oldwidth($win)]} {
>          if {[info exists oldsash($win)]} {
> +            puts "   Using oldsash from window"
>              set s0 [lindex $oldsash($win) 0]
>              set s1 [lindex $oldsash($win) 1]
> +            puts "   Sash0 is $s0"
> +            puts "   Sash1 is $s1"
>          } else {
> +            puts "   New window creation detected"
> +            puts "   Width is $w"
> +            puts "   Using sash from window sashpos directly"
>              set s0 [$win sashpos 0]
>              set s1 [$win sashpos 1]
> +            puts "   Sash0 is $s0"
> +            puts "   Sash1 is $s1"
> +            if {$s1 > $w - 140} {
> +                puts "      Sash1 greater than width - 140, setting max size"
> +                set s1 [expr {$w - 140}]
> +                if {$s0 > $s1 - 300} {
> +                    puts "         Sash0 greater than sash1 - 300, setting max size"
> +                    set s0 [expr {$s1 - 300}]
> +                }
> +            }
>          }
>          if {$w < 60} {
> +            puts "   Narrow window ($w), scaling sash in dependency to window
> width"
>              set sash0 [expr {int($w/2 - 2)}]
>              set sash1 [expr {int($w*5/6 - 2)}]
>          } else {
> +            puts "   Wide window ($w), scaling sash in dependency to old width,
> oldsash and window width"
>              set factor [expr {1.0 * $w / $oldwidth($win)}]
>              set sash0 [expr {int($factor * [lindex $s0 0])}]
>              set sash1 [expr {int($factor * [lindex $s1 0])}]
>              if {$sash0 < 30} {
> +                puts "      Sash0 too small, setting min size"
>                  set sash0 30
>              }
>              if {$sash1 < $sash0 + 20} {
> +                puts "      Sash1 smaller than sash0 + 20, setting min size"
>                  set sash1 [expr {$sash0 + 20}]
>              }
>              if {$sash1 > $w - 10} {
> +                puts "      Sash1 greater than width - 140, setting max size"
>                  set sash1 [expr {$w - 10}]
>                  if {$sash0 > $sash1 - 20} {
> +                    puts "         Sash0 greater than sash1 - 300, setting max size"
>                      set sash0 [expr {$sash1 - 20}]
>                  }
>              }
> @@ -3149,6 +3189,7 @@ proc resizeclistpanes {win w} {
>          set oldsash($win) [list $sash0 $sash1]
>      }
>      set oldwidth($win) $w
> +    puts "Finished resizeclistpanes..."
>  }
>
>  proc resizecdetpanes {win w} {
> --
> 2.47.1.windows.2
>



-------------------------------------------------------------------------------------------------
imperial-Werke oHG, Sitz Bünde, Registergericht Bad Oeynhausen - HRA 4825

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] gitk: fix history window panes position
  2025-12-02 13:08 [PATCH] gitk: fix history window panes position tobias.boesch
  2025-12-03  9:35 ` AW: " tobias.boesch
@ 2025-12-03 10:15 ` Johannes Sixt
  2025-12-04  8:39   ` AW: " tobias.boesch
  1 sibling, 1 reply; 8+ messages in thread
From: Johannes Sixt @ 2025-12-03 10:15 UTC (permalink / raw)
  To: tobias.boesch@miele.com; +Cc: Git Mailing List

Am 02.12.25 um 14:08 schrieb tobias.boesch@miele.com:
> From: Tobias Boesch <tobias.boesch@miele.com>
> Date: Thu, 27 Nov 2025 11:27:16 +0100
> Subject: [PATCH] gitk: fix history window panes position
> 
> When the history window panes in are resized
> by moving either of the two sashes and then
> the gitk window is vertically resized,
> the sashes fall back into their previous
> position without respecting the users wish
> for resizing.

You say "the Gitk windows is resized vertically". Did you mean "resized
horizontally"? If I change only the height of the Gitk window, the
widths of the top panel (history, author, date) aren't changed at all.
However, if I change only the width, the symptoms do occur.

Also, the error is not limited to the upper half of the window. The
lower panel (patch text, file list) also forgets the last used position
when the window size is changed. Can we fix this, too?

> Save the sash position when the sashes are
> moved to make them keep their position when
> the window is resized afterwards.
> 
> When the gitk window is opened and maximized
> on a screen, then closed and opened on a
> screen smaller than the previously used one,
> the author pane and time pane of the history
> window only are a few pixels wide and their
> contents are barely visible.
> Widen the two panes on start of gitk to a
> reasonable fixed size that shows a good amount
> of text of authors and time.

I did this test:

0. Make Gitk significantly less than the screen size.
1. Adjust pane size to 1/2 history, 1/3 author, 1/6 date.
2. Maximize window via "Maximize" button.
3. Restore window via "Maximize" button.

After 2., the pane widths are scaled with the window width and retain
their proportions (or so it seems).

But after 3., the pane widths are completely scrambled. The date pane is
far too wide (wider than in the maximized window), the history pane
steals a lot of the remaining width, and the author pane is squished to
a minimal size.

The behavior without the patch was better in this regard, because the
proportions of the memoized panel widths were retained.

> 
> Signed-off-by: Tobias Boesch <tobias.boesch@miele.com>
> ---
> 
> Notes:
>     Debug print statements are left in the code for easier
>     testing by maintainers.
>     They will be removed when the review is finished.
> 
>  gitk-git/gitk | 41 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/gitk-git/gitk b/gitk-git/gitk
> index 7f62c8041d..6fbc2588fb 100755
> --- a/gitk-git/gitk
> +++ b/gitk-git/gitk
> @@ -2471,6 +2471,23 @@ proc makewindow {} {
>          -xscrollincr $linespc \
>          -yscrollincr $linespc -yscrollcommand "scrollcanv $cscroll"
>      .tf.histframe.pwclist add $canv
> +    bind .tf.histframe.pwclist.canv <Configure> {
> +        global oldsash
> +        set parent [regsub {\.[A-Za-z]+$} %W ""]
> +        puts "Canvas (pwclist) configuration changed saving sash \
> +                position if parent panedwindow $parent is initialised \
> +                (oldsash exist)"
> +        if {[info exists oldsash($parent)]} {
> +            set s0 [$parent sashpos 0]
> +            set s1 [$parent sashpos 1]
> +            puts "   Sash0 is $s0"
> +            puts "   Sash1 is $s1"
> +            set oldsash($parent) [list $s0 $s1]
> +            puts "   oldsash saved for $parent"
> +        } else {
> +            puts "   oldsash not yet existing so oldsash is not saved for $parent"
> +        }
> +    }

I wonder why this handler is only installed for one of the three panes.

Does panedwindow not have any features that can notify us to store the
current sash positions? Can we perhaps bind to its <Motion> or
<ButtonRelease> instead?

At any rate, a callback like this is large enough (even without
debugging code) to be moved to its own function. Is there a reason that
proc resizeclistpanes cannot be reused in some way?

>      set canv2 .tf.histframe.pwclist.canv2
>      canvas $canv2 \
>          -selectbackground $selectbgcolor \
> @@ -3116,30 +3133,53 @@ proc savestuff {w} {
> 
>  proc resizeclistpanes {win w} {
>      global oldwidth oldsash
> +    puts "Starting resizeclistpanes..."
>      if {[info exists oldwidth($win)]} {
>          if {[info exists oldsash($win)]} {
> +            puts "   Using oldsash from window"
>              set s0 [lindex $oldsash($win) 0]
>              set s1 [lindex $oldsash($win) 1]
> +            puts "   Sash0 is $s0"
> +            puts "   Sash1 is $s1"
>          } else {
> +            puts "   New window creation detected"
> +            puts "   Width is $w"
> +            puts "   Using sash from window sashpos directly"
>              set s0 [$win sashpos 0]
>              set s1 [$win sashpos 1]
> +            puts "   Sash0 is $s0"
> +            puts "   Sash1 is $s1"
> +            if {$s1 > $w - 140} {
> +                puts "      Sash1 greater than width - 140, setting max size"
> +                set s1 [expr {$w - 140}]
> +                if {$s0 > $s1 - 300} {> +                    puts "
      Sash0 greater than sash1 - 300, setting max size"
> +                    set s0 [expr {$s1 - 300}]

So, these aren't "max size", but actually "minimal width".

It is strange that the minimal width of the author pane is only
corrected if the date pane is too small as well.

I have an issue with this. If the user makes the panes small, the wider
versions are forced on them. The user's wish should have priority.

I understand that you want to restore the widths to a sane size after
the "maximize-restore" operation has caused the degenerated widths. But
doesn't this solution just paper over the real bug that the window
resize operation doesn't heed the pane width proportions?

> +                }
> +            }
>          }
>          if {$w < 60} {
> +            puts "   Narrow window ($w), scaling sash in dependency to window width"
>              set sash0 [expr {int($w/2 - 2)}]
>              set sash1 [expr {int($w*5/6 - 2)}]
>          } else {
> +            puts "   Wide window ($w), scaling sash in dependency to old width, oldsash and window width"
>              set factor [expr {1.0 * $w / $oldwidth($win)}]
>              set sash0 [expr {int($factor * [lindex $s0 0])}]
>              set sash1 [expr {int($factor * [lindex $s1 0])}]

Not a problem of this patch, but I wonder why we have [lindex] here.

>              if {$sash0 < 30} {
> +                puts "      Sash0 too small, setting min size"
>                  set sash0 30
>              }
>              if {$sash1 < $sash0 + 20} {
> +                puts "      Sash1 smaller than sash0 + 20, setting min size"
>                  set sash1 [expr {$sash0 + 20}]
>              }
>              if {$sash1 > $w - 10} {
> +                puts "      Sash1 greater than width - 140, setting max size"
>                  set sash1 [expr {$w - 10}]
>                  if {$sash0 > $sash1 - 20} {
> +                    puts "         Sash0 greater than sash1 - 300, setting max size"
>                      set sash0 [expr {$sash1 - 20}]
>                  }
>              }
> @@ -3149,6 +3189,7 @@ proc resizeclistpanes {win w} {
>          set oldsash($win) [list $sash0 $sash1]
>      }
>      set oldwidth($win) $w
> +    puts "Finished resizeclistpanes..."
>  }
> 
>  proc resizecdetpanes {win w} {
-- Hannes


^ permalink raw reply	[flat|nested] 8+ messages in thread

* AW: [PATCH] gitk: fix history window panes position
  2025-12-03 10:15 ` Johannes Sixt
@ 2025-12-04  8:39   ` tobias.boesch
  2025-12-04  9:20     ` Johannes Sixt
  0 siblings, 1 reply; 8+ messages in thread
From: tobias.boesch @ 2025-12-04  8:39 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Git Mailing List

Some quick responses inlined below.
I'll look into the rest of your annotations and try to directly provide a second
version of the patch.

> -----Ursprüngliche Nachricht-----
> Von: Johannes Sixt <j6t@kdbg.org>
> Gesendet: Mittwoch, 3. Dezember 2025 11:15
> An: Boesch, Tobias <tobias.boesch@miele.com>
> Cc: Git Mailing List <git@vger.kernel.org>
> Betreff: Re: [PATCH] gitk: fix history window panes position
>
> Am 02.12.25 um 14:08 schrieb tobias.boesch@miele.com:
> > From: Tobias Boesch <tobias.boesch@miele.com>
> > Date: Thu, 27 Nov 2025 11:27:16 +0100
> > Subject: [PATCH] gitk: fix history window panes position
> >
> > When the history window panes in are resized by moving either of the
> > two sashes and then the gitk window is vertically resized, the sashes
> > fall back into their previous position without respecting the users
> > wish for resizing.
>
> You say "the Gitk windows is resized vertically". Did you mean "resized
> horizontally"? If I change only the height of the Gitk window, the widths of the
> top panel (history, author, date) aren't changed at all.
> However, if I change only the width, the symptoms do occur.

You're right. I meant horizontally. Will be changed in the commit message.

>
> Also, the error is not limited to the upper half of the window. The lower panel
> (patch text, file list) also forgets the last used position when the window size is
> changed. Can we fix this, too?

Yes I plan to do that, but I thought it would be too big for one commit since it is
a slightly different part of the app.
I wanted to put this in a separate patch, since I just started with using emails and
the git mailing list directly instead of using gitgitgadjet. That's all new to me and
I didn't want to start with a series of patches on this first try.
Would you like to have that fix in this patch and convert this patch into a series
(somehow) or is it okay to put it in a separate patch?

Tobias


-------------------------------------------------------------------------------------------------
imperial-Werke oHG, Sitz Bünde, Registergericht Bad Oeynhausen - HRA 4825

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] gitk: fix history window panes position
  2025-12-04  8:39   ` AW: " tobias.boesch
@ 2025-12-04  9:20     ` Johannes Sixt
  2025-12-05  2:23       ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Sixt @ 2025-12-04  9:20 UTC (permalink / raw)
  To: tobias.boesch@miele.com; +Cc: Git Mailing List

Am 04.12.25 um 09:39 schrieb tobias.boesch@miele.com:
>> Von: Johannes Sixt <j6t@kdbg.org>
>> Also, the error is not limited to the upper half of the window. The lower panel
>> (patch text, file list) also forgets the last used position when the window size is
>> changed. Can we fix this, too?
> 
> Yes I plan to do that, but I thought it would be too big for one commit since it is
> a slightly different part of the app.
> I wanted to put this in a separate patch, since I just started with using emails and
> the git mailing list directly instead of using gitgitgadjet. That's all new to me and
> I didn't want to start with a series of patches on this first try.
> Would you like to have that fix in this patch and convert this patch into a series
> (somehow) or is it okay to put it in a separate patch?
It depends on the solution needed. If they are the same approach, it can
be a single patch. Otherwise, a separate patch may make sense.

BTW, the email that I received was not usable for git-am because its
body was base64-encoded. I had to copy the text from my MUA to a text
file before I could apply it with git-am. If you have trouble sending
out unencoded, raw text mails, please use Gitgitgadget if there is more
than one patch in the series.

-- Hannes


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] gitk: fix history window panes position
  2025-12-04  9:20     ` Johannes Sixt
@ 2025-12-05  2:23       ` Junio C Hamano
  2025-12-05  6:40         ` Johannes Sixt
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2025-12-05  2:23 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: tobias.boesch@miele.com, Git Mailing List

Johannes Sixt <j6t@kdbg.org> writes:

> BTW, the email that I received was not usable for git-am because its
> body was base64-encoded. I had to copy the text from my MUA to a text
> file before I could apply it with git-am. If you have trouble sending
> out unencoded, raw text mails, please use Gitgitgadget if there is more
> than one patch in the series.

"git am" (actually "git mailsplit" that is called from it to extract
what can be used by "git apply") should be able to deal with

    Content-Type: text/plain; charset="utf-8"
    Content-Transfer-Encoding: base64

so there may be something else going on.  The rendition at lore

https://lore.kernel.org/git/AM0PR08MB5426BC141388A69BB5087732E1D8A@AM0PR08MB5426.eurprd08.prod.outlook.com/

seems to show that it has in-body headers that should have been
moved to e-mail headers, but otherwise it looks more or less like
legit patch e-mail without anything unusual.  It could be the patch
may be full of ^M, but we cannot tell from the way lore/public-inbox
shows its messages.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] gitk: fix history window panes position
  2025-12-05  2:23       ` Junio C Hamano
@ 2025-12-05  6:40         ` Johannes Sixt
  2025-12-05  7:22           ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Sixt @ 2025-12-05  6:40 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: tobias.boesch@miele.com, Git Mailing List

Am 05.12.25 um 03:23 schrieb Junio C Hamano:
> "git am" (actually "git mailsplit" that is called from it to extract
> what can be used by "git apply") should be able to deal with
> 
>     Content-Type: text/plain; charset="utf-8"
>     Content-Transfer-Encoding: base64
> 
> so there may be something else going on.

Ah! You are absolutely right! Clearly, I wasn't fully taking in what
git-am was telling me. The problem isn't the encoding. It's the patch
text itself, in particular, the single SP needed for empty context lines
is missing.

I get this error when I apply the mbox containing the complete email:

$ git am -3 --signoff ~/Mail/ambox
warning: quoted CRLF detected
Applying: gitk: fix history window panes position
error: corrupt patch at line 40
error: could not build fake ancestor
Patch failed at 0001 gitk: fix history window panes position
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: [...]

But it is OK to copy the email body text to a file (which looks like
mbox text) and apply that, despite the missing SP:

$ git am -3 --signoff bla.patch
Applying: gitk: fix history window panes position
Using index info to reconstruct a base tree...
A       gitk-git/gitk
Falling back to patching base and 3-way merge...

Why is that?

-- Hannes


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] gitk: fix history window panes position
  2025-12-05  6:40         ` Johannes Sixt
@ 2025-12-05  7:22           ` Junio C Hamano
  0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2025-12-05  7:22 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: tobias.boesch@miele.com, Git Mailing List

Johannes Sixt <j6t@kdbg.org> writes:

> Ah! You are absolutely right! Clearly, I wasn't fully taking in what
> git-am was telling me. The problem isn't the encoding. It's the patch
> text itself, in particular, the single SP needed for empty context lines
> is missing.

I do not think that is the case, either.  diff.suppressBlankEmpty is
part of Git for quite some time.  The "empty context lines can be
expressed as a totally empty line" was started at GNU IIRC, but I
think POSIX allows it these days.  And we can take it, as you found
out with your "bla.patch" experiment below.

> I get this error when I apply the mbox containing the complete email:
>
> $ git am -3 --signoff ~/Mail/ambox
> warning: quoted CRLF detected
> Applying: gitk: fix history window panes position
> error: corrupt patch at line 40
> error: could not build fake ancestor
> Patch failed at 0001 gitk: fix history window panes position
> hint: Use 'git am --show-current-patch=diff' to see the failed patch
> hint: [...]
>
> But it is OK to copy the email body text to a file (which looks like
> mbox text) and apply that, despite the missing SP:
>
> $ git am -3 --signoff bla.patch
> Applying: gitk: fix history window panes position
> Using index info to reconstruct a base tree...
> A       gitk-git/gitk
> Falling back to patching base and 3-way merge...
>
> Why is that?

So the reason you seek is because you are barking up a wrong tree?

There probably is something wrong in the patch text that has nothing
to do with diff.suppressBlankEmpty that you somehow "fixed" without
knowing when you massaged the e-mail message into the "bla.patch"
text yourself manually, if I have to guess.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-12-05  7:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-02 13:08 [PATCH] gitk: fix history window panes position tobias.boesch
2025-12-03  9:35 ` AW: " tobias.boesch
2025-12-03 10:15 ` Johannes Sixt
2025-12-04  8:39   ` AW: " tobias.boesch
2025-12-04  9:20     ` Johannes Sixt
2025-12-05  2:23       ` Junio C Hamano
2025-12-05  6:40         ` Johannes Sixt
2025-12-05  7:22           ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).