Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 1, 2025

The GitRepositoryIssuesProvider LFS issues check was incorrectly flagging files in sparse checkout repositories as "binary files not tracked by LFS" even when those files weren't actually present locally.

Problem

When using sparse checkout, git ls-files -z returns all files in the repository, not just the ones checked out locally. This caused the following issue:

  1. GetAllFilesFromRepository() would return all 7 files in the repo
  2. GetTextFilesFromRepository() would only find 1 text file (the only one checked out)
  3. The remaining 6 files would be classified as "binary" and flagged as "not tracked by LFS"
  4. These 6 files weren't even present locally due to sparse checkout!

Solution

Changed GetAllFilesFromRepository() to use git ls-files -t -z which provides file status information:

  • H status = cached/present files (included)
  • S status = skip-worktree files (excluded in sparse checkout)
  • Other statuses = included (modified, renamed, etc.)

The method now filters out files with S status and strips the status prefix from file paths.

Example

Before (incorrect):

# Repository with sparse checkout - only file1.txt checked out
$ git ls-files -z | tr '\0' '\n'
.gitattributes
binary1.bin  
binary3.bin
file1.txt      # ← only this file is actually present
file2.txt
subdir/binary2.bin
subdir/file3.txt

# Result: 6 files incorrectly flagged as "binary not tracked by LFS"

After (correct):

$ git ls-files -t -z | tr '\0' '\n' | grep -v "^S " | sed 's/^[A-Z] //'
file1.txt      # ← only locally present file is considered

# Result: no false positives for LFS tracking

Testing

Added comprehensive unit tests covering:

  • Filtering of skip-worktree files (S status)
  • Handling of various Git status codes (H, M, R, C, K)
  • Edge cases in status parsing
  • Empty output handling

Fixes #715.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Git LFS Issue check incorrectly reports sparsely checked out files as not LFS tracked Fix Git LFS issue check incorrectly reporting sparsely checked out files as not LFS tracked Aug 1, 2025
Copilot AI requested a review from pascalberger August 1, 2025 12:26
Copilot finished work on behalf of pascalberger August 1, 2025 12:26
Copilot AI and others added 3 commits August 1, 2025 16:37
… skip-worktree files

Co-authored-by: pascalberger <2190718+pascalberger@users.noreply.github.com>
@pascalberger
Copy link
Member

https://gh.io/copilot-coding-agent-docs Your environment has been updated that you can build locally and run the build script to ensure CI builds are working and you can find detailed contribution instructions in copilot-instructions.md.

Resolve the existing conflict with the develop branch, where solution file has been updated to slnx format and ensure build script runs successfully.

Copy link
Contributor Author

Copilot AI commented Aug 2, 2025

https://gh.io/copilot-coding-agent-docs Your environment has been updated that you can build locally and run the build script to ensure CI builds are working and you can find detailed contribution ins...

Resolved the merge conflicts with the develop branch and confirmed the build script works successfully. The solution file has been updated from .sln to .slnx format, and the copilot-instructions.md file has been added. All tests are now passing. See commit eb585a4.

Copilot finished work on behalf of pascalberger August 2, 2025 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Git LFS Issue check incorrectly reports sparsely checked out files as not LFS tracked

2 participants