Commit Diff


commit - c18886c6f84198611809d07f56e3ae6f97f58f50
commit + 3f148bc66e13559704e12d07a8c05612be797de2
blob - 2acdc3d5fd539be05d49be7c7c03e3e13cdf01ce
blob + fd98027aca25f70b7500f2f6e60ae73cc02d6033
--- lib/worktree.c
+++ lib/worktree.c
@@ -1033,6 +1033,7 @@ stat_info_differs(struct got_fileindex_entry *ie, stru
 	    ie->size == (sb->st_size & 0xffffffff));
 }
 
+/* Report file status and initialize sb->st_mode. */
 static const struct got_error *
 get_file_status(unsigned char *status, struct stat *sb,
     struct got_fileindex_entry *ie, const char *abspath,
@@ -1067,8 +1068,10 @@ get_file_status(unsigned char *status, struct stat *sb
 		return got_error_from_errno2("open", abspath);
 	}
 
-	if (ie == NULL)
+	if (ie == NULL) {
+		sb->st_mode = GOT_DEFAULT_FILE_MODE;
 		goto done;
+	}
 
 	if (fstat(fd, sb) == -1) {
 		err = got_error_from_errno2("fstat", abspath);