abra recipe fetch and refspecs #757

Open
opened 2026-01-24 18:02:53 +00:00 by fauno · 2 comments
Member

while testing prs for recipes i've noticed that the origin doesn't fetch remote branches. i found that it's set to only fetch the default branch, so i had to change it like this: https://www.tutorialpedia.org/blog/fetch-in-git-doesn-t-get-all-branches/#3-restrictive-refspec

i'm assuming that abra recipe fetch changes this configuration to only track changes on the default branch?

related because we were discussing having major version releases in different branches: toolshed/organising#578

while testing prs for recipes i've noticed that the origin doesn't fetch remote branches. i found that it's set to only fetch the default branch, so i had to change it like this: https://www.tutorialpedia.org/blog/fetch-in-git-doesn-t-get-all-branches/#3-restrictive-refspec i'm assuming that `abra recipe fetch` changes this configuration to only track changes on the default branch? related because we were discussing having major version releases in different branches: https://git.coopcloud.tech/toolshed/organising/issues/578
Owner

AFAIR, abra recipe fetch does only update the default branch. That's the case for all our Git related implementation code in abra. We used to specify the refspecs (see abra git log in the early days) but AFAIR, it "didn't work".

I think we tried doing this refspec trick before but it didn't work. It could be tried again but go-git is sometimes not really working as expected unfortunately... I kind of regret not just depending on /usr/bin/git... you could fiddle with the options here:

pkg/recipe/git.go Lines 259 to 276 in f835b87255
fetchOpts := &git.FetchOptions{Tags: git.AllTags}
if err := repo.Fetch(fetchOpts); err != nil {
if !strings.Contains(err.Error(), "already up-to-date") {
return errors.New(i18n.G("unable to fetch tags in %s: %s", r.Dir, err))
}
}
opts := &git.PullOptions{
Force: true,
ReferenceName: branch,
SingleBranch: true,
}
if err := worktree.Pull(opts); err != nil {
if !strings.Contains(err.Error(), "already up-to-date") {
return errors.New(i18n.G("unable to git pull in %s: %s", r.Dir, err))
}
}

I just tried to make abra recipe fetch --force update a recipe and it didn't work, so I think there is a bug there as well since a bunch of internal logic got refactored. To be Fixed ™️

AFAIR, `abra recipe fetch` does only update the default branch. That's the case for all our Git related implementation code in `abra`. We used to specify the refspecs (see `abra` git log in the early days) but AFAIR, it "didn't work". I think we tried doing this refspec trick before but it didn't work. It could be tried again but `go-git` is sometimes not really working as expected unfortunately... I kind of regret not just depending on `/usr/bin/git`... you could fiddle with the options here: https://git.coopcloud.tech/toolshed/abra/src/commit/f835b872559a7a58845675a976486733c90a7a28/pkg/recipe/git.go#L259-L276 I just tried to make `abra recipe fetch --force` update a recipe and it didn't work, so I think there is a bug there as well since a bunch of internal logic got refactored. To be Fixed ™️
decentral1se added the
enhancement
label 2026-01-24 20:05:38 +00:00
Author
Member

mmm i have this recipes directory since abra 0.9 iirc so it may be the reason for refspecs being too specific.

mmm i have this recipes directory since abra 0.9 iirc so it may be the reason for refspecs being too specific.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: toolshed/abra#757
No description provided.