diff --git a/CHANGELOG.md b/CHANGELOG.md index d98691b086..3096b2162c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 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 **reset to commit** diff --git a/src/components/commitlist.rs b/src/components/commitlist.rs index 3ba09e1f6f..cbfeb82104 100644 --- a/src/components/commitlist.rs +++ b/src/components/commitlist.rs @@ -162,7 +162,7 @@ impl CommitList { pub fn copy_commit_hash(&self) -> Result<()> { let marked = self.marked.as_slice(); - let yank: Option> = match marked { + let yank: Option = match marked { [] => self .items .iter() @@ -170,10 +170,8 @@ impl CommitList { self.selection .saturating_sub(self.items.index_offset()), ) - .map(|e| Cow::Borrowed(e.hash_short.as_ref())), - [(_idx, commit)] => { - Some(commit.get_short_string().into()) - } + .map(|e| e.id.to_string()), + [(_idx, commit)] => Some(commit.to_string()), [first, .., last] => { let marked_consecutive = marked.windows(2).all(|w| w[0].0 + 1 == w[1].0); @@ -181,18 +179,16 @@ impl CommitList { let yank = if marked_consecutive { format!( "{}^..{}", - first.1.get_short_string(), - last.1.get_short_string() + first.1.to_string(), + last.1.to_string() ) } else { marked .iter() - .map(|(_idx, commit)| { - commit.get_short_string() - }) + .map(|(_idx, commit)| commit.to_string()) .join(" ") }; - Some(yank.into()) + Some(yank) } };