Skip to content

Commit ccdf0f6

Browse files
Merge remote-tracking branch 'upstream/master'
2 parents 6b23935 + 7ad8265 commit ccdf0f6

File tree

5 files changed

+32
-11
lines changed

5 files changed

+32
-11
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
### Breaking Changes
11+
12+
#### Shell
13+
* use default shell instead of bash on Unix-like OS [[@yerke](https://github.com/yerke)] ([#2343](https://github.com/extrawurst/gitui/pull/2343))
14+
1015
### Fixes
1116
* respect env vars like `GIT_CONFIG_GLOBAL` ([#2298](https://github.com/extrawurst/gitui/issues/2298))
1217

Cargo.lock

+14-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ For a [RustBerlin meetup presentation](https://youtu.be/rpilJV-eIVw?t=5334) ([sl
7070

7171
| | Time | Memory (GB) | Binary (MB) | Freezes | Crashes |
7272
| --------- | ---------- | ----------- | ----------- | --------- | --------- |
73-
| `gitui` | **24 s**| **0.17**| 1.4 | **No**| **No**|
74-
| `lazygit` | 57 s | 2.6 | 16 | Yes | Sometimes |
73+
| `gitui` | **24 s**| **0.17**| 10 | **No**| **No**|
74+
| `lazygit` | 57 s | 2.6 | 25 | Yes | Sometimes |
7575
| `tig` | 4 m 20 s | 1.3 | **0.6**| Sometimes | **No**|
7676

7777
## 4. <a name="roadmap"></a> Road(map) to 1.0 <small><sup>[Top ▲](#table-of-contents)</sup></small>

git2-hooks/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "git2-hooks"
3-
version = "0.3.2"
3+
version = "0.3.3"
44
authors = ["extrawurst <[email protected]>"]
55
edition = "2021"
66
description = "adds git hooks support based on git2-rs"

git2-hooks/src/hookspath.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use git2::Repository;
33
use crate::{error::Result, HookResult, HooksError};
44

55
use std::{
6-
path::Path, path::PathBuf, process::Command, str::FromStr,
6+
env, path::Path, path::PathBuf, process::Command, str::FromStr,
77
};
88

99
pub struct HookPaths {
@@ -113,9 +113,10 @@ impl HookPaths {
113113

114114
log::trace!("run hook '{:?}' in '{:?}'", hook, self.pwd);
115115

116-
let git_bash = find_bash_executable()
117-
.unwrap_or_else(|| PathBuf::from("bash"));
118-
let output = Command::new(git_bash)
116+
let git_shell = find_bash_executable()
117+
.or_else(find_default_unix_shell)
118+
.unwrap_or_else(|| "bash".into());
119+
let output = Command::new(git_shell)
119120
.args(bash_args)
120121
.current_dir(&self.pwd)
121122
// This call forces Command to handle the Path environment correctly on windows,
@@ -191,3 +192,8 @@ fn find_bash_executable() -> Option<PathBuf> {
191192
None
192193
}
193194
}
195+
196+
// Find default shell on Unix-like OS.
197+
fn find_default_unix_shell() -> Option<PathBuf> {
198+
env::var_os("SHELL").map(PathBuf::from)
199+
}

0 commit comments

Comments
 (0)