From 8ec0cba2279ee7e19520eff232f8b33be669468e Mon Sep 17 00:00:00 2001 From: Martin Frost Date: Fri, 13 May 2022 18:26:16 +0200 Subject: [PATCH] Write absolute path to commit.template config var This means that `git-mob` will work in git submodules. Co-authored-by: Maria Hansson --- src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ba05dc4..e8ac5f8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -49,9 +49,10 @@ pub fn set_main_author(author: &Author) { pub fn ensure_commit_template_is_set() { with_git_repo_or_exit(|repo| { let mut config = repo.config().unwrap(); - config - .set_str("commit.template", ".git/.gitmessage") - .unwrap(); + let template_path = repo.path().join(".gitmessage"); + if let Some(template_path) = template_path.to_str() { + config.set_str("commit.template", template_path).unwrap(); + } }) }