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

This implements the server side of protocol extension to show which branch
the HEAD points at.  The information is sent as a capability symref=<target>.

Signed-off-by: Junio C Hamano <gits...@pobox.com>
Signed-off-by: Andreas Krey <a.k...@gmx.de>
---
 upload-pack.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/upload-pack.c b/upload-pack.c
index 127e59a..390d1ec 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -745,13 +745,17 @@ static int send_ref(const char *refname, const unsigned 
char *sha1, int flag, vo
        if (mark_our_ref(refname, sha1, flag, cb_data))
                return 0;
 
-       if (capabilities)
-               packet_write(1, "%s %s%c%s%s%s agent=%s\n",
+       if (capabilities) {
+               unsigned char dummy[20];
+               const char *target = resolve_ref_unsafe("HEAD", dummy, 0, NULL);
+               packet_write(1, "%s %s%c%s%s%s%s%s agent=%s\n",
                             sha1_to_hex(sha1), refname_nons,
                             0, capabilities,
                             allow_tip_sha1_in_want ? " allow-tip-sha1-in-want" 
: "",
                             stateless_rpc ? " no-done" : "",
+                            target ? " symref=" : "", target ? target : 0,
                             git_user_agent_sanitized());
+       }
        else
                packet_write(1, "%s %s\n", sha1_to_hex(sha1), refname_nons);
        capabilities = NULL;
-- 
1.8.3.1.485.g9704416.dirty
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to