We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3a5169d commit 04bf807Copy full SHA for 04bf807
git-repository/examples/init-non-bare-repo.rs
@@ -1,9 +1,14 @@
1
-// cargo run -p git-repository --example new
+// creates a repo with user-specified path (which must not exist)
2
+// adds initial commit with empty tree
3
4
use anyhow::Context;
5
use git_repository as git;
6
7
fn main() -> anyhow::Result<()> {
8
+ // Note use of args_os:
9
+ // paths may not be UTF-8 encoded and thus can't be forced into a String.
10
+ // gitoxide does not assume encodings that aren't there
11
+ // to match the way git does it as a bare minimum and be just as flexible.
12
let work_dir = std::env::args_os()
13
.nth(1)
14
.context("First argument needs to be the directory to initialize the repository in")?;
0 commit comments