summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Worthe <justin@jemstep.com>2020-03-26 09:14:10 +0200
committerJustin Worthe <justin@jemstep.com>2020-03-26 09:14:10 +0200
commit82f53b21a27d7742170a24c19a08f9f1d66d0cc2 (patch)
tree94e91c76e687f513d0eef1fc52d61b284e250e44
parent23a1c1cf6b2b9ecb28e1983f9b79e156a5a6a787 (diff)
Made temp repo cloning a bare clone to save in storage space
tmp is often a ramdisk, so this is probably actually often saving in memory usage rather than temporary storage.
-rw-r--r--src/git.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/git.rs b/src/git.rs
index e69abb9..818d697 100644
--- a/src/git.rs
+++ b/src/git.rs
@@ -1,7 +1,7 @@
use crate::error::CapnError;
use crate::keyring::Keyring;
use git2;
-use git2::{ErrorClass, ErrorCode, ObjectType, Oid, Repository};
+use git2::{build::RepoBuilder, ErrorClass, ErrorCode, ObjectType, Oid, Repository};
use std::cell::RefCell;
use std::collections::HashMap;
use std::error::Error;
@@ -509,7 +509,9 @@ impl TempRepo {
"Path to the repo being verified was not valid UTF-8",
)))?;
return Ok(TempRepo {
- repo: Repository::clone(src_path, &tmp_repo_path)?,
+ repo: RepoBuilder::new()
+ .bare(true)
+ .clone(src_path, &tmp_repo_path)?,
});
}
};