commit - efdd40df00214d30ba88fa63c6a0cb3ef414088d
commit + c18886c6f84198611809d07f56e3ae6f97f58f50
blob - bd32578a672cd5a5329ff0248325ae7f4012e663
blob + 2acdc3d5fd539be05d49be7c7c03e3e13cdf01ce
--- lib/worktree.c
+++ lib/worktree.c
sb->st_mode = GOT_DEFAULT_FILE_MODE;
return NULL;
}
- return got_error_from_errno2("fopen", abspath);
+ return got_error_from_errno2("open", abspath);
}
- if (fstat(fd, sb) == -1) {
- err = got_error_from_errno2("fstat", abspath);
+ if (ie == NULL)
goto done;
- }
- if (!S_ISREG(sb->st_mode)) {
- *status = GOT_STATUS_OBSTRUCTED;
+ if (fstat(fd, sb) == -1) {
+ err = got_error_from_errno2("fstat", abspath);
goto done;
}
- if (ie == NULL)
- goto done;
-
if (!got_fileindex_entry_has_file_on_disk(ie)) {
- *status = GOT_STATUS_DELETE;
+ if (S_ISREG(sb->st_mode))
+ *status = GOT_STATUS_DELETE;
+ else
+ *status = GOT_STATUS_OBSTRUCTED;
goto done;
} else if (!got_fileindex_entry_has_blob(ie)) {
- *status = GOT_STATUS_ADD;
+ if (S_ISREG(sb->st_mode))
+ *status = GOT_STATUS_ADD;
+ else
+ *status = GOT_STATUS_OBSTRUCTED;
goto done;
+ } else if (!S_ISREG(sb->st_mode)) {
+ *status = GOT_STATUS_OBSTRUCTED;
+ goto done;
}
if (!stat_info_differs(ie, sb))