commit 97f9158ff1c6468a2c80a195ed39dd5ee0ae600d from: Stefan Sperling via: Thomas Adam date: Tue Aug 29 16:20:40 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 - 720b08bca9347796473f8c8c4c6a1f43df62c320 commit + 97f9158ff1c6468a2c80a195ed39dd5ee0ae600d blob - 93bbe258eca02b2c8f98e5cd8fd66d8888149769 blob + f1730de3eef8aceb312d7ffbd72f6f102611ec16 --- lib/worktree.c +++ lib/worktree.c @@ -4590,7 +4590,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)