jcs
/amend
/amendments
/3
committer: Only commit files that differed
Otherwise we're including all selected files in every commit which makes the commit filtering not work well.
jcs made amendment 3 over 3 years ago
--- committer.c Mon Oct 18 16:47:01 2021
+++ committer.c Tue Oct 19 13:48:05 2021
@@ -305,7 +305,7 @@ committer_update_menu(struct committer *committer)
HiliteControl(committer->commit_button, 255);
} else {
EnableItem(edit_menu, EDIT_MENU_SELECT_ALL_ID);
- if ((*(committer->log_te))->nLines > 0)
+ if ((*(committer->log_te))->nLines > 0 && committer->ndiffed_files)
HiliteControl(committer->commit_button, 0);
}
@@ -342,6 +342,8 @@ committer_generate_diff(struct committer *committer)
committer->diff_adds = 0;
committer->diff_subs = 0;
+ committer->ndiffed_files = 0;
+ committer->diffed_files = xmalloc(sizeof(short) * nselected_files);
cur_committer = committer;
diff_too_big = 0;
@@ -354,7 +356,9 @@ committer_generate_diff(struct committer *committer)
if (file == NULL)
err(1, "Failed to find file with id %d", selected_files[i]);
committer_status("Diffing %s...", file->filename);
- repo_diff_file(committer->browser->repo, file);
+ if (repo_diff_file(committer->browser->repo, file))
+ committer->diffed_files[committer->ndiffed_files++] =
+ file->id;
diff_finish();
}
--- committer.h Mon Oct 18 15:49:37 2021
+++ committer.h Tue Oct 19 13:42:53 2021
@@ -30,6 +30,8 @@ struct committer {
unsigned long diff_te_len;
ControlHandle diff_scroller;
ControlHandle commit_button;
+ short ndiffed_files;
+ short *diffed_files;
short diff_adds;
short diff_subs;
};