commit b5bedbbb00134c51ea21a700b6da9ab45c6e432e from: Stefan Sperling via: Thomas Adam date: Tue Nov 01 08:33:49 2022 UTC use a global flag instead of a per-file flag to detect staged changes ok op@ commit - fc2a50f28951c340fb573e7fcb0646ddf93fde8f commit + b5bedbbb00134c51ea21a700b6da9ab45c6e432e blob - 17d5e53de83220c7a4c9c4b686378fdc234de517 blob + 198a7f343d11535dcd0b9767bbe1703a6ef2a4aa --- lib/worktree.c +++ lib/worktree.c @@ -5007,7 +5007,7 @@ done: static const struct got_error * append_ct_diff(struct got_commitable *ct, int *diff_header_shown, FILE *diff_outfile, FILE *f1, FILE *f2, int dirfd, const char *de_name, - struct got_repository *repo, struct got_worktree *worktree) + int diff_staged, struct got_repository *repo, struct got_worktree *worktree) { const struct got_error *err = NULL; struct got_blob_object *blob1 = NULL; @@ -5017,7 +5017,6 @@ append_ct_diff(struct got_commitable *ct, int *diff_he struct stat sb; off_t size1 = 0; int f2_exists = 0; - int diff_staged = (ct->staged_status != GOT_STATUS_NO_CHANGE); char *id_str = NULL; memset(&sb, 0, sizeof(sb)); @@ -5311,7 +5310,7 @@ collect_commitables(void *arg, unsigned char status, if (a->diff_outfile && ct && new != NULL) { err = append_ct_diff(ct, &a->diff_header_shown, a->diff_outfile, a->f1, a->f2, dirfd, de_name, - a->repo, a->worktree); + a->have_staged_files, a->repo, a->worktree); if (err) goto done; }