Update GitClient to use run_process().

Review Request #12661 — Created Sept. 30, 2022 and updated

chipx86
RBTools
release-4.x
rbtools

This switches GitClient to use run_process() instead of the legacy
execute(). This ensures that every call site is deliberate in the
kinds of data it's expected to work with and how errors are handled.

The call sites have been audited to ensure that we're only redirecting
stderr to stdout when we should and that we're explicitly handling error
conditions. This may not be perfect, but it's already fixed up a few
places where we may have been doing things wrong before.

All git config calls are now handled by a _get_git_config(), which
offers a standardized way of fetching configuration data, returning the
string if found, None if not found, or raising SCMError if we get a
fatal: result (such as if running outside of a Git tree).

Unit tests pass.

Posted this change for review.

Summary
Update GitClient to use run_process().
Description From Last Updated

'itertools' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

Could change these unicodes to str.

maubinmaubin

Could change this unicode to str (and same for the rest of the args).

maubinmaubin
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

maubin
  1. 
      
  2. rbtools/clients/git.py (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     

    Could change these unicodes to str.

    1. There's going to be a separate round of changes that will tackle types and docs.

  3. rbtools/clients/git.py (Diff revision 1)
     
     

    Could change this unicode to str (and same for the rest of the args).

  4. 
      
david
  1. Ship It!
  2. 
      
maubin
  1. Ship It!
  2. 
      
Loading...