Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- builtin/for-each-ref.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c index 08d4eb1..498d703 100644 --- a/builtin/for-each-ref.c +++ b/builtin/for-each-ref.c @@ -75,6 +75,7 @@ static struct { { "upstream" }, { "symref" }, { "flag" }, + { "current" }, }; /* @@ -90,6 +91,7 @@ static struct { static const char **used_atom; static cmp_type *used_atom_type; static int used_atom_cnt, sort_atom_limit, need_tagged, need_symref; +static const char *head; /* * Used to parse format string and sort specifiers @@ -676,6 +678,17 @@ static void populate_value(struct refinfo *ref) } continue; } + else if (!strcmp(name, "current")) { + if (!head) { + unsigned char sha1[20]; + head = resolve_refdup("HEAD", sha1, 0, NULL); + } + if (strcmp(head, "HEAD") && !strcmp(ref->refname, head)) + v->s = "*"; + else + v->s = " "; + continue; + } else continue; -- 1.8.2.83.gc99314b -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html