Re: [PATCH v2 20/51] repack_without_ref(): reimplement using do_for_each_ref_in_array()
mhagger@alum.mit.edu writes:
Show 14 quoted lines
> +static int repack_without_ref_fn(const char *refname, const unsigned char *sha1,
> + int flags, void *cb_data)
> +{
> + struct repack_without_ref_sb *data = cb_data;
> + char line[PATH_MAX + 100];
> + int len;
> +
> + if (!strcmp(data->refname, refname))
> + return 0;
> + len = snprintf(line, sizeof(line), "%s %s\n",
> + sha1_to_hex(sha1), refname);
> + /* this should not happen but just being defensive */
> + if (len > sizeof(line))
> + die("too long a refname '%s'", refname);Perhaps strbuf would be easier to use for things like this.