# Re: Supporting `git add -a <exclude submodules>`

2 messages from 2023-10-17 to 2023-10-17. Participants: Joanna Wang, Junio C Hamano.
Thread: https://gitlist.dev/t/60388

## Joanna Wang, 2023-10-17 22:48

Subject: Re: Supporting `git add -a <exclude submodules>`
Message-ID: <CAMmZTi8swsSMcLUcW+YwUDg8GcrY_ks2+i35-nsHE3o9MNpsUQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAMmZTi8swsSMcLUcW%2BYwUDg8GcrY_ks2%2Bi35-nsHE3o9MNpsUQ%40mail.gmail.com

```
 > (2) does collect_some_attrs() or git_check_attr() leave enough
 >   information in check[] to tell between [a] the attr stack had
 >   no opinion on "bits" attribute and [b] the attr stack
 >   explicitly said "bits" attribute is unspecified?
I will double check this but IIUC, I could change this part
(https://github.com/git/git/blob/master/attr.c#L1100-L1105),
such that:
ˋˋˋ
if (n == ATTR__UNKNOWN && v = NULL):
  // keep n equal to ATTR_UNKNOWN
ˋˋˋ

And here: https://github.com/git/git/blob/master/attr.c#L1238,
if value == 'ATTR__UNKNOWN', then keep it at ATTR__UNKNOWN

> (1) where in that callchain would we intercept and insert our own
>   "bits" value based on the filesystem property?
I was planning to do that somewhere around here:
https://github.com/git/git/blob/master/pathspec.c#L764-L767
 and possibly combine it with adding a new match_mode (e.g.
MATCH_BITS) which would be set by parse_pathspec().
Something like:
ˋˋˋ
else if (ATTR_UNKNOWN(value))
    matched = (match_mode == MATCH_BITS &&
!strcmp(item->attr_match[i].value, get_mode(path)));
ˋˋˋ

I will dive into the code more to confirm, but that's my current
high-level plan, in case you immediately see something very wrong.

```

## Junio C Hamano, 2023-10-17 23:02

Subject: Re: Supporting `git add -a <exclude submodules>`
Message-ID: <xmqqpm1cx37v.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqpm1cx37v.fsf%40gitster.g
In-Reply-To: <CAMmZTi8swsSMcLUcW+YwUDg8GcrY_ks2+i35-nsHE3o9MNpsUQ@mail.gmail.com>

```
Joanna Wang <jojwang@google.com> writes:

> I will dive into the code more to confirm, but that's my current
> high-level plan, in case you immediately see something very wrong.

Nothing I immediately see glaringly wrong in there ;-)

Thanks for digging!

```
