pathspecs で git-status を使用しているときに、奇妙な動作が見られます。それが期待される動作なのか、それとも git の未定義の動作なのかについて、ご意見をお聞かせください。
初期設定
$ mkdir main && cd main
$ git init .
Initialized empty Git repository in d:/temp/main/.git/
$ touch test[1].txt
$ touch test[2].txt
以下は分かりやすい
$ # 1. escaped square brackets
$ git status test\[1\].txt --short
?? test[1].txt
$ # 2. escaped square brackets with range
$ git status test\[[1-9]\].txt --short
?? test[1].txt
?? test[2].txt
$ # 3. unmatched range, with what looks like a fallback to literal comparison
$ git status test[1].txt --short
?? test[1].txt
予期しない動作のための追加設定
$ touch test1.txt
予期しない動作
$ # 4. matched range, so no fallback to literal comparison (this one looks OK)
$ git status test[1].txt --short
?? test1.txt
$ # 5. escaped square brackets => I would expect only test[1].txt to be returned
$ git status test\[1\].txt --short
?? test1.txt
?? test[1].txt
$ # 6. escaped square brackets with range => I would expect only test[1].txt
$ # and test[2].txt to be returned
$ git status test\[[1-9]\].txt --short
?? test1.txt
?? test[1].txt
?? test[2].txt
$ # 7. only escaping the last square bracket
$ # result looks similar to the 5th case
$ git status test[1\].txt --short
?? test1.txt
?? test[1].txt
より楽しくするための追加設定
$ git add test1.txt
$ rm test1.txt
$ touch test2.txt
より予期しない動作
$ # 8. ???
$ git status test[1].txt --short
AD test1.txt
?? test[1].txt
$ # 9. We lost test1.txt ???
$ git status test[1-2].txt --short
?? test2.txt
$ # Woo... Should this really work?
$ git status test[*.txt --short
AD test1.txt
?? test2.txt
?? test[1].txt
?? test[2].txt
私はそこで少し混乱しています。pathspecに関連する Git のドキュメントを読みましたが、それほど詳しくはありません。
背後にあるロジックを理解するのを手伝ってくれる人はいますか?