[PR #477] Configure automatic notes fetch after clone to persist AI attributions #500

Closed
opened 2026-03-02 04:13:48 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/git-ai-project/git-ai/pull/477

State: closed
Merged: No


After cloning, AI authorship notes may not sync on subsequent git fetch/git pull operations, causing git stats and git show to return no data. This occurs because git doesn't fetch refs/notes/* by default, and if the initial post-clone fetch fails, notes remain out of sync.

Changes

Post-clone configuration (clone_hooks.rs)

  • Added configure_notes_fetch() to set fetch refspec +refs/notes/ai:refs/notes/ai after clone
  • Ensures future fetch/pull operations automatically sync notes
  • Non-fatal: logs errors but doesn't block clone

URL normalization validation (repo_url.rs)

  • Added test for username:password@host credential format
  • Validates credentials are stripped from normalized URLs (Bitbucket Server PAT support)

Integration tests (clone_notes_fetch.rs)

  • Verifies URL normalization with embedded credentials
  • Tests notes persistence across remote operations
  • Validates automatic fetch configuration

Example

After this change, repositories cloned with:

git clone https://user:token@bitbucket.com/project/repo.git

Will have notes automatically fetched on:

git fetch origin  # Notes synced automatically
git pull         # Notes synced automatically
Original prompt

This section details on the original issue you should resolve

<issue_title>"git clone" cannot obtain AI contributions</issue_title>
<issue_description>https://confluence.atlassian.com/bitbucketserver0717/personal-access-tokens-1087535496.html?utm_campaign=in-app-help&utm_medium=in-app-help&locale=zh_CN%2Czh&utm_source=stash#Personalaccesstokens-usingpersonalaccesstokens

The "clone" notation in the document

git clone https://username:MDM0MjM5NDc2MDxxxxxxxxxxxxxxxxxxxxx@bitbucketserver.com/scm/projectname/teamsinspace.git

After cloning, entering "git stats" and "show" in the code repository does not retrieve relevant information about AI notes and AI contribution. However, normal git cloning seems to support these commands. I'm not sure if you need to support this
</issue_description>

Comments on the Issue (you are @copilot in this section)


Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

**Original Pull Request:** https://github.com/git-ai-project/git-ai/pull/477 **State:** closed **Merged:** No --- After cloning, AI authorship notes may not sync on subsequent `git fetch`/`git pull` operations, causing `git stats` and `git show` to return no data. This occurs because git doesn't fetch `refs/notes/*` by default, and if the initial post-clone fetch fails, notes remain out of sync. ## Changes **Post-clone configuration** (`clone_hooks.rs`) - Added `configure_notes_fetch()` to set fetch refspec `+refs/notes/ai:refs/notes/ai` after clone - Ensures future fetch/pull operations automatically sync notes - Non-fatal: logs errors but doesn't block clone **URL normalization validation** (`repo_url.rs`) - Added test for `username:password@host` credential format - Validates credentials are stripped from normalized URLs (Bitbucket Server PAT support) **Integration tests** (`clone_notes_fetch.rs`) - Verifies URL normalization with embedded credentials - Tests notes persistence across remote operations - Validates automatic fetch configuration ## Example After this change, repositories cloned with: ```bash git clone https://user:token@bitbucket.com/project/repo.git ``` Will have notes automatically fetched on: ```bash git fetch origin # Notes synced automatically git pull # Notes synced automatically ``` <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>"git clone" cannot obtain AI contributions</issue_title> > <issue_description>https://confluence.atlassian.com/bitbucketserver0717/personal-access-tokens-1087535496.html?utm_campaign=in-app-help&utm_medium=in-app-help&locale=zh_CN%2Czh&utm_source=stash#Personalaccesstokens-usingpersonalaccesstokens > > The "clone" notation in the document > > git clone https://username:MDM0MjM5NDc2MDxxxxxxxxxxxxxxxxxxxxx@bitbucketserver.com/scm/projectname/teamsinspace.git > > After cloning, entering "git stats" and "show" in the code repository does not retrieve relevant information about AI notes and AI contribution. However, normal git cloning seems to support these commands. I'm not sure if you need to support this > </issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes git-ai-project/git-ai#347 <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/git-ai-project/git-ai/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.
kerem 2026-03-02 04:13:48 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#500
No description provided.