Commit Diff


commit - a3df2849ff6ef714618aee3003e83b56282dbb49
commit + 8656d6c4d5273b7a838b8d2b0b057891e50a2ece
blob - 46b3ebb730cfbdd351180ada209da9dc4db793a5
blob + 3891b670e44a1c9c9bae5b74e45ce25b5e45c72e
--- got/got.c
+++ got/got.c
@@ -2345,7 +2345,9 @@ collect_commit_logmsg(struct got_pathlist_head *commit
 
 	TAILQ_FOREACH(pe, commitable_paths, entry) {
 		struct got_commitable *ct = pe->data;
-		dprintf(fd, "#  %c  %s\n", ct->status, pe->path);
+		dprintf(fd, "#  %c  %s\n",
+		    got_commitable_get_status(ct),
+		    got_commitable_get_path(ct));
 	}
 	close(fd);
 
blob - 153a8c69767c3a930035bd8d69e616f6b18f485a
blob + 2c68c6de849933fd543de60c68b71da71c71d802
--- include/got_worktree.h
+++ include/got_worktree.h
@@ -15,6 +15,7 @@
  */
 
 struct got_worktree;
+struct got_commitable;
 
 /* status codes */
 #define GOT_STATUS_NO_CHANGE	' '
@@ -30,20 +31,6 @@ struct got_worktree;
 #define GOT_STATUS_OBSTRUCTED	'~'
 #define GOT_STATUS_REVERT	'R'
 
-/* XXX TODO make this opaque */
-struct got_commitable {
-	char *path;
-	char *in_repo_path;
-	char *ondisk_path;
-	unsigned char status;
-	struct got_object_id *blob_id;
-	struct got_object_id *base_blob_id;
-	struct got_object_id *base_commit_id;
-	mode_t mode;
-	int flags;
-#define GOT_COMMITABLE_ADDED 0x01
-};
-
 /*
  * Attempt to initialize a new work tree on disk.
  * The first argument is the path to a directory where the work tree
@@ -182,9 +169,10 @@ const struct got_error *got_worktree_revert(struct got
 
 /*
  * A callback function which is invoked when a commit message is requested.
- * Passes a list of modified paths being committed to, a pointer to the log
- * message that must be set by the callback and will be freed after committing,
- * and an argument passed through to the callback.
+ * Passes a pathlist with a struct got_commitable * in the data pointer of
+ * each element, a pointer to the log message that must be set by the
+ * callback and will be freed after committing, and an argument passed
+ * through to the callback.
  */
 typedef const struct got_error *(*got_worktree_commit_msg_cb)(
     struct got_pathlist_head *, char **, void *);
@@ -203,3 +191,9 @@ const struct got_error *got_worktree_commit(struct got
     struct got_worktree *, const char *, const char *, const char *,
     got_worktree_commit_msg_cb, void *,
     got_worktree_status_cb, void *, struct got_repository *);
+
+/* Get the path of a commitable worktree item. */
+const char *got_commitable_get_path(struct got_commitable *);
+
+/* Get the status of a commitable worktree item. */
+unsigned int got_commitable_get_status(struct got_commitable *);
blob - 222d5b80f24c09ad6693cbb5d9bd53a6e62dac75
blob + 84f3dc1b2b51f685a865ccf9a0d194d305a82fd6
--- lib/got_lib_worktree.h
+++ lib/got_lib_worktree.h
@@ -35,6 +35,19 @@ struct got_worktree {
 	int lockfd;
 };
 
+struct got_commitable {
+	char *path;
+	char *in_repo_path;
+	char *ondisk_path;
+	unsigned char status;
+	struct got_object_id *blob_id;
+	struct got_object_id *base_blob_id;
+	struct got_object_id *base_commit_id;
+	mode_t mode;
+	int flags;
+#define GOT_COMMITABLE_ADDED 0x01
+};
+
 #define GOT_WORKTREE_GOT_DIR		".got"
 #define GOT_WORKTREE_FILE_INDEX		"file-index"
 #define GOT_WORKTREE_REPOSITORY		"repository"
blob - 8fe010595031738e026e47261c5708cd0a5f70cc
blob + 813c2606897283a1597ed1e26f0709ae9ddd2df2
--- lib/worktree.c
+++ lib/worktree.c
@@ -3044,4 +3044,16 @@ done:
 		got_ref_close(head_ref2);
 	}
 	return err;
+}
+
+const char *
+got_commitable_get_path(struct got_commitable *ct)
+{
+	return ct->path;
+}
+
+unsigned int
+got_commitable_get_status(struct got_commitable *ct)
+{
+	return ct->status;
 }