Abstract away git repo during tests (#82594)
### Description
During unit tests we want to return fake data for any methods that rely on a local git repository. Otherwise those tests will fail when run in an environment that doesn't have the pytorch repo checked out (such as fbinternal or a tarball download)
Also refactored existing tests to use the new DummyGitRepo
### Issue
N/A
### Testing
Validating old behavior:
Removed the `.git` folder locally to effectively delete the git repository. Then ran `python3 .github/scripts/test_trymerge.py` to ensure the test failed
Validating fix:
Ran `python3 .github/scripts/test_trymerge.py` both with and without the `.git` folder
Pull Request resolved: https://github.com/pytorch/pytorch/pull/82594
Approved by: https://github.com/zengk95, https://github.com/huydhn, https://github.com/malfet