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

[PATCH] gitk: do not show local changes when we there is no work tree

From
David Aguilar <davvid@gmail.com>
Date
Mar 10, 2008, 10:54 UTC
Message-ID
<309f000ad75b1842c11a04b16940dda8f1cd84af.1205145018.git.davvid@gmail.com>
In-Reply-To
<18386.29988.380116.517508@cargo.ozlabs.ibm.com>

Launching gitk on a bare repository or a .git directory would previously show the work tree as having removed all files. We now inhibit showing local changes when gitk is not launched from within a work tree.

Signed-off-by: David Aguilar <davvid@gmail.com>
---
 gitk |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/gitk b/gitk
index f1f21e9..ef12845 100755
--- a/gitk
+++ b/gitk
@@ -393,6 +393,9 @@ proc readcommit {id} {
 proc updatecommits {} {
     global viewdata curview phase displayorder ordertok idpending
     global children commitrow selectedline thickerline showneartags
+    global isworktree
+
+    set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == "true"}]
 
     if {$phase ne {}} {
 	stop_rev_list
@@ -2844,8 +2847,9 @@ proc dohidelocalchanges {} {
 # spawn off a process to do git diff-index --cached HEAD
 proc dodiffindex {} {
     global localirow localfrow lserial showlocalchanges
+    global isworktree
 
-    if {!$showlocalchanges} return
+    if {!$showlocalchanges || !$isworktree} return
     incr lserial
     set localfrow -1
     set localirow -1
@@ -8643,6 +8647,7 @@ set patchnum 0
 set localirow -1
 set localfrow -1
 set lserial 0
+set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == "true"}]
 setcoords
 makewindow
 # wait for the window to become visible
-- 
1.5.4.3
Previous: Paul Mackerras
Message 5 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.