NAME

App::GitHub::FindRepository - Determine the right case (mixed or lower) for a GitHub repository

VERSION

Version 0.02

SYNOPSIS

github-find-repository git://github.com/robertkrimen/Doc-Simply.git
# git://github.com/robertkrimen/doc-simply.git

github-find-repository robertkrimen,Doc-Simply
# git://github.com/robertkrimen/doc-simply.git

github-find-repository --pinger=./bin/git-ls-remote ...

# ... or ...

use App::GitHub::FindRepository

my $url = App::GitHub::FindRepository->find( robertkrimen/Doc-Simply )
# git://github.com/robertkrimen/doc-simply.git

DESCRIPTION

GitHub recently made a change that now allows mixed-case repository names. Unfortunately, their git daemon will not find the right repository given the wrong case.

App::GitHub::FindRepository (github-find-repository) will first attempt to ping the mixed-case version, and, failing that, will attempt to ping the lowercase version. It will return/print the valid repository url, if any

CAVEAT

Given a mixed-case repository, the find routine will try the mixed-case once, then the lowercase. It will not find anything else

github-find-repository robertkrimen/Doc-Simply

...will work, as long as the real repository is robertkrimen/Doc-Simply.git or robertkrimen/doc-simply.git

If the real repository is robertkrimen/dOc-sImPlY.git then the finder will NOT see it

...that being said, let me know if you want/need something that is more findy

INSTALL

cpan -i App::GitHub::FindRepository

You can also try using the bash script below if you need a quick-fix

USAGE

github-find-repository

A commandline application that will print out the the repository with the right casing

Usage: github-find-repository [--pinger <pinger>] <repository>

    --pinger        The pinger to use (default is either git-ls-remote or git-peek-remote)

    <repository>    The repository to test, can be like:

                    git://github.com/robertkrimen/App-GitHub-FindRepository.git
                    robertkrimen/App-GitHub-FindRepository.git
                    robertkrimen,App-GitHub-FindRepository

$repository = AppGitHub::FindRepository->find( <repository> [, <pinger>] )

Given a mixed-case repository URI, it will return the version with the right case

A bash function as an alternative

If you do not want to install App::GitHub::FindRepository, here is a bash equivalent:

#!/bin/bash

function github-find-repository() {
    local pinger=`which git-ls-remote`
    if [ "$pinger" == "" ]; then pinger=`which git-peek-remote`; fi
    if [ "$pinger" == "" ]; then echo "Couldn't find pinger (git-ls-remote or git-peek-remote)"; return -1; fi
    local repository=$1
    if [ "`$pinger $repository 2>/dev/null`" ]; then echo $repository; return 0; fi
    repository=`echo $repository | tr "[:upper:]" "[:lower:]" `
    if [ "`$pinger $repository 2>/dev/null`" ]; then echo $repository; return 0; fi
    return -1
}

github-find-repository $*

AUTHOR

Robert Krimen, <rkrimen at cpan.org>

BUGS

Please report any bugs or feature requests to bug-app-github-findrepository at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=App-GitHub-FindRepository. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc App::GitHub::FindRepository

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2009 Robert Krimen, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.