Skip to content

Include untracked files in copilot-chat--git-ls-files#231

Merged
chep merged 2 commits intochep:masterfrom
ajdin84:include-untracked-files-in-copilot-chat--git-ls-files
Jan 23, 2026
Merged

Include untracked files in copilot-chat--git-ls-files#231
chep merged 2 commits intochep:masterfrom
ajdin84:include-untracked-files-in-copilot-chat--git-ls-files

Conversation

@ajdin84
Copy link
Contributor

@ajdin84 ajdin84 commented Jan 20, 2026

I'll preface this by saying that I don't know what the intended behavior for this situation is - the change was useful for my use case, so I would like to merge it in case others would find it useful.

When calling copilot-chat-add-workspace, in the case that the working directory/workspace for that chat instance is a git repo, copilot-chat--git-ls-files is invoked to get the list of files to be added to the context list.

(aio-await (copilot-chat--git-ls-files repo-root))))

However, this doesn't include untracked files so I added additional arguments to make sure they get included.

As per the git ls-files --help manpage:

       -c, --cached
           Show all files cached in Git’s index, i.e. all tracked files. (This is the default if no
           -c/-s/-d/-o/-u/-k/-m/--resolve-undo options are specified.)
       -o, --others
           Show other (i.e. untracked) files in the output
       --exclude-standard
           Add the standard Git exclusions: .git/info/exclude, .gitignore in each directory, and the
           user’s global exclusion file.

@ncaq ncaq requested a review from Copilot January 21, 2026 09:35
@ncaq ncaq added the enhancement New feature or request label Jan 21, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances copilot-chat--git-ls-files to include untracked files when adding workspace files to a Copilot Chat context. Previously, only tracked files were returned; now both tracked and untracked (but not ignored) files are included.

Changes:

  • Updated git ls-files command to include --cached, --others, and --exclude-standard flags to return both tracked and untracked files while respecting gitignore patterns

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ncaq
ncaq previously approved these changes Jan 21, 2026
@ncaq ncaq requested a review from chep January 21, 2026 09:41
@ncaq
Copy link
Collaborator

ncaq commented Jan 21, 2026

@ajdin84
Please format from CI.

@chep chep merged commit 753ebc4 into chep:master Jan 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants