summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2017-08-27 17:08:44 +0200
committerJustin Worthe <justin@worthe-it.co.za>2017-08-27 17:08:44 +0200
commitaba99ff88684b08488532a6316de57b2c2e135f2 (patch)
tree343790cbfe1494edca6a5d1d61b84adcb77629e0
parent0c1e6e18373fde9407ccf287757f1d221469e6d1 (diff)
master: Excluded adding branch name in some situationsHEADmain
-rw-r--r--src/bin/prepare-commit-msg.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/bin/prepare-commit-msg.rs b/src/bin/prepare-commit-msg.rs
index 64ddd65..970435f 100644
--- a/src/bin/prepare-commit-msg.rs
+++ b/src/bin/prepare-commit-msg.rs
@@ -15,8 +15,8 @@ fn main() {
let current_branch = get_current_branch();
- match (current_branch, commit_filename) {
- (Ok(branch), Some(filename)) => {
+ match (current_branch, commit_filename, commit_source) {
+ (Ok(branch), Some(filename), None) => {
let write_result = prepend_branch_name(branch, filename);
match write_result {
Ok(_) => {},
@@ -26,11 +26,16 @@ fn main() {
}
};
},
- (Err(e), _) => {
+ (_, _, Some(_)) => {
+ // do nothing silently. This comes up on merge commits,
+ // ammendment commits, if a message was specified on the
+ // cli.
+ }
+ (Err(e), _, _) => {
eprintln!("Failed to find current branch. {}", e);
process::exit(1);
},
- (_, None) => {
+ (_, None, _) => {
eprintln!("Commit file was not provided");
process::exit(2);
}