1#![warn(missing_docs)]
4#![warn(
5 unused_imports,
6 unused_must_use,
7 dead_code,
8 unstable_name_collisions,
9 unused_assignments
10)]
11#![warn(clippy::all, clippy::perf, clippy::nursery, clippy::pedantic)]
12#![warn(
13 clippy::filetype_is_file,
14 clippy::cargo,
15 clippy::unwrap_used,
16 clippy::panic,
17 clippy::match_like_matches_macro,
18 clippy::needless_update
19 )]
22#![allow(
23 clippy::module_name_repetitions,
24 clippy::must_use_candidate,
25 clippy::missing_errors_doc
26)]
27#![allow(
29 clippy::significant_drop_tightening,
30 clippy::missing_panics_doc,
31 clippy::multiple_crate_versions,
32 clippy::needless_pass_by_ref_mut,
33 clippy::too_long_first_doc_paragraph,
34 clippy::set_contains_or_insert,
35 clippy::empty_docs
36)]
37
38pub mod gitui;
40
41pub mod gnostr;
43
44pub mod asyncjob;
45mod blame;
46mod branches;
47pub mod cached;
48mod commit_files;
49mod diff;
50mod error;
51mod fetch_job;
52mod filter_commits;
53mod progress;
54mod pull;
55mod push;
56mod push_tags;
57pub mod remote_progress;
58pub mod remote_tags;
59mod revlog;
60mod status;
61pub mod sync;
62mod tags;
63mod treefiles;
64
65use std::{
66 collections::hash_map::DefaultHasher,
67 hash::{Hash, Hasher},
68};
69
70pub use git2::message_prettify;
71
72pub use crate::{
73 blame::{AsyncBlame, BlameParams},
74 branches::AsyncBranchesJob,
75 commit_files::{AsyncCommitFiles, CommitFilesParams},
76 diff::{AsyncDiff, DiffParams, DiffType},
77 error::{Error, Result},
78 fetch_job::AsyncFetchJob,
79 filter_commits::{AsyncCommitFilterJob, CommitFilterResult},
80 progress::ProgressPercent,
81 pull::{AsyncPull, FetchRequest},
82 push::{AsyncPush, PushRequest},
83 push_tags::{AsyncPushTags, PushTagsRequest},
84 remote_progress::{RemoteProgress, RemoteProgressState},
85 revlog::{AsyncLog, FetchStatus},
86 status::{AsyncStatus, StatusParams},
87 sync::{
88 diff::{DiffLine, DiffLineType, FileDiff},
89 remotes::push::PushType,
90 status::{StatusItem, StatusItemType},
91 },
92 tags::AsyncTags,
93 treefiles::AsyncTreeFilesJob,
94};
95
96#[derive(Copy, Clone, Debug, PartialEq, Eq)]
98pub enum AsyncGitNotification {
99 FinishUnchanged,
102 Status,
104 Diff,
106 Log,
108 FileLog,
110 CommitFiles,
112 Tags,
114 Push,
116 PushTags,
118 Pull,
120 Blame,
122 RemoteTags,
124 Fetch,
126 Branches,
128 TreeFiles,
130 CommitFilter,
132}
133
134pub fn hash<T: Hash + ?Sized>(v: &T) -> u64 {
137 let mut hasher = DefaultHasher::new();
138 v.hash(&mut hasher);
139 hasher.finish()
140}
141
142#[cfg(feature = "trace-libgit")]
144pub fn register_tracing_logging() -> bool {
145 fn git_trace(level: git2::TraceLevel, msg: &[u8]) {
146 if let Ok(msg) = std::str::from_utf8(msg) {
147 log::info!("[{:?}]: {}", level, msg);
148 }
149 }
150 git2::trace_set(git2::TraceLevel::Trace, git_trace).is_ok()
151}
152
153#[cfg(not(feature = "trace-libgit"))]
155pub fn register_tracing_logging() -> bool {
156 true
157}