@@ -59,7 +59,7 @@ public string Sync(string workingDirectory, string? gitRef = null, string? repoU
59
59
if ( ! Directory . Exists ( repoDirectory ) )
60
60
Clone ( repoUrl , repoDirectory , gitRef ) ;
61
61
62
- Pull ( repoDirectory , gitRef ) ;
62
+ FetchAndCheckout ( repoDirectory , repoUrl , gitRef ) ;
63
63
64
64
return repoDirectory ;
65
65
}
@@ -97,9 +97,9 @@ private void Clone(string repoUrl, string directory, string gitRef)
97
97
_log . Information ( "Done cloning" ) ;
98
98
}
99
99
100
- private void Pull ( string repoDirectory , string gitRef )
100
+ private void FetchAndCheckout ( string repoDirectory , string repoUrl , string gitRef )
101
101
{
102
- _log . Information ( "Pulling branch/commit {Ref}..." , gitRef ) ;
102
+ _log . Information ( "Retrieving branch/commit {Ref}..." , gitRef ) ;
103
103
_log . Debug ( "Opening repository in: {RepositoryPath}" , repoDirectory ) ;
104
104
105
105
//Set an identity
@@ -114,18 +114,15 @@ private void Pull(string repoDirectory, string gitRef)
114
114
}
115
115
116
116
_log . Debug ( "Fetching ref" ) ;
117
- RunCommand ( repoDirectory , "fetch -fu origin" , gitRef ) ;
117
+ RunCommand ( repoDirectory , "fetch -fu " , repoUrl , gitRef ) ;
118
118
119
119
_log . Debug ( "Checking out {Ref}" , StripRef ( gitRef ) ) ;
120
- RunCommand ( repoDirectory , "checkout --force" , StripRef ( gitRef ) ) ;
121
-
122
- _log . Debug ( "Pulling latest changes" ) ;
123
- RunCommand ( repoDirectory , "pull origin --ff-only --force" , StripRef ( gitRef ) ) ;
124
-
120
+ RunCommand ( repoDirectory , "checkout --quiet --force FETCH_HEAD" ) ;
121
+
125
122
_log . Debug ( "Updating submodules" ) ;
126
123
RunCommand ( repoDirectory , "submodule update --init --recursive" ) ;
127
124
128
- _log . Information ( "Done pulling " ) ;
125
+ _log . Information ( "Done retrieving " ) ;
129
126
}
130
127
131
128
private string RunCommand ( string directory , params string [ ] arguments )
0 commit comments