lfs: only upload when LFS blobs are present

Summary: If no LFS blobs needs uploading, then don't try to connect to the LFS server in the first place.

Reviewed By: DurhamG

Differential Revision: D21478243

fbshipit-source-id: 81fa960d899b14f47aadf2fc90485747889041e1
This commit is contained in:
Xavier Deguillard 2020-05-08 13:22:13 -07:00 committed by Facebook GitHub Bot
parent 0f6e81bbd7
commit 4e7303efd9

View File

@ -1276,13 +1276,15 @@ impl RemoteDataStore for LfsRemoteStore {
.filter_map(|res| res.transpose())
.collect::<Result<Vec<_>>>()?;
self.remote.batch_upload(&objs, {
let local_store = local_store.clone();
move |sha256| {
let key = StoreKey::from(ContentHash::Sha256(sha256));
local_store.blob(&key)
}
})?;
if !objs.is_empty() {
self.remote.batch_upload(&objs, {
let local_store = local_store.clone();
move |sha256| {
let key = StoreKey::from(ContentHash::Sha256(sha256));
local_store.blob(&key)
}
})?;
}
Ok(not_uploaded)
}