Create a Library from a git path.
775660
def create(gitpath, cache=None):
    
    if gitpath.startswith(config.LIBRARY_PREFIX):
        path = gitpath[len(config.LIBRARY_PREFIX):]
        return Library(*path.split('/'), cache=cache)
1022825
def subtree_up(path = Dir.pwd)
      error "Unable to pull subtree(s): Dirty Git repository" if FalkorLib::Git.dirty?( path )
      exit_status = 0
      git_root_dir = rootdir(path)
      Dir.chdir(git_root_dir) do
        FalkorLib.config.git[:subtrees].each do |dir, conf|
          next if conf[:url].nil?
          #url    = conf[:url]
          remote = dir.gsub(/\//, '-')
          branch = (conf[:branch].nil?) ? 'master' : conf[:branch]
          remotes = FalkorLib::Git.remotes
          info "Pulling changes into subtree '#{dir}' using remote '#{remote}/#{branch}'"
          raise IOError, "The git remote '#{remote}' is not configured" unless remotes.include?( remote )
          info "\t\\__ fetching remote '#{remotes.join(',')}'"
          FalkorLib::Git.fetch( git_root_dir )
          raise IOError, "The git subtree directory '#{dir}' does not exists" unless File.directory?( File.join(git_root_dir, dir) )
          info "\t\\__ pulling changes"
          exit_status = execute "git subtree pull --prefix #{dir} --squash #{remote} #{branch}"
          #exit_status = puts "git subtree pull --prefix #{dir} --squash #{remote} #{branch}"
        end
      end
      exit_status
    end
943167
def repo_make(name)
      path = repo_path(name)
      path.mkpath
      Dir.chdir(path) do
        `git init`
        repo_make_readme_change(name, 'Added')
        `git add .`
        `git commit -m "Initialized."`
      end
      path
    end
410376
def create_branch(version):
    """"""
    repo = Repo.init(".")
    if repo.is_dirty(untracked_files=True):
        raise RuntimeError(f"Repository is dirty, please commit/stash your changes.")

    branch_name = f"release-{version}"
    print(f"{Fore.CYAN}Create {branch_name} branch from upstream master")
    upstream = get_upstream(repo)
    upstream.fetch()
    release_branch = repo.create_head(branch_name, upstream.refs.master, force=True)
    release_branch.checkout()
    return repo
79486
def create(path)
      self.destination_root = path

      copy_file(".gitignore")
      copy_file("config.ru")
      copy_file("Gemfile")
      copy_file("Procfile")
      copy_file("README.md")

      copy_content
      copy_themes
    end
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);
    });
}
1340026
def _make_git(config_info):
    """"""
    git_args = {}

    def _add_value(value, key):
        args_key, args_value = _GIT_ARG_FNS[key](value)
        git_args[args_key] = args_value

    devpipeline_core.toolsupport.args_builder("git", config_info, _GIT_ARGS, _add_value)
    if git_args.get("uri"):
        return devpipeline_scm.make_simple_scm(Git(git_args), config_info)
    else:
        raise Exception("No git uri ({})".format(config_info.config.name))
847690
def install(client, force):
    """"""
    import pkg_resources
    from git.index.fun import hook_path as get_hook_path

    for hook in HOOKS:
        hook_path = Path(get_hook_path(hook, client.repo.git_dir))
        if hook_path.exists():
            if not force:
                click.echo(
                    'Hook already exists. Skipping {0}'.format(str(hook_path)),
                    err=True
                )
                continue
            else:
                hook_path.unlink()

        # Make sure the hooks directory exists.
        hook_path.parent.mkdir(parents=True, exist_ok=True)

        Path(hook_path).write_bytes(
            pkg_resources.resource_string(
                'renku.data', '{hook}.sh'.format(hook=hook)
            )
        )
        hook_path.chmod(hook_path.stat().st_mode | stat.S_IEXEC)
917992
def clone_with_git(repo_uri, dest_path):
    
    log.info('Cloning git repo %s to %s', repo_uri, dest_path)
    git.Repo.clone_from(repo_uri, dest_path, depth=1)
84963
def create(cls, fpath):
        ""
        fpath = _expand_path(fpath)
        assert(fpath.suffix == '.yml')
        if fpath.exists(): return
        fpath.parent.mkdir(parents=True, exist_ok=True)
        with open(fpath, 'w') as yaml_file:
            yaml.dump(cls.DEFAULT_CONFIG, yaml_file, default_flow_style=False)
742
def find_git_repository(self, path):
        
        while path is not None:
            git_path = os.path.join(path,'.git')
            if os.path.exists(git_path) and os.path.isdir(git_path):
                return path
            path = os.path.dirname(path)
        return None
96745
def build(self, input_path, output_paths):
        """"""
        for output in output_paths:
            shutil.copy(input_path, output_paths)
1295146
def get_or_create_environment(self, repo: str, branch: str, git_repo: Repo, repo_path: Path) -> str:
        
        return sys.executable
1360303
def _init_externals():
    """"""
    if __version__ == 'git':
        sys.path.insert(0, osp.join(osp.dirname(__file__), 'ext', 'gitdb'))

    try:
        import gitdb
    except ImportError:
        raise ImportError("'gitdb' could not be found in your PYTHONPATH")
168868
def gitdir(path = Dir.pwd)
      g = MiniGit.new
      g.find_git_dir(path)[0]
    end
266980
def repository(namespace, name, branch='master'):
    ''''''
    with TemporaryDirectory() as download_path:
        old_directory = str(pwd()).strip()
        try:
            git.clone('https://github.com/{0}/{1}.git'.format(namespace, name), download_path)
            cd(download_path)
            git.fetch('origin', branch)
            git.checkout(branch)
            yield (download_path, git('rev-parse', 'HEAD'), redis.Dict(key="{0}.{1}".format(namespace, name)))
        except ErrorReturnCode_128:
            mkdir(download_path)
            yield (None, None, None)
        cd(old_directory)
371449
def _get_library_os_path_from_library_dict_tree(self, library_path, library_name):
        """"""
        if library_path is None or library_name is None:
            return None
        path_list = library_path.split(os.sep)
        target_lib_dict = self.libraries
        # go down the path to the correct library
        for path_element in path_list:
            if path_element not in target_lib_dict:  # Library cannot be found
                target_lib_dict = None
                break
            target_lib_dict = target_lib_dict[path_element]
        return None if target_lib_dict is None or library_name not in target_lib_dict else target_lib_dict[library_name]