Commit Diff


commit - 808264b2482b61d7bab9f3d7b0b4a9703a3942cd
commit + c78dbc033c5063cc79ab16426bdae976aa5beb87
blob - 2cdafab5a89da7e31a55bc887af42b14226637d8
blob + bfdd5fc5f4361a2ce5c55a856b02624a840888f5
--- lib/worktree.c
+++ lib/worktree.c
@@ -5765,17 +5765,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);