Bug 228597

Summary: [webkitscmpy] Add access to `git config`
Product: WebKit Reporter: Jonathan Bedard <jbedard>
Component: Tools / TestsAssignee: Jonathan Bedard <jbedard>
Status: RESOLVED FIXED    
Severity: Normal CC: aakash_jain, dewei_zhu, slewis, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=225985
Bug Depends on:    
Bug Blocks: 228662    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch ews-feeder: commit-queue-

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].