System call to 'git'
8353
def git_call(command, verbose = debug_mode, enforce_success = false)
      if verbose
        puts
        puts "  git #{command}"
        puts
      end

      output = `git #{command}`
      puts output if verbose and not output.empty?

      if enforce_success and not command_successful?
        puts output unless output.empty?
        raise ::GitReview::UnprocessableState
      end

      output
    end
1000473
def git(commands={})
      if commands.is_a?(Symbol)
        run "git #{commands}"
      else
        commands.each do |cmd, options|
          run "git #{cmd} #{options}"
        end
      end
    end
116768
def requires_git(func: Callable) -> Callable:
    
    def decorated(*args, **kwargs):
        try:
            run([GIT_COMMAND, "--version"])
        except RunException as e:
            raise RuntimeError("`git` does not appear to be working") from e
        return func(*args, **kwargs)

    return decorated
257247
def git_clone(git_url, path):
    """"""
    if os.path.exists(os.path.join(path, '.git')):
        # get rid of local repo if it already exists
        shutil.rmtree(path)

    os.makedirs(path, exist_ok=True)
    print('Start cloning from {}…'.format(git_url))
    git_proc = subprocess.Popen(['git', 'clone', git_url, path],
                                stderr=subprocess.PIPE,
                                stdout=subprocess.PIPE,
                                env={'GIT_TERMINAL_PROMPT': '0'})

    try:
        stdoutmsg, stderrmsg = git_proc.communicate(timeout=120)
    except subprocess.TimeoutExpired:
        git_proc.kill()
        stderrmsg = b'Timed out.'

    if git_proc.returncode == 0:
        print('Cloned {}.'.format(git_url))
    else:
        print('Error cloning from {}:\n{}'.format(git_url,
                                                  stderrmsg.decode('utf-8')))
527972
def git_fetch(repo_dir, remote=None, refspec=None, verbose=False, tags=True):
    
    command = ['git', 'fetch']
    if not remote:
        command.append('--all')
    else:
        remote = pipes.quote(remote)
    command.extend(['--update-head-ok'])
    if tags:
        command.append('--tags')
    if verbose:
        command.append('--verbose')
    if remote:
        command.append(remote)
    if refspec:
        command.append(refspec)
    return execute_git_command(command, repo_dir=repo_dir)
1185322
def run():
    

    setup_file = os.path.join(package_root, 'setup.py')

    git_wc_proc = subprocess.Popen(
        ['git', 'status', '--porcelain', '-uno'],
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,
        cwd=package_root
    )
    git_wc_status, _ = git_wc_proc.communicate()

    if len(git_wc_status) > 0:
        print(git_wc_status.decode('utf-8').rstrip(), file=sys.stderr)
        print('Unable to perform release since working copy is not clean', file=sys.stderr)
        return False

    git_tag_proc = subprocess.Popen(
        ['git', 'tag', '-l', '--contains', 'HEAD'],
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
        cwd=package_root
    )
    tag, tag_error = git_tag_proc.communicate()

    if len(tag_error) > 0:
        print(tag_error.decode('utf-8').rstrip(), file=sys.stderr)
        print('Error looking for current git tag', file=sys.stderr)
        return False

    if len(tag) == 0:
        print('No git tag found on HEAD', file=sys.stderr)
        return False

    tag = tag.decode('ascii').strip()

    setuptools.sandbox.run_setup(
        setup_file,
        ['sdist', 'bdist_wheel', '--universal']
    )

    twine.cli.dispatch(['upload', 'dist/%s-%s*' % (package_name, tag)])

    setuptools.sandbox.run_setup(
        setup_file,
        ['clean']
    )
342691
def fetch(self, remote='origin'):
        """"""
        git(self.gitdir, "fetch", remote, _env=self.env())
623587
def run!
      git  = nil
      path = nil

      return show_usage() if ARGV.length < 1
      name = ARGV.shift() if ARGV.first[ 0 ] != '-'

      opts = GetoptLong.new(
        [ '--help',    '-h',       GetoptLong::NO_ARGUMENT       ],
        [ '--version', '-v', '-V', GetoptLong::NO_ARGUMENT       ],
        [ '--path',    '-p',       GetoptLong::REQUIRED_ARGUMENT ],
        [ '--from',    '-f',       GetoptLong::REQUIRED_ARGUMENT ],
        [ '--git',     '-g',       GetoptLong::REQUIRED_ARGUMENT ],
      )

      silence_stream( $stderr ) do
        begin
          opts.each do | opt, arg |
            case opt
              when '--help'
                return show_usage()
              when '--version'
                return show_version()
              when '--path'
                path = arg
              when '--from', '--git'
                git = arg
            end
          end

        rescue GetoptLong::InvalidOption, GetoptLong::MissingArgument => e
          return usage_and_warning( e.message )

        end
      end

      unless path.nil? || git.nil?
        return usage_and_warning( 'Use the --path OR --from arguments, but not both' )
      end

      git ||= 'git@github.com:LoyaltyNZ/service_shell.git'

      name = ARGV.shift() if name.nil?
      return show_usage() if name.nil?

      return usage_and_warning( "Unexpected extra arguments were given" ) if ARGV.count > 0
      return usage_and_warning( "SERVICE_NAME must match #{ NAME_REGEX.inspect }" ) if naughty_name?( name )
      return usage_and_warning( "'#{ name }' already exists" ) if File.exist?( "./#{ name }" )

      return create_service( name, git, path )
    end
1151158
async function synchRepo(remote, pathname) {
  const cmd = `git subtree push --prefix=${pathname} ${remote} master`;

  try {
    await exec(cmd);
    logger.log(`Synched master of ${pathname}`);
  } catch (error) {
    throw error;
  }
}
515219
def run(self):
        """"""
        sha = VersionUtils.run_git_command(["rev-parse", "HEAD"], self.git_dir)
        tag = self.distribution.get_version()

        if self.has_tag(tag, sha):
            tags_sha = VersionUtils.run_git_command(["rev-parse", tag], self.git_dir)
            if sha != tags_sha:
                logger.error(
                    "git tag {0} sha does not match the sha requesting to be tagged, you need to increment the version number, Skipped Tagging!".format(
                        tag
                    )
                )
                return
            else:
                logger.info(
                    "git tag {0} already exists for this repo, Skipped Tagging!".format(
                        tag
                    )
                )
                return

        logger.info("Adding tag {0} for commit {1}".format(tag, sha))
        if not self.dry_run:
            VersionUtils.run_git_command(
                ["tag", "-m", '""', tag, sha], self.git_dir, throw_on_error=True
            )
            logger.info("Pushing tag {0} to remote {1}".format(tag, self.remote))
            VersionUtils.run_git_command(
                ["push", self.remote, tag], self.git_dir, throw_on_error=True
            )
108320
async function commitVersionBump (version) {
  const gitDir = path.resolve(__dirname, '..')
  const gitArgs = ['commit', '-a', '-m', `Bump v${version}`, '-n']
  await GitProcess.exec(gitArgs, gitDir)
}
850168
function clone(git_url, git_ref, clone_dir){
    
    var needsGitCheckout = !!git_ref;
    if (!shell.which('git')) {
        return Q.reject(new Error('"git" command line tool is not installed: make sure it is accessible on your PATH.'));
    }

    // If no clone_dir is specified, create a tmp dir which git will clone into.
    var tmp_dir = clone_dir;
    if(!tmp_dir){
        tmp_dir = path.join(os.tmpdir(), 'git', String((new Date()).valueOf()));
    }
    shell.rm('-rf', tmp_dir);
    shell.mkdir('-p', tmp_dir);
    
    var cloneArgs = ['clone'];
    if(!needsGitCheckout) {
        // only get depth of 1 if there is no branch/commit specified
        cloneArgs.push('--depth=1');
    }
    cloneArgs.push(git_url, tmp_dir);
    return superspawn.spawn('git', cloneArgs)
    .then(function() {
        if (needsGitCheckout){
            return superspawn.spawn('git', ['checkout', git_ref], {
                cwd: tmp_dir
            });
        }
    })
    .then(function(){
        events.emit('log', 'Repository "' + git_url + '" checked out to git ref "' + (git_ref || 'master') + '".');
        return tmp_dir;
    })
    .fail(function (err) {
        shell.rm('-rf', tmp_dir);
        return Q.reject(err);
    });
}
422109
function gitTrack () {
      var remoteBranch = options.remoteBranch || options.branch;
      if (shelljs.exec('git config branch.' + options.branch + '.remote', {silent: true}).output.replace(/\n/g, '') !== remoteName) {
        execWrap('git branch --set-upstream-to=' + remoteName + '/' + remoteBranch + ' ' + options.branch);
      }
    }
541084
def _run_git_command(cls, cmd, **opts):
        

        if '_bare' in opts:
            _copts = []
            del opts['_bare']
        else:
            _copts = ['-c', 'core.quotepath=false', ]
        safe_call = False
        if '_safe' in opts:
            #no exc on failure
            del opts['_safe']
            safe_call = True

        _str_cmd = False
        if isinstance(cmd, basestring):
            cmd = [cmd]
            _str_cmd = True

        gitenv = os.environ
        # need to clean fix GIT_DIR !
        if 'GIT_DIR' in gitenv:
            del gitenv['GIT_DIR']
        gitenv['GIT_CONFIG_NOGLOBAL'] = '1'

        _git_path = settings.GIT_EXECUTABLE_PATH
        cmd = [_git_path] + _copts + cmd
        if _str_cmd:
            cmd = ' '.join(cmd)
        try:
            _opts = dict(
                env=gitenv,
                shell=False,
            )
            _opts.update(opts)
            p = subprocessio.SubprocessIOChunker(cmd, **_opts)
        except (EnvironmentError, OSError), err:
            tb_err = ("Couldn't run git command (%s).\n"
                      "Original error was:%s\n" % (cmd, err))
            if safe_call:
                return '', err
            else:
                raise RepositoryError(tb_err)

        return ''.join(p.output), ''.join(p.error)
763464
def run_cmd(cmd)
      raise "Unstubbed git command #{cmd}" if ENV['SCGITX_TEST'] == 'true'
      say "\n$ "
      say cmd.gsub("'", ''), :red
      raise "#{cmd} failed" unless system cmd
    end
503713
def is_git_repo(repo_dir):
    """"""
    command = ['git', 'rev-parse']
    try:
        execute_git_command(command, repo_dir=repo_dir)
    except exceptions.SimplGitCommandError:
        return False
    else:
        return True
755980
def current_git_dir():
    """"""
    path = os.path.abspath(os.curdir)
    while path != '/':
        if os.path.isdir(os.path.join(path, '.git')):
            return os.path.join(path, '.git')
        path = os.path.dirname(path)
    return None