Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Checkout assigned branch (or default to master) when commit ref matches HEAD. #1164

Closed
stevelacey opened this Issue · 6 comments

5 participants

@stevelacey

When Composer updates a package it leaves the local repo for it in a detached HEAD state rather than on a particular branch, for good reasons.

This is fine for third-party packages you're not going to be editing often if at all, but when you're doing a lot of work in bundles as part of a team, naturally, you find yourself doing composer update quite a lot– it would be great if there was a more reliable workaround to having to remember to checkout master first / merge in when you forget.

Perhaps a configurable way to define which packages you want to always be on a particular branch and some kind of comparison of the state of the detached head to that branch?

See: http://stackoverflow.com/questions/12284090/no-branch-when-installing-with-composer-json/12284689#comment17059215_12284689

@Seldaek Seldaek closed this in 3068f29
@Seldaek
Owner

Fixed, as said though it'll only do it when the commit you're checking out is the latest commit of the branch, it might be possible to do it for older commits but I think it's a bit dangerous, we'll see later if it's still a big inconvenience.

@ronnylt

Does not work consistently for me. With the following deps, composer leaves "doctrine/dbal" in the correct (2.3) branch, but "predis/predis" still is in a detached branch.

"require": {
    "predis/predis": "0.7.x-dev",
    "doctrine/dbal": "2.3.x-dev",
    "mockery/mockery": "dev-master"
},

Thanks for your support.

@Seldaek
Owner

@ronnylt ok fixed that, it was an issue with non-master branches. Now it should check out branches for everything but tagged releases.

@marcosQuesada

Great improvement :)

@ricardclau

@Seldaek Thank you so much for this. We work on a project with several bundles created by ourselves and this was a bit annoying when we updated dependencies.

@Seldaek
Owner

No worries, beware though that it is rolling back the branch to an older state, so if you force-push you will destroy commits. Be sure to pull/rebase before pushing.

@felixalias felixalias referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@felixalias felixalias referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@digitalkaoz digitalkaoz referenced this issue from a commit in digitalkaoz/composer
@Seldaek Seldaek Checkout branch by name when the current reference matches the branch…
… tip, fixes #1164
a6f20a3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.