diff options
author | Raman Tenneti <rtenneti@google.com> | 2021-02-07 16:30:27 -0800 |
---|---|---|
committer | Raman Tenneti <rtenneti@google.com> | 2021-02-08 17:34:55 +0000 |
commit | 8d43dea6ea4b7d1664632e555e207f617e54657b (patch) | |
tree | 5632d2a6e5d6e8ccff305e84734665f2f1b4fb04 /tests/test_git_superproject.py | |
parent | 1fd7bc24386dbba3a9454bb49c702a642f00e34c (diff) | |
download | git-repo-8d43dea6ea4b7d1664632e555e207f617e54657b.tar.gz |
sync: pass --bare option when doing git clone of superproject.v2.12.1
Changed "git pull" to "git fetch" as we are using --bare option. Used the
following command to fetch:
git fetch origin +refs/heads/*:refs/heads/* --prune
Pass --branch argument to Superproject's UpdateProjectsRevisionId function.
Returned False/None when directories don't exist instead of raise
GitError exception from _Fetch and _LsTree functions. The caller of Fetch
does Clone if Fetch fails.
Tested the code with the following commands.
$ ./run_tests -v
Tested the init and sync code by copying all the repo changes into my Android
AOSP checkout and running repo sync with --use-superproject option.
Bug: https://crbug.com/gerrit/13709
Bug: https://crbug.com/gerrit/13707
Tested-by: Raman Tenneti <rtenneti@google.com>
Change-Id: I3e441ecdfc87c735f46eff0eb98efa63cc2eb22a
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/296222
Reviewed-by: Mike Frysinger <vapier@google.com>
Diffstat (limited to 'tests/test_git_superproject.py')
-rw-r--r-- | tests/test_git_superproject.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/test_git_superproject.py b/tests/test_git_superproject.py index d2c2f501..fc9101dd 100644 --- a/tests/test_git_superproject.py +++ b/tests/test_git_superproject.py | |||
@@ -78,11 +78,11 @@ class SuperprojectTestCase(unittest.TestCase): | |||
78 | with mock.patch.object(self._superproject, '_Clone', return_value=False): | 78 | with mock.patch.object(self._superproject, '_Clone', return_value=False): |
79 | self._superproject._GetAllProjectsSHAs(url='localhost') | 79 | self._superproject._GetAllProjectsSHAs(url='localhost') |
80 | 80 | ||
81 | def test_superproject_get_project_shas_mock_pull(self): | 81 | def test_superproject_get_project_shas_mock_fetch(self): |
82 | """Test with _Pull failing.""" | 82 | """Test with _Fetch failing.""" |
83 | with self.assertRaises(GitError): | 83 | with self.assertRaises(GitError): |
84 | with mock.patch.object(self._superproject, '_Clone', return_value=True): | 84 | with mock.patch.object(self._superproject, '_Clone', return_value=True): |
85 | with mock.patch.object(self._superproject, '_Pull', return_value=False): | 85 | with mock.patch.object(self._superproject, '_Fetch', return_value=False): |
86 | self._superproject._GetAllProjectsSHAs(url='localhost') | 86 | self._superproject._GetAllProjectsSHAs(url='localhost') |
87 | 87 | ||
88 | def test_superproject_get_project_shas_mock_ls_tree(self): | 88 | def test_superproject_get_project_shas_mock_ls_tree(self): |
@@ -141,7 +141,7 @@ class SuperprojectTestCase(unittest.TestCase): | |||
141 | data = ('160000 commit 2c2724cb36cd5a9cec6c852c681efc3b7c6b86ea\tart\x00' | 141 | data = ('160000 commit 2c2724cb36cd5a9cec6c852c681efc3b7c6b86ea\tart\x00' |
142 | '160000 commit e9d25da64d8d365dbba7c8ee00fe8c4473fe9a06\tbootable/recovery\x00') | 142 | '160000 commit e9d25da64d8d365dbba7c8ee00fe8c4473fe9a06\tbootable/recovery\x00') |
143 | with mock.patch.object(self._superproject, '_Clone', return_value=True): | 143 | with mock.patch.object(self._superproject, '_Clone', return_value=True): |
144 | with mock.patch.object(self._superproject, '_Pull', return_value=True): | 144 | with mock.patch.object(self._superproject, '_Fetch', return_value=True): |
145 | with mock.patch.object(self._superproject, '_LsTree', return_value=data): | 145 | with mock.patch.object(self._superproject, '_LsTree', return_value=data): |
146 | # Create temporary directory so that it can write the file. | 146 | # Create temporary directory so that it can write the file. |
147 | os.mkdir(self._superproject._superproject_path) | 147 | os.mkdir(self._superproject._superproject_path) |