You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary: Lot of code in a single function. Let's clean it up.
Differential Revision: D78090943
fbshipit-source-id: 6ed398bc3cefb5d111f2b7245efabc4a7828cd6c
"Pushes to repo {0} are disallowed because its source of truth has been moved. Use `git pushrebase` or make changes directly in the repo where the source of truth was moved.",
173
-
repo.repo_identity().name()
174
-
));
175
-
}
176
170
// If the ref is a content ref, then we have already processed it in the uploader. There is no
177
171
// bookmark to move in this case
178
172
if ref_update.is_content(){
@@ -186,6 +180,15 @@ async fn set_ref_inner(
186
180
}
187
181
returnOk(());
188
182
}
183
+
// Create the bookmark operation representing the ref update if its allowed
184
+
let bookmark_operation = bookmark_operation(
185
+
&ctx,
186
+
repo.clone(),
187
+
mappings_store.clone(),
188
+
object_store.clone(),
189
+
&ref_update,
190
+
)
191
+
.await?;
189
192
// Create the repo context which is the pre-requisite for moving bookmarks
190
193
let repo_context = RepoContextBuilder::new(ctx.clone(), repo.clone(), repos)
191
194
.await
@@ -194,6 +197,67 @@ async fn set_ref_inner(
194
197
.build()
195
198
.await
196
199
.context("Failure in creating RepoContext for git push")?;
200
+
201
+
// Do one final check of SoT to ensure that we don't update the bookmark if the repo is locked or sourced in Metagit
202
+
if !mononoke_source_of_truth(&ctx, repo.clone()).await? {
203
+
returnErr(anyhow::anyhow!(
204
+
"Mononoke is not the source of truth for this repo"
205
+
));
206
+
}
207
+
208
+
// Flag for client side expectation of allow non fast forward updates. Git clients by default
209
+
// prevent users from pushing non-ffwd updates. If the request reaches the server, then that
210
+
// means the client has explicitly requested for a non-ffwd update and the final result will be
211
+
// governed by the server side config (ofcourse subject to bypass)
"Pushes to repo {0} are disallowed because its source of truth has been moved. Use `git pushrebase` or make changes directly in the repo where the source of truth was moved.",
258
+
repo.repo_identity().name()
259
+
));
260
+
}
197
261
// Get the bonsai changeset id of the old and the new git commits
198
262
let old_changeset = get_bonsai(&mappings_store,&object_store,&ref_update.from).await?;
199
263
let new_changeset = get_bonsai(&mappings_store,&object_store,&ref_update.to).await?;
0 commit comments