summaryrefslogtreecommitdiff
path: root/builtin/show-ref.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-10-25 06:42:27 -0400
committerJeff King <peff@peff.net>2012-10-25 06:42:27 -0400
commit315ea32f1bd57b884f654f6f8a965af9b5e4d8ee (patch)
tree757e5c6df4daf22d2864bdf9c20b896d08b285f0 /builtin/show-ref.c
parent6a83a6d57a61e7c9ebfb6741965f7c0bad03899e (diff)
parent435c83323713066723e4194cd89c31bbec7011a2 (diff)
downloadgit-315ea32f1bd57b884f654f6f8a965af9b5e4d8ee.tar.gz
Merge branch 'jk/peel-ref'
Speeds up "git upload-pack" (what is invoked by "git fetch" on the other side of the connection) by reducing the cost to advertise the branches and tags that are available in the repository. * jk/peel-ref: upload-pack: use peel_ref for ref advertisements peel_ref: check object type before loading peel_ref: do not return a null sha1 peel_ref: use faster deref_tag_noverify
Diffstat (limited to 'builtin/show-ref.c')
-rw-r--r--builtin/show-ref.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index 4eb016d6e5..8d9b76a02f 100644
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -28,7 +28,6 @@ static void show_one(const char *refname, const unsigned char *sha1)
static int show_ref(const char *refname, const unsigned char *sha1, int flag, void *cbdata)
{
- struct object *obj;
const char *hex;
unsigned char peeled[20];
@@ -79,25 +78,9 @@ match:
if (!deref_tags)
return 0;
- if ((flag & REF_ISPACKED) && !peel_ref(refname, peeled)) {
- if (!is_null_sha1(peeled)) {
- hex = find_unique_abbrev(peeled, abbrev);
- printf("%s %s^{}\n", hex, refname);
- }
- }
- else {
- obj = parse_object(sha1);
- if (!obj)
- die("git show-ref: bad ref %s (%s)", refname,
- sha1_to_hex(sha1));
- if (obj->type == OBJ_TAG) {
- obj = deref_tag(obj, refname, 0);
- if (!obj)
- die("git show-ref: bad tag at ref %s (%s)", refname,
- sha1_to_hex(sha1));
- hex = find_unique_abbrev(obj->sha1, abbrev);
- printf("%s %s^{}\n", hex, refname);
- }
+ if (!peel_ref(refname, peeled)) {
+ hex = find_unique_abbrev(peeled, abbrev);
+ printf("%s %s^{}\n", hex, refname);
}
return 0;
}