Owner: @Saanvi521
Files: minigit/index.py, tests/test_index.py
Depends on: #16 , #17
Branch: week4/m2-checkout
Replace WorkingTree.checkout(tree_hash) with a real checkout. Restore tracked files and rebuild the index from the target tree.
Steps
Start from updated main after Week 3 - M1: Tree object serialization #16 and Week 3 - M2: Trees from index + file-level diff #17 merge. Keep checkout(tree_hash) -> None.
Flatten the target with read_tree_entries. Read every required blob through M1 before changing files.
Missing or corrupt objects raise the shared object errors.
Reject paths outside the repo, paths through symlinks, and entries under .minigit/.
Check for local edits before writing.
Compare tracked files against the current index. Modified or missing tracked files raise MiniGitError.
Reject untracked files or directories that block a target path.
Preserve unrelated untracked files.
M3 checks staged changes against HEAD before calling checkout.
Remove tracked files absent from the target. Remove empty directories left by those deletions.
Handle file-to-directory and directory-to-file changes.
Never remove a directory containing untracked files.
Create target directories and write blob bytes. Restore 100644 and 100755 modes.
Rewrite the index with the target entries, sorted by path. An empty target tree produces an empty index.
Leave HEAD and branch refs to M3. Keep M2 independent of CommitManager.
Run scripts/quality-check.sh. Open a PR linked to this issue and request a teammate review.
Tests
Restore changed files, nested paths, spaces, binary bytes, and executable modes.
Remove tracked files missing from the target; preserve untracked files.
Check empty trees and both file/directory transitions.
A bad object, local edit, or blocked path fails before files or index change.
Repeating checkout leaves the same files and index.
After M3 lands, switch between two committed snapshots; status reports clean.
Done when
Owner: @Saanvi521
Files:
minigit/index.py,tests/test_index.pyDepends on: #16, #17
Branch:
week4/m2-checkoutReplace
WorkingTree.checkout(tree_hash)with a real checkout. Restore tracked files and rebuild the index from the target tree.Steps
mainafter Week 3 - M1: Tree object serialization #16 and Week 3 - M2: Trees from index + file-level diff #17 merge. Keepcheckout(tree_hash) -> None.read_tree_entries. Read every required blob through M1 before changing files..minigit/.MiniGitError.100644and100755modes.CommitManager.scripts/quality-check.sh. Open a PR linked to this issue and request a teammate review.Tests
statusreportsclean.Done when