Compare if the HEAD of $targetBrnach equals the HEAD of the local branch.

@param string|null $targetBranch

@return bool
183955
public function isLocalBranchEqualTo($targetBranch) : bool
    {
        if (!$this->gitInputValidator->isCommitishValid($targetBranch)) {
            return false;
        }
        if ($this->localHeadHash === null) {
            $this->localHeadHash = $this->commitishToHash('HEAD');
        }

        $targetCommitHash = $this->commitishToHash($targetBranch);

        return $targetCommitHash === $this->localHeadHash;
    }
277227
private function assertExchangeRateIsNotOnTheList($sourceCurrencyName, $targetCurrencyName)
    {
        Assert::false(
            $this->indexPage->isSingleResourceOnPage([
                'sourceCurrency' => $sourceCurrencyName,
                'targetCurrency' => $targetCurrencyName,
            ]),
            sprintf(
                'An exchange rate with source currency %s and target currency %s has been found on the list.',
                $sourceCurrencyName,
                $targetCurrencyName
            )
        );
    }
696815
public function versionCompare($a, $b, $operator, $compareBranches = false)
    {
        if (!isset(self::$transOpStr[$operator])) {
            throw new \InvalidArgumentException(sprintf(
                'Invalid operator "%s" given, expected one of: %s',
                $operator,
                implode(', ', self::getSupportedOperators())
            ));
        }

        $aIsBranch = 'dev-' === substr($a, 0, 4);
        $bIsBranch = 'dev-' === substr($b, 0, 4);

        if ($aIsBranch && $bIsBranch) {
            return $operator === '==' && $a === $b;
        }

        // when branches are not comparable, we make sure dev branches never match anything
        if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
            return false;
        }

        return version_compare($a, $b, $operator);
    }
1278275
protected void createBranchIfNeeded(String branch) throws Exception {
        fetch(); // in case the branch is not known locally
        if (localRepo.findRef(branch) == null) {
            git.branchCreate()
               .setName(branch)
               .setUpstreamMode(SetupUpstreamMode.TRACK)
               .setStartPoint("origin/" + branch)
               .call();
        }
    }
420527
public function stashBranch(string $branch, string $stash)
    {
        $stashCommand = StashCommand::getInstance($this);
        $command = $stashCommand->branch($branch, $stash);
        $this->caller->execute($command);
    }
725355
public static boolean branchExists(String branch, String baseUrl) {
        CommandLine cmdLine = new CommandLine(SVN_CMD);
        cmdLine.addArgument(CMD_LOG);
        cmdLine.addArgument(OPT_XML);
        addDefaultArguments(cmdLine, null, null);
        cmdLine.addArgument("-r");
        cmdLine.addArgument("HEAD:HEAD");
        cmdLine.addArgument(baseUrl + branch);

        try (InputStream inStr = ExecutionHelper.getCommandResult(cmdLine, new File("."), 0, 120000)) {
            return true;
        } catch (IOException e) {
            log.log(Level.FINE, "Branch " + branch + " not found or other error", e);
            return false;
        }
    }
649266
public function getNextSibling(Branch $branch, Branch $currentBranch)
    {
        $current = null;
        $nextSibiling = null;

        foreach ($branch->getChildren() as $node) {
            if ($current) {
                $nextSibiling = $node;
                break;
            }
            if ($node->getNodeId() === $currentBranch->getNodeId()) {
                $current = $node;
            }
        }

        return $nextSibiling;
    }
729484
private boolean isBranch(Execution execution) {
        return execution != null && !StringUtils.isEmpty(execution.getSystemContext().getBranchId());
    }
275314
protected function copy($source, $target)
    {
        if (is_file($source)) {
            $exists = is_file($target) ? true :false;
            $this->filesystem->copy($source, $target);

            if (!$exists) {
                return true;
            }
        }

        return false;
    }
804451
public boolean isBranch()
  {
    switch (getOpcode()) {
    case IFNULL:
    case IFNONNULL:
    case IFNE:
    case IFEQ:
    case IFLT:
    case IFGE:
    case IFGT:
    case IFLE:
    case IF_ICMPEQ:
    case IF_ICMPNE:
    case IF_ICMPLT:
    case IF_ICMPGE:
    case IF_ICMPGT:
    case IF_ICMPLE:
    case IF_ACMPEQ:
    case IF_ACMPNE:
    case JSR:
    case JSR_W:
    case GOTO:
    case GOTO_W:
      return true;
    }

    return false;
  }
1127985
public function getCurrentBranch($keep_asterisk = false)
    {
        $branchArray = $this->getBranchesList(true);
        $getCurrentBranch = preg_grep("/^\*/", $branchArray);
        reset($getCurrentBranch);
        if ($keep_asterisk) {
            return current($getCurrentBranch);
        } else {
            return str_replace("* ", "", current($getCurrentBranch));
        }
    }
93718
public function canConvertFrom($source, $targetType)
    {
        return !(
            $this->reflectionService->isClassAnnotatedWith($targetType, Flow\Entity::class) ||
            $this->reflectionService->isClassAnnotatedWith($targetType, Flow\ValueObject::class) ||
            $this->reflectionService->isClassAnnotatedWith($targetType, \Doctrine\ORM\Mapping\Entity::class)
        );
    }
277563
public function setBranch($branch)
    {
        $this->branch = $branch;
        $this->domusClient->setBranch($branch);

        return $this;
    }
196895
public function canConvertFrom($source, $targetType)
    {
        $identifier = $this->persistenceManager->getIdentifierByObject($source);
        return ($identifier !== null);
    }
375620
public function setBranch($branch)
    {
        $request = new Request($this->handler);
        $this->branch = $request->execute(
            RequestMethods::HTTP_PUT,
            $this->makeUrl(RequestMethods::DOMUSERP_API_PEDIDOVENDA . '/auth'),
            [
                'json' => [
                    'id' => $branch,
                ],
                'headers' => [
                    'X-Session-ID' => $this->getToken()
                ]
            ]
        )->id;

        return $this;
    }
1080811
public void cloneBranch(String branch) throws Exception {
        CloneCommand cloneCommand = Git.cloneRepository()
                .setURI(repositoryUrl)
                .setDirectory(localRepo.getDirectory().getParentFile())
                .setBranchesToClone(Arrays.asList(branch))
                .setCloneAllBranches(false)
                .setBranch(branch);
        if (credentialsProvider != null)
            cloneCommand.setCredentialsProvider(credentialsProvider);
        Git git = cloneCommand.call();
        git.getRepository().close();
        git.close();
    }
1170904
private function add_to_parent_category_branch($category, $newnode, &$categoriesbranch) {

        foreach ($categoriesbranch as $key => $branch) {
            if (!empty($branch['categoryid']) && $branch['categoryid'] == $category->parent) {
                // It may be empty (if it does not contain courses and this is the first child cat).
                if (!isset($categoriesbranch[$key]['branches'])) {
                    $categoriesbranch[$key]['branches'] = [];
                }
                $categoriesbranch[$key]['branches'][] = $newnode;
                return true;
            }
            if (!empty($branch['branches'])) {
                $parent = $this->add_to_parent_category_branch($category, $newnode, $categoriesbranch[$key]['branches']);
                if ($parent) {
                    return true;
                }
            }
        }

        return false;
    }