gitwrapper: Re-run git init before do full clone
Sometimes full clone failed with error fatal: Not a git repository and we found that .git/refs/ dir is missing after shallow clone failed. JIRA: RHELCMP-724 Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
parent
c6312b34d0
commit
b3a55fd863
@ -168,6 +168,8 @@ class GitWrapper(ScmBase):
|
||||
% (e, e.output)
|
||||
)
|
||||
try:
|
||||
# Re-run git init in case of previous failure breaking .git dir
|
||||
run(["git", "init"], workdir=destdir)
|
||||
run(["git", "remote", "add", "origin", repo], workdir=destdir)
|
||||
self.retry_run(["git", "remote", "update", "origin"], workdir=destdir)
|
||||
run(["git", "checkout", branch], workdir=destdir)
|
||||
|
@ -192,6 +192,7 @@ class GitSCMTestCase(SCMBaseTest):
|
||||
"git://example.com/git/repo.git",
|
||||
"master",
|
||||
],
|
||||
["git", "init"],
|
||||
["git", "remote", "add", "origin", url],
|
||||
["git", "remote", "update", "origin"],
|
||||
["git", "checkout", "master"],
|
||||
|
Loading…
Reference in New Issue
Block a user