git-cinnabar 0.6.0-rc2

git remote helper to interact with mercurial repositories
diff --git a/notes.c b/notes.c
index f2805d51bb..edc4dd19e2 100644
--- a/notes.c
+++ b/notes.c
@@ -417,11 +417,6 @@ static void load_subtree(struct notes_tree *t, struct leaf_node *subtree,
 
 		if (path_len == 2 * (hashsz - prefix_len)) {
 			/* This is potentially the remainder of the SHA-1 */
-
-			if (!S_ISREG(entry.mode))
-				/* notes must be blobs */
-				goto handle_non_note;
-
 			if (hex_to_bytes(object_oid.hash + prefix_len, entry.path,
 					 hashsz - prefix_len))
 				goto handle_non_note; /* entry.path is not a SHA1 */
@@ -728,6 +723,7 @@ struct write_each_note_data {
 	struct tree_write_stack *root;
 	struct non_note **nn_list;
 	struct non_note *nn_prev;
+	unsigned int note_mode;
 };
 
 static int write_each_non_note_until(const char *note_path,
@@ -759,7 +755,7 @@ static int write_each_note(const struct object_id *object_oid,
 	struct write_each_note_data *d =
 		(struct write_each_note_data *) cb_data;
 	size_t note_path_len = strlen(note_path);
-	unsigned int mode = 0100644;
+	unsigned int mode = d->note_mode;
 
 	if (note_path[note_path_len - 1] == '/') {
 		/* subtree entry */
@@ -1169,7 +1165,10 @@ int for_each_note(struct notes_tree *t, int flags, each_note_fn fn,
 	return for_each_note_helper(t, t->root, 0, 0, flags, fn, cb_data);
 }
 
-int write_notes_tree(struct notes_tree *t, struct object_id *result)
+int write_notes_tree_mode(struct notes_tree *t, struct object_id *result,
+                          unsigned int mode);
+int write_notes_tree_mode(struct notes_tree *t, struct object_id *result,
+                          unsigned int mode)
 {
 	struct tree_write_stack root;
 	struct write_each_note_data cb_data;
@@ -1187,6 +1186,7 @@ int write_notes_tree(struct notes_tree *t, struct object_id *result)
 	cb_data.root = &root;
 	cb_data.nn_list = &(t->first_non_note);
 	cb_data.nn_prev = NULL;
+	cb_data.note_mode = mode;
 
 	/* Write tree objects representing current notes tree */
 	flags = FOR_EACH_NOTE_DONT_UNPACK_SUBTREES |
@@ -1199,6 +1199,11 @@ int write_notes_tree(struct notes_tree *t, struct object_id *result)
 	return ret;
 }
 
+int write_notes_tree(struct notes_tree *t, struct object_id *result)
+{
+	return write_notes_tree_mode(t, result, 0100644);
+}
+
 void prune_notes(struct notes_tree *t, int flags)
 {
 	struct note_delete_list *l = NULL;