[Bps-public-commit] git-sync branch, master, updated. 2f75f3088bf69d30ee6f3f80ba8069b7be63b3a1

Alex Vandiver alexmv at bestpractical.com
Mon Jun 28 12:52:28 EDT 2010


The branch, master has been updated
       via  2f75f3088bf69d30ee6f3f80ba8069b7be63b3a1 (commit)
       via  2b0bc1ededf3a81ec54951f498171b24143aed67 (commit)
      from  29f9a29b9bd633f25c04a287d80053f0f63bb69c (commit)

Summary of changes:
 git-sync |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 2b0bc1ededf3a81ec54951f498171b24143aed67
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jun 28 12:53:16 2010 -0400

    The SYNOPSIS already fails to include all options; limit to the basic ones

diff --git a/git-sync b/git-sync
index 78c0cfd..1c1c5ad 100755
--- a/git-sync
+++ b/git-sync
@@ -6,7 +6,7 @@ git-sync - synchronize multiple git repositories
 
 =head1 SYNOPSIS
 
-    git-sync [--verbose|--quiet] [--dry-run] [--log] [category]
+    git-sync [--verbose|--quiet] [--dry-run] [category]
 
 =head1 DESCRIPTION
 

commit 2f75f3088bf69d30ee6f3f80ba8069b7be63b3a1
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jun 28 12:53:44 2010 -0400

    Add an option to GC all of the repositories as it checks them for updates

diff --git a/git-sync b/git-sync
index 1c1c5ad..e6c812a 100755
--- a/git-sync
+++ b/git-sync
@@ -162,6 +162,13 @@ Display how many entries there are in the stash, if there are any;
 defaults to off.  This option's default is controlled by the
 C<sync.stash> key in F<.gitconfig>
 
+=item C<--gc> or <-G>
+
+Run C<git gc> on each repository, repacking it for better disk space
+efficiency, and faster operation; as this is a possibly time-intensive
+operation, this defaults to off.  This option's default is controlled
+by the C<sync.gc> key in F<.gitconfig>
+
 =item C<--help> or C<-h>
 
 Shows this documentation.
@@ -203,13 +210,14 @@ $SIG{INT} = sub {
 };
 $SIG{USR1} = 'IGNORE';
 
-my ($verbose, $quiet, $pretend, $log, $stash, $help);
+my ($verbose, $quiet, $pretend, $log, $stash, $gc, $help);
 GetOptions(
     'verbose|v!' => \$verbose,
     'quiet|terse|q!' => \$quiet,
     'pretend|dry-run|n' => \$pretend,
     'log|l!' => \$log,
     'stash|s!' => \$stash,
+    'gc|G!' => \$gc,
     'help|h' => \$help,
 ) or pod2usage( -verbose => 1 );
 
@@ -226,6 +234,7 @@ for (split /\0/, `git config -z --get-regexp ^sync\\\\.`) {
     $verbose = -1 if not defined $verbose and $_ eq "sync.quiet";
     $log     =  1 if not defined $log     and $_ eq "sync.log";
     $stash   =  1 if not defined $stash   and $_ eq "sync.stash";
+    $gc      =  1 if not defined $gc      and $_ eq "sync.gc";
     next unless /^sync\.(.*?)\.([^\n]*)(?:\n(.*))?/;
     $sync{$1}{$2} = exists $sync{$1}{$2}
         ? ref $sync{$1}{$2} ? [@{$sync{$1}{$2}}, $3] : [$sync{$1}{$2}, $3]
@@ -571,7 +580,12 @@ sub update {
         $pull =~ s/^( .*?)(\+*)(-*)$/$1.colored($2,"green").colored($3,"red")/gme;
         $pull =~ s/^/    /gm if length $pull;
         print $pull;
+
+        # GC after the pull, so we get the new objects
+        $repo->command("gc", "--quiet") if $gc and not $pretend;
     } else {
+        # If we don't pull, GC now, before we possibly bail
+        $repo->command("gc", "--quiet") if $gc and not $pretend;
         my $logs = "";
         my $dirty = ($status !~ /^nothing (?:added )?to commit/m) ? 1 : 0;
         if ($status =~ /^# Your branch and '.*?' have diverged.*?(\d+) and (\d+) different commit/sm) {

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



More information about the Bps-public-commit mailing list