Bug 228597 - [webkitscmpy] Add access to `git config`
Summary: [webkitscmpy] Add access to `git config`
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jonathan Bedard
URL:
Keywords: InRadar
Depends on:
Blocks: 228662
  Show dependency treegraph
 
Reported: 2021-07-29 11:59 PDT by Jonathan Bedard
Modified: 2021-08-03 12:49 PDT (History)
4 users (show)

See Also:


Attachments
Patch (8.11 KB, patch)
2021-07-29 12:02 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (8.15 KB, patch)
2021-07-29 12:04 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (8.51 KB, patch)
2021-08-02 08:45 PDT, Jonathan Bedard
no flags Details | Formatted Diff | Diff
Patch (8.56 KB, patch)
2021-08-03 09:55 PDT, Jonathan Bedard
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Bedard 2021-07-29 11:59:27 PDT
We need a function which provides machine-readable access to the git config.
Comment 1 Radar WebKit Bug Importer 2021-07-29 12:01:29 PDT
<rdar://problem/81283644>
Comment 2 Jonathan Bedard 2021-07-29 12:02:49 PDT
Created attachment 434553 [details]
Patch
Comment 3 Jonathan Bedard 2021-07-29 12:04:57 PDT
Created attachment 434554 [details]
Patch
Comment 4 Jonathan Bedard 2021-08-02 08:45:21 PDT
Created attachment 434758 [details]
Patch
Comment 5 Aakash Jain 2021-08-03 09:16:49 PDT
Comment on attachment 434758 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=434758&action=review

> Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py:280
> +        if command.returncode:

should log a warning/error here about failure.

> Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py:286
> +            result[parts[0]] = '='.join(parts[1:])

why join? can there be more than one = in a line in the output of 'git config -l'

> Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py:597
> +        RE_SINGLE_TOP = re.compile(r'^\[\s*(?P<key>\S+)\s*\]')

might be a good idea to put an example of expected strings in a comment along-with all these REs.
Comment 6 Jonathan Bedard 2021-08-03 09:26:10 PDT
Comment on attachment 434758 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=434758&action=review

>> Tools/Scripts/libraries/webkitscmpy/webkitscmpy/local/git.py:286
>> +            result[parts[0]] = '='.join(parts[1:])
> 
> why join? can there be more than one = in a line in the output of 'git config -l'

Git allows it, although I'm not sure if it happens in practice. Do something like `git config --global user.name "foo=bar"`and then `git config -l` to see what I mean.

>> Tools/Scripts/libraries/webkitscmpy/webkitscmpy/mocks/local/git.py:597
>> +        RE_SINGLE_TOP = re.compile(r'^\[\s*(?P<key>\S+)\s*\]')
> 
> might be a good idea to put an example of expected strings in a comment along-with all these REs.

Ok
Comment 7 Jonathan Bedard 2021-08-03 09:55:11 PDT
Created attachment 434837 [details]
Patch
Comment 8 Aakash Jain 2021-08-03 11:53:41 PDT
Comment on attachment 434837 [details]
Patch

rs=me
Comment 9 EWS 2021-08-03 12:00:40 PDT
Committed r280604 (240222@main): <https://commits.webkit.org/240222@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 434837 [details].