get the branches this commit is contained in

@see BranchCommand::contains
481876
public function getContainedIn()
    {
        $command = BranchCommand::getInstance($this->getRepository())->contains($this->getSha());

        return array_map('trim', (array)$this->getCaller()->execute($command)->getOutputLines(true));
    }
292751
def show_branches(branch1, branch2):
    """"""

    def find_column(string):
        """Find first non space line in the prefix"""
        result = 0
        for c in string:
            if c == ' ':
                result += 1
        return result

    def parse_show_line(string):
        """Parse a typical line from git show-branch

        >>> parse_show_line('+  [master^2] TOOLS-122 Add bashrc')
        '+ ', 'master^2', 'TOOLS-122 Add bashrc'
        """
        regexp = re.compile('(.*)\[(.*)] (.*)')
        match = regexp.match(string)
        if not match:
            return None
        prefix, commit, comment = match.groups()
        return find_column(prefix), commit, comment

    log = run('show-branch --sha1-name "%s" "%s"' % (branch1, branch2))
    lines = iter(log.splitlines())
    line = lines.next()
    branches = {}
    while line != '--':
        column, branch, comment = parse_show_line(line)
        branches[column] = [branch]
        line = lines.next()
    line = lines.next()
    for line in lines:
        column, commit, comment = parse_show_line(line)
        branches[column].append((commit, comment))
    return branches
1082970
function getCurrentBranch(verbose) {
  return Promise.resolve()
    .then(execCmd.bind(null,
      'git',
      ['symbolic-ref', 'HEAD', '-q'],
      'problem getting current branch',
      verbose
    ))
    .catch(function() {
      return '';
    })
    .then(function(result) {
      return result.replace(new RegExp('^refs\/heads\/'), '');
    });
}
123841
public function branchExists($branchName, $dir = null, $mustRun = false)
    {
        // The porcelain command 'git branch' is less strict about character
        // encoding than (otherwise simpler) plumbing commands such as
        // 'git show-ref'.
        $result = $this->execute(['branch', '--list', '--no-color', '--no-column'], $dir, $mustRun);
        $branches = array_map(function ($line) {
            return trim(ltrim($line, '* '));
        }, explode("\n", $result));

        return in_array($branchName, $branches, true);
    }
48914
public function getBranches()
    {
        $branches = array();

        $xml = $this->execute('branch');

        foreach ($xml->branch as $xmlBranch) {
            $branch = new BranchSummary;
            $branch->setName(self::normalise($xmlBranch->name, 'string'));
            $branch->setFirmId(self::normalise($xmlBranch->firmid, 'int'));
            $branch->setBranchId(self::normalise($xmlBranch->branchid, 'int'));
            $branch->setUrl(self::normalise($xmlBranch->url, 'string'));
            $branches[] = $branch;
        }

        return $branches;
    }
1259876
protected function findSplits()
    {
        $this->log("checking heads for subsplits");
        $repo = $this->getRepository();
        $base = $this->getBase();

        $splits = array();
        $heads = $this->getHeads();

        if (!empty($base)) {
            $base = '/' . ltrim($base, '/');
        } else {
            $base = '/';
        }

        chdir($repo . '/.subsplit');
        foreach ($heads as $head) {
            $splits[$head] = array();

            // check each head requested *BEFORE* the actual subtree split command gets it
            passthru("git checkout '$head'");
            $ds = new DirectoryScanner();
            $ds->setBasedir($repo . '/.subsplit' . $base);
            $ds->setIncludes(array('**/'.$this->subIndicatorFile));
            $ds->scan();
            $files = $ds->getIncludedFiles();

            // Process the files we found
            foreach ($files as $file) {
                $pkg = file_get_contents($repo . '/.subsplit' . $base .'/'. $file);
                $pkg_json = json_decode($pkg, true);
                $name = $pkg_json['name'];
                $component = str_replace('/composer.json', '', $file);
                // keep this for split cmd
                $tmpreponame = explode('/', $name);
                $reponame = $tmpreponame[1];
                $splits[$head][$component]['repo'] = $reponame;
                $nscomponent = str_replace('/', '\\', $component);
                $splits[$head][$component]['desc'] = "[READ ONLY] Subtree split of $nscomponent: " . $pkg_json['description'];
            }
        }

        // go back to how we found it
        passthru("git checkout master");
        chdir($repo);
        $this->splits = $splits;
    }
823258
def branches(self):
		
		# TODO(jchaloup): find out of all branches are listed (even remote)
		# if there is a concept of remote branch
		return map(lambda (b, r, n): b, self.repo.branches())
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));
        }
    }
967918
protected function matchBranches($childType)
	{
		$branches = $this->getBranches();
		if (!isset($branches[0]->$childType))
		{
			return false;
		}

		$childNode = $branches[0]->$childType;
		foreach ($branches as $branch)
		{
			if (!isset($branch->$childType) || !$this->isEqualNode($childNode, $branch->$childType))
			{
				return false;
			}
		}

		return true;
	}
316055
public function branches()
    {
        $result = $this->execute('list', array('--xml' => true, $this->getUrl() . '/' . $this->basePaths['branches']));

        $logTrunk = $this->log('/', null, 1);
        $logTrunk = reset($logTrunk);

        $branches = array();
        $branches[] = new Reference('trunk', Reference::BRANCH, $logTrunk->getRevision());

        foreach ($result as $fileinfo) {
            $branches[] = new Reference($fileinfo->getFilename(), Reference::BRANCH, $fileinfo->getCommit()->getRevision());
        }

        return $branches;
    }
409645
function listLocalBranches(repo) {
  return caller.call(repo, repo.branches).then(function (branches) {
    return branches.map(function (branch) {
      return branch.name
    })
  })
}
839015
protected static function branch(array $paths, array $branches): array
    {
        $twig = array_shift($branches);
        if (count($branches) == 0) {
            $paths[] = $twig;

            return $paths;
        }

        if (!isset($paths[$twig])) {
            $paths[$twig] = [];
        }

        $paths[$twig] = static::branch($paths[$twig], $branches);

        return $paths;
    }
1368213
def get_commits(self):
        '''
        
        '''
        if not self.is_managed_by_git():
            return []
        return self.git.get_commits(self.content.source_path, self.follow)
357098
protected function getValuesPerCodeBranch()
	{
		$values = [];
		foreach ($this->branchesCode as $value => $branchCode)
		{
			$values[$branchCode][] = $value;
		}

		return $values;
	}
488701
public function parse_branch_response( $response ) {
		if ( $this->validate_response( $response ) ) {
			return $response;
		}
		$branches = [];
		foreach ( $response as $branch ) {
			$branches[ $branch->name ]['download']         = $this->construct_download_link( $branch->name );
			$branches[ $branch->name ]['commit_hash']      = $branch->target->hash;
			$branches[ $branch->name ]['commit_timestamp'] = $branch->target->date;
		}
		return $branches;
	}
391435
def get_commits(repo_dir, old_commit, new_commit, hide_merges=True):
    """"""
    repo = Repo(repo_dir)
    commits = repo.iter_commits(rev="{0}..{1}".format(old_commit, new_commit))
    if hide_merges:
        return [x for x in commits if not x.summary.startswith("Merge ")]
    else:
        return list(commits)
982323
public function updateSourceCode($branch = CFG_GIT_BRANCH)
    {
        // Check that name is not any other command
        if (!FileSystem::checkFileName($branch)) {
            return $this;
        }

        // To use this command owner of folder and git repository must be the same as web user
        exec('git reset --hard origin/' . $branch . ' 2>&1; git pull -v origin ' . $branch . ' 2>&1', $out);
        if ($out) {
            $this->result_message[] = $out;
        }

        // Clear all caches - may be required to show fresh data
        @Cacher::getInstance()->clearAllCaches();

        // Invalidate all frontend assets
        $setting = SettingEntityRepository::findOneEntityByCriteria(['name' => 'last_assets_invalidate_time']);
        if (!$setting) {
            $setting = new SettingEntity();
            $setting->setName('last_assets_invalidate_time');
        }

        $setting->setValue(NOW);
        $setting->save();

        return $this;
    }