libgit2sharpgit-status

Files marked as 'Deleted' are reported as 'Missing' in LibGit2Sharp


When viewing my repository status with Git Bash I can see many files that are marked as 'Deleted'. LibGit2Sharp RepositoryStatus reports these files as "Missing". The RepositoryStatus object also has a collection "Removed".

What is the difference between these two? Should deleted files not be marked as "Removed"?


Solution

  • So what is the difference between these two?

    Missing and Removed are entries of the FileStatus enumeration.

    As stated by the xml documentation

    They can be seen as specific states of a file lifecycle. Let's consider a file which exists in the working directory, in the index and in the Head. Its status is Unaltered.

    When being suppressed from the working directory (ie. deleted from the filesystem), the status of the file turns into Missing

    If now, one stages the suppression of the file, it disappears from the Index and the status becomes Removed

    Should deleted files not be marked as, "Removed"?

    Git uses the same word deleted to describe the two states. However, there are some visual clues to let you disambiguate them.

    When running git status