Commit Diff


commit - c8b73ac1663c35b32c7f8ce4173765461b72f3fa
commit + 720b08bca9347796473f8c8c4c6a1f43df62c320
blob - f7f0c4a2baa46967792517f2c5fba61b64e85e59
blob + 93bbe258eca02b2c8f98e5cd8fd66d8888149769
--- lib/worktree.c
+++ lib/worktree.c
@@ -5762,17 +5762,16 @@ collect_commitables(void *arg, unsigned char status,
 		err = got_error_from_errno("strdup");
 		goto done;
 	}
-	err = got_pathlist_insert(&new, a->commitable_paths, ct->path, ct);
-	if (err)
-		goto done;
 
-	if (a->diff_outfile && ct && new != NULL) {
+	if (a->diff_outfile) {
 		err = append_ct_diff(ct, &a->diff_header_shown,
 		    a->diff_outfile, a->f1, a->f2, dirfd, de_name,
 		    a->have_staged_files, a->repo, a->worktree);
 		if (err)
 			goto done;
 	}
+
+	err = got_pathlist_insert(&new, a->commitable_paths, ct->path, ct);
 done:
 	if (ct && (err || new == NULL))
 		free_commitable(ct);