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

[PATCH (GITK) 6/6] gitk: Fallback to selecting the head commit upon load.

From
Alexander Gavrilov <angavrilov@gmail.com>
Date
Jul 27, 2008, 06:22 UTC
Message-ID
<200807271022.42476.angavrilov@gmail.com>
In-Reply-To
<200807271021.46661.angavrilov@gmail.com>
Date: Sat, 26 Jul 2008 20:15:54 +0400

Try selecting the head, if the previously selected commit is not available in the new view.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
---
 gitk |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/gitk b/gitk
index 5021437..d093a39 100755
--- a/gitk
+++ b/gitk
@@ -1506,8 +1506,15 @@ proc chewcommits {} {
 	global numcommits startmsecs
 
 	if {[info exists pending_select]} {
-	    set row [first_real_row]
-	    selectline $row 1
+	    update
+	    reset_pending_select {}
+
+	    if {[commitinview $pending_select $curview]} {
+		selectline [rowofcommit $pending_select] 1
+	    } else {
+		set row [first_real_row]
+		selectline $row 1
+	    }
 	}
 	if {$commitidx($curview) > 0} {
 	    #set ms [expr {[clock clicks -milliseconds] - $startmsecs}]
@@ -3372,14 +3379,18 @@ proc showview {n} {
     drawvisible
     if {$row ne {}} {
 	selectline $row 0
-    } elseif {$mainheadid ne {} && [commitinview $mainheadid $curview]} {
-	selectline [rowofcommit $mainheadid] 1
     } elseif {!$viewcomplete($n)} {
 	reset_pending_select $selid
     } else {
-	set row [first_real_row]
-	if {$row < $numcommits} {
-	    selectline $row 0
+	reset_pending_select {}
+
+	if {[commitinview $pending_select $curview]} {
+	    selectline [rowofcommit $pending_select] 1
+	} else {
+	    set row [first_real_row]
+	    if {$row < $numcommits} {
+		selectline $row 0
+	    }
 	}
     }
     if {!$viewcomplete($n)} {
-- 
1.5.6.3.18.gfe82
Previous: Alexander GavrilovNext: Paul Mackerras
Message 7 of 10 in “Runaway process and commit selection fixes”
  1. 0/6 Runaway process and commit selection fixesAlexander Gavrilov, Jul 27, 2008
  2. 1/6 gitk: Kill back-end processes on window close.Alexander Gavrilov, Jul 27, 2008
  3. 2/6 gitk: Register diff-files & diff-index in commfd, to ensure kill.Alexander Gavrilov, Jul 27, 2008
  4. 3/6 gitk: On Windows use a Cygwin-specific flag for kill.Alexander Gavrilov, Jul 27, 2008
  5. 4/6 gitk: Fixed broken exception handling in diff.Alexander Gavrilov, Jul 27, 2008
  6. 5/6 gitk: Fixed automatic row selection during load.Alexander Gavrilov, Jul 27, 2008
  7. 6/6 gitk: Fallback to selecting the head commit upon load.Alexander Gavrilov, Jul 27, 2008
  8. Paul MackerrasJul 31, 2008
  9. Alexander GavrilovJul 31, 2008
  10. gitk: Allow overriding the default commit.Alexander Gavrilov, Aug 3, 2008

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.