Skip to content

Repair build on nightly and new MSRV 1.81 #2582

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

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,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 +25,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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.27.0"
authors = ["extrawurst <[email protected]>"]
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
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
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
1 change: 1 addition & 0 deletions git2-hooks/src/hookspath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ impl HookPaths {
pub fn run_hook(&self, args: &[&str]) -> Result<HookResult> {
let hook = self.hook.clone();

#[allow(clippy::unnecessary_debug_formatting)]
let arg_str = format!("{:?} {}", hook, args.join(" "));
// Use -l to avoid "command not found" on Windows.
let bash_args =
Expand Down
8 changes: 4 additions & 4 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ impl App {
3 => self.stashing_tab.draw(f, chunks_main[1])?,
4 => self.stashlist_tab.draw(f, chunks_main[1])?,
_ => bail!("unknown tab"),
};
}
}

self.draw_popups(f)?;
Expand Down Expand Up @@ -905,7 +905,7 @@ impl App {
InternalEvent::CommitSearch(options) => {
self.revlog.search(options);
}
};
}

Ok(flags)
}
Expand Down Expand Up @@ -997,7 +997,7 @@ impl App {
undo_last_commit(&self.repo.borrow())
);
}
};
}

flags.insert(NeedsUpdate::ALL);

Expand All @@ -1019,7 +1019,7 @@ impl App {
));

self.tags_popup.update_tags()?;
};
}
Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ fn setup_logging(path_override: Option<PathBuf>) -> Result<()> {
path
};

println!("Logging enabled. Log written to: {path:?}");
println!("Logging enabled. Log written to: {}", path.display());

WriteLogger::init(
LevelFilter::Trace,
Expand Down
2 changes: 1 addition & 1 deletion src/components/changes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl ChangesComponent {
&self.repo.borrow(),
path,
)?,
};
}
} else {
let config =
self.options.borrow().status_show_untracked();
Expand Down
51 changes: 33 additions & 18 deletions src/components/commitlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ impl CommitList {
self.marked.len()
}

// Clippy wants this to be const in nightly, which is not possible.
// Disable check to make clippy pass:
#[allow(clippy::missing_const_for_fn)]
///
pub fn marked(&self) -> &[(usize, CommitId)] {
&self.marked
Expand Down Expand Up @@ -490,24 +493,36 @@ impl CommitList {
txt.push(splitter.clone());
}

let style_hash = normal
.then(|| theme.commit_hash(selected))
.unwrap_or_else(|| theme.commit_unhighlighted());
let style_time = normal
.then(|| theme.commit_time(selected))
.unwrap_or_else(|| theme.commit_unhighlighted());
let style_author = normal
.then(|| theme.commit_author(selected))
.unwrap_or_else(|| theme.commit_unhighlighted());
let style_tags = normal
.then(|| theme.tags(selected))
.unwrap_or_else(|| theme.commit_unhighlighted());
let style_branches = normal
.then(|| theme.branch(selected, true))
.unwrap_or_else(|| theme.commit_unhighlighted());
let style_msg = normal
.then(|| theme.text(true, selected))
.unwrap_or_else(|| theme.commit_unhighlighted());
let style_hash = if normal {
theme.commit_hash(selected)
} else {
theme.commit_unhighlighted()
};
let style_time = if normal {
theme.commit_time(selected)
} else {
theme.commit_unhighlighted()
};
let style_author = if normal {
theme.commit_author(selected)
} else {
theme.commit_unhighlighted()
};
let style_tags = if normal {
theme.tags(selected)
} else {
theme.commit_unhighlighted()
};
let style_branches = if normal {
theme.branch(selected, true)
} else {
theme.commit_unhighlighted()
};
let style_msg = if normal {
theme.text(true, selected)
} else {
theme.commit_unhighlighted()
};

// commit hash
txt.push(Span::styled(Cow::from(&*e.hash_short), style_hash));
Expand Down
2 changes: 1 addition & 1 deletion src/components/textinput.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ impl TextInputComponent {
)
.title(self.title.clone()),
);
};
}
text_area
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/utils/filetree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl FileTreeItem {

match path
.components()
.last()
.next_back()
.map(std::path::Component::as_os_str)
.map(OsStr::to_string_lossy)
.map(String::from)
Expand Down
Loading
Loading