From 7be82a2c648b2c9a5c02531c1fb93da7532d9ffc Mon Sep 17 00:00:00 2001 From: Aidan Cunniffe Date: Thu, 3 Jul 2025 18:44:18 -0400 Subject: [PATCH 1/5] modified refs init --- src/git/refs.rs | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/src/git/refs.rs b/src/git/refs.rs index f073f3740..0314813f9 100644 --- a/src/git/refs.rs +++ b/src/git/refs.rs @@ -70,23 +70,6 @@ pub fn setup_ai_refspecs(repo: &Repository) -> Result<(), GitAiError> { for i in 0..remotes.len() { if let Some(remote_name) = remotes.get(i) { - // Check if default fetch refspec exists, if not add it - let fetch_output = std::process::Command::new("git") - .args(["config", "--get", &format!("remote.{}.fetch", remote_name)]) - .output()?; - - if fetch_output.stdout.is_empty() { - // No fetch refspec exists, add the default one first - std::process::Command::new("git") - .args([ - "config", - "--add", - &format!("remote.{}.fetch", remote_name), - "+refs/heads/*:refs/remotes/{}/*", - ]) - .status()?; - } - // Check if AI fetch refspec already exists let ai_fetch_output = std::process::Command::new("git") .args([ @@ -121,35 +104,6 @@ pub fn setup_ai_refspecs(repo: &Repository) -> Result<(), GitAiError> { ); } - // Check if default push refspec exists, if not add it - let push_output = std::process::Command::new("git") - .args([ - "config", - "--get-all", - &format!("remote.{}.push", remote_name), - ]) - .output()?; - - let default_push_exists = String::from_utf8_lossy(&push_output.stdout) - .lines() - .any(|line| line.trim() == "refs/heads/*:refs/heads/*"); - - if !default_push_exists { - // No default push refspec exists, add it first - let default_push_status = std::process::Command::new("git") - .args([ - "config", - "--add", - &format!("remote.{}.push", remote_name), - "refs/heads/*:refs/heads/*", - ]) - .status()?; - - if default_push_status.success() { - println!("Added default push refspec for remote: {}", remote_name); - } - } - // Check if AI push refspec already exists let ai_push_output = std::process::Command::new("git") .args([ From 8a73a6caf6b4d9ec50dcc56e3ee61050d032e8b6 Mon Sep 17 00:00:00 2001 From: Aidan Cunniffe Date: Thu, 3 Jul 2025 18:45:35 -0400 Subject: [PATCH 2/5] update docs --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 95b1c17d0..64f45329e 100644 --- a/Readme.md +++ b/Readme.md @@ -53,7 +53,7 @@ git-ai init > If you are not using Claude Code, you'll need to manually mark AI contributions by running `git-ai checkpoint --author 'Cursor'` after approving generated code. Automatic support for Cursor, Codex, Copilot support coming soon! -3. Add hooks to Claude Code +3. Add hooks to Claude Code [`.claude/settings.local.json`](https://docs.anthropic.com/en/docs/claude-code/hooks) ```json file=".claude/settings.local.json" { From 9914362cca289fb5e4026514a044377c01711f58 Mon Sep 17 00:00:00 2001 From: Aidan Cunniffe Date: Thu, 3 Jul 2025 18:46:27 -0400 Subject: [PATCH 3/5] update docs --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 64f45329e..3dd4bae19 100644 --- a/Readme.md +++ b/Readme.md @@ -55,7 +55,7 @@ git-ai init 3. Add hooks to Claude Code [`.claude/settings.local.json`](https://docs.anthropic.com/en/docs/claude-code/hooks) -```json file=".claude/settings.local.json" +```json { "hooks": { "PreToolUse": [ From cefe66acba580c6b750140ec133cf626a88f25f3 Mon Sep 17 00:00:00 2001 From: Aidan Cunniffe Date: Thu, 3 Jul 2025 18:50:48 -0400 Subject: [PATCH 4/5] fixes for ref default. check verified --- src/git/refs.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/git/refs.rs b/src/git/refs.rs index 0314813f9..90e1118ad 100644 --- a/src/git/refs.rs +++ b/src/git/refs.rs @@ -117,6 +117,35 @@ pub fn setup_ai_refspecs(repo: &Repository) -> Result<(), GitAiError> { .lines() .any(|line| line.trim() == "refs/ai/*:refs/ai/*"); + // Check if default push refspec exists, if not add it + let default_push_output = std::process::Command::new("git") + .args([ + "config", + "--get-all", + &format!("remote.{}.push", remote_name), + ]) + .output()?; + + let default_push_exists = String::from_utf8_lossy(&default_push_output.stdout) + .lines() + .any(|line| line.trim() == "refs/heads/*:refs/heads/*"); + + if !default_push_exists { + // Add default push refspec first + let default_push_status = std::process::Command::new("git") + .args([ + "config", + "--add", + &format!("remote.{}.push", remote_name), + "refs/heads/*:refs/heads/*", + ]) + .status()?; + + if default_push_status.success() { + println!("Added default push refspec for remote: {}", remote_name); + } + } + // Add AI push refspec only if it doesn't exist if !ai_push_exists { let push_status = std::process::Command::new("git") From 0d35d534afd03b1315d844402e0360e5b0cf5c37 Mon Sep 17 00:00:00 2001 From: Aidan Cunniffe Date: Thu, 3 Jul 2025 18:55:28 -0400 Subject: [PATCH 5/5] update version --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 39e251a66..8c5d82baf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -203,7 +203,7 @@ dependencies = [ [[package]] name = "git-ai" -version = "0.1.0" +version = "0.1.1" dependencies = [ "clap", "git2", diff --git a/Cargo.toml b/Cargo.toml index 1ff9b2490..4f25ac945 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "git-ai" -version = "0.1.0" +version = "0.1.1" edition = "2024"