[PATCH 1/3] upload-pack: send the HEAD information
- From
Andreas Krey <a.krey@gmx.de>
- Date
- Sep 6, 2013, 15:56 UTC
- Message-ID
- <20130906155608.GF12966@inner.h.apk.li>
- In-Reply-To
- <20130906155204.GE12966@inner.h.apk.li>
From: Junio C Hamano <gitster@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 <gitster@pobox.com> Signed-off-by: Andreas Krey <a.krey@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