+ for (;patch ; patch = patch->next)
+ error |= check_patch(patch);
+ return error;
+}
+
+static void show_file(int c, unsigned int mode, const char *name)
+{
+ printf("%c %o %s\n", c, mode, name);
+}
+
+static void show_file_list(struct patch *patch)
+{
+ for (;patch ; patch = patch->next) {
+ if (patch->is_rename) {
+ show_file('-', patch->old_mode, patch->old_name);
+ show_file('+', patch->new_mode, patch->new_name);
+ continue;
+ }
+ if (patch->is_copy || patch->is_new) {
+ show_file('+', patch->new_mode, patch->new_name);
+ continue;
+ }
+ if (patch->is_delete) {
+ show_file('-', patch->old_mode, patch->old_name);
+ continue;
+ }
+ if (patch->old_mode && patch->new_mode && patch->old_mode != patch->new_mode) {
+ printf("M %o:%o %s\n", patch->old_mode, patch->new_mode, patch->old_name);
+ continue;
+ }
+ printf("M %o %s\n", patch->old_mode, patch->old_name);
+ }
+}
+
+static void stat_patch_list(struct patch *patch)
+{
+ int files, adds, dels;
+
+ for (files = adds = dels = 0 ; patch ; patch = patch->next) {
+ files++;
+ adds += patch->lines_added;
+ dels += patch->lines_deleted;
+ show_stats(patch);
+ }
+
+ printf(" %d files changed, %d insertions(+), %d deletions(-)\n", files, adds, dels);
+}
+
+static void patch_stats(struct patch *patch)
+{
+ int lines = patch->lines_added + patch->lines_deleted;
+
+ if (lines > max_change)
+ max_change = lines;
+ if (patch->old_name) {
+ int len = strlen(patch->old_name);
+ if (len > max_len)
+ max_len = len;
+ }
+ if (patch->new_name) {
+ int len = strlen(patch->new_name);
+ if (len > max_len)
+ max_len = len;
+ }