git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michele Ballabio <barra_cuda@katamail.com>
To: Paul Mackerras <paulus@samba.org>
Cc: git@vger.kernel.org
Subject: [PATCH] gitk: disable "Reset %s branch to here" when on a detached head
Date: Fri, 2 May 2008 17:46:20 +0200	[thread overview]
Message-ID: <200805021746.20883.barra_cuda@katamail.com> (raw)
In-Reply-To: <200805021656.57929.barra_cuda@katamail.com>

When we are on a detached head - since gitk does not display where
we are - reset has no sense, so disable the relevant line on the
context menu, and point out to the user that we are on a detached head.

Otherwise, a reset from gitk when on a detached head returns the
error:

can't read "headids()": no such element in array
can't read "headids()": no such element in array
    while executing
"removehead $headids($name) $name"
    (procedure "movehead" line 4)
    invoked from within
"movehead $newhead $mainhead"
    (procedure "readresetstat" line 20)
    invoked from within
"readresetstat file4"
    ("eval" body line 1)
    invoked from within
"eval $script"
    (procedure "dorunq" line 9)
    invoked from within
"dorunq"
    ("after" script)

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
---

On Friday 02 May 2008, Michele Ballabio wrote:
> On Friday 02 May 2008, Paul Mackerras wrote:
> > I wonder if we can make this message something more appropriate than
> > "Reset  branch to here" (since $mainhead has to be the empty string
> > here)?  Not sure what I would suggest though. :)
> 
> Oh, you're right. I'd say either "Reset detached head to here" greyed out
> (i.e. change the words as little as possible), or something more
> explicative like "Detached head: reset not possible". I'd go for the first,

Here's the updated patch.

 gitk |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/gitk b/gitk
index da685aa..23247ff 100755
--- a/gitk
+++ b/gitk
@@ -6016,7 +6016,11 @@ proc rowmenu {x y id} {
     }
     if {$id ne $nullid && $id ne $nullid2} {
 	set menu $rowctxmenu
-	$menu entryconfigure 7 -label [mc "Reset %s branch to here" $mainhead]
+	if {$mainhead ne {}} {
+	    $menu entryconfigure 7 -label [mc "Reset %s branch to here" $mainhead]
+	} else {
+	    $menu entryconfigure 7 -label [mc "Reset detached head to here" $mainhead] -state disabled
+	}
     } else {
 	set menu $fakerowmenu
     }
-- 
1.5.5.1

      reply	other threads:[~2008-05-02 15:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200803181535.53635.barra_cuda@katamail.com>
2008-05-02 12:52 ` [PATCH] gitk: disable "Reset %s branch to here" when on a detached head Paul Mackerras
2008-05-02 14:56   ` Michele Ballabio
2008-05-02 15:46     ` Michele Ballabio [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=200805021746.20883.barra_cuda@katamail.com \
    --to=barra_cuda@katamail.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).