Returns name of active branch

@access  public
@param   bool    keep asterisk mark on branch name
@return  string
190203
public function active_branch($keep_asterisk = false) {
		$branchArray = $this->list_branches(true);
		$active_branch = preg_grep("/^\*/", $branchArray);
		reset($active_branch);
		if ($keep_asterisk) {
			return current($active_branch);
		} else {
			return str_replace("* ", "", current($active_branch));
		}
	}
190754
protected function getTagFromBranch($branch)
    {
        $git  = new GitRepository($this->input->getArgument('git-dir'));
        $tag  = trim($git->describe()->tags()->always()->execute($branch));
        $hash = trim($git->revParse()->short(false)->execute($branch));
        return $hash !== $tag ? $tag : null;
    }
1182392
public function getFirstCommitTitle($base, $sourceBranch)
    {
        try {
            $forkPoint = $this->processHelper->runCommand(['git', 'merge-base', '--fork-point', $base, $sourceBranch]);
            $lines = $this->processHelper->runCommand(['git', 'rev-list', $forkPoint.'..'.$sourceBranch, '--reverse', '--oneline']);

            return trim(strstr(strtok($lines, "\n"), ' '));
        } catch (\RuntimeException $e) {
            return '';
        }
    }
919392
public function getSubName()
    {
        if (false !== $pos = strpos($this->name, '(')) {
            return trim(substr($this->name, $pos + 1, -1));
        }

        return '';
    }
1194358
public function getName()
    {
        $name = !empty($this->alias) ? $this->alias : (!empty($this->name) ? $this->name : '');
        return $name ? $name . (!empty($this->channel) ? ' ' . $this->channel : '') : '';
    }
1218723
protected function getContractName()
    {
        if (!$this->input->getOption('contract')) {
            return false;
        }

        $className = $this->getClassName();

        return $this->getContractNamespace() . '\\' . $className;
    }
1130766
public function getClientId()
    {
        preg_match('#branch\/(\d+)/#', $this->url, $matches);

        return isset($matches[1]) ? (int) $matches[1] : null;
    }
127818
public function getName($quoted = false) {
		if (!$quoted) return $this->name;
		
		$quotedName = addcslashes($this->name, "\0..\37\177\\\"");
		// check if name needs to be quoted
		if ($this->name == $quotedName && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $this->name)) {
			return $this->name;
		} else {
			return mb_encode_mimeheader($quotedName, 'utf-8', 'Q', "\r\n");
			// return "\"{$quotedName}\"";
		}
	}
558662
public function getFieldName($refresh = false)
    {
        if (!$this->fieldName || $refresh) {
            // Prevent double '/'
            $names = array_values(array_filter(explode('/', (string) $this->getName(true)), 'strlen'));

            $control = array_values(array_filter(explode('/', (string) $this->getControl()), 'strlen'));

            $names = array_merge($control, $names);

            $control = array_shift($names);

            $names = array_map(
                function ($value) {
                    return '[' . $value . ']';
                },
                $names
            );

            $this->fieldName = $control . implode('', $names);
        }

        return $this->fieldName;
    }
869260
public function getName($old_name=null) {
    // return existing old name
    if($old_name && property_exists($this->existing, $old_name)) {
      return $this->existing->{$old_name};
    }

    // get next name
    $name = $this->prefix . $this->counter;
    $this->counter += 1;

    // save mapping
    if($old_name !== null) {
      $this->existing->{$old_name} = $name;
      $this->order[] = $old_name;
    }

    return $name;
  }
401988
public function getNickname(bool $wrap = false): string
    {
        if ($wrap) {
            return sprintf('(%s)', $this->export('Nickname'));
        }

        return $this->export('Nickname');
    }
602228
public function gitBranch($branch)
    {
        $options = ['options' => ['regexp' => '/^[a-zA-Z0-9\/\+\._-]+$/']];
        if (filter_var($branch, FILTER_VALIDATE_REGEXP, $options) === false) {
            throw new \InvalidArgumentException(sprintf("Invalid characters found in git branch name '%s'. Use only letters, numbers, underscore, hyphen and forward slashes.", $branch));
        }

        return $branch;
    }
457944
function(branch, name) {
  return _.find(branch.children, function(child) {
    return getName(child) === name;
  });
}
139044
async function getBranchPr(branchName) {
  logger.debug(`getBranchPr(${branchName})`);
  if (!(await branchExists(branchName))) {
    return null;
  }
  const urlString = `projects/${
    config.repository
  }/merge_requests?state=opened&per_page=100`;
  const res = await get(urlString, { paginate: true });
  logger.debug(`Got res with ${res.body.length} results`);
  let pr = null;
  res.body.forEach(result => {
    if (result.source_branch === branchName) {
      pr = result;
    }
  });
  if (!pr) {
    return null;
  }
  return getPr(pr.iid);
}
816475
public function getBranches($which = self::BRANCHES_LOCAL)
    {
        $which       = (int)$which;
        $arguments  = array(
            '--no-color'
        );

        $local  = (($which & self::BRANCHES_LOCAL) == self::BRANCHES_LOCAL);
        $remote = (($which & self::BRANCHES_REMOTE) == self::BRANCHES_REMOTE);

        if ($local && $remote) {
            $arguments[] = '-a';
        } else if ($remote) {
            $arguments[] = '-r';
        }

        /** @var $result CallResult */
        $result = $this->getGit()->{'branch'}($this->getRepositoryPath(), $arguments);
        $result->assertSuccess(
            sprintf('Cannot retrieve branch from "%s"', $this->getRepositoryPath())
        );

        $output = rtrim($result->getStdOut());
        if (empty($output)) {
            return array();
        }

        $branches = array_map(function($b) {
            $line   = rtrim($b);
            if (strpos($line, '* ') === 0) {
                $line   = substr($line, 2);
            }
            $line   = ltrim($line);
            return $line;
        }, explode("\n", $output));
        return $branches;
    }
850932
def branch_name
      @branch_name ||= Zenflow::Branch.current(flow) ||
                       Zenflow::Ask("Name of the #{flow}:",
                           required:      true,
                           validate:      /^[-_0-9a-z]+$/,
                           error_message: "Names can only contain dashes, underscores, 0-9, and a-z").downcase
    end
723300
protected function getIndexName()
    {
        $name = $this->prefixKey(self::INDEX_NAME);

        if ($this->isItemNameValid($name)) {
            return $name;
        }

        return false;
    }