From 51d8f96348eade846eb82721bc190a8c93ace2a0 Mon Sep 17 00:00:00 2001 From: extrawurst Date: Fri, 15 Dec 2023 19:28:11 +0100 Subject: [PATCH 1/6] new crate that uses openai to summarize git diffs --- Cargo.lock | 100 ++++++++++++++++++++++++++++ Cargo.toml | 2 +- git2-summarize/Cargo.toml | 19 ++++++ git2-summarize/LICENSE.md | 1 + git2-summarize/README.md | 3 + git2-summarize/examples/simple.diff | 49 ++++++++++++++ git2-summarize/examples/simple.rs | 13 ++++ git2-summarize/src/lib.rs | 85 +++++++++++++++++++++++ 8 files changed, 271 insertions(+), 1 deletion(-) create mode 100644 git2-summarize/Cargo.toml create mode 120000 git2-summarize/LICENSE.md create mode 100644 git2-summarize/README.md create mode 100644 git2-summarize/examples/simple.diff create mode 100644 git2-summarize/examples/simple.rs create mode 100644 git2-summarize/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 1792def046..d922393ad1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -725,6 +725,16 @@ dependencies = [ "thiserror", ] +[[package]] +name = "git2-summarize" +version = "0.1.0" +dependencies = [ + "git2", + "log", + "openai-api-rs", + "thiserror", +] + [[package]] name = "git2-testing" version = "0.1.0" @@ -1056,6 +1066,21 @@ dependencies = [ "adler", ] +[[package]] +name = "minreq" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb3371dfc7b772c540da1380123674a8e20583aca99907087d990ca58cf44203" +dependencies = [ + "log", + "once_cell", + "rustls", + "rustls-webpki", + "serde", + "serde_json", + "webpki-roots", +] + [[package]] name = "mio" version = "0.8.5" @@ -1142,6 +1167,17 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "openai-api-rs" +version = "2.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ead8e910b541f342b445ab68dd52ae24d695abaf781aee2ae933a77ac29ea5de" +dependencies = [ + "minreq", + "serde", + "serde_json", +] + [[package]] name = "openssl-probe" version = "0.1.5" @@ -1382,6 +1418,20 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +[[package]] +name = "ring" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9babe80d5c16becf6594aa32ad2be8fe08498e7ae60b77de8df700e67f191d7e" +dependencies = [ + "cc", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.48.0", +] + [[package]] name = "ron" version = "0.8.0" @@ -1413,6 +1463,28 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "rustls" +version = "0.21.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +dependencies = [ + "log", + "ring", + "rustls-webpki", + "sct", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "ryu" version = "1.0.14" @@ -1447,6 +1519,16 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "serde" version = "1.0.156" @@ -1579,6 +1661,12 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "strsim" version = "0.10.0" @@ -1783,6 +1871,12 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.5.0" @@ -1882,6 +1976,12 @@ version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +[[package]] +name = "webpki-roots" +version = "0.25.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" + [[package]] name = "which" version = "4.4.0" diff --git a/Cargo.toml b/Cargo.toml index ce834bdf0b..43104819ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,7 +69,7 @@ trace-libgit = ["asyncgit/trace-libgit"] vendor-openssl = ["asyncgit/vendor-openssl"] [workspace] -members = ["asyncgit", "filetreelist", "git2-hooks", "git2-testing", "scopetime"] +members = ["asyncgit", "filetreelist", "git2-hooks", "git2-summarize", "git2-testing", "scopetime"] [profile.release] lto = true diff --git a/git2-summarize/Cargo.toml b/git2-summarize/Cargo.toml new file mode 100644 index 0000000000..7d2041e828 --- /dev/null +++ b/git2-summarize/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "git2-summarize" +version = "0.1.0" +authors = ["extrawurst "] +edition = "2021" +description = "use openai gpt to summarize git2 diffs" +homepage = "https://github.com/extrawurst/gitui" +repository = "https://github.com/extrawurst/gitui" +documentation = "https://docs.rs/git2-summarize/" +readme = "README.md" +license = "MIT" +categories = ["development-tools"] +keywords = ["git"] + +[dependencies] +git2 = ">=0.17" +log = "0.4" +thiserror = "1.0" +openai-api-rs = "2.1" diff --git a/git2-summarize/LICENSE.md b/git2-summarize/LICENSE.md new file mode 120000 index 0000000000..7eabdb1c27 --- /dev/null +++ b/git2-summarize/LICENSE.md @@ -0,0 +1 @@ +../LICENSE.md \ No newline at end of file diff --git a/git2-summarize/README.md b/git2-summarize/README.md new file mode 100644 index 0000000000..8c108ec117 --- /dev/null +++ b/git2-summarize/README.md @@ -0,0 +1,3 @@ +# git2-summarize + +this uses open ai chat-gpt to summarize a git diff \ No newline at end of file diff --git a/git2-summarize/examples/simple.diff b/git2-summarize/examples/simple.diff new file mode 100644 index 0000000000..f9f54599fc --- /dev/null +++ b/git2-summarize/examples/simple.diff @@ -0,0 +1,49 @@ +diff --git a/git2-hooks/src/lib.rs b/git2-hooks/src/lib.rs +index 0cf5ac8..042ac87 100644 +--- a/git2-hooks/src/lib.rs ++++ b/git2-hooks/src/lib.rs +@@ -27,6 +27,7 @@ use git2::Repository; + pub const HOOK_POST_COMMIT: &str = "post-commit"; + pub const HOOK_PRE_COMMIT: &str = "pre-commit"; + pub const HOOK_COMMIT_MSG: &str = "commit-msg"; ++pub const HOOK_PRE_PUSH: &str = "pre-push"; + + const HOOK_COMMIT_MSG_TEMP_FILE: &str = "COMMIT_EDITMSG"; + +@@ -152,6 +153,36 @@ pub fn hooks_post_commit( + hook.run_hook(&[]) + } + ++/// see [`hooks_pre_push`] ++pub enum PrePushHookLocalRef<'a> { ++ Delete, ++ Ref { ++ local_ref: &'a str, ++ local_obj_name: &'a str, ++ }, ++} ++ ++/// see https://git-scm.com/docs/githooks#_pre_push ++/// ++/// # Arguments ++/// ++/// * `remote_obj_name` - pass `None` if foreign ref not yet exists ++pub fn hooks_pre_push( ++ repo: &Repository, ++ other_paths: Option<&[&str]>, ++ local_ref: PrePushHookLocalRef, ++ remote_ref: &str, ++ remote_obj_name: Option<&str>, ++) -> Result { ++ let hook = HookPaths::new(repo, other_paths, HOOK_PRE_PUSH)?; ++ ++ if !hook.found() { ++ return Ok(HookResult::NoHookFound); ++ } ++ ++ hook.run_hook(&[]) ++} ++ + #[cfg(test)] + mod tests { + use super::*; diff --git a/git2-summarize/examples/simple.rs b/git2-summarize/examples/simple.rs new file mode 100644 index 0000000000..a39e800d2d --- /dev/null +++ b/git2-summarize/examples/simple.rs @@ -0,0 +1,13 @@ +use std::env; + +fn main() { + let diff = include_str!("simple.diff"); + + let summary = git2_summarize::git_diff_summarize_old( + &env::var("OPENAI_API_KEY").unwrap(), + diff, + ) + .unwrap(); + + println!("{summary}"); +} diff --git a/git2-summarize/src/lib.rs b/git2-summarize/src/lib.rs new file mode 100644 index 0000000000..20d8242f43 --- /dev/null +++ b/git2-summarize/src/lib.rs @@ -0,0 +1,85 @@ +//! Uses Open API GPT-3 to summarize unified git diffs + +use openai_api_rs::v1::{ + api::Client, + chat_completion::{self, ChatCompletionRequest}, + common::GPT3_5_TURBO, + completion::{self, CompletionRequest}, +}; + +/// Uses old GPT3_TEXT_DAVINCI_003 model to generate message +/// +/// # Arguments +/// +/// * `api_key` - open api key +/// * `diff` - expects a diff formatted as a unified diff +pub fn git_diff_summarize_old( + api_key: &str, + diff: &str, +) -> Result { + let client = Client::new(api_key.to_string()); + + let req = CompletionRequest::new( + completion::GPT3_TEXT_DAVINCI_003.to_string(), + format!("Generate a Git commit message based on the following summary: {}\n\nCommit message: ",diff), + ) + .max_tokens(500) + .temperature(0.5) + .n(1); + + let result = client.completion(req).map_err(|e| e.message)?; + Ok(result + .choices + .get(0) + .ok_or_else(|| String::from("choises empty"))? + .text + .clone()) +} + +/// Uses GPT3_5_TURBO model to generate message using chat completion API +/// +/// # Arguments +/// +/// * `api_key` - open api key +/// * `diff` - expects a diff formatted as a unified diff +pub fn git_diff_summarize( + api_key: &str, + diff: &str, + line_length: usize, +) -> Result { + let client = Client::new(api_key.to_string()); + + let prompt = format!( + r#"You are a smart git commit message creator software. + Now you are going to create a git commit message. + The commit messages you generate aim to explain why the changes were introduced. + Write a one-sentence message no longer than {line_length} characters, followed by two newline characters. + Create a commit message for these changes:\n{} + "#, + diff + ); + + let req = ChatCompletionRequest::new( + GPT3_5_TURBO.to_string(), + vec![chat_completion::ChatCompletionMessage { + role: chat_completion::MessageRole::system, + content: prompt, + name: None, + function_call: None, + }], + ) + .max_tokens(200); + + let result = + client.chat_completion(req).map_err(|e| e.message)?; + + Ok(result + .choices + .get(0) + .ok_or_else(|| String::from("response.choises empty"))? + .message + .content + .as_ref() + .ok_or_else(|| String::from("choise[0].message empty"))? + .clone()) +} From c98ca240a6ed236e560962eb8ffd366439f48756 Mon Sep 17 00:00:00 2001 From: extrawurst Date: Fri, 15 Dec 2023 19:33:27 +0100 Subject: [PATCH 2/6] Add command to use ai to generate commit msg --- Cargo.lock | 1 + Cargo.toml | 1 + asyncgit/src/sync/diff.rs | 31 +++++++++++++++++++++++++++- asyncgit/src/sync/mod.rs | 2 +- src/components/commit.rs | 43 +++++++++++++++++++++++++++++++++++++++ src/keys/key_list.rs | 2 ++ src/strings.rs | 13 ++++++++++++ 7 files changed, 91 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d922393ad1..70f37d1ddb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -765,6 +765,7 @@ dependencies = [ "filetreelist", "fuzzy-matcher", "gh-emoji", + "git2-summarize", "indexmap", "itertools", "log", diff --git a/Cargo.toml b/Cargo.toml index 43104819ff..bb70efeae5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ keywords = ["git", "gui", "cli", "terminal", "ui"] [dependencies] anyhow = "1.0" asyncgit = { path = "./asyncgit", version = "0.24", default-features = false } +git2-summarize = { path = "./git2-summarize", version = "0.1"} backtrace = "0.3" bitflags = "1.3" bugreport = "0.5" diff --git a/asyncgit/src/sync/diff.rs b/asyncgit/src/sync/diff.rs index f02e1be3df..5f876914b0 100644 --- a/asyncgit/src/sync/diff.rs +++ b/asyncgit/src/sync/diff.rs @@ -9,7 +9,7 @@ use crate::{ error::Error, error::Result, hash, - sync::{get_stashes, repository::repo}, + sync::{get_stashes, repository::repo, utils::bytes2string}, }; use easy_cast::Conv; use git2::{ @@ -398,6 +398,35 @@ fn raw_diff_to_file_diff( Ok(res.into_inner()) } +/// +pub fn unified_stage_diff(repo_path: &RepoPath) -> Result { + scope_time!("unified_stage_diff"); + + let repo = repo(repo_path)?; + + let diff = get_diff_raw(&repo, "*", true, false, None)?; + + let mut output = String::with_capacity(32); + + diff.print(DiffFormat::Patch, |_delta, _hunk, line| { + let prefix = match line.origin_value() { + git2::DiffLineType::Addition => "+", + git2::DiffLineType::Deletion => "-", + _ => "", + }; + + output.push_str(&format!( + "{}{}", + prefix, + bytes2string(line.content()).unwrap() + )); + + true + })?; + + Ok(output) +} + const fn is_newline(c: char) -> bool { c == '\n' || c == '\r' } diff --git a/asyncgit/src/sync/mod.rs b/asyncgit/src/sync/mod.rs index 909bea6f03..ff3a2c0852 100644 --- a/asyncgit/src/sync/mod.rs +++ b/asyncgit/src/sync/mod.rs @@ -62,7 +62,7 @@ pub use config::{ get_config_string, untracked_files_config, ShowUntrackedFilesConfig, }; -pub use diff::get_diff_commit; +pub use diff::{get_diff_commit, unified_stage_diff}; pub use git2::BranchType; pub use hooks::{ hooks_commit_msg, hooks_post_commit, hooks_pre_commit, HookResult, diff --git a/src/components/commit.rs b/src/components/commit.rs index ba32394a74..95081b30d0 100644 --- a/src/components/commit.rs +++ b/src/components/commit.rs @@ -59,6 +59,7 @@ pub struct CommitComponent { commit_msg_history_idx: usize, options: SharedOptions, verify: bool, + open_ai_token: Option, } const FIRST_LINE_LIMIT: usize = 50; @@ -90,6 +91,7 @@ impl CommitComponent { commit_msg_history_idx: 0, options, verify: true, + open_ai_token: std::env::var("OPENAI_API_KEY").ok(), } } @@ -352,6 +354,30 @@ impl CommitComponent { self.input.set_text(signed_msg); } } + + fn commit_summarize(&mut self) -> Result<()> { + use std::result::Result::Ok; + + if let Some(api_key) = self.open_ai_token.as_ref() { + let mut unified_diff = + sync::unified_stage_diff(&self.repo.borrow())?; + + while unified_diff.len() > 3500 { + unified_diff.pop(); + } + + match git2_summarize::git_diff_summarize( + &api_key, + &unified_diff, + FIRST_LINE_LIMIT, + ) { + Ok(msg) => self.input.set_text(msg), + Err(e) => bail!(e), + }; + } + + Ok(()) + } fn toggle_verify(&mut self) { self.verify = !self.verify; } @@ -539,6 +565,14 @@ impl Component for CommitComponent { self.options.borrow().has_commit_msg_history(), true, )); + + out.push(CommandInfo::new( + strings::commands::commit_msg_summarize( + &self.key_config, + ), + self.open_ai_token.is_some(), + true, + )); } visibility_blocking(self) @@ -596,6 +630,15 @@ impl Component for CommitComponent { self.key_config.keys.toggle_signoff, ) { self.signoff_commit(); + } else if key_match( + e, + self.key_config.keys.commit_msg_summarize, + ) { + try_or_popup!( + self, + "commit summary error:", + self.commit_summarize() + ); } // stop key event propagation return Ok(EventState::Consumed); diff --git a/src/keys/key_list.rs b/src/keys/key_list.rs index 5530719330..916e133441 100644 --- a/src/keys/key_list.rs +++ b/src/keys/key_list.rs @@ -120,6 +120,7 @@ pub struct KeysList { pub view_submodule_parent: GituiKeyEvent, pub update_submodule: GituiKeyEvent, pub commit_history_next: GituiKeyEvent, + pub commit_msg_summarize: GituiKeyEvent, } #[rustfmt::skip] @@ -209,6 +210,7 @@ impl Default for KeysList { view_submodule_parent: GituiKeyEvent::new(KeyCode::Char('p'), KeyModifiers::empty()), update_submodule: GituiKeyEvent::new(KeyCode::Char('u'), KeyModifiers::empty()), commit_history_next: GituiKeyEvent::new(KeyCode::Char('n'), KeyModifiers::CONTROL), + commit_msg_summarize: GituiKeyEvent::new(KeyCode::Char('g'), KeyModifiers::CONTROL), } } } diff --git a/src/strings.rs b/src/strings.rs index 6c3b061a65..448ccff3ee 100644 --- a/src/strings.rs +++ b/src/strings.rs @@ -965,6 +965,19 @@ pub mod commands { CMD_GROUP_COMMIT_POPUP, ) } + pub fn commit_msg_summarize( + key_config: &SharedKeyConfig, + ) -> CommandText { + CommandText::new( + format!( + "Summarize [{}]", + key_config + .get_hint(key_config.keys.commit_msg_summarize), + ), + "use openai chat-gpt to generate commit message", + CMD_GROUP_COMMIT_POPUP, + ) + } pub fn commit_enter(key_config: &SharedKeyConfig) -> CommandText { CommandText::new( format!( From b0d66cb176187809e6a81457e25521692222caac Mon Sep 17 00:00:00 2001 From: extrawurst Date: Fri, 15 Dec 2023 20:00:21 +0100 Subject: [PATCH 3/6] clippy fixes --- asyncgit/src/sync/diff.rs | 8 +++----- git2-summarize/examples/simple.rs | 3 ++- git2-summarize/src/lib.rs | 32 +------------------------------ src/components/commit.rs | 2 +- 4 files changed, 7 insertions(+), 38 deletions(-) diff --git a/asyncgit/src/sync/diff.rs b/asyncgit/src/sync/diff.rs index 5f876914b0..739ac90315 100644 --- a/asyncgit/src/sync/diff.rs +++ b/asyncgit/src/sync/diff.rs @@ -415,11 +415,9 @@ pub fn unified_stage_diff(repo_path: &RepoPath) -> Result { _ => "", }; - output.push_str(&format!( - "{}{}", - prefix, - bytes2string(line.content()).unwrap() - )); + if let Ok(line) = bytes2string(line.content()) { + output.push_str(&format!("{prefix}{line}")); + } true })?; diff --git a/git2-summarize/examples/simple.rs b/git2-summarize/examples/simple.rs index a39e800d2d..2074aec0c0 100644 --- a/git2-summarize/examples/simple.rs +++ b/git2-summarize/examples/simple.rs @@ -3,9 +3,10 @@ use std::env; fn main() { let diff = include_str!("simple.diff"); - let summary = git2_summarize::git_diff_summarize_old( + let summary = git2_summarize::git_diff_summarize( &env::var("OPENAI_API_KEY").unwrap(), diff, + 50, ) .unwrap(); diff --git a/git2-summarize/src/lib.rs b/git2-summarize/src/lib.rs index 20d8242f43..63a8920070 100644 --- a/git2-summarize/src/lib.rs +++ b/git2-summarize/src/lib.rs @@ -1,41 +1,11 @@ -//! Uses Open API GPT-3 to summarize unified git diffs +//! Uses Open API GPT-3 to summarize unified git diffs use openai_api_rs::v1::{ api::Client, chat_completion::{self, ChatCompletionRequest}, common::GPT3_5_TURBO, - completion::{self, CompletionRequest}, }; -/// Uses old GPT3_TEXT_DAVINCI_003 model to generate message -/// -/// # Arguments -/// -/// * `api_key` - open api key -/// * `diff` - expects a diff formatted as a unified diff -pub fn git_diff_summarize_old( - api_key: &str, - diff: &str, -) -> Result { - let client = Client::new(api_key.to_string()); - - let req = CompletionRequest::new( - completion::GPT3_TEXT_DAVINCI_003.to_string(), - format!("Generate a Git commit message based on the following summary: {}\n\nCommit message: ",diff), - ) - .max_tokens(500) - .temperature(0.5) - .n(1); - - let result = client.completion(req).map_err(|e| e.message)?; - Ok(result - .choices - .get(0) - .ok_or_else(|| String::from("choises empty"))? - .text - .clone()) -} - /// Uses GPT3_5_TURBO model to generate message using chat completion API /// /// # Arguments diff --git a/src/components/commit.rs b/src/components/commit.rs index 95081b30d0..f86377e1f4 100644 --- a/src/components/commit.rs +++ b/src/components/commit.rs @@ -367,7 +367,7 @@ impl CommitComponent { } match git2_summarize::git_diff_summarize( - &api_key, + api_key, &unified_diff, FIRST_LINE_LIMIT, ) { From 86df3f1b3c7af2390319da57347a15802032776b Mon Sep 17 00:00:00 2001 From: extrawurst Date: Fri, 15 Dec 2023 20:16:43 +0100 Subject: [PATCH 4/6] fix license --- deny.toml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/deny.toml b/deny.toml index ed75622d3f..e089c2cba3 100644 --- a/deny.toml +++ b/deny.toml @@ -7,17 +7,23 @@ allow = [ "BSD-3-Clause", "CC0-1.0", "ISC", - "MPL-2.0" + "MPL-2.0", + "OpenSSL" ] copyleft = "warn" allow-osi-fsf-free = "neither" default = "deny" confidence-threshold = 0.9 +exceptions = [ + { name = "unicode-ident", allow = ["Unicode-DFS-2016"], version = "1.0.3" }, +] -[[licenses.exceptions]] -allow = ["Unicode-DFS-2016"] -name = "unicode-ident" -version = "1.0.3" +[[licenses.clarify]] +name = "ring" +expression = "MIT AND ISC AND OpenSSL" +license-files = [ + { path = "LICENSE", hash = 0xbd0eed23 } +] [bans] multiple-versions = "deny" From 51fea784900de2265a83a467177d9f73b945daf6 Mon Sep 17 00:00:00 2001 From: extrawurst Date: Sat, 16 Dec 2023 00:31:37 +0100 Subject: [PATCH 5/6] cleanup --- deny.toml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/deny.toml b/deny.toml index e089c2cba3..0562a0e046 100644 --- a/deny.toml +++ b/deny.toml @@ -8,25 +8,23 @@ allow = [ "CC0-1.0", "ISC", "MPL-2.0", - "OpenSSL" + "OpenSSL", ] copyleft = "warn" allow-osi-fsf-free = "neither" default = "deny" confidence-threshold = 0.9 -exceptions = [ - { name = "unicode-ident", allow = ["Unicode-DFS-2016"], version = "1.0.3" }, -] + +[[licenses.exceptions]] +allow = ["Unicode-DFS-2016"] +name = "unicode-ident" +version = "1.0.3" [[licenses.clarify]] name = "ring" expression = "MIT AND ISC AND OpenSSL" -license-files = [ - { path = "LICENSE", hash = 0xbd0eed23 } -] +license-files = [{ path = "LICENSE", hash = 0xbd0eed23 }] [bans] multiple-versions = "deny" -skip-tree = [ - { name = "windows-sys" } -] +skip-tree = [{ name = "windows-sys" }] From c8db258ef5ee0b393db80f8be0643054c9a6daf5 Mon Sep 17 00:00:00 2001 From: extrawurst Date: Sat, 16 Dec 2023 00:34:59 +0100 Subject: [PATCH 6/6] cleanup --- Cargo.lock | 1 - Cargo.toml | 2 +- git2-summarize/Cargo.toml | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dd1645d104..206f4703c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -732,7 +732,6 @@ dependencies = [ "git2", "log", "openai-api-rs", - "thiserror", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index bb70efeae5..9f5cffd9f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,6 @@ keywords = ["git", "gui", "cli", "terminal", "ui"] [dependencies] anyhow = "1.0" asyncgit = { path = "./asyncgit", version = "0.24", default-features = false } -git2-summarize = { path = "./git2-summarize", version = "0.1"} backtrace = "0.3" bitflags = "1.3" bugreport = "0.5" @@ -31,6 +30,7 @@ easy-cast = "0.5" filetreelist = { path = "./filetreelist", version = "0.5" } fuzzy-matcher = "0.3" gh-emoji = { version = "1.0", optional = true } +git2-summarize = { path = "./git2-summarize", version = "0.1" } indexmap = "1.9" itertools = "0.12" log = "0.4" diff --git a/git2-summarize/Cargo.toml b/git2-summarize/Cargo.toml index 7d2041e828..e701fc500b 100644 --- a/git2-summarize/Cargo.toml +++ b/git2-summarize/Cargo.toml @@ -15,5 +15,4 @@ keywords = ["git"] [dependencies] git2 = ">=0.17" log = "0.4" -thiserror = "1.0" openai-api-rs = "2.1"