git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitk: show detached HEAD if --all is specified
@ 2014-09-09  7:29 Max Kirillov
  2014-09-09 17:02 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Max Kirillov @ 2014-09-09  7:29 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git, Max Kirillov

If HEAD is detached, 'gitk --all' does not show it. This is inconvenient
for frontend program, and for example git log does show the detached HEAD.

gitk uses git rev-parse to find a list of branches to show.
Apparently, the command does not include detached HEAD to output if
--all argument is specified. This has been discussed in [1] and stated
as expected behavior. So rev-parse's parameters should be tuned in gitk.

[1] http://thread.gmane.org/gmane.comp.version-control.git/255996

Signed-off-by: Max Kirillov <max@max630.net>
---
 gitk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gitk b/gitk
index c8df35d..a5d98bf 100755
--- a/gitk
+++ b/gitk
@@ -294,6 +294,8 @@ proc parseviewrevs {view revs} {
 
     if {$revs eq {}} {
 	set revs HEAD
+    } elseif {[lsearch -exact $revs --all] >= 0} {
+	lappend revs HEAD
     }
     if {[catch {set ids [eval exec git rev-parse $revs]} err]} {
 	# we get stdout followed by stderr in $err
-- 
2.0.1.1697.g73c6810

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gitk: show detached HEAD if --all is specified
  2014-09-09  7:29 [PATCH] gitk: show detached HEAD if --all is specified Max Kirillov
@ 2014-09-09 17:02 ` Junio C Hamano
  2014-09-09 17:04   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2014-09-09 17:02 UTC (permalink / raw)
  To: Max Kirillov; +Cc: Paul Mackerras, git

Max Kirillov <max@max630.net> writes:

> If HEAD is detached, 'gitk --all' does not show it. This is inconvenient
> for frontend program, and for example git log does show the detached HEAD.

"git log" does use the same revision machinery as rev-parse uses
internally to parse its command line arguments.  What does it do
differently?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gitk: show detached HEAD if --all is specified
  2014-09-09 17:02 ` Junio C Hamano
@ 2014-09-09 17:04   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2014-09-09 17:04 UTC (permalink / raw)
  To: Max Kirillov; +Cc: Paul Mackerras, git

Junio C Hamano <gitster@pobox.com> writes:

> Max Kirillov <max@max630.net> writes:
>
>> If HEAD is detached, 'gitk --all' does not show it. This is inconvenient
>> for frontend program, and for example git log does show the detached HEAD.
>
> "git log" does use the same revision machinery as rev-parse uses
> internally to parse its command line arguments.  What does it do
> differently?

Ah, nevermind.  I misremembered that rev-parse does not use the
revision machinery.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-09 17:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-09  7:29 [PATCH] gitk: show detached HEAD if --all is specified Max Kirillov
2014-09-09 17:02 ` Junio C Hamano
2014-09-09 17:04   ` Junio C Hamano

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).