Commit Diff


commit - 5de261fe1da72d717a12aadc5ef8dc89b06c4556
commit + 3962e86afd3ac8e3cd0d102c91b7fb4bc436fea4
blob - dd50f8982f38aef266c0c423575786972565f157
blob + 280103eade2f9a6bb4b039407d36286b71588f0c
--- regress/worktree/worktree_test.c
+++ regress/worktree/worktree_test.c
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <errno.h>
+#include <util.h>
 
 #include "got_error.h"
 #include "got_object.h"
@@ -97,6 +98,26 @@ remove_worktree(const char *worktree_path)
 	if (rmdir(worktree_path) == -1)
 		return 0;
 	return 1;
+}
+
+static int
+read_meta_file(char **content, const char *path)
+{
+	FILE *f;
+	size_t n;
+	size_t len;
+	const char delim[3] = {'\0', '\0', '\0'};
+	int ret = 0;
+
+	f = fopen(path, "r");
+	if (f == NULL)
+		return errno;
+
+	*content = fparseln(f, &len, NULL, delim, 0);
+	if (*content == NULL)
+		ret = errno;
+	fclose(f);
+	return ret;
 }
 
 static int
@@ -111,6 +132,13 @@ check_meta_file_exists(const char *worktree_path, cons
 		return 0;
 	if (stat(path, &sb) == 0)
 		ret = 1;
+	if (verbose) {
+		char *content;
+		if (read_meta_file(&content, path) == 0) {
+			test_printf("%s:\t%s\n", name, content);
+			free(content);
+		}
+	}
 	free(path);
 	return ret;
 }