Skip to content

Commit 50b8763

Browse files
committed
Fix directory access on get git info
1 parent e9f4f8d commit 50b8763

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: src/info.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl Info {
195195
disabled: InfoFieldOn,
196196
) -> Result<Info> {
197197
let authors = Info::get_authors(&dir, 3);
198-
let (git_v, git_user) = Info::get_git_info();
198+
let (git_v, git_user) = Info::get_git_info(&dir);
199199
let current_commit_info = Info::get_current_commit_info(&dir)?;
200200
let config = Info::get_configuration(&dir)?;
201201
let version = Info::get_version(&dir)?;
@@ -273,7 +273,7 @@ impl Info {
273273
authors
274274
}
275275

276-
fn get_git_info() -> (String, String){
276+
fn get_git_info(dir: &str) -> (String, String){
277277
let version = Command::new("git")
278278
.arg("--version")
279279
.output()
@@ -282,6 +282,8 @@ impl Info {
282282
let version = version.to_string().replace('\n',"");
283283

284284
let username = Command::new("git")
285+
.arg("-C")
286+
.arg(dir)
285287
.arg("config")
286288
.arg("--get")
287289
.arg("user.name")

0 commit comments

Comments
 (0)