Browse Source

step thirty seven: set head to master on init

master
Gonçalo Valério 2 years ago
parent
commit
e0392ead71
  1. 2
      .gitignore
  2. 13
      src/base.rs
  3. 2
      src/main.rs

2
.gitignore vendored

@ -1,3 +1,3 @@
/target
/test
/test*
.rgit

13
src/base.rs

@ -215,6 +215,19 @@ pub fn create_branch(name: String, oid: String) {
);
}
pub fn init() -> std::io::Result<()> {
data::init()?;
data::update_ref(
"HEAD".to_owned(),
data::RefValue {
symbolic: true,
value: "refs/heads/master".to_owned(),
},
true,
);
Ok(())
}
fn is_ignored(path: &String) -> bool {
if path.contains(".rgit") {
true

2
src/main.rs

@ -83,7 +83,7 @@ fn main() {
}
fn init() {
match data::init() {
match base::init() {
Ok(()) => println!("Repository created"),
_ => println!("Failed. Perhaps the repository already exists."),
}

Loading…
Cancel
Save