Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream seems to be checked out even when :fork is provided in the recipe. #350

Closed
Fuco1 opened this issue Feb 2, 2019 · 6 comments
Closed

Comments

@Fuco1
Copy link

Fuco1 commented Feb 2, 2019

I have this recipe in my init

(helm :repo "git@github.com:emacs-helm/helm.git" :remote "upstream"
      :fork (:repo "git@github.com:Fuco1/helm.git" :remote "origin"))

Yet after installation master is still checked out to upstream/master. This is wrong in my opinion. How can I force straight.el to always use my fork's master as the default checkout?

@raxod502 raxod502 added this to the 1.0 milestone Feb 2, 2019
raxod502 added a commit that referenced this issue Feb 9, 2019
This fixes a bug where if:

(1) you specified both an upstream and a fork
(2) both the upstream and a fork have a branch by the same name
(3) your recipe tells straight.el to use that branch for your local
    work

then your local branch is set up to track the upstream branch rather
than the fork branch as it is supposed to.
@raxod502
Copy link
Member

raxod502 commented Feb 9, 2019

Should be fixed now. Thanks for the report! I never ran into it because I never used a branch on my fork that was also present in upstream.

@Fuco1
Copy link
Author

Fuco1 commented Feb 10, 2019

I can confirm that the correct commit is checked out but it is in a detached head form. So I still get the fork/master checked out but not a local tracking branch.

I'm not sure if that's relevant to this issue or another one should be opened.

What I did to test this was pull latest straight.el, rebuld and reload, then delete the helm repo so a new clone would trigger.

@Fuco1
Copy link
Author

Fuco1 commented Feb 10, 2019

Actually, now I tried to create a branch and I got "branch master already exists", so I think it is still tracking the origin (upstream).

Personally I would prefer it to track the fork as I always sync with the upstream manually and push to my fork.

@raxod502
Copy link
Member

Can't reproduce. Running this code from an empty ~/.emacs.d:

(setq straight-repository-branch "develop")

(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package
 '(helm :repo "git@github.com:emacs-helm/helm.git" :remote "upstream"
        :fork (:repo "git@github.com:Fuco1/helm.git" :remote "origin")))

(let ((default-directory (straight--repos-dir "helm")))
  (compile "git status"))

gives me the following:

On branch master
Your branch is up to date with 'origin/master'.

Of course, if you have a version lockfile then the particular commit specified therein will be checked out, rather than the branch you specify in your recipe. Is that what is going on?

@Fuco1
Copy link
Author

Fuco1 commented Feb 10, 2019

Yes indeed, I have a lock file.

I think we can close!

@raxod502
Copy link
Member

Great. See also #66 to change the UX around detached HEADs.

hartzell pushed a commit to hartzell/straight.el that referenced this issue Jun 14, 2019
This fixes a bug where if:

(1) you specified both an upstream and a fork
(2) both the upstream and a fork have a branch by the same name
(3) your recipe tells straight.el to use that branch for your local
    work

then your local branch is set up to track the upstream branch rather
than the fork branch as it is supposed to.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants