[Bps-public-commit] Shipwright branch, master, updated. b9b9169b3029aab49135b01d4c021f2e2c6b16b5

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Jul 13 02:29:24 EDT 2009


The branch, master has been updated
       via  b9b9169b3029aab49135b01d4c021f2e2c6b16b5 (commit)
      from  9bac16656ab8f0650c88325acc90d3fbbc413027 (commit)

Summary of changes:
 lib/Shipwright/Backend/Git.pm |   24 +++++++++---------------
 1 files changed, 9 insertions(+), 15 deletions(-)

- Log -----------------------------------------------------------------
commit b9b9169b3029aab49135b01d4c021f2e2c6b16b5
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Mon Jul 13 14:29:05 2009 +0800

    use --bare to init git repo

diff --git a/lib/Shipwright/Backend/Git.pm b/lib/Shipwright/Backend/Git.pm
index 63b8886..84094d6 100644
--- a/lib/Shipwright/Backend/Git.pm
+++ b/lib/Shipwright/Backend/Git.pm
@@ -38,26 +38,19 @@ sub initialize {
 
     my $dir = $self->SUPER::initialize(@_);
 
-    my $cwd = getcwd;
-    chdir $dir;
-    Shipwright::Util->run( [ $ENV{'SHIPWRIGHT_GIT'}, 'init' ] );
-    Shipwright::Util->run(
-        [
-            $ENV{'SHIPWRIGHT_GIT'},      'config',
-            'receive.denyCurrentBranch', 'ignore',
-        ]
-    );
-    Shipwright::Util->run( [ $ENV{'SHIPWRIGHT_GIT'}, 'add', '.' ] );
-    Shipwright::Util->run(
-        [ $ENV{'SHIPWRIGHT_GIT'}, 'commit', '-m', 'creating repository' ] );
-
     my $path = $self->repository;
     $path =~ s!^file://!!;    # this is always true since we check that before
 
     Shipwright::Util->run( [ 'rm', '-rf', $path ] );
+    Shipwright::Util->run( [ 'mkdir', '-p', $path ] );
+
+    my $cwd = getcwd;
+    chdir $path;
+    Shipwright::Util->run( [ $ENV{'SHIPWRIGHT_GIT'}, '--bare', 'init' ] );
 
-    dircopy( catdir( $dir, '.git' ), $path )
+    dircopy( $dir, $self->cloned_dir )
       or confess "can't copy $dir to " . $path . ": $!";
+    $self->commit( comment => 'create project' );
     chdir $cwd;
 }
 
@@ -202,7 +195,8 @@ sub commit {
         #    TODO comment need to be something special
         Shipwright::Util->run(
             [ $ENV{'SHIPWRIGHT_GIT'}, 'commit', '-m', $args{comment} ], 1 );
-        Shipwright::Util->run( [ $ENV{'SHIPWRIGHT_GIT'}, 'push' ] );
+        Shipwright::Util->run(
+            [ $ENV{'SHIPWRIGHT_GIT'}, 'push', 'origin', 'master' ] );
         chdir $cwd;
     }
     return;

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list