From: Junio C Hamano Date: Wed, 22 Oct 2008 00:58:01 +0000 (-0700) Subject: Merge branch 'rs/alloc-ref' X-Git-Tag: v1.6.1-rc1~116 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/6af50f7536d559f891d08597203ba605726511d6?ds=inline;hp=-c Merge branch 'rs/alloc-ref' * rs/alloc-ref: make alloc_ref_from_str() the new alloc_ref() use alloc_ref_from_str() everywhere add alloc_ref_with_prefix() --- 6af50f7536d559f891d08597203ba605726511d6 diff --combined transport.c index 1c510a3360,cfb73500ec..56831c57c5 --- a/transport.c +++ b/transport.c @@@ -75,7 -75,7 +75,7 @@@ static int read_loose_refs(struct strbu if (fd < 0) continue; - next = alloc_ref(path->len - name_offset + 1); + next = alloc_ref(path->buf + name_offset); if (read_in_full(fd, buffer, 40) != 40 || get_sha1_hex(buffer, next->old_sha1)) { close(fd); @@@ -83,7 -83,6 +83,6 @@@ continue; } close(fd); - strcpy(next->name, path->buf + name_offset); (*tail)->next = next; *tail = next; } @@@ -127,14 -126,13 +126,13 @@@ static void insert_packed_refs(const ch (*list)->next->name)) > 0) list = &(*list)->next; if (!(*list)->next || cmp < 0) { - struct ref *next = alloc_ref(len - 40); + struct ref *next = alloc_ref(buffer + 41); buffer[40] = '\0'; if (get_sha1_hex(buffer, next->old_sha1)) { warning ("invalid SHA-1: %s", buffer); free(next); continue; } - strcpy(next->name, buffer + 41); next->next = (*list)->next; (*list)->next = next; list = &(*list)->next; @@@ -501,7 -499,7 +499,7 @@@ static struct ref *get_refs_via_curl(st strbuf_release(&buffer); - ref = alloc_ref_from_str("HEAD"); + ref = alloc_ref("HEAD"); if (!walker->fetch_ref(walker, ref) && !resolve_remote_symref(ref, refs)) { ref->next = refs; @@@ -542,7 -540,7 +540,7 @@@ static struct ref *get_refs_from_bundle die ("Could not read bundle '%s'.", transport->url); for (i = 0; i < data->header.references.nr; i++) { struct ref_list_entry *e = data->header.references.list + i; - struct ref *ref = alloc_ref_from_str(e->name); + struct ref *ref = alloc_ref(e->name); hashcpy(ref->old_sha1, e->sha1); ref->next = result; result = ref; @@@ -644,7 -642,7 +642,7 @@@ static int fetch_refs_via_pack(struct t args.include_tag = data->followtags; args.verbose = (transport->verbose > 0); args.quiet = (transport->verbose < 0); - args.no_progress = args.quiet || !isatty(1); + args.no_progress = args.quiet || (!transport->progress && !isatty(1)); args.depth = data->depth; for (i = 0; i < nr_heads; i++)