mirror of
https://github.com/extrawurst/gitui.git
synced 2024-11-27 00:14:52 +03:00
Copy full Commit Hash by default (#1836)
This commit is contained in:
parent
c84a973d5d
commit
6339a1f33c
@ -42,6 +42,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
* fix hunk (un)staging/reset for # of context lines != 3 ([#1746](https://github.com/extrawurst/gitui/issues/1746))
|
* fix hunk (un)staging/reset for # of context lines != 3 ([#1746](https://github.com/extrawurst/gitui/issues/1746))
|
||||||
* fix delay when opening external editor ([#1506](https://github.com/extrawurst/gitui/issues/1506))
|
* fix delay when opening external editor ([#1506](https://github.com/extrawurst/gitui/issues/1506))
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
* Copy full Commit Hash by default [[@AmmarAbouZor](https://github.com/AmmarAbouZor)] ([#1836](https://github.com/extrawurst/gitui/issues/1836))
|
||||||
|
|
||||||
## [0.23.0] - 2022-06-19
|
## [0.23.0] - 2022-06-19
|
||||||
|
|
||||||
**reset to commit**
|
**reset to commit**
|
||||||
|
@ -162,7 +162,7 @@ impl CommitList {
|
|||||||
|
|
||||||
pub fn copy_commit_hash(&self) -> Result<()> {
|
pub fn copy_commit_hash(&self) -> Result<()> {
|
||||||
let marked = self.marked.as_slice();
|
let marked = self.marked.as_slice();
|
||||||
let yank: Option<Cow<str>> = match marked {
|
let yank: Option<String> = match marked {
|
||||||
[] => self
|
[] => self
|
||||||
.items
|
.items
|
||||||
.iter()
|
.iter()
|
||||||
@ -170,10 +170,8 @@ impl CommitList {
|
|||||||
self.selection
|
self.selection
|
||||||
.saturating_sub(self.items.index_offset()),
|
.saturating_sub(self.items.index_offset()),
|
||||||
)
|
)
|
||||||
.map(|e| Cow::Borrowed(e.hash_short.as_ref())),
|
.map(|e| e.id.to_string()),
|
||||||
[(_idx, commit)] => {
|
[(_idx, commit)] => Some(commit.to_string()),
|
||||||
Some(commit.get_short_string().into())
|
|
||||||
}
|
|
||||||
[first, .., last] => {
|
[first, .., last] => {
|
||||||
let marked_consecutive =
|
let marked_consecutive =
|
||||||
marked.windows(2).all(|w| w[0].0 + 1 == w[1].0);
|
marked.windows(2).all(|w| w[0].0 + 1 == w[1].0);
|
||||||
@ -181,18 +179,16 @@ impl CommitList {
|
|||||||
let yank = if marked_consecutive {
|
let yank = if marked_consecutive {
|
||||||
format!(
|
format!(
|
||||||
"{}^..{}",
|
"{}^..{}",
|
||||||
first.1.get_short_string(),
|
first.1.to_string(),
|
||||||
last.1.get_short_string()
|
last.1.to_string()
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
marked
|
marked
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(_idx, commit)| {
|
.map(|(_idx, commit)| commit.to_string())
|
||||||
commit.get_short_string()
|
|
||||||
})
|
|
||||||
.join(" ")
|
.join(" ")
|
||||||
};
|
};
|
||||||
Some(yank.into())
|
Some(yank)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user