commit - 4a1ddfc2ae992bd73e34ce89b7f309df643aeba5
commit + cf61d8187fe29b5d3333c3103bc73ad3ca585efc
blob - f51b680fd50600a7dde8e98ca7bb6f718b81089c
blob + a161221afac60aee49eeed1c62a75ef2f9fec686
--- lib/worktree.c
+++ lib/worktree.c
*/
index = fopen(fileindex_path, "rb");
if (index == NULL) {
- err = got_error_from_errno();
- goto done;
+ if (errno != ENOENT) {
+ err = got_error_from_errno();
+ goto done;
+ }
+ } else {
+ err = got_fileindex_read(fileindex, index);
+ fclose(index);
+ if (err)
+ goto done;
}
- err = got_fileindex_read(fileindex, index);
- fclose(index);
- if (err)
- goto done;
err = got_opentemp_named(&new_fileindex_path, &new_index,
fileindex_path);