Skip to content

Commit 49f5453

Browse files
committed
Merge branch 'repository-integration'
2 parents b58134b + ab250f7 commit 49f5453

File tree

148 files changed

+3632
-1689
lines changed

Some content is hidden

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

148 files changed

+3632
-1689
lines changed

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
[profile.dev]
2+
debug = false
3+
14
[build]
25
rustflags = "--cfg unsound_local_offset -C target-cpu=native"

.github/workflows/rust.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v2
14+
# - uses: Swatinem/rust-cache@v1 - todo: figure out why windows doesn't seem to get its own caches, maybe?
1415
- name: clippy
1516
run: cargo clippy --all
1617
- name: fmt
@@ -44,6 +45,7 @@ jobs:
4445
profile: default
4546
toolchain: stable
4647
override: true
48+
- uses: Swatinem/rust-cache@v1
4749
- name: "Check default features build on windows"
4850
uses: actions-rs/cargo@v1
4951
with:
@@ -75,4 +77,4 @@ jobs:
7577
- uses: actions/checkout@v2
7678
- uses: EmbarkStudios/cargo-deny-action@v1
7779
with:
78-
command: check ${{ matrix.checks }}
80+
command: check ${{ matrix.checks }}

Cargo.lock

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pretty-cli = ["clap",
5050
"prodash/local-time",
5151
"prodash-render-tui",
5252
"prodash-render-line",
53+
"gitoxide-core/local-time-support",
5354
"env_logger",
5455
"futures-lite"]
5556
lean-cli = ["argh", "prodash/progress-log", "env_logger" ]
@@ -79,8 +80,17 @@ env_logger = { version = "0.9.0", optional = true, default-features = false, fea
7980
crosstermion = { version = "0.8.0", optional = true, default-features = false }
8081
futures-lite = { version = "1.12.0", optional = true, default-features = false, features = ["std"] }
8182

82-
[profile.dev]
83-
incremental = false
83+
# toml_edit can't parse this :(
84+
#[profile.dev.package]
85+
#git-object.opt-level = 3
86+
#git-ref.opt-level = 3
87+
#git-pack.opt-level = 3
88+
#git-hash.opt-level = 3
89+
#git-actor.opt-level = 3
90+
#git-config.opt-level = 3
91+
#miniz_oxide.opt-level = 3
92+
#sha-1.opt-level = 3
93+
#sha1.opt-level = 3
8494

8595
[profile.release]
8696
overflow-checks = false

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,12 @@ check: ## Build all code in suitable configurations
8585
cargo check --no-default-features --features lean-termion
8686
cargo check --no-default-features --features max
8787
cargo check --no-default-features --features max-termion
88-
cd git-actor && cargo check
88+
cd git-actor && cargo check \
89+
&& cargo check --features local-time-support
8990
cd gitoxide-core && cargo check \
9091
&& cargo check --features blocking-client \
91-
&& cargo check --features async-client
92+
&& cargo check --features async-client \
93+
&& cargo check --features local-time-support
9294
cd gitoxide-core && if cargo check --all-features 2>/dev/null; then false; else true; fi
9395
cd git-hash && cargo check --all-features \
9496
&& cargo check
@@ -110,6 +112,7 @@ check: ## Build all code in suitable configurations
110112
&& cargo check --features rustsha1 \
111113
&& cargo check --features fast-sha1 \
112114
&& cargo check --features progress \
115+
&& cargo check --features time \
113116
&& cargo check --features io-pipe \
114117
&& cargo check --features crc32 \
115118
&& cargo check --features zlib \
@@ -131,6 +134,7 @@ check: ## Build all code in suitable configurations
131134
cd git-repository && cargo check --all-features \
132135
&& cargo check --no-default-features --features local \
133136
&& cargo check --no-default-features --features network \
137+
&& cargo check --no-default-features --features one-stop-shop \
134138
&& cargo check --no-default-features
135139
cd cargo-smart-release && cargo check
136140
cd experiments/object-access && cargo check

STABILITY.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ Please note that this guide isn't stable itself and may be adjusted to fit chang
77

88
## Terminology
99

10-
* _dependent crate_
10+
- _dependent crate_
1111
- A crate which depends on a crate in this workspace directly.
12-
* _downstream crate_
12+
- _downstream crate_
1313
- A crate which directly or indirectly depends on a crate in this workspace.
14-
* _workspace crate_
14+
- _workspace crate_
1515
- A crate which is a member of this workspace and hence is stored in this repository
16-
* _breaking change_
16+
- _breaking change_
1717
- A change in code that requires a `dependent crate` to adjust their code to fix compile errors.
18-
* _release_
18+
- _release_
1919
- A new version of a crate is published to crates.io
20-
* _development version_
20+
- _development version_
2121
- A crate version whose _major_ version is 0.
22-
* _release version_
22+
- _release version_
2323
- A crate version whose _major_ version is 1 or higher.
2424

2525
## Tiers
@@ -56,9 +56,13 @@ The following schematic helps to visualize what follows.
5656
║ │ ┌─────────────┐ ┌─────────────┐ │ ║
5757
║ │ │ git-ref │ │ git-config │ │ ║ │
5858
║ │ └─────────────┘ └─────────────┘ │ ║
59-
║ └───────────────────────────────────┘ ║ │
60-
║ ║
61-
╚═════════════════════════════════════════════╝ │
59+
║ │ ┌─────────────┐ ┌─────────────┐ │ ║ │
60+
║ │ │ git-object │ │ git-lock │ │ ║
61+
║ │ └─────────────┘ └─────────────┘ │ ║ │
62+
║ └───────────────────────────────────┘ ║
63+
║ ║ │
64+
╚═════════════════════════════════════════════╝
65+
6266
Stability Tier 2 ─────────────────────────────┐
6367
│ │ │
6468
│ Plumbing Crates─────────────────────┐ │
@@ -95,7 +99,7 @@ If there are additional breaking changes without a release, these push back the
9599

96100
### Tier 1: released apps and application crates
97101

98-
Released apps and application crates are marked with major version number 1 or above, like `2.3.0+21.06` and live in tier 1 _(->ST1)_,
102+
Released apps and application crates are marked with major version number 1 or above, like `2.3.0+21.06` and live in tier 1 _(->ST1)_,
99103
with the build identifiers for year (`21`) and and month `06` appended, based on the actual release year and month.
100104

101105
Breaking changes are collected and may be released no more often than every 6 months by incrementing the major version number. If there are additional breaking changes,

cargo-features.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ The library powering the command-line interface.
7272
- **async-client**
7373
- The client to connect to git servers will be async, while supporting only the 'git' transport itself. It's the most limited and can be seen as example
7474
on how to use custom transports for custom servers.
75+
* **local-time-support**
76+
- Functions dealing with time may include the local timezone offset, not just UTC with the offset being zero.
7577

7678
[skim]: https://github.com/lotabout/skim
7779
[git-hours]: https://github.com/kimmobrunfeldt/git-hours
@@ -83,6 +85,11 @@ The library powering the command-line interface.
8385
for the LRU-cache itself low.
8486
* **pack-cache-lru-dynamic**
8587
* Provide a hash-map based LRU cache whose eviction is based a memory cap calculated from object data.
88+
89+
### git-actor
90+
91+
* **local-time-support**
92+
- Make `Signature` initializers using the local time (with UTC offset) available.
8693

8794
### git-features
8895

@@ -185,6 +192,8 @@ be selected.
185192
* **unstable**
186193
- Re-export stability tier 2 crates for convenience and make `Repository` struct fields with types from these crates publicly accessible.
187194
- Doing so is less stable than the stability tier 1 that `git-repository` is a member of.
195+
* **local-time-support**
196+
- Functions dealing with time may include the local timezone offset, not just UTC with the offset being zero.
188197

189198
The following toggles can be used to reduce dependencies.
190199

cargo-smart-release/src/command/release/git.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use cargo_metadata::{
66
camino::{Utf8Component, Utf8Path},
77
Package,
88
};
9-
use git_repository::{easy::object, prelude::ReferenceAccessExt, refs};
9+
use git_repository::{easy::object, prelude::ReferenceAccessExt, refs, refs::transaction::PreviousValue};
1010

1111
use super::{tag_name_for, utils::will, Context, Oid, Options};
1212

@@ -46,8 +46,8 @@ pub(in crate::command::release_impl) fn has_changed_since_last_release(
4646
.strip_prefix(&ctx.root)
4747
.expect("workspace members are releative to the root directory");
4848

49-
let current_commit = ctx.git_easy.find_reference("HEAD")?.peel_to_oid_in_place()?;
50-
let released_target = tag_ref.peel_to_oid_in_place()?;
49+
let current_commit = ctx.git_easy.find_reference("HEAD")?.peel_to_id_in_place()?;
50+
let released_target = tag_ref.peel_to_id_in_place()?;
5151

5252
if repo_relative_crate_dir.as_os_str().is_empty() {
5353
Ok(current_commit != released_target)
@@ -126,7 +126,7 @@ pub(in crate::command::release_impl) fn commit_changes(
126126
if !cmd.status()?.success() {
127127
bail!("Failed to commit changed manifests");
128128
}
129-
Ok(Some(ctx.git_easy.find_reference("HEAD")?.peel_to_oid_in_place()?))
129+
Ok(Some(ctx.git_easy.find_reference("HEAD")?.peel_to_id_in_place()?))
130130
}
131131

132132
pub(in crate::command::release_impl) fn create_version_tag<'repo>(
@@ -155,12 +155,9 @@ pub(in crate::command::release_impl) fn create_version_tag<'repo>(
155155
}
156156
Ok(Some(format!("refs/tags/{}", tag_name).try_into()?))
157157
} else {
158-
let edits = ctx.git_easy.tag(
159-
tag_name,
160-
commit_id.expect("set in --execute mode"),
161-
git_lock::acquire::Fail::Immediately,
162-
false,
163-
)?;
158+
let edits = ctx
159+
.git_easy
160+
.tag(tag_name, commit_id.expect("set in --execute mode"), PreviousValue::Any)?;
164161
assert_eq!(edits.len(), 1, "We create only one tag and there is no expansion");
165162
let tag = edits.into_iter().next().expect("the promised tag");
166163
log::info!("Created tag {}", tag.name.as_bstr());

crate-status.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ See its [README.md](https://github.com/Byron/gitoxide/blob/main/git-lock/README.
239239

240240
### git-repository
241241
* [x] utilities for applications to make long running operations interruptible gracefully and to support timeouts in servers.
242+
* [ ] handle `core.repositoryFormatVersion` and extensions
242243
* [x] discovery
243244
* [ ] option to not cross file systems
244245
* [ ] handle git-common-dir

etc/check-package-size.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function indent () {
1515
}
1616

1717
echo "in root: gitoxide CLI"
18-
indent cargo diet -n --package-size-limit 25KB
18+
#indent cargo diet -n --package-size-limit 25KB - fails right now because of dotted profile.dev.package
1919
(enter cargo-smart-release && indent cargo diet -n --package-size-limit 15KB)
2020
(enter git-actor && indent cargo diet -n --package-size-limit 5KB)
2121
(enter git-tempfile && indent cargo diet -n --package-size-limit 20KB)
@@ -34,6 +34,6 @@ indent cargo diet -n --package-size-limit 25KB
3434
(enter git-odb && indent cargo diet -n --package-size-limit 15KB)
3535
(enter git-protocol && indent cargo diet -n --package-size-limit 25KB)
3636
(enter git-packetline && indent cargo diet -n --package-size-limit 15KB)
37-
(enter git-repository && indent cargo diet -n --package-size-limit 30KB)
37+
(enter git-repository && indent cargo diet -n --package-size-limit 35KB)
3838
(enter git-transport && indent cargo diet -n --package-size-limit 30KB)
3939
(enter gitoxide-core && indent cargo diet -n --package-size-limit 20KB)

etc/crate-structure.monopic

245 Bytes
Binary file not shown.

experiments/diffing/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use git_repository::{
99
objs::{bstr::BStr, TreeRefIter},
1010
odb,
1111
prelude::*,
12-
refs::file::loose::reference::peel,
12+
refs::{file::ReferenceExt, peel},
1313
};
1414
use rayon::prelude::*;
1515

@@ -255,7 +255,7 @@ where
255255
where
256256
L: for<'a> FnMut(&oid, &'a mut Vec<u8>) -> Option<odb::data::Object<'a>>,
257257
{
258-
find(id, buf).and_then(|o| o.into_tree_iter())
258+
find(id, buf).and_then(|o| o.try_into_tree_iter())
259259
}
260260

261261
fn tree_iter_by_commit<'b, L>(id: &oid, buf: &'b mut Vec<u8>, mut find: L) -> TreeRefIter<'b>
@@ -264,7 +264,7 @@ where
264264
{
265265
let tid = find(id, buf)
266266
.expect("commit present")
267-
.into_commit_iter()
267+
.try_into_commit_iter()
268268
.expect("a commit")
269269
.tree_id()
270270
.expect("tree id present and decodable");

experiments/traversal/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use git_repository::{
1010
objs::{bstr::BStr, tree::EntryRef},
1111
odb,
1212
prelude::*,
13-
refs::file::loose::reference::peel,
13+
refs::{file::ReferenceExt, peel},
1414
traverse::{tree, tree::visit::Action},
1515
};
1616

@@ -209,13 +209,13 @@ where
209209
for commit in commits {
210210
let tree_id = db
211211
.try_find(commit, &mut buf, &mut cache)?
212-
.and_then(|o| o.into_commit_iter().and_then(|mut c| c.tree_id()))
212+
.and_then(|o| o.try_into_commit_iter().and_then(|mut c| c.tree_id()))
213213
.expect("commit as starting point");
214214

215215
let mut count = Count { entries: 0, seen };
216216
db.find_tree_iter(tree_id, &mut buf2, &mut cache)?.traverse(
217217
&mut state,
218-
|oid, buf| db.find(oid, buf, &mut cache).ok().and_then(|o| o.into_tree_iter()),
218+
|oid, buf| db.find(oid, buf, &mut cache).ok().and_then(|o| o.try_into_tree_iter()),
219219
&mut count,
220220
)?;
221221
entries += count.entries as u64;

git-actor/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ doctest = false
1313

1414
[features]
1515
serde1 = ["serde", "bstr/serde1"]
16+
local-time-support = ["git-features/time"]
1617

1718
[package.metadata.docs.rs]
1819
all-features = true
1920

2021
[dependencies]
22+
git-features = { version = "^0.16.0", path = "../git-features", optional = true }
2123
quick-error = "2.0.0"
2224
btoi = "0.4.2"
2325
bstr = { version = "0.2.13", default-features = false, features = ["std"]}

0 commit comments

Comments
 (0)