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 asyncjob;
42mod blame;
43mod branches;
44pub mod cached;
45mod commit_files;
46mod diff;
47mod error;
48mod fetch_job;
49mod filter_commits;
50mod progress;
52mod pull;
53mod push;
54mod push_tags;
55pub mod remote_progress;
56pub mod remote_tags;
57mod revlog;
58mod status;
59pub mod sync;
60mod tags;
61mod treefiles;
62
63use std::{
64 collections::hash_map::DefaultHasher,
65 hash::{Hash, Hasher},
66};
67
68pub use git2::message_prettify;
69
70pub use crate::{
71 blame::{AsyncBlame, BlameParams},
72 branches::AsyncBranchesJob,
73 commit_files::{AsyncCommitFiles, CommitFilesParams},
74 diff::{AsyncDiff, DiffParams, DiffType},
75 error::{Error, Result},
76 fetch_job::AsyncFetchJob,
77 filter_commits::{AsyncCommitFilterJob, CommitFilterResult},
78 progress::ProgressPercent,
79 pull::{AsyncPull, FetchRequest},
80 push::{AsyncPush, PushRequest},
81 push_tags::{AsyncPushTags, PushTagsRequest},
82 remote_progress::{RemoteProgress, RemoteProgressState},
83 revlog::{AsyncLog, FetchStatus},
84 status::{AsyncStatus, StatusParams},
85 sync::{
86 diff::{DiffLine, DiffLineType, FileDiff},
87 remotes::push::PushType,
88 status::{StatusItem, StatusItemType},
89 },
90 tags::AsyncTags,
91 treefiles::AsyncTreeFilesJob,
92};
93
94#[derive(Copy, Clone, Debug, PartialEq, Eq)]
96pub enum AsyncGitNotification {
97 FinishUnchanged,
100 Status,
102 Diff,
104 Log,
106 FileLog,
108 CommitFiles,
110 Tags,
112 Push,
114 PushTags,
116 Pull,
118 Blame,
120 RemoteTags,
122 Fetch,
124 Branches,
126 TreeFiles,
128 CommitFilter,
130}
131
132pub fn hash<T: Hash + ?Sized>(v: &T) -> u64 {
135 let mut hasher = DefaultHasher::new();
136 v.hash(&mut hasher);
137 hasher.finish()
138}
139
140#[cfg(feature = "trace-libgit")]
142pub fn register_tracing_logging() -> bool {
143 fn git_trace(level: git2::TraceLevel, msg: &str) {
144 log::info!("[{:?}]: {}", level, msg);
145 }
146 git2::trace_set(git2::TraceLevel::Trace, git_trace)
147}
148
149#[cfg(not(feature = "trace-libgit"))]
151pub fn register_tracing_logging() -> bool {
152 true
153}