Commit Diff


commit - 161b566ff8fdc61984f077c6ab1d75b5f0fd5ac7
commit + 2c4740ad12b787db8704cb160abc4f1e5e73d911
blob - 34bcaf456f729025ac1a5e221d929468c7458bed
blob + c4fc2f02d953c285d633a68f2ef9f0cebc512bca
--- lib/worktree.c
+++ lib/worktree.c
@@ -1649,8 +1649,9 @@ get_file_status(unsigned char *status, struct stat *sb
 	uint8_t fbuf[8192];
 	struct got_blob_object *blob = NULL;
 	size_t flen, blen;
-	unsigned char staged_status = get_staged_status(ie);
+	unsigned char staged_status;
 
+	staged_status = get_staged_status(ie);
 	*status = GOT_STATUS_NO_CHANGE;
 	memset(sb, 0, sizeof(*sb));
 
@@ -3329,12 +3330,13 @@ report_file_status(struct got_fileindex_entry *ie, con
 {
 	const struct got_error *err = NULL;
 	unsigned char status = GOT_STATUS_NO_CHANGE;
-	unsigned char staged_status = get_staged_status(ie);
+	unsigned char staged_status;
 	struct stat sb;
 	struct got_object_id blob_id, commit_id, staged_blob_id;
 	struct got_object_id *blob_idp = NULL, *commit_idp = NULL;
 	struct got_object_id *staged_blob_idp = NULL;
 
+	staged_status = get_staged_status(ie);
 	err = get_file_status(&status, &sb, ie, abspath, dirfd, de_name, repo);
 	if (err)
 		return err;