diff --git a/.github/workflows/msrv.yml b/.github/workflows/msrv.yml
index 4d0fb9613df..f16da43f3a8 100644
--- a/.github/workflows/msrv.yml
+++ b/.github/workflows/msrv.yml
@@ -20,7 +20,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- - uses: dtolnay/rust-toolchain@1.59.0 # dictated by `windows` crates effectively, IMPORTANT: adjust etc/msrv-badge.svg as well
+ - uses: dtolnay/rust-toolchain@1.60.0 # dictated by `windows` crates effectively, IMPORTANT: adjust etc/msrv-badge.svg as well
- run: make check-msrv-on-ci
continue-on-error: true # TODO: turn this off once the toolchain gets updated. There is a strange error preventing cargo to select the correct libgit2 version
# like it doesn't exist.
diff --git a/Cargo.lock b/Cargo.lock
index 6fe19ef74ea..660f997149d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -258,6 +258,18 @@ dependencies = [
"serde",
]
+[[package]]
+name = "bstr"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fca0852af221f458706eb0725c03e4ed6c46af9ac98e6a689d5e634215d594dd"
+dependencies = [
+ "memchr",
+ "once_cell",
+ "regex-automata",
+ "serde",
+]
+
[[package]]
name = "btoi"
version = "0.4.2"
@@ -736,7 +748,7 @@ version = "1.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1"
dependencies = [
- "bstr",
+ "bstr 0.2.17",
"csv-core",
"itoa 0.4.8",
"ryu",
@@ -1092,7 +1104,7 @@ dependencies = [
name = "git-actor"
version = "0.11.4"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"btoi",
"document-features",
"git-date",
@@ -1109,7 +1121,7 @@ dependencies = [
name = "git-attributes"
version = "0.3.3"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"compact_str",
"document-features",
"git-features",
@@ -1148,7 +1160,7 @@ dependencies = [
name = "git-commitgraph"
version = "0.8.2"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"document-features",
"git-chunk",
"git-features",
@@ -1163,7 +1175,7 @@ dependencies = [
name = "git-config"
version = "0.7.1"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"criterion",
"document-features",
"git-config-value",
@@ -1190,7 +1202,7 @@ name = "git-config-value"
version = "0.7.0"
dependencies = [
"bitflags",
- "bstr",
+ "bstr 1.0.1",
"document-features",
"git-path",
"libc",
@@ -1213,7 +1225,7 @@ dependencies = [
name = "git-credentials"
version = "0.4.0"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"document-features",
"git-command",
"git-config-value",
@@ -1230,7 +1242,7 @@ dependencies = [
name = "git-date"
version = "0.1.0"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"document-features",
"git-testtools",
"itoa 1.0.3",
@@ -1256,7 +1268,7 @@ dependencies = [
name = "git-discover"
version = "0.4.2"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"defer",
"git-hash",
"git-path",
@@ -1272,7 +1284,7 @@ dependencies = [
name = "git-features"
version = "0.22.4"
dependencies = [
- "bstr",
+ "bstr 0.2.17",
"bytes",
"crc32fast",
"crossbeam-channel",
@@ -1292,6 +1304,10 @@ dependencies = [
"walkdir",
]
+[[package]]
+name = "git-fetchhead"
+version = "0.0.0"
+
[[package]]
name = "git-filter"
version = "0.0.0"
@@ -1301,7 +1317,7 @@ name = "git-glob"
version = "0.3.2"
dependencies = [
"bitflags",
- "bstr",
+ "bstr 1.0.1",
"document-features",
"git-testtools",
"serde",
@@ -1324,7 +1340,7 @@ version = "0.4.3"
dependencies = [
"atoi",
"bitflags",
- "bstr",
+ "bstr 1.0.1",
"document-features",
"filetime",
"git-bitmap",
@@ -1357,7 +1373,7 @@ dependencies = [
name = "git-mailmap"
version = "0.3.2"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"document-features",
"git-actor",
"git-testtools",
@@ -1373,7 +1389,7 @@ version = "0.0.0"
name = "git-object"
version = "0.20.3"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"btoi",
"document-features",
"git-actor",
@@ -1417,7 +1433,7 @@ dependencies = [
name = "git-pack"
version = "0.22.0"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"bytesize",
"clru",
"dashmap",
@@ -1448,7 +1464,7 @@ name = "git-packetline"
version = "0.12.7"
dependencies = [
"async-std",
- "bstr",
+ "bstr 1.0.1",
"document-features",
"futures-io",
"futures-lite",
@@ -1465,7 +1481,7 @@ dependencies = [
name = "git-path"
version = "0.4.2"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"tempfile",
"thiserror",
]
@@ -1475,7 +1491,7 @@ name = "git-pathspec"
version = "0.0.0"
dependencies = [
"bitflags",
- "bstr",
+ "bstr 1.0.1",
"git-attributes",
"git-glob",
"git-testtools",
@@ -1503,7 +1519,7 @@ version = "0.20.0"
dependencies = [
"async-std",
"async-trait",
- "bstr",
+ "bstr 1.0.1",
"btoi",
"document-features",
"futures-io",
@@ -1524,7 +1540,7 @@ dependencies = [
name = "git-quote"
version = "0.2.1"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"btoi",
"quick-error",
]
@@ -1560,7 +1576,7 @@ dependencies = [
name = "git-refspec"
version = "0.1.1"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"git-hash",
"git-revision",
"git-testtools",
@@ -1626,7 +1642,7 @@ dependencies = [
name = "git-revision"
version = "0.4.4"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"document-features",
"git-date",
"git-hash",
@@ -1676,7 +1692,7 @@ dependencies = [
name = "git-testtools"
version = "0.8.0"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"crc",
"fs_extra",
"git-attributes",
@@ -1706,7 +1722,7 @@ dependencies = [
"async-trait",
"base64",
"blocking",
- "bstr",
+ "bstr 1.0.1",
"curl",
"document-features",
"futures-io",
@@ -1743,7 +1759,7 @@ version = "0.0.0"
name = "git-url"
version = "0.8.0"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"document-features",
"git-features",
"git-path",
@@ -1757,7 +1773,7 @@ dependencies = [
name = "git-validate"
version = "0.5.5"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"git-testtools",
"thiserror",
]
@@ -1766,7 +1782,7 @@ dependencies = [
name = "git-worktree"
version = "0.4.3"
dependencies = [
- "bstr",
+ "bstr 1.0.1",
"document-features",
"git-attributes",
"git-features",
diff --git a/Cargo.toml b/Cargo.toml
index 17f287e4bc1..fc82ce0ad02 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -146,6 +146,7 @@ members = [
"git-packetline",
"git-mailmap",
"git-note",
+ "git-fetchhead",
"git-prompt",
"git-filter",
"git-sec",
diff --git a/README.md b/README.md
index f18bf132b96..d064cc3d831 100644
--- a/README.md
+++ b/README.md
@@ -149,6 +149,7 @@ is usable to some extend.
* [git-date](https://github.com/Byron/gitoxide/blob/main/crate-status.md#git-date)
* **idea** _(just a name placeholder)_
* [git-note](https://github.com/Byron/gitoxide/blob/main/crate-status.md#git-note)
+ * [git-fetchhead](https://github.com/Byron/gitoxide/blob/main/crate-status.md#git-fetchhead)
* [git-filter](https://github.com/Byron/gitoxide/blob/main/crate-status.md#git-filter)
* [git-lfs](https://github.com/Byron/gitoxide/blob/main/crate-status.md#git-lfs)
* [git-rebase](https://github.com/Byron/gitoxide/blob/main/crate-status.md#git-rebase)
diff --git a/crate-status.md b/crate-status.md
index f9a38016f00..78f282293a5 100644
--- a/crate-status.md
+++ b/crate-status.md
@@ -259,6 +259,10 @@ Check out the [performance discussion][git-traverse-performance] as well.
A mechanism to associate metadata with any object, and keep revisions of it using git itself.
* [ ] CRUD for git notes
+
+### git-fetchhead
+* [ ] parse `FETCH_HEAD` information back entirely
+* [ ] write typical fetch-head lines
### git-discover
diff --git a/etc/check-package-size.sh b/etc/check-package-size.sh
index 52501746588..ce2eb789ffe 100755
--- a/etc/check-package-size.sh
+++ b/etc/check-package-size.sh
@@ -46,6 +46,7 @@ echo "in root: gitoxide CLI"
(enter git-filter && indent cargo diet -n --package-size-limit 5KB)
(enter git-lfs && indent cargo diet -n --package-size-limit 5KB)
(enter git-note && indent cargo diet -n --package-size-limit 5KB)
+(enter git-fetchhead && indent cargo diet -n --package-size-limit 5KB)
(enter git-sec && indent cargo diet -n --package-size-limit 15KB)
(enter git-tix && indent cargo diet -n --package-size-limit 5KB)
(enter git-credentials && indent cargo diet -n --package-size-limit 20KB)
diff --git a/etc/msrv-badge.svg b/etc/msrv-badge.svg
index e3e639ade1e..4e327611bf4 100644
--- a/etc/msrv-badge.svg
+++ b/etc/msrv-badge.svg
@@ -1 +1 @@
-
+
diff --git a/git-actor/Cargo.toml b/git-actor/Cargo.toml
index a807f4fffe9..5f09075d7c3 100644
--- a/git-actor/Cargo.toml
+++ b/git-actor/Cargo.toml
@@ -13,7 +13,7 @@ doctest = false
[features]
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
-serde1 = ["serde", "bstr/serde1", "git-date/serde1"]
+serde1 = ["serde", "bstr/serde", "git-date/serde1"]
[dependencies]
git-features = { version = "^0.22.4", path = "../git-features", optional = true }
@@ -21,7 +21,7 @@ git-date = { version = "^0.1.0", path = "../git-date" }
quick-error = "2.0.0"
btoi = "0.4.2"
-bstr = { version = "0.2.13", default-features = false, features = ["std", "unicode"]}
+bstr = { version = "1.0.1", default-features = false, features = ["std", "unicode"]}
nom = { version = "7", default-features = false, features = ["std"]}
itoa = "1.0.1"
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}
diff --git a/git-attributes/Cargo.toml b/git-attributes/Cargo.toml
index fc5ce6bdb19..6cf4ab23444 100644
--- a/git-attributes/Cargo.toml
+++ b/git-attributes/Cargo.toml
@@ -13,7 +13,7 @@ doctest = false
[features]
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
-serde1 = ["serde", "bstr/serde1", "git-glob/serde1", "compact_str/serde"]
+serde1 = ["serde", "bstr/serde", "git-glob/serde1", "compact_str/serde"]
[dependencies]
git-features = { version = "^0.22.4", path = "../git-features" }
@@ -21,7 +21,7 @@ git-path = { version = "^0.4.2", path = "../git-path" }
git-quote = { version = "^0.2.1", path = "../git-quote" }
git-glob = { version = "^0.3.2", path = "../git-glob" }
-bstr = { version = "0.2.13", default-features = false, features = ["std"]}
+bstr = { version = "1.0.1", default-features = false, features = ["std", "unicode"]}
unicode-bom = "1.1.4"
thiserror = "1.0.26"
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}
diff --git a/git-commitgraph/Cargo.toml b/git-commitgraph/Cargo.toml
index 32a043d106c..c94cbc68472 100644
--- a/git-commitgraph/Cargo.toml
+++ b/git-commitgraph/Cargo.toml
@@ -14,14 +14,14 @@ doctest = false
[features]
## Data structures implement `serde::Serialize` and `serde::Deserialize`
-serde1 = ["serde", "git-hash/serde1", "bstr/serde1"]
+serde1 = ["serde", "git-hash/serde1", "bstr/serde"]
[dependencies]
git-features = { version = "^0.22.4", path = "../git-features", features = ["rustsha1"] }
git-hash = { version = "^0.9.9", path = "../git-hash" }
git-chunk = { version = "^0.3.1", path = "../git-chunk" }
-bstr = { version = "0.2.13", default-features = false, features = ["std"] }
+bstr = { version = "1.0.1", default-features = false, features = ["std"] }
memmap2 = "0.5.0"
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"] }
thiserror = "1.0.26"
diff --git a/git-config-value/Cargo.toml b/git-config-value/Cargo.toml
index 8b5ab3050db..5ad16633b8a 100644
--- a/git-config-value/Cargo.toml
+++ b/git-config-value/Cargo.toml
@@ -12,13 +12,13 @@ doctest = false
[features]
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
-serde1 = ["serde", "bstr/serde1"]
+serde1 = ["serde", "bstr/serde"]
[dependencies]
git-path = { version = "^0.4.2", path = "../git-path" }
thiserror = "1.0.32"
-bstr = "0.2.17"
+bstr = "1.0.1"
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}
bitflags = "1.3.2"
diff --git a/git-config/Cargo.toml b/git-config/Cargo.toml
index 598b390a1f4..a5afbd107bf 100644
--- a/git-config/Cargo.toml
+++ b/git-config/Cargo.toml
@@ -12,7 +12,7 @@ include = ["src/**/*", "LICENSE-*", "README.md", "CHANGELOG.md"]
[features]
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
-serde1 = ["serde", "bstr/serde1", "git-sec/serde1", "git-ref/serde1", "git-glob/serde1", "git-config-value/serde1"]
+serde1 = ["serde", "bstr/serde", "git-sec/serde1", "git-ref/serde1", "git-glob/serde1", "git-config-value/serde1"]
[dependencies]
git-features = { version = "^0.22.4", path = "../git-features"}
@@ -26,7 +26,7 @@ nom = { version = "7", default_features = false, features = [ "std" ] }
memchr = "2"
thiserror = "1.0.26"
unicode-bom = "1.1.4"
-bstr = { version = "0.2.13", default-features = false, features = ["std"] }
+bstr = { version = "1.0.1", default-features = false, features = ["std"] }
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}
smallvec = "1.9.0"
diff --git a/git-credentials/Cargo.toml b/git-credentials/Cargo.toml
index e89e862ae3c..9f89370c526 100644
--- a/git-credentials/Cargo.toml
+++ b/git-credentials/Cargo.toml
@@ -12,7 +12,7 @@ doctest = false
[features]
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
-serde1 = ["serde", "bstr/serde1", "git-sec/serde1"]
+serde1 = ["serde", "bstr/serde", "git-sec/serde1"]
[dependencies]
git-sec = { version = "^0.3.1", path = "../git-sec" }
@@ -24,7 +24,7 @@ git-prompt = { version = "0.1.0", path = "../git-prompt" }
thiserror = "1.0.32"
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"] }
-bstr = { version = "0.2.13", default-features = false, features = ["std"]}
+bstr = { version = "1.0.1", default-features = false, features = ["std"]}
diff --git a/git-date/Cargo.toml b/git-date/Cargo.toml
index 093a5764174..1106f0fad3b 100644
--- a/git-date/Cargo.toml
+++ b/git-date/Cargo.toml
@@ -13,10 +13,10 @@ doctest = false
[features]
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
-serde1 = ["serde", "bstr/serde1"]
+serde1 = ["serde", "bstr/serde"]
[dependencies]
-bstr = { version = "0.2.13", default-features = false, features = ["std"]}
+bstr = { version = "1.0.1", default-features = false, features = ["std"]}
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}
itoa = "1.0.1"
time = { version = "0.3.2", default-features = false, features = ["local-offset", "formatting", "macros", "parsing"] }
diff --git a/git-diff/src/tree/visit.rs b/git-diff/src/tree/visit.rs
index d5c3f6b4348..b66e47b37ce 100644
--- a/git-diff/src/tree/visit.rs
+++ b/git-diff/src/tree/visit.rs
@@ -2,6 +2,7 @@ use git_hash::ObjectId;
use git_object::{bstr::BStr, tree};
/// Represents any possible change in order to turn one tree into another.
+#[derive(Debug, Clone, PartialOrd, PartialEq, Ord, Eq, Hash)]
pub enum Change {
/// An entry was added, like the addition of a file or directory.
Addition {
diff --git a/git-discover/Cargo.toml b/git-discover/Cargo.toml
index 817a5d0e1f3..c24a1b31d28 100644
--- a/git-discover/Cargo.toml
+++ b/git-discover/Cargo.toml
@@ -17,7 +17,7 @@ git-path = { version = "^0.4.2", path = "../git-path" }
git-ref = { version = "^0.15.2", path = "../git-ref" }
git-hash = { version = "^0.9.9", path = "../git-hash" }
-bstr = { version = "0.2.13", default-features = false, features = ["std", "unicode"] }
+bstr = { version = "1.0.1", default-features = false, features = ["std", "unicode"] }
thiserror = "1.0.26"
[dev-dependencies]
diff --git a/git-fetchhead/CHANGELOG.md b/git-fetchhead/CHANGELOG.md
new file mode 100644
index 00000000000..a22b3a1589e
--- /dev/null
+++ b/git-fetchhead/CHANGELOG.md
@@ -0,0 +1,30 @@
+# Changelog
+
+All notable changes to this project will be documented in this file.
+
+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).
+
+## 0.0.0 (2022-09-12)
+
+The initial release to reserve the name.
+
+### Commit Statistics
+
+
+
+ - 2 commits contributed to the release.
+ - 0 commits were understood as [conventional](https://www.conventionalcommits.org).
+ - 1 unique issue was worked on: [#450](https://github.com/Byron/gitoxide/issues/450)
+
+### Commit Details
+
+
+
+view details
+
+ * **[#450](https://github.com/Byron/gitoxide/issues/450)**
+ - prepare changelog for initial `git-fetchhead` release ([`7aff085`](https://github.com/Byron/gitoxide/commit/7aff0856b76043f1e9021fff72ce96d4f69d255e))
+ - frame for `git-fetchhead` crate ([`f9aeda8`](https://github.com/Byron/gitoxide/commit/f9aeda88554fb852dd21ae8402000e0da742e2b2))
+
+
diff --git a/git-fetchhead/Cargo.toml b/git-fetchhead/Cargo.toml
new file mode 100644
index 00000000000..70d8a0a6fcb
--- /dev/null
+++ b/git-fetchhead/Cargo.toml
@@ -0,0 +1,13 @@
+[package]
+name = "git-fetchhead"
+version = "0.0.0"
+repository = "https://github.com/Byron/gitoxide"
+license = "MIT/Apache-2.0"
+description = "A WIP crate of the gitoxide project to read and write .git/FETCH_HEAD"
+authors = ["Sebastian Thiel "]
+edition = "2018"
+
+[lib]
+doctest = false
+
+[dependencies]
diff --git a/git-fetchhead/src/lib.rs b/git-fetchhead/src/lib.rs
new file mode 100644
index 00000000000..3a6cd994a53
--- /dev/null
+++ b/git-fetchhead/src/lib.rs
@@ -0,0 +1,2 @@
+#![deny(rust_2018_idioms)]
+#![forbid(unsafe_code)]
diff --git a/git-glob/Cargo.toml b/git-glob/Cargo.toml
index c901a098588..d3a904d45db 100644
--- a/git-glob/Cargo.toml
+++ b/git-glob/Cargo.toml
@@ -12,10 +12,10 @@ doctest = false
[features]
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
-serde1 = ["serde", "bstr/serde1"]
+serde1 = ["serde", "bstr/serde"]
[dependencies]
-bstr = { version = "0.2.13", default-features = false, features = ["std"]}
+bstr = { version = "1.0.1", default-features = false, features = ["std"]}
bitflags = "1.3.2"
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}
diff --git a/git-index/Cargo.toml b/git-index/Cargo.toml
index ba3c450943b..ef47e49af9a 100644
--- a/git-index/Cargo.toml
+++ b/git-index/Cargo.toml
@@ -38,7 +38,7 @@ git-object = { version = "^0.20.2", path = "../git-object" }
thiserror = "1.0.32"
memmap2 = "0.5.0"
filetime = "0.2.15"
-bstr = { version = "0.2.13", default-features = false }
+bstr = { version = "1.0.1", default-features = false }
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"] }
smallvec = "1.7.0"
diff --git a/git-mailmap/Cargo.toml b/git-mailmap/Cargo.toml
index 88a0400972f..9f229435a4f 100644
--- a/git-mailmap/Cargo.toml
+++ b/git-mailmap/Cargo.toml
@@ -12,11 +12,11 @@ doctest = false
[features]
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
-serde1 = ["serde", "bstr/serde1", "git-actor/serde1"]
+serde1 = ["serde", "bstr/serde", "git-actor/serde1"]
[dependencies]
git-actor = { version = "^0.11.3", path = "../git-actor" }
-bstr = { version = "0.2.13", default-features = false, features = ["std", "unicode"]}
+bstr = { version = "1.0.1", default-features = false, features = ["std", "unicode"]}
quick-error = "2.0.0"
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}
diff --git a/git-object/Cargo.toml b/git-object/Cargo.toml
index 5b23f0d470b..5565ab7b9f0 100644
--- a/git-object/Cargo.toml
+++ b/git-object/Cargo.toml
@@ -13,7 +13,7 @@ doctest = false
[features]
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
-serde1 = ["serde", "bstr/serde1", "smallvec/serde", "git-hash/serde1", "git-actor/serde1"]
+serde1 = ["serde", "bstr/serde", "smallvec/serde", "git-hash/serde1", "git-actor/serde1"]
## When parsing objects by default errors will only be available on the granularity of success or failure, and with the above flag enabled
## details information about the error location will be collected.
## Use it in applications which expect broken or invalid objects or for debugging purposes. Incorrectly formatted objects aren't at all
@@ -30,7 +30,7 @@ btoi = "0.4.2"
itoa = "1.0.1"
thiserror = "1.0.34"
hex = "0.4.2"
-bstr = { version = "0.2.13", default-features = false, features = ["std", "unicode"] }
+bstr = { version = "1.0.1", default-features = false, features = ["std", "unicode"] }
nom = { version = "7", default-features = false, features = ["std"]}
smallvec = { version = "1.4.0", features = ["write"] }
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}
diff --git a/git-pack/Cargo.toml b/git-pack/Cargo.toml
index 70b6c9d5a68..0ec79073ff2 100644
--- a/git-pack/Cargo.toml
+++ b/git-pack/Cargo.toml
@@ -63,7 +63,7 @@ document-features = { version = "0.2.0", optional = true }
git-testtools = { path = "../tests/tools"}
git-odb = { path = "../git-odb" }
tempfile = "3.1.0"
-bstr = { version = "0.2.13", default-features = false, features = ["std"] }
+bstr = { version = "1.0.1", default-features = false, features = ["std"] }
maplit = "1.0.2"
[package.metadata.docs.rs]
diff --git a/git-packetline/Cargo.toml b/git-packetline/Cargo.toml
index a7981dd3e5a..5f2c6c24b0d 100644
--- a/git-packetline/Cargo.toml
+++ b/git-packetline/Cargo.toml
@@ -25,7 +25,7 @@ async-io = ["futures-io", "futures-lite", "pin-project-lite"]
#! ### Other
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
-serde1 = ["serde", "bstr/serde1"]
+serde1 = ["serde", "bstr/serde"]
[[test]]
name = "async-packetline"
@@ -41,7 +41,7 @@ required-features = ["blocking-io", "maybe-async/is_sync"]
serde = { version = "1.0.114", optional = true, default-features = false, features = ["std", "derive"]}
thiserror = "1.0.34"
hex = "0.4.2"
-bstr = { version = "0.2.13", default-features = false, features = ["std"] }
+bstr = { version = "1.0.1", default-features = false, features = ["std"] }
# async support
futures-io = { version = "0.3.16", optional = true }
futures-lite = { version = "1.12.0", optional = true }
diff --git a/git-path/Cargo.toml b/git-path/Cargo.toml
index d771a5b87db..c10d334d4df 100644
--- a/git-path/Cargo.toml
+++ b/git-path/Cargo.toml
@@ -12,7 +12,7 @@ include = ["src/**/*", "CHANGELOG.md"]
doctest = false
[dependencies]
-bstr = { version = "0.2.17", default-features = false, features = ["std"] }
+bstr = { version = "1.0.1", default-features = false, features = ["std"] }
thiserror = "1.0.26"
[dev-dependencies]
diff --git a/git-pathspec/Cargo.toml b/git-pathspec/Cargo.toml
index 47878786254..97ed19abca8 100644
--- a/git-pathspec/Cargo.toml
+++ b/git-pathspec/Cargo.toml
@@ -14,7 +14,7 @@ doctest = false
git-glob = { version = "^0.3.2", path = "../git-glob" }
git-attributes = { version = "^0.3.3", path = "../git-attributes" }
-bstr = { version = "0.2.13", default-features = false, features = ["std"]}
+bstr = { version = "1.0.1", default-features = false, features = ["std"]}
bitflags = "1.3.2"
thiserror = "1.0.26"
diff --git a/git-protocol/Cargo.toml b/git-protocol/Cargo.toml
index d780c384d1f..e263117f841 100644
--- a/git-protocol/Cargo.toml
+++ b/git-protocol/Cargo.toml
@@ -26,7 +26,7 @@ async-client = ["git-transport/async-client", "async-trait", "futures-io", "futu
#! ### Other
## Data structures implement `serde::Serialize` and `serde::Deserialize`.
-serde1 = ["serde", "bstr/serde1", "git-transport/serde1", "git-hash/serde1"]
+serde1 = ["serde", "bstr/serde", "git-transport/serde1", "git-hash/serde1"]
[[test]]
name = "blocking-client-protocol"
@@ -46,7 +46,7 @@ git-credentials = { version = "^0.4.0", path = "../git-credentials" }
thiserror = "1.0.32"
serde = { version = "1.0.114", optional = true, default-features = false, features = ["derive"]}
-bstr = { version = "0.2.13", default-features = false, features = ["std"] }
+bstr = { version = "1.0.1", default-features = false, features = ["std"] }
nom = { version = "7", default-features = false, features = ["std"]}
btoi = "0.4.2"
diff --git a/git-quote/Cargo.toml b/git-quote/Cargo.toml
index 829647d1276..d96de1cae1f 100644
--- a/git-quote/Cargo.toml
+++ b/git-quote/Cargo.toml
@@ -11,6 +11,6 @@ edition = "2018"
doctest = false
[dependencies]
-bstr = { version = "0.2.13", default-features = false, features = ["std"]}
+bstr = { version = "1.0.1", default-features = false, features = ["std"]}
quick-error = "2.0.0"
btoi = "0.4.2"
diff --git a/git-refspec/Cargo.toml b/git-refspec/Cargo.toml
index 2897bed7e29..9ea3722f848 100644
--- a/git-refspec/Cargo.toml
+++ b/git-refspec/Cargo.toml
@@ -16,7 +16,7 @@ git-revision = { version = "^0.4.4", path = "../git-revision" }
git-validate = { version = "^0.5.5", path = "../git-validate" }
git-hash = { version = "^0.9.9", path = "../git-hash" }
-bstr = { version = "0.2.13", default-features = false, features = ["std"]}
+bstr = { version = "1.0.1", default-features = false, features = ["std"]}
thiserror = "1.0.26"
smallvec = "1.9.0"
diff --git a/git-refspec/src/instruction.rs b/git-refspec/src/instruction.rs
index cde4a09fc27..c37ceebcd35 100644
--- a/git-refspec/src/instruction.rs
+++ b/git-refspec/src/instruction.rs
@@ -42,9 +42,10 @@ pub enum Push<'a> {
/// Destinations can only be a partial or full ref-names on the local side.
#[derive(PartialOrd, Ord, PartialEq, Eq, Copy, Clone, Hash, Debug)]
pub enum Fetch<'a> {
- /// Fetch a ref or refs and write the result into the `FETCH_HEAD` without updating local branches.
+ /// Fetch a ref or refs, without updating local branches.
Only {
- /// The ref name to fetch on the remote side, without updating the local side. This will write the result into `FETCH_HEAD`.
+ /// The partial or full ref name to fetch on the remote side or the full object hex-name, without updating the local side.
+ /// Note that this may not be a glob pattern, as those need to be matched by a destination which isn't present here.
src: &'a BStr,
},
/// Exclude a single ref.
diff --git a/git-refspec/src/lib.rs b/git-refspec/src/lib.rs
index f53fdcdc013..54d5f3057a9 100644
--- a/git-refspec/src/lib.rs
+++ b/git-refspec/src/lib.rs
@@ -29,5 +29,11 @@ pub struct RefSpec {
mod spec;
+mod write;
+
+///
+pub mod match_group;
+pub use match_group::types::MatchGroup;
+
mod types;
pub use types::Instruction;
diff --git a/git-refspec/src/match_group/mod.rs b/git-refspec/src/match_group/mod.rs
new file mode 100644
index 00000000000..5b10ee32cc4
--- /dev/null
+++ b/git-refspec/src/match_group/mod.rs
@@ -0,0 +1,118 @@
+use crate::parse::Operation;
+use crate::types::Mode;
+use crate::{MatchGroup, RefSpecRef};
+use std::collections::BTreeSet;
+
+pub(crate) mod types;
+pub use types::{Item, Mapping, Outcome, Source, SourceRef};
+
+///
+pub mod validate;
+
+/// Initialization
+impl<'a> MatchGroup<'a> {
+ /// Take all the fetch ref specs from `specs` get a match group ready.
+ pub fn from_fetch_specs(specs: impl IntoIterator- >) -> Self {
+ MatchGroup {
+ specs: specs.into_iter().filter(|s| s.op == Operation::Fetch).collect(),
+ }
+ }
+}
+
+/// Matching
+impl<'a> MatchGroup<'a> {
+ /// Match all `items` against all fetch specs present in this group, returning deduplicated mappings from source to destination.
+ /// Note that this method only makes sense if the specs are indeed fetch specs and may panic otherwise.
+ ///
+ /// Note that negative matches are not part of the return value, so they are not observable but will be used to remove mappings.
+ pub fn match_remotes<'item>(self, mut items: impl Iterator
- > + Clone) -> Outcome<'a, 'item> {
+ let mut out = Vec::new();
+ let mut seen = BTreeSet::default();
+ let mut push_unique = |mapping| {
+ if seen.insert(calculate_hash(&mapping)) {
+ out.push(mapping);
+ }
+ };
+ let mut matchers: Vec