Re: Possible bug: Empty magic word list in pathspec is handled differently in short vs. long form

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you and Lucas Oshiro <lucasseikioshiro@xxxxxxxxx> for the clarification

On 19/02/2025 18:11, Junio C Hamano wrote:
Anselm Schüler <mail@xxxxxxxxxxxxxxxxxx> writes:

If you run git diff for a pathspec with an empty magic word/symbol
list in short form (prefixed by ::) and in long form (prefixed by
:():), you get different results.
The short form is prefixed by a ":" and optionally ends by a ":",
but the optional termination may not be required when there is no
ambiguity (e.g. ":/!path" is "from the top, not matching "path", as
"p" cannot be a magic signature; ":/:!path" is "from the top,
matching "!path", as the set of magic signatures ends with the
second disambiguating colon).

The long form is prefixed by a ":(" and ends by a ")".


Here’s an example use of git that illustrates this:

~☭ mkdir gittest
~☭ y gittest/
~/gittest☭ git init
Initialized empty Git repository in /home/anselmschueler/gittest/.git/
~/gittest (b0)☭ uuidgen >file
~/gittest (b0)☭ git add file && git commit -m "$(read)"
read> initial commit
[b0 (root-commit) cd3bd43] initial commit
  1 file changed, 1 insertion(+)
  create mode 100644 file
~/gittest (b0)☭ uuidgen >file
~/gittest (b0)☭ git diff -- "::file"

file
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

───┐
1: │
───┘
66d18ffa-1128-42a5-8d4e-f9d75eb86b92
9acea2b5-50a6-4f87-ae1a-64019a93e55e
~/gittest (b0)☭ git diff -- ":():file"
~/gittest (b0)☭
Doesn't ":():file" ask for a match for the pattern ":file", with a
leading colon?




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux