idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
53,600 | public function remote ( SubCommandCommand $ subcommand = null , Array $ options = array ( ) ) { $ normalizedOptions = $ this -> normalizeOptions ( $ options , $ this -> remoteCmdSwitchOptions ( ) ) ; $ this -> clearAll ( ) ; $ this -> addCommandName ( self :: GIT_REMOTE ) ; foreach ( $ normalizedOptions as $ value ) {... | Build the remote command |
53,601 | public function toString ( bool $ full = false ) { if ( count ( $ this -> message ) == 0 ) { return null ; } if ( $ full ) { return implode ( PHP_EOL , $ this -> message ) ; } else { return $ this -> message [ 0 ] ; } } | Return message string |
53,602 | public function getOutputLines ( $ stripBlankLines = false ) { if ( $ stripBlankLines ) { $ output = array ( ) ; foreach ( $ this -> outputLines as $ line ) { if ( '' !== $ line ) { $ output [ ] = $ line ; } } return $ output ; } return $ this -> outputLines ; } | returns the output of the last executed command as an array of lines |
53,603 | public function contains ( $ reference ) { $ this -> clearAll ( ) ; $ this -> addCommandName ( self :: BRANCH_COMMAND ) ; $ this -> addCommandArgument ( '--contains' ) ; $ this -> addCommandSubject ( $ reference ) ; return $ this -> getCommand ( ) ; } | Locate branches that contain a reference |
53,604 | public function singleInfo ( $ name , $ all = false , $ simple = false , $ verbose = false ) { $ this -> clearAll ( ) ; $ this -> addCommandName ( self :: BRANCH_COMMAND ) ; if ( ! $ simple ) { $ this -> addCommandArgument ( '-v' ) ; } $ this -> addCommandArgument ( '--list' ) ; $ this -> addCommandArgument ( '--no-col... | get info about a single branch |
53,605 | public function delete ( $ name , $ force = false ) { $ arg = ( $ force === true ) ? '-D' : '-d' ; $ this -> clearAll ( ) ; $ this -> addCommandName ( self :: BRANCH_COMMAND ) ; $ this -> addCommandArgument ( $ arg ) ; $ this -> addCommandSubject ( $ name ) ; return $ this -> getCommand ( ) ; } | Delete a branch by its name |
53,606 | public function parseOutputLines ( array $ remoteDetails ) { array_filter ( $ remoteDetails ) ; $ name = array_shift ( $ remoteDetails ) ; $ name = ( is_string ( $ name ) ) ? trim ( $ name ) : '' ; $ name = $ this -> parseName ( $ name ) ; if ( ! $ name ) { throw new \ UnexpectedValueException ( sprintf ( 'Invalid data... | parse details from remote show |
53,607 | protected function aggregateBranchDetails ( $ groupLines , $ remoteDetails ) { $ configuredRefs = [ ] ; arsort ( $ groupLines ) ; foreach ( $ groupLines as $ type => $ lineno ) { $ configuredRefs [ $ type ] = array_splice ( $ remoteDetails , $ lineno ) ; array_shift ( $ configuredRefs [ $ type ] ) ; } $ configuredRefs ... | provided with the start points of the branch details parse out the branch details and return a structured representation of said details |
53,608 | public function parseRemoteBranches ( array $ lines ) { $ branches = [ ] ; $ delimiter = ' ' ; foreach ( $ lines as $ line ) { $ line = trim ( $ line ) ; $ line = preg_replace ( '/\s+/' , ' ' , $ line ) ; $ parts = explode ( $ delimiter , $ line ) ; if ( count ( $ parts ) > 1 ) { $ branches [ $ parts [ 0 ] ] = [ 'local... | parse the details related to remote branch references |
53,609 | public function parseLocalPushRefs ( $ lines ) { $ branches = [ ] ; $ delimiter = ' pushes to ' ; foreach ( $ lines as $ line ) { $ line = trim ( $ line ) ; $ line = preg_replace ( '/\s+/' , ' ' , $ line ) ; $ parts = explode ( $ delimiter , $ line ) ; if ( count ( $ parts ) > 1 ) { $ value = explode ( ' ' , $ parts [ ... | parse the details related to local branches and the remotes that they push to |
53,610 | private function findChunks ( array $ lines ) { $ arrayChunks = Utilities :: pregSplitArray ( $ lines , '/^@@ -(\d+,\d+)|(\d+) \+(\d+,\d+)|(\d+) @@(.*)$/' ) ; foreach ( $ arrayChunks as $ chunkLines ) { $ this -> chunks [ ] = new DiffChunk ( $ chunkLines ) ; } } | Find the diff chunks |
53,611 | private function findPath ( string $ line ) { $ matches = [ ] ; if ( preg_match ( '/^diff --git SRC\/(.*) DST\/(.*)$/' , $ line , $ matches ) ) { $ this -> originalPath = $ matches [ 1 ] ; $ this -> destinationPath = $ matches [ 2 ] ; } } | look for the path in the line |
53,612 | private function findMode ( string $ line ) { if ( preg_match ( '/^index (.*)\.\.(.*) (.*)$/' , $ line ) ) { $ this -> mode = self :: MODE_INDEX ; } if ( preg_match ( '/^mode (.*)\.\.(.*) (.*)$/' , $ line ) ) { $ this -> mode = self :: MODE_MODE ; } if ( preg_match ( '/^new file mode (.*)/' , $ line ) ) { $ this -> mod... | find the line mode |
53,613 | private function findSimilarityIndex ( string $ line ) { $ matches = [ ] ; if ( preg_match ( '/^similarity index (.*)\%$/' , $ line , $ matches ) ) { $ this -> similarityIndex = $ matches [ 1 ] ; } } | look for similarity index in the line |
53,614 | public static function createFromRemote ( $ git , $ repositoryPath = null , string $ binary = null , $ name = null ) { if ( null === $ repositoryPath ) { $ tempDir = realpath ( sys_get_temp_dir ( ) ) ; $ repositoryPath = sprintf ( '%s%s%s' , $ tempDir , DIRECTORY_SEPARATOR , sha1 ( uniqid ( ) ) ) ; $ fs = new Filesyste... | create a repository from a remote git url or a local filesystem and save it in a temp folder |
53,615 | public function stage ( $ path = '.' ) { $ this -> caller -> execute ( MainCommand :: getInstance ( $ this ) -> add ( $ path ) ) ; return $ this ; } | Stage the working tree content |
53,616 | public function unstage ( $ path ) { $ this -> caller -> execute ( MainCommand :: getInstance ( $ this ) -> unstage ( $ path ) , true , null , [ 0 , 1 ] ) ; return $ this ; } | Unstage a tree content |
53,617 | public function commit ( string $ message , $ stageAll = false , $ ref = null , $ author = null , $ allowEmpty = false ) { $ currentBranch = null ; if ( ! is_null ( $ ref ) ) { $ currentBranch = $ this -> getMainBranch ( ) ; $ this -> checkout ( $ ref ) ; } if ( $ stageAll ) { $ this -> stage ( ) ; } $ this -> caller -... | Commit content to the repository eventually staging all unstaged content |
53,618 | public function isBare ( ) { $ options = [ RevParseCommand :: OPTION_IS_BARE_REPOSIORY ] ; $ this -> caller -> execute ( RevParseCommand :: getInstance ( ) -> revParse ( null , $ options ) ) ; return trim ( $ this -> caller -> getOutput ( ) ) === 'true' ; } | Check if this is a bare repository |
53,619 | public function getStatusOutput ( ) { $ this -> caller -> execute ( MainCommand :: getInstance ( $ this ) -> status ( ) ) ; return array_map ( 'trim' , $ this -> caller -> getOutputLines ( ) ) ; } | Get the repository status as a string |
53,620 | public function deleteBranch ( string $ name , bool $ force = false ) { $ this -> caller -> execute ( BranchCommand :: getInstance ( $ this ) -> delete ( $ name , $ force ) ) ; return $ this ; } | Delete a branch by its name This function change the state of the repository on the filesystem |
53,621 | public function getBranches ( bool $ namesOnly = false , bool $ all = false ) { $ branches = [ ] ; if ( $ namesOnly ) { $ outputLines = $ this -> caller -> execute ( BranchCommand :: getInstance ( $ this ) -> listBranches ( $ all , true ) ) -> getOutputLines ( true ) ; $ branches = array_map ( function ( $ v ) { return... | An array of Branch objects |
53,622 | public function getMainBranch ( ) { $ filtered = array_filter ( $ this -> getBranches ( ) , function ( Branch $ branch ) { return $ branch -> getCurrent ( ) ; } ) ; sort ( $ filtered ) ; return $ filtered [ 0 ] ; } | Return the actually checked out branch |
53,623 | public function getBranch ( string $ name ) { foreach ( $ this -> getBranches ( ) as $ branch ) { if ( $ branch -> getName ( ) === $ name ) { return $ branch ; } } return null ; } | Retrieve a Branch object by a branch name |
53,624 | public function checkoutAllRemoteBranches ( $ remote = 'origin' ) { $ actualBranch = $ this -> getMainBranch ( ) ; $ actualBranches = $ this -> getBranches ( true , false ) ; $ allBranches = $ this -> getBranches ( true , true ) ; $ realBranches = array_filter ( $ allBranches , function ( string $ branch ) use ( $ actu... | Checkout all branches from the remote and make them local |
53,625 | public function merge ( Branch $ branch , string $ message = '' , string $ mode = 'auto' ) { $ valid_modes = [ 'auto' , 'ff-only' , 'no-ff' , ] ; if ( ! in_array ( $ mode , $ valid_modes ) ) { throw new InvalidArgumentException ( "Invalid merge mode: $mode." ) ; } $ options = [ ] ; switch ( $ mode ) { case 'ff-only' : ... | Merge a Branch in the current checked out branch |
53,626 | public function createTag ( string $ name , $ startPoint = null , string $ message = null ) { Tag :: create ( $ this , $ name , $ startPoint , $ message ) ; return $ this ; } | Create a new tag This function change the state of the repository on the filesystem |
53,627 | public function deleteTag ( $ tag ) { if ( $ tag instanceof Tag ) { $ tag -> delete ( ) ; } else { Tag :: pick ( $ this , $ tag ) -> delete ( ) ; } return $ this ; } | Delete a tag by it s name or by passing a Tag object This function change the state of the repository on the filesystem |
53,628 | public function addSubmodule ( string $ gitUrl , $ path = null ) { $ this -> caller -> execute ( SubmoduleCommand :: getInstance ( $ this ) -> add ( $ gitUrl , $ path ) ) ; return $ this ; } | add a git submodule to the repository |
53,629 | public function getTags ( ) { $ tags = [ ] ; $ this -> caller -> execute ( TagCommand :: getInstance ( $ this ) -> listTags ( ) ) ; foreach ( $ this -> caller -> getOutputLines ( ) as $ tagString ) { if ( $ tagString != '' ) { $ tags [ ] = new Tag ( $ this , trim ( $ tagString ) ) ; } } return $ tags ; } | Gets an array of Tag objects |
53,630 | public function getTag ( string $ name ) { $ tagFinderOutput = $ this -> caller -> execute ( TagCommand :: getInstance ( ) -> listTags ( ) ) -> getOutputLines ( true ) ; foreach ( $ tagFinderOutput as $ line ) { if ( $ line === $ name ) { return new Tag ( $ this , $ name ) ; } } return null ; } | Return a tag object |
53,631 | public function getLastTag ( ) { $ finder = Finder :: create ( ) -> files ( ) -> in ( sprintf ( '%s/.git/refs/tags' , $ this -> path ) ) -> sortByChangedTime ( ) ; if ( $ finder -> count ( ) == 0 ) { return null ; } $ files = iterator_to_array ( $ finder -> getIterator ( ) , false ) ; $ files = array_reverse ( $ files ... | Return the last created tag |
53,632 | public function getBranchOrTag ( string $ name ) { if ( in_array ( $ name , $ this -> getBranches ( true ) ) ) { return new Branch ( $ this , $ name ) ; } $ tagFinderOutput = $ this -> caller -> execute ( TagCommand :: getInstance ( $ this ) -> listTags ( ) ) -> getOutputLines ( true ) ; foreach ( $ tagFinderOutput as ... | Try to get a branch or a tag by its name . |
53,633 | public function getLog ( $ ref = 'HEAD' , $ path = null , int $ limit = 10 , int $ offset = null , bool $ firstParent = false ) { return new Log ( $ this , $ ref , $ path , $ limit , $ offset , $ firstParent ) ; } | Get a log for a ref |
53,634 | public function getLogRange ( $ refStart , $ refEnd , $ path = null , int $ limit = 10 , int $ offset = null , bool $ firstParent = false ) { if ( preg_match ( '~^[0]+$~' , $ refStart ) ) { return new Log ( $ this , $ refEnd , $ path , $ limit , $ offset , $ firstParent ) ; } if ( preg_match ( '~^[0]+$~' , $ refEnd ) )... | Get a log for a range ref |
53,635 | public function getObjectLog ( NodeObject $ obj , $ branch = null , int $ limit = 1 , int $ offset = null ) { $ command = LogCommand :: getInstance ( $ this ) -> showObjectLog ( $ obj , $ branch , $ limit , $ offset ) ; return Log :: createFromOutputLines ( $ this , $ this -> caller -> execute ( $ command ) -> getOutpu... | Get a log for an object |
53,636 | public function checkout ( $ ref , bool $ create = false ) { if ( $ create && is_null ( $ this -> getBranch ( $ ref ) ) ) { $ this -> createBranch ( $ ref ) ; } $ this -> caller -> execute ( MainCommand :: getInstance ( $ this ) -> checkout ( $ ref ) ) ; return $ this ; } | Checkout a branch This function change the state of the repository on the filesystem |
53,637 | public function getTree ( $ ref = 'HEAD' , $ path = null ) { if ( is_string ( $ path ) && '' !== $ path ) { $ outputLines = $ this -> getCaller ( ) -> execute ( LsTreeCommand :: getInstance ( $ this ) -> tree ( $ ref , $ path ) ) -> getOutputLines ( true ) ; $ path = TreeObject :: createFromOutputLine ( $ this , $ outp... | Retrieve an instance of Tree Tree Object is Countable Iterable and has ArrayAccess for easy manipulation |
53,638 | public function getDiff ( string $ commit1 = null , string $ commit2 = null , string $ path = null ) { return Diff :: create ( $ this , $ commit1 , $ commit2 , $ path ) ; } | Get a Diff object for a commit with its parent by default the diff is between the current head and its parent |
53,639 | public function cloneFrom ( string $ url , string $ to = null , string $ repoReference = null , int $ depth = null , bool $ recursive = false ) { $ command = ( Command \ CloneCommand :: getInstance ( $ this ) ) -> cloneUrl ( $ url , $ to , $ repoReference , $ depth , $ recursive ) ; $ this -> caller -> execute ( $ comm... | Clone a repository |
53,640 | public function getRemotes ( bool $ queryRemotes = true ) { $ remoteNames = $ this -> caller -> execute ( RemoteCommand :: getInstance ( $ this ) -> show ( null , $ queryRemotes ) ) -> getOutputLines ( true ) ; $ remotes = [ ] ; foreach ( $ remoteNames as $ remoteName ) { $ remotes [ ] = $ this -> getRemote ( $ remoteN... | gets a list of remote objects |
53,641 | public function fetch ( $ from = null , $ ref = null , bool $ tags = false ) { $ options = [ ] ; if ( $ tags === true ) { $ options = [ '--tags' ] ; } $ this -> caller -> execute ( FetchCommand :: getInstance ( $ this ) -> fetch ( $ from , $ ref , $ options ) ) ; } | Download objects and refs from another repository |
53,642 | public function pull ( $ from = null , $ ref = null , bool $ rebase = true ) { $ this -> caller -> execute ( PullCommand :: getInstance ( $ this ) -> pull ( $ from , $ ref , $ rebase ) ) ; } | Fetch from and merge with another repository or a local branch |
53,643 | public function push ( $ to = null , $ ref = null , string $ args = null ) { $ this -> caller -> execute ( PushCommand :: getInstance ( $ this ) -> push ( $ to , $ ref , $ args ) ) ; } | Push changes to remote repository |
53,644 | public function getHumanishName ( ) { $ name = substr ( $ this -> getPath ( ) , strrpos ( $ this -> getPath ( ) , '/' ) + 1 ) ; $ name = str_replace ( '.git' , '.' , $ name ) ; $ name = str_replace ( '.bundle' , '.' , $ name ) ; return $ name ; } | get the humanish name of the repository |
53,645 | public function outputContent ( NodeObject $ obj , $ treeish ) { $ command = CatFileCommand :: getInstance ( $ this ) -> content ( $ obj , $ treeish ) ; return $ this -> caller -> execute ( $ command ) -> getOutputLines ( ) ; } | output a node content as an array of lines |
53,646 | public function outputRawContent ( NodeObject $ obj , $ treeish ) { $ command = CatFileCommand :: getInstance ( $ this ) -> content ( $ obj , $ treeish ) ; return $ this -> caller -> execute ( $ command ) -> getRawOutput ( ) ; } | output a node raw content |
53,647 | public function removeGlobalConfig ( string $ name ) { if ( isset ( $ this -> globalConfigs [ $ name ] ) ) { unset ( $ this -> globalConfigs [ $ name ] ) ; } } | remove an element form the global config list identified by key |
53,648 | public function removeGlobalOption ( string $ name ) { if ( isset ( $ this -> globalOptions [ $ name ] ) ) { unset ( $ this -> globalOptions [ $ name ] ) ; } } | remove an element form the global option list identified by key |
53,649 | public function addGlobalCommandArgument ( $ value ) { if ( ! in_array ( $ value , $ this -> globalCommandArguments , true ) ) { $ this -> globalCommandArguments [ ] = $ value ; } } | add a value to the global command argument list |
53,650 | public function removeGlobalCommandArgument ( $ value ) { if ( in_array ( $ value , $ this -> globalCommandArguments , true ) ) { $ index = array_search ( $ value , $ this -> globalCommandArguments ) ; unset ( $ this -> globalCommandArguments [ $ index ] ) ; } } | remove an element form the global command argument list identified by value |
53,651 | public function stashShow ( string $ stash ) { $ stashCommand = StashCommand :: getInstance ( $ this ) ; $ command = $ stashCommand -> show ( $ stash ) ; $ this -> caller -> execute ( $ command ) ; return $ this -> caller -> getOutput ( ) ; } | Shows details for a stash |
53,652 | public function stashDrop ( string $ stash ) { $ stashCommand = StashCommand :: getInstance ( $ this ) ; $ command = $ stashCommand -> drop ( $ stash ) ; $ this -> caller -> execute ( $ command ) ; } | Drops a stash |
53,653 | public function stashPop ( string $ stash , bool $ index = false ) { $ stashCommand = StashCommand :: getInstance ( $ this ) ; $ command = $ stashCommand -> pop ( $ stash , $ index ) ; $ this -> caller -> execute ( $ command ) ; } | Applies a stash then removes it from the stash |
53,654 | private function getLinesNumbers ( string $ line ) { $ matches = [ ] ; preg_match ( '/@@ -(.*) \+(.*) @@?(.*)/' , $ line , $ matches ) ; if ( ! strpos ( $ matches [ 1 ] , ',' ) ) { $ this -> originStartLine = $ matches [ 1 ] ; $ this -> originEndLine = $ matches [ 1 ] ; } else { list ( $ this -> originStartLine , $ thi... | Get line numbers |
53,655 | public function getHeaderLine ( ) { if ( null === $ this -> headerLine ) { $ line = '@@' ; $ line .= ' -' . $ this -> getOriginStartLine ( ) . ',' . $ this -> getOriginEndLine ( ) ; $ line .= ' +' . $ this -> getDestStartLine ( ) . ',' . $ this -> getDestEndLine ( ) ; $ line .= ' @@' ; $ this -> headerLine = $ line ; }... | Get hunk header line |
53,656 | public static function createFromOutputLine ( Repository $ repository , string $ outputLine ) { $ slices = static :: getLineSlices ( $ outputLine ) ; $ fullPath = $ slices [ 'fullPath' ] ; if ( false === $ pos = mb_strrpos ( $ fullPath , '/' ) ) { $ path = '' ; $ name = $ fullPath ; } else { $ path = substr ( $ fullPat... | create a Object from a single outputLine of the git ls - tree command |
53,657 | public static function getLineSlices ( string $ line ) { preg_match ( '/^(\d+) (\w+) ([a-z0-9]+) +(\d+|-)\t(.*)$/' , $ line , $ matches ) ; $ permissions = $ matches [ 1 ] ; $ type = null ; switch ( $ matches [ 2 ] ) { case NodeObject :: TYPE_TREE : $ type = NodeObject :: TYPE_TREE ; break ; case NodeObject :: TYPE_BLO... | Take a line and turn it in slices |
53,658 | public function getExtension ( ) { $ pos = strrpos ( $ this -> name , '.' ) ; if ( $ pos === false ) { return null ; } else { return substr ( $ this -> name , $ pos + 1 ) ; } } | get extension if it s a blob |
53,659 | public function getFullPath ( ) { return rtrim ( '' == $ this -> path ? $ this -> name : $ this -> path . DIRECTORY_SEPARATOR . $ this -> name , DIRECTORY_SEPARATOR ) ; } | Full path getter |
53,660 | public static function create ( Repository $ repository , string $ message , bool $ stageAll = false , $ author = null ) { $ repository -> getCaller ( ) -> execute ( MainCommand :: getInstance ( $ repository ) -> commit ( $ message , $ stageAll , $ author ) ) ; return $ repository -> getCommit ( ) ; } | factory method to create a commit |
53,661 | public static function pick ( Repository $ repository , $ treeish = null ) { $ commit = new self ( $ repository , $ treeish ) ; $ commit -> createFromCommand ( ) ; return $ commit ; } | pick an existing commit |
53,662 | public function getContainedIn ( ) { $ command = BranchCommand :: getInstance ( $ this -> getRepository ( ) ) -> contains ( $ this -> getSha ( ) ) ; return array_map ( 'trim' , ( array ) $ this -> getCaller ( ) -> execute ( $ command ) -> getOutputLines ( true ) ) ; } | get the branches this commit is contained in |
53,663 | public function count ( ) { $ command = RevListCommand :: getInstance ( $ this -> getRepository ( ) ) -> commitPath ( $ this ) ; return count ( $ this -> getCaller ( ) -> execute ( $ command ) -> getOutputLines ( true ) ) ; } | number of commits that lead to this one |
53,664 | public function tagged ( ) { $ result = false ; foreach ( $ this -> repository -> getTags ( ) as $ tag ) { if ( $ tag -> getSha ( ) === $ this -> getSha ( ) ) { $ result = true ; break ; } } return $ result ; } | Is the commit tagged? |
53,665 | public function getTags ( ) { $ currentCommitTags = [ ] ; foreach ( $ this -> repository -> getTags ( ) as $ tag ) { if ( $ tag -> getSha ( ) === $ this -> getSha ( ) ) { $ currentCommitTags [ ] = $ tag ; } } return $ currentCommitTags ; } | Return Tags that point to this commit |
53,666 | private function createFromCommand ( ) { $ command = MainCommand :: getInstance ( $ this -> repository ) -> status ( true ) ; $ lines = $ this -> repository -> getCaller ( ) -> execute ( $ command ) -> getOutputLines ( true ) ; $ this -> parseOutputLines ( $ lines ) ; } | create from git command |
53,667 | public function calculateDescription ( ) { $ status = $ this -> x . $ this -> y ; $ matching = [ '/ [MD]/' => 'not updated' , '/M[MD]/' => 'updated in index' , '/A[MD]/' => 'added to index' , '/D[M]/' => 'deleted from index' , '/R[MD]/' => 'renamed in index' , '/C[MD]/' => 'copied in index' , '/[MARC] /' => 'index and ... | description of the status |
53,668 | public function execute ( $ cmd , $ git = true , $ cwd = null ) { if ( $ git ) { $ cmd = $ this -> getBinaryPath ( ) . ' ' . $ cmd ; } $ stream = ssh2_exec ( $ this -> resource , $ cmd ) ; stream_set_blocking ( $ stream , 1 ) ; $ data = stream_get_contents ( $ stream ) ; fclose ( $ stream ) ; $ values = array_map ( 'rt... | execute a command |
53,669 | public function cloneUrl ( string $ url , string $ to = null , string $ repoReference = null , int $ depth = null , bool $ recursive = false ) { $ v = $ this -> getBinaryVersion ( ) ; $ this -> clearAll ( ) ; $ this -> addCommandName ( static :: GIT_CLONE_COMMAND ) ; $ this -> addCommandSubject ( $ url ) ; if ( null !=... | Command to clone a repository |
53,670 | public function show ( $ stash ) { $ stash = $ this -> normalizeStashName ( $ stash ) ; $ this -> clearAll ( ) ; $ this -> addCommandName ( self :: STASH_COMMAND . ' show' ) ; $ this -> addCommandSubject ( $ stash ) ; return $ this -> getCommand ( ) ; } | Shows details for a specific stash |
53,671 | public function add ( $ gitUrl , $ path = null ) { $ this -> clearAll ( ) ; $ this -> addCommandName ( sprintf ( '%s %s' , self :: SUBMODULE_COMMAND , self :: SUBMODULE_ADD_COMMAND ) ) ; $ this -> addCommandArgument ( $ gitUrl ) ; if ( null !== $ path ) { $ this -> addCommandSubject ( $ path ) ; } return $ this -> getC... | add a submodule |
53,672 | public function init ( $ path = null ) { $ this -> clearAll ( ) ; $ this -> addCommandName ( sprintf ( '%s %s' , self :: SUBMODULE_COMMAND , self :: SUBMODULE_INIT_COMMAND ) ) ; if ( null !== $ path ) { $ this -> addPath ( $ path ) ; } return $ this -> getCommand ( ) ; } | initialize a repository s submodules |
53,673 | public function update ( $ recursive = false , $ init = false , $ force = false , $ path = null ) { $ this -> clearAll ( ) ; $ this -> addCommandName ( sprintf ( '%s %s' , self :: SUBMODULE_COMMAND , self :: SUBMODULE_UPDATE_COMMAND ) ) ; if ( $ recursive === true ) { $ this -> addCommandArgument ( self :: SUBMODULE_OP... | update a repository s submodules |
53,674 | public function diff ( $ of , $ with = null , $ path = null ) { $ this -> clearAll ( ) ; $ this -> addCommandName ( self :: DIFF_COMMAND ) ; $ this -> addCommandArgument ( '--full-index' ) ; $ this -> addCommandArgument ( '--no-color' ) ; $ this -> addCommandArgument ( '--no-ext-diff' ) ; $ this -> addCommandArgument (... | build a diff command |
53,675 | public function getCommand ( ) { $ command = $ this -> getCommandName ( ) ; if ( is_null ( $ command ) ) { throw new \ RuntimeException ( "commandName must be specified to build a subcommand" ) ; } $ command .= ' ' ; $ args = $ this -> getCommandArguments ( ) ; if ( count ( $ args ) > 0 ) { $ command .= $ this -> extra... | Get the sub command |
53,676 | public function fullTree ( $ ref = 'HEAD' ) { $ what = $ ref ; if ( $ ref instanceof TreeishInterface ) { $ what = $ ref -> getSha ( ) ; } $ this -> clearAll ( ) ; $ this -> addCommandName ( self :: LS_TREE_COMMAND ) ; $ this -> addCommandArgument ( '-r' ) ; $ this -> addCommandArgument ( '-t' ) ; $ this -> addCommandA... | build a ls - tree command |
53,677 | public function tree ( $ ref = 'HEAD' , $ path = null ) { if ( $ path instanceof NodeObject ) { $ subjectPath = $ path -> getFullPath ( ) . ( $ path -> isTree ( ) ? '/' : '' ) ; } else { $ subjectPath = $ path ; } $ what = $ ref ; if ( $ ref instanceof TreeishInterface ) { $ what = $ ref -> getSha ( ) ; } $ this -> cle... | tree of a given path |
53,678 | public function listAll ( $ ref = null ) { if ( is_null ( $ ref ) ) { $ ref = 'HEAD' ; } $ this -> clearAll ( ) ; $ this -> addCommandName ( self :: LS_TREE_COMMAND ) ; $ this -> addCommandSubject ( $ ref ) ; return $ this -> getCommand ( ) ; } | build ls - tree command that list all |
53,679 | public function showCommit ( $ ref ) { $ this -> clearAll ( ) ; $ this -> addCommandName ( self :: GIT_SHOW ) ; $ this -> addCommandArgument ( '-s' ) ; $ this -> addCommandArgument ( '--pretty=raw' ) ; $ this -> addCommandArgument ( '--no-color' ) ; $ this -> addCommandSubject ( $ ref ) ; return $ this -> getCommand ( ... | build the show command |
53,680 | public function showObjectLog ( NodeObject $ obj , $ branch = null , $ limit = null , $ offset = null ) { $ subject = null ; if ( null !== $ branch ) { if ( $ branch instanceof Branch ) { $ subject .= $ branch -> getName ( ) ; } else { $ subject .= ( string ) $ branch ; } } return $ this -> showLog ( $ subject , $ obj ... | Build an object log command |
53,681 | public function all ( ) { return new Sequence ( array_filter ( $ this -> files , function ( StatusFile $ statusFile ) { return $ statusFile -> getIndexStatus ( ) && '?' !== $ statusFile -> getIndexStatus ( ) ; } ) ) ; } | all files with modified status in the index |
53,682 | protected function filterByType ( string $ type ) { if ( ! $ this -> files ) { return new Sequence ( ) ; } return new Sequence ( array_filter ( $ this -> files , function ( StatusFile $ statusFile ) use ( $ type ) { return $ type === $ statusFile -> getIndexStatus ( ) ; } ) ) ; } | filter files by index status |
53,683 | public function status ( $ porcelain = false ) { $ this -> clearAll ( ) ; $ this -> addCommandName ( self :: GIT_STATUS ) ; if ( $ porcelain ) { $ this -> addCommandArgument ( '--porcelain' ) ; } else { $ this -> addConfigs ( array ( 'color.status' => 'false' ) ) ; } return $ this -> getCommand ( ) ; } | Get the repository status |
53,684 | public function add ( $ what = '.' ) { $ this -> clearAll ( ) ; $ this -> addCommandName ( self :: GIT_ADD ) ; $ this -> addCommandArgument ( '--all' ) ; $ this -> addCommandSubject ( $ what ) ; return $ this -> getCommand ( ) ; } | Add a node to the stage |
53,685 | public function unstage ( $ what ) { $ this -> clearAll ( ) ; $ this -> addCommandName ( self :: GIT_RESET ) ; $ this -> addCommandArgument ( 'HEAD' ) ; $ this -> addPath ( $ what ) ; return $ this -> getCommand ( ) ; } | Remove a node from the stage and put in the working tree |
53,686 | public function checkout ( $ ref ) { $ this -> clearAll ( ) ; $ what = $ ref ; if ( $ ref instanceof Branch ) { $ what = $ ref -> getName ( ) ; } elseif ( $ ref instanceof TreeishInterface ) { $ what = $ ref -> getSha ( ) ; } $ this -> addCommandName ( self :: GIT_CHECKOUT ) ; $ this -> addCommandArgument ( '-q' ) ; $ ... | Checkout a treeish reference |
53,687 | protected function validatePath ( $ path ) { if ( empty ( $ path ) ) { return false ; } if ( false !== strpos ( $ path , '..' ) ) { return false ; } return true ; } | Validates a path |
53,688 | public static function pregSplitArray ( array $ list , string $ pattern ) : array { $ slices = [ ] ; $ index = - 1 ; foreach ( $ list as $ value ) { if ( preg_match ( $ pattern , $ value ) === 1 ) { ++ $ index ; } if ( $ index !== - 1 ) { $ slices [ $ index ] [ ] = $ value ; } } return $ slices ; } | explode an array by lines that match a regular expression |
53,689 | public function showLog ( $ refStart , $ refEnd , $ path = null , $ limit = null , $ offset = null , $ firstParent = false ) { $ this -> clearAll ( ) ; $ this -> addCommandName ( self :: GIT_LOG ) ; $ this -> addCommandArgument ( '-s' ) ; $ this -> addCommandArgument ( '--pretty=raw' ) ; $ this -> addCommandArgument ( ... | Build a generic log command |
53,690 | public static function create ( Repository $ repository , $ commit1 = null , $ commit2 = null , string $ path = null ) { $ commit = new self ( $ repository ) ; $ commit -> createFromCommand ( $ commit1 , $ commit2 , $ path ) ; return $ commit ; } | static generator to generate a Diff object |
53,691 | public function content ( NodeObject $ object , $ treeish ) { $ this -> clearAll ( ) ; if ( $ treeish instanceof TreeishInterface ) { $ sha = $ treeish -> getSha ( ) ; } else { $ sha = $ treeish ; } $ this -> addCommandName ( static :: GIT_CAT_FILE ) ; $ this -> addCommandArgument ( '-p' ) ; $ this -> addCommandSubject... | command to show content of a Object at a given Treeish point |
53,692 | public function contentBySha ( $ sha ) { $ this -> clearAll ( ) ; $ this -> addCommandName ( static :: GIT_CAT_FILE ) ; $ this -> addCommandArgument ( '-p' ) ; $ this -> addCommandSubject ( $ sha ) ; return $ this -> getCommand ( ) ; } | output an object content given it s sha |
53,693 | public function merge ( Branch $ with , $ message = '' , Array $ options = array ( ) ) { if ( in_array ( self :: MERGE_OPTION_FF_ONLY , $ options ) && in_array ( self :: MERGE_OPTION_NO_FF , $ options ) ) { throw new \ Symfony \ Component \ Process \ Exception \ InvalidArgumentException ( "Invalid options: cannot use f... | Generate a merge command |
53,694 | public static function create ( Repository $ repository , string $ name , string $ startPoint = null ) { $ repository -> getCaller ( ) -> execute ( BranchCommand :: getInstance ( $ repository ) -> create ( $ name , $ startPoint ) ) ; return new self ( $ repository , $ name ) ; } | Creates a new branch on the repository and returns it |
53,695 | private function createFromCommand ( ) { $ command = BranchCommand :: getInstance ( $ this -> getRepository ( ) ) -> listBranches ( ) ; $ outputLines = $ this -> repository -> getCaller ( ) -> execute ( $ command ) -> getOutputLines ( true ) ; foreach ( $ outputLines as $ outputLine ) { $ matches = static :: getMatches... | get the branch properties from command |
53,696 | public static function uuid1 ( $ node = null , ? int $ clockSeq = null ) : string { $ uuid = Uuid :: uuid1 ( $ node , $ clockSeq ) ; $ shortUuid = new self ( ) ; return $ shortUuid -> encode ( $ uuid ) ; } | Generate a version 1 UUID from a host ID sequence number and the current time and shorten it . |
53,697 | public function addResource ( $ name , $ resource , array $ options = [ ] ) { $ stream = $ this -> streamFactory -> createStream ( $ resource ) ; if ( ! isset ( $ options [ 'headers' ] ) ) { $ options [ 'headers' ] = [ ] ; } if ( empty ( $ options [ 'filename' ] ) ) { $ options [ 'filename' ] = null ; $ uri = $ stream ... | Add a resource to the Multipart Stream . |
53,698 | public function build ( ) { $ streams = '' ; foreach ( $ this -> data as $ data ) { $ streams .= "--{$this->getBoundary()}\r\n" . $ this -> getHeaders ( $ data [ 'headers' ] ) . "\r\n" ; $ contentStream = $ data [ 'contents' ] ; if ( $ contentStream -> isSeekable ( ) ) { $ streams .= $ contentStream -> __toString ( ) ;... | Build the stream . |
53,699 | private function prepareHeaders ( $ name , StreamInterface $ stream , $ filename , array & $ headers ) { $ hasFilename = '0' === $ filename || $ filename ; if ( ! $ this -> hasHeader ( $ headers , 'content-disposition' ) ) { $ headers [ 'Content-Disposition' ] = sprintf ( 'form-data; name="%s"' , $ name ) ; if ( $ hasF... | Add extra headers if they are missing . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.