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

Re: [PATCH 2/2] fetch/push: readd rsync support

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:43:37

Hi,

On Fri, 28 Sep 2007, Junio C Hamano wrote:
Johannes Schindelin [off-list ref] writes:
quoted
diff --git a/transport.c b/transport.c
index 4f9cddc..c8eed95 100644
--- a/transport.c
+++ b/transport.c
@@ -6,6 +6,330 @@
...
+static int direntry_cmp(const void *a, const void *b)
+{
+	const struct dirent *d1 = a;
+	const struct dirent *d2 = b;
+
+	return strcmp(d1->d_name, d2->d_name);
+}
...
+/*
+ * path is assumed to point to a buffer of PATH_MAX bytes, and
+ * path + name_offset is expected to point to "refs/".
+ */
+
+static int read_loose_refs(struct strbuf *path, int name_offset,
+		struct ref **tail)
+{
+	DIR *dir = opendir(path->buf);
+	struct dirent *de;
+	struct {
+		char **entries;
+		int nr, alloc;
+	} list;
...
+	while ((de = readdir(dir))) {
+		if (de->d_name[0] == '.' && (de->d_name[1] == '\0' ||
+				(de->d_name[1] == '.' &&
+				 de->d_name[2] == '\0')))
+			continue;
+		ALLOC_GROW(list.entries, list.nr + 1, list.alloc);
+		list.entries[list.nr++] = xstrdup(de->d_name);
+	}
+	closedir(dir);
+
+	/* sort the list */
+
+	qsort(list.entries, list.nr, sizeof(*de), direntry_cmp);
Hmmmph...?
Ouch.  Sorry.

Will resend in a few minutes. (After reading the patch -- again)

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help