threads / discuss / 61950

Git exclude patterns with full static file, without globs, fails to capture the exclusion (the file is added anyway

Subject: Git exclude patterns with full static file, without globs, fails to capture the exclusion (the file is added anyway

## tl;dr

One message between Aug 14, 2024 and Aug 14, 2024.

replies: 0people: 1as markdown or json

Alex Recuenco· Aug 14, 2024, 13:26 UTC · lore
Good afternoon,
This was very confusing to track down, I can't find any documentation that showcases this as intended behaviour.
I reviewed the pathspec docs quite a few times.

Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue) I executed

`git add -A ':(exclude,glob)lib/power.rb'`

What did you expect to happen? (Expected behavior) The file `lib/power.rb` is excluded

What happened instead? (Actual behavior) The file `lib/power.rb` is added to staging However, if I run `git add -A ':(exclude,glob)lib/power\.rb'`

The file is excluded correctly
What's different between what you expected and what actually happened?
Anything else you want to add:

If I use `git add -A ':(exclude,glob)lib/*ower.rb'` the file is also excluded correctly, which makes this even more confusing

Please review the rest of the bug report below. You can delete any lines you don't wish to share.

[System Info] git version: git version 2.45.1 cpu: arm64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh feature: fsmonitor--daemon uname: Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:19:05 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8112 arm64 compiler info: clang: 15.0.0 (clang-1500.3.9.4) libc info: no libc information available $SHELL (typically, interactive shell): /bin/zsh

Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue) I executed git add -A ':(exclude,glob)lib/power.rb'

What did you expect to happen? (Expected behavior) The file lib/power.rb is excluded

What happened instead? (Actual behavior) The file lib/power.rb is added to staging However, if I run git add -A ':(exclude,glob)lib/power\.rb'

The file is excluded correctly
What's different between what you expected and what actually happened?
Anything else you want to add:

If I use git add -A ':(exclude,glob)lib/*ower.rb' the file is also excluded correctly, which makes this even more confusing

Please review the rest of the bug report below. You can delete any lines you don't wish to share.

[System Info] git version: git version 2.45.1 cpu: arm64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh feature: fsmonitor--daemon uname: Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:19:05 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8112 arm64 compiler info: clang: 15.0.0 (clang-1500.3.9.4) libc info: no libc information available $SHELL (typically, interactive shell): /bin/zsh

← back to recent threads