Skip to content

Commit 3e5c974

Browse files
committed
Merge branch 'status'
2 parents 5722e3a + 3753592 commit 3e5c974

File tree

398 files changed

+4727
-628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

398 files changed

+4727
-628
lines changed

Diff for: .github/workflows/ci.yml

+17-17
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,18 @@ jobs:
4747
test:
4848
runs-on: ubuntu-latest
4949
steps:
50-
- uses: actions/checkout@v3
51-
- uses: dtolnay/rust-toolchain@stable
52-
- uses: Swatinem/rust-cache@v2
53-
- name: Setup dependencies
54-
run:
55-
sudo apt-get install tree
56-
- uses: extractions/setup-just@v1
57-
- name: test
58-
env:
59-
CI: true
60-
GITOXIDE_TEST_IGNORE_ARCHIVES: 1
61-
run: just ci-test
50+
- uses: actions/checkout@v3
51+
- uses: dtolnay/rust-toolchain@stable
52+
- uses: Swatinem/rust-cache@v2
53+
- name: Setup dependencies
54+
run:
55+
sudo apt-get install tree
56+
- uses: extractions/setup-just@v1
57+
- name: test
58+
env:
59+
CI: true
60+
GITOXIDE_TEST_IGNORE_ARCHIVES: 1
61+
run: just ci-test
6262

6363
test-fast:
6464
strategy:
@@ -163,7 +163,7 @@ jobs:
163163
components: clippy,rustfmt
164164
- uses: extractions/setup-just@v1
165165
- name: Run cargo clippy
166-
run: just clippy -D warnings
166+
run: just clippy -D warnings -A unknown-lints
167167
- name: Run cargo doc
168168
run: just doc
169169
- name: Run cargo fmt
@@ -189,10 +189,10 @@ jobs:
189189
continue-on-error: ${{ matrix.checks == 'advisories' }}
190190

191191
steps:
192-
- uses: actions/checkout@v3
193-
- uses: EmbarkStudios/cargo-deny-action@v1
194-
with:
195-
command: check ${{ matrix.checks }}
192+
- uses: actions/checkout@v3
193+
- uses: EmbarkStudios/cargo-deny-action@v1
194+
with:
195+
command: check ${{ matrix.checks }}
196196
wasm:
197197
name: WebAssembly
198198
runs-on: ubuntu-latest

Diff for: Cargo.lock

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: crate-status.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -552,12 +552,12 @@ Make it the best-performing implementation and the most convenient one.
552552

553553
### gix-status
554554
* [x] differences between index and worktree to turn index into worktree
555-
- [ ] rename tracking
555+
- [x] rename tracking
556+
- [x] untracked files
557+
- [ ] support for fs-monitor for modification checks
556558
* [ ] differences between index and index to learn what changed
557559
- [ ] rename tracking
558-
* [ ] untracked files
559-
* [ ] fast answer to 'is it dirty'.
560-
*
560+
561561
### gix-worktree-state
562562
* handle the working **tree/checkout**
563563
- [x] checkout an index of files, executables and symlinks just as fast as git

Diff for: gitoxide-core/src/repository/attributes/query.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use gix::repository::IndexPersistedOrInMemory;
1+
use gix::worktree::IndexPersistedOrInMemory;
22

33
use crate::OutputFormat;
44

Diff for: gitoxide-core/src/repository/commit.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ pub fn describe(
5252
statistics,
5353
max_candidates,
5454
long_format,
55+
dirty_suffix,
5556
}: describe::Options,
5657
) -> Result<()> {
5758
repo.object_cache_size_if_unset(4 * 1024 * 1024);
@@ -80,7 +81,7 @@ pub fn describe(
8081
writeln!(err, "traversed {} commits", resolution.outcome.commits_seen)?;
8182
}
8283

83-
let mut describe_id = resolution.format()?;
84+
let mut describe_id = resolution.format_with_dirty_suffix(dirty_suffix)?;
8485
describe_id.long(long_format);
8586

8687
writeln!(out, "{describe_id}")?;
@@ -97,5 +98,6 @@ pub mod describe {
9798
pub long_format: bool,
9899
pub statistics: bool,
99100
pub max_candidates: usize,
101+
pub dirty_suffix: Option<String>,
100102
}
101103
}

Diff for: gitoxide-core/src/repository/credential.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::convert::TryInto;
2-
31
#[derive(Debug, thiserror::Error)]
42
enum Error {
53
#[error(transparent)]

Diff for: gitoxide-core/src/repository/dirty.rs

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
use crate::OutputFormat;
2+
use anyhow::bail;
3+
4+
pub enum Mode {
5+
IsClean,
6+
IsDirty,
7+
}
8+
9+
pub fn check(
10+
repo: gix::Repository,
11+
mode: Mode,
12+
out: &mut dyn std::io::Write,
13+
format: OutputFormat,
14+
) -> anyhow::Result<()> {
15+
if format != OutputFormat::Human {
16+
bail!("JSON output isn't implemented yet");
17+
}
18+
let is_dirty = repo.is_dirty()?;
19+
let res = match (is_dirty, mode) {
20+
(false, Mode::IsClean) => Ok("The repository is clean"),
21+
(true, Mode::IsClean) => Err("The repository has changes"),
22+
(false, Mode::IsDirty) => Err("The repository is clean"),
23+
(true, Mode::IsDirty) => Ok("The repository has changes"),
24+
};
25+
26+
let suffix = "(not counting untracked files)";
27+
match res {
28+
Ok(msg) => writeln!(out, "{msg} {suffix}")?,
29+
Err(msg) => bail!("{msg} {suffix}"),
30+
}
31+
Ok(())
32+
}

Diff for: gitoxide-core/src/repository/index/entries.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub(crate) mod function {
2525

2626
use gix::{
2727
bstr::{BStr, BString},
28-
repository::IndexPersistedOrInMemory,
28+
worktree::IndexPersistedOrInMemory,
2929
Repository,
3030
};
3131

Diff for: gitoxide-core/src/repository/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ pub use credential::function as credential;
2626
pub mod attributes;
2727
#[cfg(feature = "clean")]
2828
pub mod clean;
29+
pub mod dirty;
2930
#[cfg(feature = "clean")]
3031
pub use clean::function::clean;
3132
#[cfg(feature = "blocking-client")]

0 commit comments

Comments
 (0)