This implements the server side of protocol extension to show which branch the HEAD points at. The information is sent after the terminating NUL that comes after the server capabilities list, to cause older clients to ignore it, while allowing newer clients to make use of that information Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> --- upload-pack.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/upload-pack.c b/upload-pack.c index e5adbc0..4aa444a 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -579,9 +579,17 @@ static int send_ref(const char *refname, const unsigned char *sha1, int flag, vo if (!o) die("git upload-pack: cannot find object %s:", sha1_to_hex(sha1)); - if (capabilities) - packet_write(1, "%s %s%c%s\n", sha1_to_hex(sha1), refname, - 0, capabilities); + if (capabilities) { + unsigned char dummy[20]; + const char *target = resolve_ref("HEAD", dummy, 0, NULL); + + if (!target) + packet_write(1, "%s %s%c%s\n", sha1_to_hex(sha1), refname, + 0, capabilities); + else + packet_write(1, "%s %s%c%s%c%s\n", sha1_to_hex(sha1), refname, + 0, capabilities, 0, target); + } else packet_write(1, "%s %s\n", sha1_to_hex(sha1), refname); capabilities = NULL; -- 1.6.0.4.864.g0f47a -- 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