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

[PATCH] gitk: do not show local changes for bare repositories

From
David Aguilar <davvid@gmail.com>
Date
Mar 7, 2008, 09:04 UTC
Message-ID
<8875845cb2c0c3a1ac515b8f71e6be77f3266479.1204879048.git.davvid@gmail.com>
In-Reply-To
<64b42ab91804e670057c807fd8265fc07106792c.1204806475.git.davvid@gmail.com>

Launching gitk on a bare repository would previously show the work tree as having removed all files. We now query for bare repositories in updatecommits and test the value in dodiffindex before showing local changes.

Signed-off-by: David Aguilar <davvid@gmail.com>
---
 gitk |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/gitk b/gitk
index f1f21e9..080459d 100755
--- a/gitk
+++ b/gitk
@@ -393,6 +393,7 @@ proc readcommit {id} {
 proc updatecommits {} {
     global viewdata curview phase displayorder ordertok idpending
     global children commitrow selectedline thickerline showneartags
+    global isbare
 
     if {$phase ne {}} {
 	stop_rev_list
@@ -407,6 +408,7 @@ proc updatecommits {} {
     foreach vid [array names idpending "$n,*"] {
 	unset idpending($vid)
     }
+    set isbare [expr {[exec git rev-parse --is-bare-repository] == "true"}]
     set curview -1
     catch {unset selectedline}
     catch {unset thickerline}
@@ -2843,9 +2845,9 @@ proc dohidelocalchanges {} {
 
 # spawn off a process to do git diff-index --cached HEAD
 proc dodiffindex {} {
-    global localirow localfrow lserial showlocalchanges
+    global localirow localfrow lserial showlocalchanges isbare
 
-    if {!$showlocalchanges} return
+    if {!$showlocalchanges || $isbare} return
     incr lserial
     set localfrow -1
     set localirow -1
-- 
1.5.4.1
Previous: Paul MackerrasNext: Paul Mackerras
Message 3 of 5 in “gitk: do not show local changes for bare repositories”
  1. gitk: do not show local changes for bare repositoriesDavid Aguilar, Mar 6, 2008
  2. Paul MackerrasMar 6, 2008
  3. gitk: do not show local changes for bare repositoriesDavid Aguilar, Mar 7, 2008
  4. Paul MackerrasMar 8, 2008
  5. gitk: do not show local changes when we there is no work treeDavid Aguilar, Mar 10, 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.