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