Skip to content

Commit

Permalink
gitk: Disable "Reset %s branch to here" when on a detached head
Browse files Browse the repository at this point in the history
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)

[paulus@samba.org: changed menu item to "Detached head: can't reset"]

Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Michele Ballabio authored and Paul Mackerras committed May 3, 2008
1 parent 81811a7 commit 5e3502d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gitk
Original file line number Diff line number Diff line change
Expand Up @@ -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 "Detached head: can't reset" $mainhead] -state disabled
}
} else {
set menu $fakerowmenu
}
Expand Down

0 comments on commit 5e3502d

Please sign in to comment.