It is possible that straight may fail to retrieve any new commits from the remote package repo, if the repository is already been cloned, and there has been a modification in the name of the remote HEAD branch (such as renamed from master to main).
Directions to reproduce
Create an new git repository with a single file with some text
In Emacs scratch buffer with straight.el loaded, fetch the repo using a custom recipy
(straight-use-package
'(issue :type git :repo "/tmp/issue-straight"))
;; => t
In the straight repo dir, check that the above repo has been checked out
/tmp/issue-straight$ cd ~/.config/emacs/straight/repos/issue
~/.config/emacs/straight/repos/issue$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
~/.config/emacs/straight/repos/issue$ cat issue
123
~/.config/emacs/straight/repos/issue$
4. Back at the source repo, add some more text to the file
``` sh
~/.config/emacs/straight/repos/issue$ cd /tmp/issue-straight/
/tmp/issue-straight$ echo 456 >> issue
/tmp/issue-straight$ git commit -am "2"
[master 8ec7551] 2
1 file changed, 1 insertion(+)
Back in Emacs, pull the changes with straight
(straight-pull-package "issue")
;; => nil
Back to the straight repo dir, check that the changes have been picked up by the straight pull
/tmp/issue-straight$ cd ~/.config/emacs/straight/repos/issue
~/.config/emacs/straight/repos/issue$ cat issue
123
456
Back at the source repo, rename the branch from master to main, and add some more changes
~/.config/emacs/straight/repos/issue$ cd /tmp/issue-straight/
/tmp/issue-straight$ git branch -m master main
/tmp/issue-straight$ git status
On branch main
nothing to commit, working tree clean
/tmp/issue-straight$ echo 789 >> issue
/tmp/issue-straight$ git commit -am "3"
[main 3fd338b] 3
1 file changed, 1 insertion(+)
/tmp/issue-straight$ cat issue
123
456
789
Back in Emacs, do straight pull again
(straight-pull-package "issue")
;; => nil
Check the straight repo, the last commit is not picked up, there is no commit 3 in the repo
commit 38aeb629a8011b8dd024fd5ff9b3c7c8369eaba8
Date: Mon Nov 13 22:10:39 2023 +0000
1
Perhaps straight can check the remote HEAD branch before a fetch/pull and adjust the local HEAD accordingly when they diverge?
The above example scenario was encountered with [emasql ](https://github.com/magit/emacsql)where I suspect somewhere in the last year their renamed their `master` branch to `main`, and I was stuck with a year's old `master` branch that could not be updated with straight pull
``` elisp
(straight-pull-package "emacsql")
;; => nil
~/.config/emacs/straight/repos/emacsql $ git log -1
commit 6b2e65bdf785364cf7c34c31fea5812e1e58c657
Author: Jonas Bernoulli <jonas@bernoul.li>
Date: Sun Nov 27 22:46:37 2022 +0100
Use new version string format for unreleased revisions
"N-git" < "N"; but "N.50-git" > "N".
~/.config/emacs/straight/repos/emacsql $ git remote -v
origin https://github.com/magit/emacsql.git (fetch)
origin https://github.com/magit/emacsql.git (push)
~/.config/emacs/straight/repos/emacsql $ git symbolic-ref refs/remotes/origin/HEAD
refs/remotes/origin/master
~/.config/emacs/straight/repos/emacsql $ git ls-remote --symref origin HEAD
ref: refs/heads/main HEAD
59de83a1276a5fbcf8a682b64bbdcf5e00c6ce8b HEAD
What's wrong
It is possible that
straight
may fail to retrieve any new commits from the remote package repo, if the repository is already been cloned, and there has been a modification in the name of the remote HEAD branch (such as renamed frommaster
tomain
).Directions to reproduce
straight.el
loaded, fetch the repo using a custom recipynothing to commit, working tree clean ~/.config/emacs/straight/repos/issue$ cat issue 123 ~/.config/emacs/straight/repos/issue$
master
tomain
, and add some more changesCheck the straight repo, the last commit is not picked up, there is no commit 3 in the repo
commit 38aeb629a8011b8dd024fd5ff9b3c7c8369eaba8 Date: Mon Nov 13 22:10:39 2023 +0000
Version information