In commit 4d5e1b1319 ("gitk: Show detached HEAD if --all is specified",
2014-09-09) the intention was to have detached HEAD shown when the --all
argument is given.

This was solved by appending HEAD to the revs list. By doing that the
behavior using the --not argument is now broken, since that inverts the
meaning of all following arguments passed to git rev-parse.

Lets fix this by prepending HEAD instead of appending, this way there
can not be any '--not' in front.

This was discovered because

        gitk --all --not origin/master

does not display the same revs as

        gitk --all ^origin/master

which it should.

Signed-off-by: Heiko Voigt <hvo...@hvoigt.net>
---
 gitk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gitk b/gitk
index a14d7a1..19d95cd 100755
--- a/gitk
+++ b/gitk
@@ -295,7 +295,7 @@ proc parseviewrevs {view revs} {
     if {$revs eq {}} {
        set revs HEAD
     } elseif {[lsearch -exact $revs --all] >= 0} {
-       lappend revs HEAD
+       linsert revs 0 HEAD
     }
     if {[catch {set ids [eval exec git rev-parse $revs]} err]} {
        # we get stdout followed by stderr in $err
-- 
2.21.0

Reply via email to