threads / patch / 42237

patchgitk: Fix missing commits when using -S or -G

Subject: [PATCH] gitk: Fix missing commits when using -S or -G

## tl;dr

6 messages between May 6, 2016 and Dec 12, 2016. Diffs are folded; open one to read it.

replies: 5people: 2as markdown or json

Stefan Dotterweich· May 6, 2016, 11:56 UTC · lore

When -S or -G is used as a filter option, the resulting commit list rarely contains all matching commits. Only a certain number of commits are displayed and the rest are missing.

"git log --boundary -S" does not return as many boundary commits as you might expect. gitk makes up for this in closevargs() by adding missing parent (boundary) commits. However, it does not change $numcommits, which limits how many commits are shown. In the end, some commits at the end of the commit list are simply not shown.

Change $numcommits whenever a missing parent is added.
Signed-off-by: Stefan Dotterweich <stefandotterweich@gmx.de>
---
 gitk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Show changes to gitk +2 −2
diff --git a/gitk b/gitk
index 805a1c7..b0da174 100755
--- a/gitk
+++ b/gitk
@@ -1315,7 +1315,7 @@ proc commitonrow {row} {
  proc closevarcs {v} {
     global varctok varccommits varcid parents children
-    global cmitlisted commitidx vtokmod
+    global cmitlisted commitidx vtokmod numcommits
      set missing_parents 0
     set scripts {}
@@ -1339,7 +1339,7 @@ proc closevarcs {v} {
 		modify_arc $v $b
 	    }
 	    lappend varccommits($v,$b) $p
-	    incr commitidx($v)
+	    set numcommits [incr commitidx($v)]
 	    set scripts [check_interest $p $scripts]
 	}
     }
-- 
2.7.4
Stefan Dotterweich· May 6, 2016, 12:16 UTC · re: Stefan Dotterweich · lore

Re: [PATCH v2] gitk: Fix missing commits when using -S or -G

When -S or -G is used as a filter option, the resulting commit list rarely contains all matching commits. Only a certain number of commits are displayed and the rest are missing.

"git log --boundary -S" does not return as many boundary commits as you might expect. gitk makes up for this in closevargs() by adding missing parent (boundary) commits. However, it does not change $numcommits, which limits how many commits are shown. In the end, some commits at the end of the commit list are simply not shown.

Change $numcommits whenever a missing parent is added.
Signed-off-by: Stefan Dotterweich <stefandotterweich@gmx.de>
---
 gitk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Show changes to gitk +2 −2
diff --git a/gitk b/gitk
index 805a1c7..b0da174 100755
--- a/gitk
+++ b/gitk
@@ -1315,7 +1315,7 @@ proc commitonrow {row} {
 
 proc closevarcs {v} {
     global varctok varccommits varcid parents children
-    global cmitlisted commitidx vtokmod
+    global cmitlisted commitidx vtokmod numcommits
 
     set missing_parents 0
     set scripts {}
@@ -1339,7 +1339,7 @@ proc closevarcs {v} {
 		modify_arc $v $b
 	    }
 	    lappend varccommits($v,$b) $p
-	    incr commitidx($v)
+	    set numcommits [incr commitidx($v)]
 	    set scripts [check_interest $p $scripts]
 	}
     }
-- 
2.7.4
Paul Mackerras· May 9, 2016, 03:45 UTC · re: Stefan Dotterweich · lore

Re: [PATCH v2] gitk: Fix missing commits when using -S or -G

On Fri, May 06, 2016 at 02:16:54PM +0200, Stefan Dotterweich wrote:
Show 11 quoted lines
> When -S or -G is used as a filter option, the resulting commit list
> rarely contains all matching commits. Only a certain number of commits
> are displayed and the rest are missing.
> 
> "git log --boundary -S" does not return as many boundary commits as you
> might expect. gitk makes up for this in closevargs() by adding missing
> parent (boundary) commits. However, it does not change $numcommits,
> which limits how many commits are shown. In the end, some commits at the
> end of the commit list are simply not shown.
> 
> Change $numcommits whenever a missing parent is added.

Nice catch; however, we should only update numcommits if the commits are for the current view, i.e. if $v == $curview.

Do you want to update the patch? If you prefer, I can update the patch and put a note in the commit message about the issue.

Paul.
Stefan Dotterweich· May 9, 2016, 05:33 UTC · re: Paul Mackerras · lore

Re: [PATCH v2] gitk: Fix missing commits when using -S or -G

Show 5 quoted lines
> Nice catch; however, we should only update numcommits if the commits
> are for the current view, i.e. if $v == $curview.
>
> Do you want to update the patch?  If you prefer, I can update the
> patch and put a note in the commit message about the issue.
Sure, feel free to update the patch as you see fit.
Stefan Dotterweich· Jun 4, 2016, 08:47 UTC · re: Stefan Dotterweich · lore

[PATCH v3] gitk: Fix missing commits when using -S or -G

When -S or -G is used as a filter option, the resulting commit list rarely contains all matching commits. Only a certain number of commits are displayed and the rest are missing.

"git log --boundary -S" does not return as many boundary commits as you might expect. gitk makes up for this in closevargs() by adding missing parent (boundary) commits. However, it does not change $numcommits, which limits how many commits are shown. In the end, some commits at the end of the commit list are simply not shown.

Change $numcommits whenever a missing parent is added.
Signed-off-by: Stefan Dotterweich <stefandotterweich@gmx.de>
---

Here is an updated version of the patch. Feel free to change it if anything is missing.

 gitk-git/gitk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Show changes to gitk-git/gitk +4 −1
diff --git a/gitk-git/gitk b/gitk-git/gitk
index 805a1c7..572da4a 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -1315,7 +1315,7 @@ proc commitonrow {row} {
 
 proc closevarcs {v} {
     global varctok varccommits varcid parents children
-    global cmitlisted commitidx vtokmod
+    global cmitlisted commitidx vtokmod curview numcommits
 
     set missing_parents 0
     set scripts {}
@@ -1340,6 +1340,9 @@ proc closevarcs {v} {
 	    }
 	    lappend varccommits($v,$b) $p
 	    incr commitidx($v)
+	    if {$v == $curview} {
+		set numcommits $commitidx($v)
+	    }
 	    set scripts [check_interest $p $scripts]
 	}
     }
-- 
2.8.0
Paul Mackerras· Dec 12, 2016, 00:39 UTC · re: Stefan Dotterweich · lore

Re: [PATCH v3] gitk: Fix missing commits when using -S or -G

On Sat, Jun 04, 2016 at 10:47:16AM +0200, Stefan Dotterweich wrote:
Show 13 quoted lines
> When -S or -G is used as a filter option, the resulting commit list
> rarely contains all matching commits. Only a certain number of commits
> are displayed and the rest are missing.
> 
> "git log --boundary -S" does not return as many boundary commits as you
> might expect. gitk makes up for this in closevargs() by adding missing
> parent (boundary) commits. However, it does not change $numcommits,
> which limits how many commits are shown. In the end, some commits at the
> end of the commit list are simply not shown.
> 
> Change $numcommits whenever a missing parent is added.
> 
> Signed-off-by: Stefan Dotterweich <stefandotterweich@gmx.de>
Thanks, applied, with slight tweaks to the commit message.
Paul.

← back to recent threads