diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2017-08-20 21:07:07 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2017-08-20 21:14:57 +0200 |
commit | 35cedc888379d0279b1c725388c25d02f4ecb691 (patch) | |
tree | 183541db26a06ab2fc5f3436592f46de4d7a1666 | |
parent | 44ac404d6a1f537ba3da27f9cc8f3908396d931f (diff) |
Initial commit, added some main files for hooks
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Cargo.lock | 4 | ||||
-rw-r--r-- | Cargo.toml | 6 | ||||
-rw-r--r-- | README.org | 13 | ||||
-rw-r--r-- | src/bin/commit-msg.rs | 6 | ||||
-rw-r--r-- | src/bin/pre-push.rs | 6 | ||||
-rw-r--r-- | src/bin/prepare-commit-msg.rs | 6 |
7 files changed, 43 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eccd7b4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target/ +**/*.rs.bk diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..1804eaf --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,4 @@ +[root] +name = "rust_git_hooks" +version = "0.1.0" + diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..0d70e26 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "rust_git_hooks" +version = "0.1.0" +authors = ["Justin Worthe <justin@worthe-it.co.za>"] + +[dependencies] diff --git a/README.org b/README.org new file mode 100644 index 0000000..d8fb088 --- /dev/null +++ b/README.org @@ -0,0 +1,13 @@ +Playing with Rust as an option for writing git hooks. + +To try the hooks, do the following to compile the hooks and symlink +them into your git hooks folder. + +#+BEGIN_SRC sh +cargo build + +ln -s $PWD/target/debug/prepare-commit-msg .git/hooks/prepare-commit-msg +ln -s $PWD/target/debug/commit-msg .git/hooks/commit-msg +ln -s $PWD/target/debug/pre-push .git/hooks/pre-push +#+END_SRC + diff --git a/src/bin/commit-msg.rs b/src/bin/commit-msg.rs new file mode 100644 index 0000000..488613e --- /dev/null +++ b/src/bin/commit-msg.rs @@ -0,0 +1,6 @@ +use std::env; + +fn main() { + let args: Vec<_> = env::args().skip(1).collect(); + println!("commit-msg called with {:?}", args); +} diff --git a/src/bin/pre-push.rs b/src/bin/pre-push.rs new file mode 100644 index 0000000..a290af2 --- /dev/null +++ b/src/bin/pre-push.rs @@ -0,0 +1,6 @@ +use std::env; + +fn main() { + let args: Vec<_> = env::args().skip(1).collect(); + println!("pre-push called with {:?}", args); +} diff --git a/src/bin/prepare-commit-msg.rs b/src/bin/prepare-commit-msg.rs new file mode 100644 index 0000000..5ce0012 --- /dev/null +++ b/src/bin/prepare-commit-msg.rs @@ -0,0 +1,6 @@ +use std::env; + +fn main() { + let args: Vec<_> = env::args().skip(1).collect(); + println!("prepare-commit-msg called with {:?}", args); +} |