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;
51mod pull;
52mod push;
53mod push_tags;
54pub mod remote_progress;
55pub mod remote_tags;
56mod revlog;
57mod status;
58pub mod sync;
59mod tags;
60mod treefiles;
61
62use std::{
63 collections::hash_map::DefaultHasher,
64 hash::{Hash, Hasher},
65};
66
67pub use git2::message_prettify;
68
69pub use crate::{
70 blame::{AsyncBlame, BlameParams},
71 branches::AsyncBranchesJob,
72 commit_files::{AsyncCommitFiles, CommitFilesParams},
73 diff::{AsyncDiff, DiffParams, DiffType},
74 error::{Error, Result},
75 fetch_job::AsyncFetchJob,
76 filter_commits::{AsyncCommitFilterJob, CommitFilterResult},
77 progress::ProgressPercent,
78 pull::{AsyncPull, FetchRequest},
79 push::{AsyncPush, PushRequest},
80 push_tags::{AsyncPushTags, PushTagsRequest},
81 remote_progress::{RemoteProgress, RemoteProgressState},
82 revlog::{AsyncLog, FetchStatus},
83 status::{AsyncStatus, StatusParams},
84 sync::{
85 diff::{DiffLine, DiffLineType, FileDiff},
86 remotes::push::PushType,
87 status::{StatusItem, StatusItemType},
88 },
89 tags::AsyncTags,
90 treefiles::AsyncTreeFilesJob,
91};
92
93#[derive(Copy, Clone, Debug, PartialEq, Eq)]
95pub enum AsyncGitNotification {
96 FinishUnchanged,
99 Status,
101 Diff,
103 Log,
105 FileLog,
107 CommitFiles,
109 Tags,
111 Push,
113 PushTags,
115 Pull,
117 Blame,
119 RemoteTags,
121 Fetch,
123 Branches,
125 TreeFiles,
127 CommitFilter,
129}
130
131pub fn hash<T: Hash + ?Sized>(v: &T) -> u64 {
134 let mut hasher = DefaultHasher::new();
135 v.hash(&mut hasher);
136 hasher.finish()
137}
138
139#[cfg(feature = "trace-libgit")]
141pub fn register_tracing_logging() -> bool {
142 fn git_trace(level: git2::TraceLevel, msg: &str) {
143 log::info!("[{:?}]: {}", level, msg);
144 }
145 git2::trace_set(git2::TraceLevel::Trace, git_trace)
146}
147
148#[cfg(not(feature = "trace-libgit"))]
150pub fn register_tracing_logging() -> bool {
151 true
152}