Thread (63 messages) flat view 63 messages, 3 authors, 2016-06-15

Re: [PATCH v2 20/51] repack_without_ref(): reimplement using do_for_each_ref_in_array()

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:52:37

mhagger@alum.mit.edu writes:
+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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help