Skip to content

Commit

Permalink
Merge branch 'status'
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Mar 14, 2024
2 parents 5722e3a + 3753592 commit 3e5c974
Show file tree
Hide file tree
Showing 398 changed files with 4,727 additions and 628 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Setup dependencies
run:
sudo apt-get install tree
- uses: extractions/setup-just@v1
- name: test
env:
CI: true
GITOXIDE_TEST_IGNORE_ARCHIVES: 1
run: just ci-test
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Setup dependencies
run:
sudo apt-get install tree
- uses: extractions/setup-just@v1
- name: test
env:
CI: true
GITOXIDE_TEST_IGNORE_ARCHIVES: 1
run: just ci-test

test-fast:
strategy:
Expand Down Expand Up @@ -163,7 +163,7 @@ jobs:
components: clippy,rustfmt
- uses: extractions/setup-just@v1
- name: Run cargo clippy
run: just clippy -D warnings
run: just clippy -D warnings -A unknown-lints
- name: Run cargo doc
run: just doc
- name: Run cargo fmt
Expand All @@ -189,10 +189,10 @@ jobs:
continue-on-error: ${{ matrix.checks == 'advisories' }}

steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}
wasm:
name: WebAssembly
runs-on: ubuntu-latest
Expand Down
11 changes: 11 additions & 0 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions crate-status.md
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,12 @@ Make it the best-performing implementation and the most convenient one.

### gix-status
* [x] differences between index and worktree to turn index into worktree
- [ ] rename tracking
- [x] rename tracking
- [x] untracked files
- [ ] support for fs-monitor for modification checks
* [ ] differences between index and index to learn what changed
- [ ] rename tracking
* [ ] untracked files
* [ ] fast answer to 'is it dirty'.
*

### gix-worktree-state
* handle the working **tree/checkout**
- [x] checkout an index of files, executables and symlinks just as fast as git
Expand Down
2 changes: 1 addition & 1 deletion gitoxide-core/src/repository/attributes/query.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use gix::repository::IndexPersistedOrInMemory;
use gix::worktree::IndexPersistedOrInMemory;

use crate::OutputFormat;

Expand Down
4 changes: 3 additions & 1 deletion gitoxide-core/src/repository/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ pub fn describe(
statistics,
max_candidates,
long_format,
dirty_suffix,
}: describe::Options,
) -> Result<()> {
repo.object_cache_size_if_unset(4 * 1024 * 1024);
Expand Down Expand Up @@ -80,7 +81,7 @@ pub fn describe(
writeln!(err, "traversed {} commits", resolution.outcome.commits_seen)?;
}

let mut describe_id = resolution.format()?;
let mut describe_id = resolution.format_with_dirty_suffix(dirty_suffix)?;
describe_id.long(long_format);

writeln!(out, "{describe_id}")?;
Expand All @@ -97,5 +98,6 @@ pub mod describe {
pub long_format: bool,
pub statistics: bool,
pub max_candidates: usize,
pub dirty_suffix: Option<String>,
}
}
2 changes: 0 additions & 2 deletions gitoxide-core/src/repository/credential.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryInto;

#[derive(Debug, thiserror::Error)]
enum Error {
#[error(transparent)]
Expand Down
32 changes: 32 additions & 0 deletions gitoxide-core/src/repository/dirty.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use crate::OutputFormat;
use anyhow::bail;

pub enum Mode {
IsClean,
IsDirty,
}

pub fn check(
repo: gix::Repository,
mode: Mode,
out: &mut dyn std::io::Write,
format: OutputFormat,
) -> anyhow::Result<()> {
if format != OutputFormat::Human {
bail!("JSON output isn't implemented yet");
}
let is_dirty = repo.is_dirty()?;
let res = match (is_dirty, mode) {
(false, Mode::IsClean) => Ok("The repository is clean"),
(true, Mode::IsClean) => Err("The repository has changes"),
(false, Mode::IsDirty) => Err("The repository is clean"),
(true, Mode::IsDirty) => Ok("The repository has changes"),
};

let suffix = "(not counting untracked files)";
match res {
Ok(msg) => writeln!(out, "{msg} {suffix}")?,
Err(msg) => bail!("{msg} {suffix}"),
}
Ok(())
}
2 changes: 1 addition & 1 deletion gitoxide-core/src/repository/index/entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub(crate) mod function {

use gix::{
bstr::{BStr, BString},
repository::IndexPersistedOrInMemory,
worktree::IndexPersistedOrInMemory,
Repository,
};

Expand Down
1 change: 1 addition & 0 deletions gitoxide-core/src/repository/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub use credential::function as credential;
pub mod attributes;
#[cfg(feature = "clean")]
pub mod clean;
pub mod dirty;
#[cfg(feature = "clean")]
pub use clean::function::clean;
#[cfg(feature = "blocking-client")]
Expand Down

0 comments on commit 3e5c974

Please sign in to comment.