Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Commit

Permalink
Modified checkout for tag/branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Garfield-fr committed Sep 24, 2011
1 parent 211512c commit 5a163f8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Command/GenerateProjectCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -791,9 +791,14 @@ private function installRepositories($repositories, $input, $output)

$output->writeln(sprintf(' > <comment>Git revision %s</comment>', $repository->getRevision()));

if ('master' !== $repository->getRevision()) {
if ('tag' === $repository->getType()) {
$gitcommand = sprintf('git checkout -b %s', $repository->getRevision());
exec($gitcommand);
} else {
if ('master' !== $repository->getRevision()) {
$gitcommand = sprintf('git checkout -b origin/%s', $repository->getRevision());

This comment has been minimized.

Copy link
@BorisMorel

BorisMorel Sep 24, 2011

Contributor

I suggest
$gitcommand = sprintf('git checkout -b %s origin/%s', $repository->getRevision(), $repository->getRevision());

exec($gitcommand);
}
}

chdir($path);
Expand Down

6 comments on commit 5a163f8

@stof
Copy link

@stof stof commented on 5a163f8 Sep 24, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still wrong. The -b option requires giving the name of the new branch so you are using the revision to name the branch which will then be based on the current state (so master)

@Garfield-fr
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stof. If i don't make the name with -b, the new branch named with the revision.

@stof
Copy link

@stof stof commented on 5a163f8 Sep 24, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git checkout -b <new_branch> <target_revision>. In your case, you omit the target revision so it uses the current revision.

@BorisMorel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That why I have changed the checkout line ; Because with just -b option you create locally branch named %s but you will work on master branch.

@stof
Copy link

@stof stof commented on 5a163f8 Sep 24, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BorisMorel except that your own version was broken for tags

@BorisMorel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stof, Now Garfield-fr check if it's a tag or branch, so the modification is only available for branch.

Please sign in to comment.