src/Event/Subscriber/StashUnstagedChangesSubscriber.php
private function doSaveStash()
    {
        $pending = $this->repository->getWorkingCopy()->getDiffPending();
        if (!\count($pending->getFiles())) {
            return;
        }

        try {
            $this->io->write(['<fg=yellow>Detected unstaged changes... Stashing them!</fg=yellow>']);
            $this->repository->run('stash', ['save', '--quiet', '--keep-index', uniqid('grumphp')]);
        } catch (Exception $e) {
            // No worries ...
            $this->io->write([sprintf('<fg=red>Failed stashing changes: %s</fg=red>', $e->getMessage())]);

            return;
        }

        $this->stashIsApplied = true;
        $this->registerShutdownHandler();
    }
private function doSaveStash()
    {
        $pending = $this->repository->getWorkingCopy()->getDiffPending();
        if (!\count($pending->getFiles())) {
            return;
        }

        try {
            $this->io->write(['<fg=yellow>Detected unstaged changes... Stashing them!</fg=yellow>']);
            $this->repository->run('stash', ['save', '--quiet', '--keep-index', uniqid('grumphp')]);
        } catch (Exception $e) {
            // No worries ...
            $this->io->write([sprintf('<fg=red>Failed stashing changes: %s</fg=red>', $e->getMessage())]);

            return;
        }

        $this->stashIsApplied = true;
        $this->registerShutdownHandler();
    }
private function doSaveStash ( ) { $ pending = $ this -> repository -> getWorkingCopy ( ) -> getDiffPending ( ) ; if ( ! \ count ( $ pending -> getFiles ( ) ) ) { return ; } try { $ this -> io -> write ( [ '<fg=yellow>Detected unstaged changes... Stashing them!</fg=yellow>' ] ) ; $ this -> repository -> run ( 'stash' , [ 'save' , '--quiet' , '--keep-index' , uniqid ( 'grumphp' ) ] ) ; } catch ( Exception $ e ) { // No worries ... $ this -> io -> write ( [ sprintf ( '<fg=red>Failed stashing changes: %s</fg=red>' , $ e -> getMessage ( ) ) ] ) ; return ; } $ this -> stashIsApplied = true ; $ this -> registerShutdownHandler ( ) ; }
Check if there is a pending diff and stash the changes.

@reurn void
Check if there is a pending diff and stash the changes .