Skip to content

Commit e1b21a3

Browse files
committed
Create a new git repository on init
1 parent af12915 commit e1b21a3

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

Cargo.lock

Lines changed: 44 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ clap = { version = "4.5.27", features = [
3333
] }
3434
futures-io = "0.3.31"
3535
futures-util = "0.3.31"
36+
git2 = { version = "0.20.0", default-features = false }
3637
glob = "0.3.2"
3738
indicatif = "0.17.11"
3839
itertools = "0.14.0"

src/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ async fn main() -> Result<()> {
149149
writer.close().await?;
150150
}
151151
Commands::Init { version, name, .. } => {
152+
let current_dir = current_dir().expect("Failed to get current directory");
153+
152154
let name = if let Some(name) = name {
153155
name
154156
} else {
155157
// TODO: some degree of error handling I guess
156-
let current_dir = current_dir().expect("Failed to get current directory");
157-
158158
current_dir
159159
.file_name()
160160
.and_then(|name| name.to_str())
@@ -193,6 +193,8 @@ async fn main() -> Result<()> {
193193
};
194194

195195
fs::write("podzol.toml", &toml_edit::ser::to_string_pretty(&manifest)?)?;
196+
197+
git2::Repository::init(current_dir)?;
196198
}
197199
Commands::Remove => todo!(),
198200
}

0 commit comments

Comments
 (0)