You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In general git can merge against a branch or a tag as long as it can translate that to a commit sha.
The current codebase insists that what it passed to merge be a branch.
I NEED to be able to merge against tags for the release process that we have.
So, the following code will allow you to pass a branch OR a tag to repository->merge
First remove the branch specifier from merge in repository.php:
public function merge($branch)
and then recode MergeCommand.php merge to look like:
public function merge($with)
{
$this->clearAll();
$this->addCommandName(static::MERGE_COMMAND);
// $with may not always be a branch. It can be a tag.
if (method_exists($with, 'setFullRef')) {
$ref = $with->getFullRef();
} else {
$ref = $with->getName();
}
$this->addCommandSubject($ref);
return $this->getCommand();
}
This removes the Branch specifier from the calling parameters, and also checks to make sure that the getFullRef is there (when it's a branch, if not it assumes it's a tag and uses getName)
This is not a perfect implementation as we should also be able to pass in a commit, but since I haven't had to deal with that yet, I've done what I need, and this is healthier than it was.
The text was updated successfully, but these errors were encountered:
In general git can merge against a branch or a tag as long as it can translate that to a commit sha.
The current codebase insists that what it passed to merge be a branch.
I NEED to be able to merge against tags for the release process that we have.
So, the following code will allow you to pass a branch OR a tag to repository->merge
First remove the branch specifier from merge in repository.php:
public function merge($branch)
and then recode MergeCommand.php merge to look like:
public function merge($with)
{
$this->clearAll();
$this->addCommandName(static::MERGE_COMMAND);
// $with may not always be a branch. It can be a tag.
if (method_exists($with, 'setFullRef')) {
$ref = $with->getFullRef();
} else {
$ref = $with->getName();
}
$this->addCommandSubject($ref);
This removes the Branch specifier from the calling parameters, and also checks to make sure that the getFullRef is there (when it's a branch, if not it assumes it's a tag and uses getName)
This is not a perfect implementation as we should also be able to pass in a commit, but since I haven't had to deal with that yet, I've done what I need, and this is healthier than it was.
The text was updated successfully, but these errors were encountered: