summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNaoaki Iwakiri <naokiri@gmail.com>2019-10-21 22:21:09 +0900
committerTim Oram <dev@mitmaro.ca>2019-10-21 10:51:09 -0230
commit1fca80992cab9af20692acd6c847eb7cdc8d361d (patch)
tree801911a9dfbbfc68a6efd9b78dfcb50bdac95b45
parent59ca265658f627b598c8a984b9cc640d61ae8e02 (diff)
Fix error when git config core.commentChar is auto (#184)
* Fix error when git config core.commentChar is auto * Fix lint * Only check '#' when commentChar is auto
-rw-r--r--src/git_interactive.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/git_interactive.rs b/src/git_interactive.rs
index fbc1ab2..8bef646 100644
--- a/src/git_interactive.rs
+++ b/src/git_interactive.rs
@@ -8,7 +8,7 @@ use crate::action::Action;
use crate::commit::Commit;
use crate::line::Line;
-fn load_filepath(path: &PathBuf, comment_char: &str) -> Result<Vec<Line>, String> {
+fn load_filepath(path: &PathBuf, config_comment_char: &str) -> Result<Vec<Line>, String> {
let mut file = match File::open(&path) {
Ok(file) => file,
Err(why) => {
@@ -23,6 +23,12 @@ fn load_filepath(path: &PathBuf, comment_char: &str) -> Result<Vec<Line>, String
return Err(format!("Error reading file, {}\nReason: {}", path.display(), why));
},
}
+ let comment_char = if config_comment_char.eq("auto") {
+ "#"
+ }
+ else {
+ config_comment_char
+ };
// catch noop rebases
s.lines()