Skip to content

Build msrv.local+joshix #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
2d90eb5
use /bin/sh for git-hooks
Joshix-1 Jan 15, 2025
6a4b9d6
update CHANGELOG.md
Joshix-1 Jan 15, 2025
8571406
fix escape bugs in hooks
Joshix-1 Jan 15, 2025
cba5142
simplify logic for running hooks on non-windows platforms
Joshix-1 Jan 15, 2025
7f70d52
invert if check
Joshix-1 Jan 15, 2025
bd61ad8
debug_assert
Joshix-1 Jan 15, 2025
c257d02
update CHANGELOG.md
Joshix-1 Jan 15, 2025
cde4bc1
Merge remote-tracking branch 'extrawurst/master' into git-hooks-shell…
Joshix-1 Mar 25, 2025
816e175
simplify build_shell_script_execution_command
Joshix-1 Mar 25, 2025
da71107
create build_shell_script_execution_command
Joshix-1 Mar 25, 2025
2b6d295
small refactorings
Joshix-1 Mar 25, 2025
ce9fc0e
add line
Joshix-1 Mar 25, 2025
04a31eb
execute hoooks directly and fallback to using sh
Joshix-1 Mar 25, 2025
8ba997d
rename function
Joshix-1 Mar 25, 2025
4f65b81
update commend
Joshix-1 Mar 25, 2025
58afb49
sh_command
Joshix-1 Mar 25, 2025
a6e71d3
refactor
Joshix-1 Mar 25, 2025
b79e5ce
name const
Joshix-1 Mar 25, 2025
177d9d8
update CHANGELOG
Joshix-1 Mar 25, 2025
e5e562e
add new test
Joshix-1 Mar 25, 2025
f397799
deindent
Joshix-1 Mar 25, 2025
dbd8fee
fix is_executable
Joshix-1 Mar 25, 2025
7c8b6bc
debug print
Joshix-1 Mar 25, 2025
1370a14
handle ENOEXEC
Joshix-1 Mar 25, 2025
65c5997
add debug print
Joshix-1 Mar 25, 2025
102e7fd
remove debug print
Joshix-1 Mar 25, 2025
26b8871
set different env var
Joshix-1 Mar 25, 2025
5327f4a
Revert "set different env var"
Joshix-1 Mar 25, 2025
11da04a
remove ansi clear from output
Joshix-1 Mar 25, 2025
cfdb196
fix typo
Joshix-1 Mar 25, 2025
08dce84
move ansi escape hack to impl From<git2_hooks::HookResult> for HookRe…
Joshix-1 Mar 25, 2025
b37817d
fix ansi clear
Joshix-1 Mar 25, 2025
a7fe9cb
try strip different
Joshix-1 Mar 25, 2025
a4e2f54
more trimming
Joshix-1 Mar 25, 2025
d25efdc
Revert "more trimming"
Joshix-1 Mar 25, 2025
caf83c8
weird hack only on windows
Joshix-1 Mar 25, 2025
f91aa10
revert stuff
Joshix-1 Mar 25, 2025
adeb50d
trim_ascii_end
Joshix-1 Mar 25, 2025
369ea6a
Bump struct-patch from 0.8.7 to 0.9.0 (#2583)
dependabot[bot] Mar 26, 2025
c5c1fe9
format assert
Joshix-1 Mar 26, 2025
c0a8996
move truncation
Joshix-1 Mar 26, 2025
3e4b3c2
debug
Joshix-1 Mar 26, 2025
4601892
Merge remote-tracking branch 'extrawurst/master' into git-hooks-shell…
Joshix-1 Mar 26, 2025
db60ac3
fix test
Joshix-1 Mar 26, 2025
5a1dfbd
fix windows
Joshix-1 Mar 26, 2025
94b9dc7
add missing argument
Joshix-1 Mar 26, 2025
f9ff366
add argument
Joshix-1 Mar 26, 2025
38a3484
remove hacks
Joshix-1 Mar 26, 2025
7b4903b
correctly escape single-quote if utf8
Joshix-1 Mar 26, 2025
0b3d2c0
less indentation
Joshix-1 Mar 26, 2025
1563811
Bump clap from 4.5.32 to 4.5.34 (#2585)
dependabot[bot] Mar 27, 2025
a26afc8
ci: Actually use toolchain in nightly/MSRV runs
Mar 25, 2025
32807fd
Upgrade MSRV to 1.81
Mar 27, 2025
fce84ae
Temporarily allow debug formatting of hook path
Mar 25, 2025
eea202b
Fix clippy remarks
Mar 27, 2025
e09fe3a
Disable clippy::missing_const_for_fn if impossible
Mar 27, 2025
32e8358
Add changelog entry
Mar 27, 2025
e6357e1
Merge remote-tracking branch 'joshix/git-hooks-shell-fix' into build-…
Mar 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [nightly, stable, '1.70']
rust: [nightly, stable, '1.81']
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.rust == 'nightly' }}

Expand All @@ -41,6 +41,9 @@ jobs:
toolchain: ${{ matrix.rust }}
components: clippy

- name: Override rust toolchain
run: rustup override set ${{ matrix.rust }}

- name: Rustup Show
run: rustup show

Expand Down Expand Up @@ -89,7 +92,7 @@ jobs:
strategy:
fail-fast: false
matrix:
rust: [nightly, stable, '1.70']
rust: [nightly, stable, '1.81']
continue-on-error: ${{ matrix.rust == 'nightly' }}
steps:
- uses: actions/checkout@v4
Expand All @@ -112,6 +115,12 @@ jobs:
- name: Manually install target
run: rustup target add x86_64-unknown-linux-musl

- name: Override rust toolchain
run: rustup override set ${{ matrix.rust }}

- name: Rustup Show
run: rustup show

- name: Setup MUSL
run: |
sudo apt-get -qq install musl-tools
Expand All @@ -135,7 +144,7 @@ jobs:
strategy:
fail-fast: false
matrix:
rust: [nightly, stable, '1.70']
rust: [nightly, stable, '1.81']
continue-on-error: ${{ matrix.rust == 'nightly' }}
steps:
- uses: actions/checkout@v4
Expand All @@ -151,6 +160,10 @@ jobs:
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}

- name: Override rust toolchain
run: rustup override set ${{ matrix.rust }}

- name: Setup ARM toolchain
run: |
rustup target add aarch64-unknown-linux-gnu
Expand All @@ -166,6 +179,9 @@ jobs:
echo "$GITHUB_WORKSPACE/gcc-arm-8.2-2018.08-x86_64-aarch64-linux-gnu/bin" >> $GITHUB_PATH
echo "$GITHUB_WORKSPACE/gcc-arm-8.2-2018.08-x86_64-arm-linux-gnueabihf/bin" >> $GITHUB_PATH

- name: Rustup Show
run: rustup show

- name: Build Debug
run: |
make build-linux-arm-debug
Expand All @@ -179,7 +195,7 @@ jobs:
strategy:
fail-fast: false
matrix:
rust: [nightly, stable, '1.70']
rust: [nightly, stable, '1.81']
continue-on-error: ${{ matrix.rust == 'nightly' }}
steps:
- uses: actions/checkout@v4
Expand All @@ -195,9 +211,16 @@ jobs:
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}

- name: Override rust toolchain
run: rustup override set ${{ matrix.rust }}

- name: Setup target
run: rustup target add x86_64-apple-darwin

- name: Rustup Show
run: rustup show

- name: Build Debug
run: |
make build-apple-x86-debug
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
* execute git-hooks directly if possible (on *nix) else use sh instead of bash (without reading SHELL variable) [[@Joshix](https://github.com/Joshix-1)] ([#2483](https://github.com/extrawurst/gitui/pull/2483))

### Added
* support loading custom syntax highlighting themes from a file [[@acuteenvy](https://github.com/acuteenvy)] ([#2565](https://github.com/gitui-org/gitui/pull/2565))
Expand All @@ -15,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* add `use_selection_fg` to theme file to allow customizing selection foreground color [[@Upsylonbare](https://github.com/Upsylonbare)] ([#2515](https://github.com/gitui-org/gitui/pull/2515))

### Changed
* increase MSRV from 1.70 to 1.81 [[@naseschwarz](https://github.com/naseschwarz)] ([#2094](https://github.com/gitui-org/gitui/issues/2094))
* improve syntax highlighting file detection [[@acuteenvy](https://github.com/acuteenvy)] ([#2524](https://github.com/extrawurst/gitui/pull/2524))
* Updated project links to point to `gitui-org` instead of `extrawurst` [[@vasleymus](https://github.com/vasleymus)] ([#2538](https://github.com/gitui-org/gitui/pull/2538))
* After commit: jump back to unstaged area [[@tommady](https://github.com/tommady)] ([#2476](https://github.com/extrawurst/gitui/issues/2476))
Expand All @@ -24,6 +26,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* set the terminal title to `gitui ({repo_path})` [[@acuteenvy](https://github.com/acuteenvy)] ([#2462](https://github.com/gitui-org/gitui/issues/2462))
* respect `.mailmap` [[@acuteenvy](https://github.com/acuteenvy)] ([#2406](https://github.com/gitui-org/gitui/issues/2406))

### Fixed
* build on nightly [[@naseschwarz](https://github.com/naseschwarz)] ([#2094](https://github.com/gitui-org/gitui/issues/2094))

## [0.27.0] - 2024-01-14

**new: manage remotes**
Expand Down
16 changes: 8 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.27.0"
authors = ["extrawurst <mail@rusticorn.com>"]
description = "blazing fast terminal-ui for git"
edition = "2021"
rust-version = "1.70"
rust-version = "1.81"
exclude = [".github/*", ".vscode/*", "assets/*"]
homepage = "https://github.com/gitui-org/gitui"
repository = "https://github.com/gitui-org/gitui"
Expand Down Expand Up @@ -51,7 +51,7 @@ scopetime = { path = "./scopetime", version = "0.1" }
serde = "1.0"
shellexpand = "3.1"
simplelog = { version = "0.12", default-features = false }
struct-patch = "0.8"
struct-patch = "0.9"
syntect = { version = "5.2", default-features = false, features = [
"parsing",
"default-syntaxes",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ see [NIGHTLIES.md](./NIGHTLIES.md)

### Requirements

- Minimum supported `rust`/`cargo` version: `1.70`
- Minimum supported `rust`/`cargo` version: `1.81`
- See [Install Rust](https://www.rust-lang.org/tools/install)

- To build openssl dependency (see https://docs.rs/openssl/latest/openssl/)
Expand Down
8 changes: 4 additions & 4 deletions asyncgit/src/sync/branch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ pub fn config_is_pull_rebase(repo_path: &RepoPath) -> Result<bool> {
let value =
rebase.value().map(String::from).unwrap_or_default();
return Ok(value == "true");
};
}

Ok(false)
}
Expand Down Expand Up @@ -701,7 +701,7 @@ mod tests_branches {
&root.as_os_str().to_str().unwrap().into();

let upstream_merge_res =
get_branch_upstream_merge(&repo_path, "master");
get_branch_upstream_merge(repo_path, "master");
assert!(
upstream_merge_res.is_ok_and(|v| v.as_ref().is_none())
);
Expand All @@ -721,12 +721,12 @@ mod tests_branches {
config
.set_str(
&format!("branch.{branch_name}.merge"),
&upstrem_merge,
upstrem_merge,
)
.expect("fail set branch merge config");

let upstream_merge_res =
get_branch_upstream_merge(&repo_path, &branch_name);
get_branch_upstream_merge(repo_path, branch_name);
assert!(upstream_merge_res
.as_ref()
.is_ok_and(|v| v.as_ref().is_some()));
Expand Down
20 changes: 13 additions & 7 deletions asyncgit/src/sync/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,15 @@ pub fn hooks_prepare_commit_msg(

#[cfg(test)]
mod tests {
use git2::Repository;
use tempfile::TempDir;

use super::*;
use crate::sync::tests::repo_init;
use crate::sync::tests::repo_init_with_prefix;

fn repo_init() -> Result<(TempDir, Repository)> {
repo_init_with_prefix("gitui $# ' ")
}

#[test]
fn test_post_commit_hook_reject_in_subfolder() {
Expand All @@ -85,7 +92,7 @@ mod tests {
let hook = b"#!/bin/sh
echo 'rejected'
exit 1
";
";

git2_hooks::create_hook(
&repo,
Expand Down Expand Up @@ -120,10 +127,9 @@ mod tests {
crate::sync::utils::repo_work_dir(repo_path).unwrap();

let hook = b"#!/bin/sh
echo $(pwd)
echo \"$(pwd)\"
exit 1
";

";
git2_hooks::create_hook(
&repo,
git2_hooks::HOOK_PRE_COMMIT,
Expand All @@ -146,10 +152,10 @@ mod tests {
let root = repo.path().parent().unwrap();

let hook = b"#!/bin/sh
echo 'msg' > $1
echo 'msg' > \"$1\"
echo 'rejected'
exit 1
";
";

git2_hooks::create_hook(
&repo,
Expand Down
10 changes: 9 additions & 1 deletion asyncgit/src/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,19 @@ pub mod tests {

///
pub fn repo_init() -> Result<(TempDir, Repository)> {
repo_init_with_prefix("gitui")
}

///
#[inline]
pub fn repo_init_with_prefix(
prefix: &'static str,
) -> Result<(TempDir, Repository)> {
init_log();

sandbox_config_files();

let td = TempDir::new()?;
let td = TempDir::with_prefix(prefix)?;
let repo = Repository::init(td.path())?;
{
let mut config = repo.config()?;
Expand Down
9 changes: 6 additions & 3 deletions asyncgit/src/sync/remotes/push.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::fmt::Write;

use crate::{
error::{Error, Result},
progress::ProgressPercent,
Expand Down Expand Up @@ -182,7 +184,8 @@ pub fn push_raw(
if let Ok(Some(branch_upstream_merge)) =
get_branch_upstream_merge(repo_path, branch)
{
push_ref.push_str(&format!(":{branch_upstream_merge}"));
write!(&mut push_ref, ":{branch_upstream_merge}")
.map_err(|e| Error::Generic(e.to_string()))?;
}
}

Expand Down Expand Up @@ -289,7 +292,7 @@ mod tests {

// Attempt force push,
// should work as it forces the push through
assert!(!push_branch(
assert!(push_branch(
&tmp_other_repo_dir.path().to_str().unwrap().into(),
"origin",
"master",
Expand All @@ -298,7 +301,7 @@ mod tests {
None,
None,
)
.is_err());
.is_ok());
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion asyncgit/src/sync/stash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ mod tests {
let repo_path: &RepoPath =
&root.as_os_str().to_str().unwrap().into();

assert!(!stash_save(repo_path, None, true, false).is_ok());
assert!(stash_save(repo_path, None, true, false).is_err());

assert!(get_stashes(repo_path).unwrap().is_empty());
}
Expand Down
4 changes: 2 additions & 2 deletions asyncgit/src/sync/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ mod tests {
let root = repo.path().parent().unwrap();
let repo_path = root.as_os_str().to_str().unwrap();

assert!(!stage_add_file(&repo_path.into(), file_path).is_ok());
assert!(stage_add_file(&repo_path.into(), file_path).is_err());
}

#[test]
Expand Down Expand Up @@ -440,7 +440,7 @@ mod tests {
let repo_path: &RepoPath =
&root.as_os_str().to_str().unwrap().into();

assert!(!get_head(repo_path).is_ok());
assert!(get_head(repo_path).is_err());

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion filetreelist/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl TreeItemInfo {
Path::new(
self.full_path
.components()
.last()
.next_back()
.and_then(|c| c.as_os_str().to_str())
.unwrap_or_default(),
)
Expand Down
2 changes: 1 addition & 1 deletion filetreelist/src/treeitems_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl<'a> Iterator for TreeItemsIterator<'a> {
*i += 1;
} else {
self.increments = Some(0);
};
}

loop {
if !init {
Expand Down
Loading
Loading