git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Aguilar <davvid@gmail.com>
To: Paul Mackerras <paulus@samba.org>
Cc: git@vger.kernel.org
Subject: [PATCH] gitk: do not show local changes when we there is no work tree
Date: Mon, 10 Mar 2008 03:54:56 -0700	[thread overview]
Message-ID: <309f000ad75b1842c11a04b16940dda8f1cd84af.1205145018.git.davvid@gmail.com> (raw)
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

      reply	other threads:[~2008-03-10 10:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-06 12:39 [PATCH] gitk: do not show local changes for bare repositories David Aguilar
2008-03-06 23:07 ` Paul Mackerras
2008-03-07  9:04 ` David Aguilar
2008-03-08 11:14   ` Paul Mackerras
2008-03-10 10:54     ` David Aguilar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=309f000ad75b1842c11a04b16940dda8f1cd84af.1205145018.git.davvid@gmail.com \
    --to=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).