{"thread":{"id":"60345","subject":"Bug: `git stash push ':(attr:<somevalue>)' attr magic does not get parsed correctly","startedAt":"2023-10-11T19:14:38Z","lastAt":"2023-10-11T19:14:38Z","messageCount":1,"participants":["Joanna Wang"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"483076","messageId":"CAMmZTi-0QKtj7Q=sbC5qhipGsQxJFOY-Qkk1jfkRYwfF5FcUVg@mail.gmail.com","threadId":"60345","inReplyTo":null,"subject":"Bug: `git stash push ':(attr:<somevalue>)' attr magic does not get parsed correctly","fromName":"Joanna Wang","fromEmail":"jojwang@google.com","sentAt":"2023-10-11T19:14:22Z","receivedAt":"2023-10-11T19:14:38Z","isPatch":false,"sender":{"key":"jojwang@google.com","avatar":"https://avatars.githubusercontent.com/u/120585822?v=4"},"body":"What did you do before the bug happened? (Steps to reproduce your issue)\nrun the following with a debugger: `git stash push ':(attr:<somevalue>)'`\ncheck the resulting pathspec after parse_pathspec()\n\nWhat did you expect to happen? (Expected behavior)\nthe resulting pathspec should contain ':(attr:<somevalue>)'.\n\nWhat happened instead? (Actual behavior)\nThe resulting pathspec is ':(attr,prefix:0)'\nThis is due to parse_pathspec in git-stash being called with\nPATHSPEC_PREFIX_ORIGIN as a flag.\n\n':(attr:<somevalue>)' gets parsed into ':(attr,prefix:0)' because prefix_magic()\nhttps://github.com/git/git/blob/master/pathspec.c#L112 does not take\ninto account\nthat some magic can have values in addition to their magic names\nspecified in the pathspec.\n\nWhat's different between what you expected and what actually happened?\nResulting pathspec is ':(attr,prefix:0)' when it should be\n':(attr:<somevalue>,prefix:0)'\n\nAnything else you want to add:\nattr pathspec magic is currently blocked for git stash by GUARD_PATHSPEC\nhttps://github.com/git/git/blob/master/dir.c#L2176\nBut, it looks like it can be unblocked, once prefix_magic() is fixed.\n\nAlso add-interactive also uses PATHSPEC_PREFIX_ORIGIN as a flag and\nthe resulting pathspec from parse_pathspec\nshows the same bug.  But `git add -i ':(attr:<somevalue>'` behaves as\nexpected and I'm not sure why. It may be using different parts of the\npathspec struct down the line to filter out files.\n\n[Enabled Hooks]\ncommit-msg\npre-commit\nprepare-commit-msg\n"}]}