Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2a140a1

Browse files
committed
Add a way to create bare repositories
1 parent 2319bab commit 2a140a1

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/repository.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ pub struct Repository {
1414
pub branches: Vec<Branch>,
1515
pub references: Vec<Reference>,
1616
pub pack_indexes: Vec<PackIndex>,
17+
pub bare: bool,
1718
}
1819

1920
impl Repository {
@@ -32,6 +33,24 @@ impl Repository {
3233
branches: Vec::new(),
3334
references: Vec::new(),
3435
pack_indexes: Vec::new(),
36+
bare: false,
37+
}
38+
}
39+
40+
pub fn open_bare(path: &str) -> Repository {
41+
let repository_path = Path::new(path);
42+
let wc_path = repository_path.clone();
43+
44+
init(&repository_path);
45+
46+
Repository {
47+
path: repository_path,
48+
wc_path: wc_path,
49+
tags: Vec::new(),
50+
branches: Vec::new(),
51+
references: Vec::new(),
52+
pack_indexes: Vec::new(),
53+
bare: true,
3554
}
3655
}
3756
}

0 commit comments

Comments
 (0)