The core of status compares each staged file's current content against what the index recorded. Equal ids mean unchanged; different ids mean modified. Today you classify a tracked file.
Classify a tracked file as unchanged or modified by comparing its working id to its index id.
For any path that is both on disk and in the index, the question is simple: does its current content still match what was staged? Compute the working id and compare it to the index id. Same id, unchanged; different id, modified. There is no special content comparison because content equality is id equality.
This is the everyday heart of git status: it tells you which tracked files you
have edited since staging them. Right after add, a file is unchanged; edit it and
it becomes modified until you stage it again (which updates the index id to match).
Two more cases complete the picture, a file that is in the working tree but not the
index, and one in the index but no longer on disk, which are next.
// compare the file's current id to what the index recordedwid, _ := r.WorkingId(path)if wid == ix.entries[path].Id {return "unchanged"}return "modified"