diff --git a/Cargo.lock b/Cargo.lock
@@ -494,26 +494,6 @@ dependencies = [
"serde",
]
-[[package]]
-name = "const-random"
-version = "0.1.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359"
-dependencies = [
- "const-random-macro",
-]
-
-[[package]]
-name = "const-random-macro"
-version = "0.1.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e"
-dependencies = [
- "getrandom",
- "once_cell",
- "tiny-keccak",
-]
-
[[package]]
name = "const_format"
version = "0.2.33"
@@ -576,12 +556,6 @@ version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
-[[package]]
-name = "crunchy"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
-
[[package]]
name = "crypto-common"
version = "0.1.6"
@@ -678,15 +652,6 @@ dependencies = [
"syn",
]
-[[package]]
-name = "dlv-list"
-version = "0.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "442039f5147480ba31067cb00ada1adae6892028e40e45fc5de7b7df6dcc1b5f"
-dependencies = [
- "const-random",
-]
-
[[package]]
name = "dunce"
version = "1.0.5"
@@ -2269,16 +2234,6 @@ version = "1.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
-[[package]]
-name = "ordered-multimap"
-version = "0.7.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49203cdcae0030493bad186b28da2fa25645fa276a51b6fec8010d281e02ef79"
-dependencies = [
- "dlv-list",
- "hashbrown",
-]
-
[[package]]
name = "parking"
version = "2.2.1"
@@ -2591,7 +2546,6 @@ dependencies = [
"rkyv",
"rocksdb",
"rsass",
- "rust-ini",
"serde",
"simdutf8",
"tar",
@@ -2668,17 +2622,6 @@ dependencies = [
"tracing",
]
-[[package]]
-name = "rust-ini"
-version = "0.21.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e310ef0e1b6eeb79169a1171daf9abcb87a2e17c03bee2c4bb100b55c75409f"
-dependencies = [
- "cfg-if",
- "ordered-multimap",
- "trim-in-place",
-]
-
[[package]]
name = "rustc-demangle"
version = "0.1.24"
@@ -3063,15 +3006,6 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1710e589de0a76aaf295cd47a6699f6405737dbfd3cf2b75c92d000b548d0e6"
-[[package]]
-name = "tiny-keccak"
-version = "2.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237"
-dependencies = [
- "crunchy",
-]
-
[[package]]
name = "tinystr"
version = "0.7.6"
@@ -3295,12 +3229,6 @@ version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8ddffe35a0e5eeeadf13ff7350af564c6e73993a24db62caee1822b185c2600"
-[[package]]
-name = "trim-in-place"
-version = "0.1.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "343e926fc669bc8cde4fa3129ab681c63671bae288b1f1081ceee6d9d37904fc"
-
[[package]]
name = "triomphe"
version = "0.1.11"
diff --git a/Cargo.toml b/Cargo.toml
@@ -59,7 +59,6 @@ rkyv = { version = "0.8", features = [
"alloc",
], default-features = false }
rocksdb = { version = "0.22", default-features = false, features = ["snappy"] }
-rust-ini = "0.21.1"
serde = { version = "1.0", features = ["derive", "rc"] }
simdutf8 = "0.1.5"
tar = { version = "0.4", default-features = false }
diff --git a/src/database/indexer.rs b/src/database/indexer.rs
@@ -8,7 +8,6 @@ use std::{
use anyhow::Context;
use gix::{bstr::ByteSlice, refs::Category, Reference};
-use ini::Ini;
use itertools::Itertools;
use rocksdb::WriteBatch;
use time::{OffsetDateTime, UtcOffset};
@@ -70,11 +69,16 @@ fn update_repository_metadata(scan_path: &Path, db: &rocksdb::DB) {
.ok()
.filter(|v| !v.is_empty());
+ let owner = git_repository
+ .config_snapshot()
+ .string("gitweb.owner")
+ .map(|v| v.to_string());
+
let res = Repository {
id,
name: name.to_string(),
description,
- owner: find_gitweb_owner(repository_path.as_path()),
+ owner,
last_modified: {
let r =
find_last_committed_time(&git_repository).unwrap_or(OffsetDateTime::UNIX_EPOCH);
@@ -104,16 +108,11 @@ fn find_last_committed_time(repo: &gix::Repository) -> Result<OffsetDateTime, an
};
let committer = commit.committer()?;
- let mut committed_time = OffsetDateTime::from_unix_timestamp(committer.time.seconds)
- .unwrap_or(OffsetDateTime::UNIX_EPOCH);
-
- if let Ok(offset) = UtcOffset::from_whole_seconds(committer.time.offset) {
- committed_time = committed_time.to_offset(offset);
- }
-
- if committed_time > timestamp {
- timestamp = committed_time;
- }
+ let offset = UtcOffset::from_whole_seconds(committer.time.offset).unwrap_or(UtcOffset::UTC);
+ let committed_time = OffsetDateTime::from_unix_timestamp(committer.time.seconds)
+ .unwrap_or(OffsetDateTime::UNIX_EPOCH)
+ .to_offset(offset);
+ timestamp = timestamp.max(committed_time);
}
Ok(timestamp)
@@ -431,12 +430,3 @@ fn discover_repositories(current: &Path, discovered_repos: &mut Vec<(PathBuf, gi
}
}
}
-
-fn find_gitweb_owner(repository_path: &Path) -> Option<String> {
- // Load the Git config file and attempt to extract the owner from the "gitweb" section.
- // If the owner is not found, an empty string is returned.
- Ini::load_from_file(repository_path.join("config"))
- .ok()?
- .section_mut(Some("gitweb"))
- .and_then(|section| section.remove("owner"))
-}