{"thread":{"id":"60388","subject":"Re: Supporting `git add -a <exclude submodules>`","startedAt":"2023-10-17T22:48:18Z","lastAt":"2023-10-17T23:02:20Z","messageCount":2,"participants":["Joanna Wang","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"483375","messageId":"CAMmZTi8swsSMcLUcW+YwUDg8GcrY_ks2+i35-nsHE3o9MNpsUQ@mail.gmail.com","threadId":"60388","inReplyTo":null,"subject":"Re: Supporting `git add -a <exclude submodules>`","fromName":"Joanna Wang","fromEmail":"jojwang@google.com","sentAt":"2023-10-17T22:48:03Z","receivedAt":"2023-10-17T22:48:18Z","isPatch":false,"sender":{"key":"jojwang@google.com","avatar":"https://avatars.githubusercontent.com/u/120585822?v=4"},"body":" > (2) does collect_some_attrs() or git_check_attr() leave enough\n >   information in check[] to tell between [a] the attr stack had\n >   no opinion on \"bits\" attribute and [b] the attr stack\n >   explicitly said \"bits\" attribute is unspecified?\nI will double check this but IIUC, I could change this part\n(https://github.com/git/git/blob/master/attr.c#L1100-L1105),\nsuch that:\n```\nif (n == ATTR__UNKNOWN && v = NULL):\n  // keep n equal to ATTR_UNKNOWN\n```\n\nAnd here: https://github.com/git/git/blob/master/attr.c#L1238,\nif value == 'ATTR__UNKNOWN', then keep it at ATTR__UNKNOWN\n\n> (1) where in that callchain would we intercept and insert our own\n>   \"bits\" value based on the filesystem property?\nI was planning to do that somewhere around here:\nhttps://github.com/git/git/blob/master/pathspec.c#L764-L767\n and possibly combine it with adding a new match_mode (e.g.\nMATCH_BITS) which would be set by parse_pathspec().\nSomething like:\n```\nelse if (ATTR_UNKNOWN(value))\n    matched = (match_mode == MATCH_BITS &&\n!strcmp(item->attr_match[i].value, get_mode(path)));\n```\n\nI will dive into the code more to confirm, but that's my current\nhigh-level plan, in case you immediately see something very wrong.\n"},{"id":"483376","messageId":"xmqqpm1cx37v.fsf@gitster.g","threadId":"60388","inReplyTo":"CAMmZTi8swsSMcLUcW+YwUDg8GcrY_ks2+i35-nsHE3o9MNpsUQ@mail.gmail.com","subject":"Re: Supporting `git add -a <exclude submodules>`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-10-17T23:02:12Z","receivedAt":"2023-10-17T23:02:20Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Joanna Wang <jojwang@google.com> writes:\n\n> I will dive into the code more to confirm, but that's my current\n> high-level plan, in case you immediately see something very wrong.\n\nNothing I immediately see glaringly wrong in there ;-)\n\nThanks for digging!\n"}]}