commit f6635657d4d78b75242d294ae26086c05bfa489d from: Stefan Sperling date: Fri Aug 25 11:26:02 2023 UTC fix deletion of missing locally-added files If a locally added file in A status gets deleted from disk it will move into missing ! status. If the user then decides to delete the file we must remove the file index entry immediately rather than flagging the file for removal during the next commit operation. The file was never committed and lacks a base-blob and base-commit, so it cannot be removed during the next commit. As a result the commit operation was reporting a bogus "out of date" error. Found while diagnosing a related bug reported by gonzalo@ ok op@ commit - c78dbc033c5063cc79ab16426bdae976aa5beb87 commit + f6635657d4d78b75242d294ae26086c05bfa489d blob - bfdd5fc5f4361a2ce5c55a856b02624a840888f5 blob + a60bbbeee54da16d7504c7439574f7825bf1625a --- lib/worktree.c +++ lib/worktree.c @@ -4593,7 +4593,10 @@ schedule_for_deletion(void *arg, unsigned char status, strlen(ondisk_path), root_len) != 0); } - got_fileindex_entry_mark_deleted_from_disk(ie); + if (got_fileindex_entry_has_blob(ie)) + got_fileindex_entry_mark_deleted_from_disk(ie); + else + got_fileindex_entry_remove(a->fileindex, ie); done: free(ondisk_path); if (err)