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

> The "--all" in rev-list family (including "git log") unconditionally
> include HEAD.  The glitch here is that "--all" in rev-parse does
> not.  And 4d5e1b1319 was an attempt to "fix" that, i.e. make "--all"
> imply "HEAD".

And it becomes really tempting to get rid of that "let's tweak
--all" hack and declare that "rev-parse --all" is simply buggy,
proposing a simple "bugfix" that may look like this (not even
compile tested, but you get the idea).

 builtin/rev-parse.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index f8bbe6d47e..94f9a6efba 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -766,6 +766,7 @@ int cmd_rev_parse(int argc, const char **argv, const char 
*prefix)
                        }
                        if (!strcmp(arg, "--all")) {
                                for_each_ref(show_reference, NULL);
+                               head_ref(show_reference, NULL);
                                clear_ref_exclusion(&ref_excludes);
                                continue;
                        }

Reply via email to