{"thread":{"id":"12539","subject":"[PATCH] gitk: do not show local changes for bare repositories","startedAt":"2008-03-06T12:39:24Z","lastAt":"2008-03-10T10:54:56Z","messageCount":5,"participants":["David Aguilar","Paul Mackerras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"71243","messageId":"64b42ab91804e670057c807fd8265fc07106792c.1204806475.git.davvid@gmail.com","threadId":"12539","inReplyTo":null,"subject":"[PATCH] gitk: do not show local changes for bare repositories","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2008-03-06T12:39:24Z","receivedAt":"2008-03-06T12:39:24Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"Launching gitk on a bare repository would previously show the\nwork tree as having removed all files.  We now test for bare\nrepositories before showing local changes.\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\n gitk |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex f1f21e9..cc4cde3 100755\n--- a/gitk\n+++ b/gitk\n@@ -2843,9 +2843,9 @@ proc dohidelocalchanges {} {\n \n # spawn off a process to do git diff-index --cached HEAD\n proc dodiffindex {} {\n-    global localirow localfrow lserial showlocalchanges\n+    global localirow localfrow lserial showlocalchanges isbare\n \n-    if {!$showlocalchanges} return\n+    if {!$showlocalchanges || $isbare} return\n     incr lserial\n     set localfrow -1\n     set localirow -1\n@@ -8643,6 +8643,7 @@ set patchnum 0\n set localirow -1\n set localfrow -1\n set lserial 0\n+set isbare [expr {[exec git rev-parse --is-bare-repository] == \"true\"}]\n setcoords\n makewindow\n # wait for the window to become visible\n-- \n1.5.4.rc2.1105.gfc5f2\n\n"},{"id":"71288","messageId":"18384.31029.243013.764703@cargo.ozlabs.ibm.com","threadId":"12539","inReplyTo":"64b42ab91804e670057c807fd8265fc07106792c.1204806475.git.davvid@gmail.com","subject":"Re: [PATCH] gitk: do not show local changes for bare repositories","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2008-03-06T23:07:33Z","receivedAt":"2008-03-06T23:07:33Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"David Aguilar writes:\n\n> +set isbare [expr {[exec git rev-parse --is-bare-repository] == \"true\"}]\n\nNice idea, but I think we should update isbare in updatecommits, in\ncase the user does a checkout and then presses F5.\n\nPaul.\n"},{"id":"71327","messageId":"8875845cb2c0c3a1ac515b8f71e6be77f3266479.1204879048.git.davvid@gmail.com","threadId":"12539","inReplyTo":"64b42ab91804e670057c807fd8265fc07106792c.1204806475.git.davvid@gmail.com","subject":"[PATCH] gitk: do not show local changes for bare repositories","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2008-03-07T09:04:42Z","receivedAt":"2008-03-07T09:04:42Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"Launching gitk on a bare repository would previously show the\nwork tree as having removed all files.  We now query for\nbare repositories in updatecommits and test the value in\ndodiffindex before showing local changes.\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\n gitk |    6 ++++--\n 1 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex f1f21e9..080459d 100755\n--- a/gitk\n+++ b/gitk\n@@ -393,6 +393,7 @@ proc readcommit {id} {\n proc updatecommits {} {\n     global viewdata curview phase displayorder ordertok idpending\n     global children commitrow selectedline thickerline showneartags\n+    global isbare\n \n     if {$phase ne {}} {\n \tstop_rev_list\n@@ -407,6 +408,7 @@ proc updatecommits {} {\n     foreach vid [array names idpending \"$n,*\"] {\n \tunset idpending($vid)\n     }\n+    set isbare [expr {[exec git rev-parse --is-bare-repository] == \"true\"}]\n     set curview -1\n     catch {unset selectedline}\n     catch {unset thickerline}\n@@ -2843,9 +2845,9 @@ proc dohidelocalchanges {} {\n \n # spawn off a process to do git diff-index --cached HEAD\n proc dodiffindex {} {\n-    global localirow localfrow lserial showlocalchanges\n+    global localirow localfrow lserial showlocalchanges isbare\n \n-    if {!$showlocalchanges} return\n+    if {!$showlocalchanges || $isbare} return\n     incr lserial\n     set localfrow -1\n     set localirow -1\n-- \n1.5.4.1\n\n"},{"id":"71545","messageId":"18386.29988.380116.517508@cargo.ozlabs.ibm.com","threadId":"12539","inReplyTo":"8875845cb2c0c3a1ac515b8f71e6be77f3266479.1204879048.git.davvid@gmail.com","subject":"Re: [PATCH] gitk: do not show local changes for bare repositories","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2008-03-08T11:14:44Z","receivedAt":"2008-03-08T11:14:44Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"David Aguilar writes:\n\n> @@ -407,6 +408,7 @@ proc updatecommits {} {\n>      foreach vid [array names idpending \"$n,*\"] {\n>  \tunset idpending($vid)\n>      }\n> +    set isbare [expr {[exec git rev-parse --is-bare-repository] == \"true\"}]\n\nSorry, I meant do that in updatecommits as well as at startup.  You\nstill need that line in the startup code.\n\nPaul.\n"},{"id":"71569","messageId":"309f000ad75b1842c11a04b16940dda8f1cd84af.1205145018.git.davvid@gmail.com","threadId":"12539","inReplyTo":"18386.29988.380116.517508@cargo.ozlabs.ibm.com","subject":"[PATCH] gitk: do not show local changes when we there is no work tree","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2008-03-10T10:54:56Z","receivedAt":"2008-03-10T10:54:56Z","isPatch":true,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"Launching gitk on a bare repository or a .git directory\nwould previously show the work tree as having removed all\nfiles.  We now inhibit showing local changes when gitk\nis not launched from within a work tree.\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\n---\n gitk |    7 ++++++-\n 1 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex f1f21e9..ef12845 100755\n--- a/gitk\n+++ b/gitk\n@@ -393,6 +393,9 @@ proc readcommit {id} {\n proc updatecommits {} {\n     global viewdata curview phase displayorder ordertok idpending\n     global children commitrow selectedline thickerline showneartags\n+    global isworktree\n+\n+    set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == \"true\"}]\n \n     if {$phase ne {}} {\n \tstop_rev_list\n@@ -2844,8 +2847,9 @@ proc dohidelocalchanges {} {\n # spawn off a process to do git diff-index --cached HEAD\n proc dodiffindex {} {\n     global localirow localfrow lserial showlocalchanges\n+    global isworktree\n \n-    if {!$showlocalchanges} return\n+    if {!$showlocalchanges || !$isworktree} return\n     incr lserial\n     set localfrow -1\n     set localirow -1\n@@ -8643,6 +8647,7 @@ set patchnum 0\n set localirow -1\n set localfrow -1\n set lserial 0\n+set isworktree [expr {[exec git rev-parse --is-inside-work-tree] == \"true\"}]\n setcoords\n makewindow\n # wait for the window to become visible\n-- \n1.5.4.3\n"}]}