Github?

Ovid on 2008-09-15T08:01:18

I've been thinking more and more about opening up all of my code. I was tempted to put it on Google Code, but the more I think about it, the more I want Git Hub or something similar. There are two reasons for this. First, even if I never used the advanced features of git, I find that it has so many little details that are "just right", that I'm comfortable with it. Git's responsiveness and lack of a central server are also huge plusses for me.

The main reason, though, is that I suspect I'll have a better quality of developer submitting patches and work if I use git. I can't prove this, but the sort of developer who says "cvs is good enough for me" and then makes commits without a commit message just isn't the sort of developer I feel comfortable with. They might be a great developer, but usually when I've encountered this type, they have quite a lot to learn.

I realize that this might sound terribly elitist of me and I suppose it is. It's also worth pointing out that I might be trying to pre-emptively solve a non-existent problem. I rarely get patches now and when I do, they're usually of high quality. However, I suspect that's because the sort of people who are willing to take the trouble submit those patches are the sorts of people who already care about their craft.


Elitist?

polettix on 2008-09-15T10:01:53

I don't think that setting rules for other to participate on your projects is being elitist - you should keep the joy of working on them. As the "founder", IMHO you deserve any right to set the standards, either explicitly or - as in this case - implicitly.

Github is good

amoore on 2008-09-15T13:48:05

I think a service like GitHub is pretty useful for module authors. In fact, I've often thought that a few tools that relate CPAN to github (or another similar one) could solve the occasional "svn (or other repository tool) for all CPAN modules or authors" plan that arises.

I say go for it.

I enjoy it so far.

jk2addict on 2008-09-15T15:15:55

About 2 weeks ago, I started the process of moving all of the crap out of my basement and out into shared hosting world. I started with moving my local svn projects to GitHub.

It's free. Someone else backs it up, and I don't have to worry about mine crashing. Win win. I happen to also like the GitHub interface better.

My git transition

brian_d_foy on 2008-09-15T18:18:06

A lot of good developers use git, but I don't think using Git makes you a good developer.

In my experience the good people submit patches no matter what source control I'm using.

Still, I'm really enjoying git now that I've gotten over the hump of learning the basics. It took a little while to get used to, but that I'm easily managing several branches at the same time on some projects, I'm happy with git.

I have a github_creator script on Github. I make my repositories locally and set up github as a remote (not origin). I just run the script in a working copy and it automatically creates the git repo, sets up the remote, and pushes to it. I also replicate my git stuff in a few different places so I don't rely on someone else's service:

#!/usr/bin/perl
use warnings;
use strict;
 
use Cwd;
use Config::IniFiles;
 
use File::Basename;
use File::Path;
use File::Spec::Functions qw(catfile);
use Log::Log4perl qw(:easy);
use Net::SSH::Expect;
 
Log::Log4perl->easy_init($DEBUG);
 
=for
 
{ # for debugging
rmtree( [ 'Foo-Bar', 'Git' ], 0, 0 );
 
`module_cooker Foo::Bar`;
chdir 'Foo-Bar';
}
 
=cut
 
my $dirname = basename( cwd() );
DEBUG "Local dir is $dirname";
 
my $repo_name = "$dirname\.git";
 
unless( -d ".git" )
    {
    INFO `git init`;
    INFO `git add .`;
    INFO `git commit -a -m "* Initial module creation"`;
    }
 
my %remotes = map { $_, 1 } map { chomp $_; $_ } `git remote 2>/dev/null`;
 
my $basename = basename( $0 );
my $Config = Config::IniFiles->new( -file => "/Users/brian/bin/$basename.ini" );
unless( eval { $Config->isa( 'Config::IniFiles' ) } )
    {
    die "Could not find config file [$basename.ini]\n";
    }
 
HOST: foreach my $remote_name ( $Config->Sections )
    {
    my( $host, $user, $git_dir, $remote_git ) = map {
        $Config->val( $remote_name, $_ ) } qw( host user dir git );
 
    INFO "Remote is $remote_name";
 
    INFO "Processing $host";
 
    {
    next HOST if exists $remotes{ $remote_name };
    INFO `git remote add $remote_name ssh://$user\@$host$git_dir/$repo_name`;
    }
 
    my $path = catfile( $git_dir, $repo_name );
    DEBUG "path is $path\n";
 
    my $ssh = get_ssh_session( $host, $user );
    $ssh->run_ssh;
 
    my $cwd = $ssh->exec( "pwd" ) || '';
    DEBUG "at login, pwd is $cwd\n";
 
    $ssh->exec( "mkdir -p $path" );
    my $pwd = $ssh->exec( "cd $path; pwd" );
    DEBUG "after cd, pwd is $pwd\n";
 
    my $output = $ssh->exec( "$remote_git --bare init" );
    DEBUG "git says [$output]\n";
 
    my $push = `/usr/local/bin/git push $remote_name master`;
    }
 
sub get_ssh_session
    {
    my( $host, $user ) = @_;
 
    Net::SSH::Expect->new(
            host    => $host,
            user    => $user,
            raw_pty => 1,
            no_terminal => 1,
        );
    }

Pushing to them all is easy (although maybe there is a hidden git command to do all this):

#!/usr/bin/perl
 
use Term::ANSIColor;
 
my $status = `git status`;
 
my( $branch ) = $status =~ m/# On branch (\w+)/g;
print "Pushing branch $branch\n";
 
foreach my $remote ( map { chomp; $_ } `git remote` )
        {
        print colored( "Processing remote $remote\n", 'red' );
        `git push --all $remote @ARGV`;
        `git push --tags $remote`;
        }

I should probably store these scripts in some repo, but I haven't. Do whatever you like with them.

github++

Dom2 on 2008-09-16T07:23:58

I've just moved my modules over there. It works a treat.