|
@@ -10,6 +10,11 @@ use lib "/usr/local/lib";
|
|
use SimplyGit::Shellex qw(shellex findBin);
|
|
use SimplyGit::Shellex qw(shellex findBin);
|
|
use SimplyGit::Git qw(readConfig getStatus returnState addFiles commitChanges pushChanges);
|
|
use SimplyGit::Git qw(readConfig getStatus returnState addFiles commitChanges pushChanges);
|
|
|
|
|
|
|
|
+if ( ! -d ".git" ) {
|
|
|
|
+ print "Not a git dir, exiting...\n";
|
|
|
|
+ exit 1;
|
|
|
|
+}
|
|
|
|
+
|
|
sub initSG($) {
|
|
sub initSG($) {
|
|
|
|
|
|
my $sgDir = shift;
|
|
my $sgDir = shift;
|
|
@@ -92,9 +97,13 @@ if ( scalar keys %args < 1 ) {
|
|
if ( defined $args{'view'} ) {
|
|
if ( defined $args{'view'} ) {
|
|
my ( $untrackedRef, $modifiedRef, $addedRef, $deletedRef ) = returnState($logger);
|
|
my ( $untrackedRef, $modifiedRef, $addedRef, $deletedRef ) = returnState($logger);
|
|
my $refs = shellex("$gitCmd show-ref",$logger);
|
|
my $refs = shellex("$gitCmd show-ref",$logger);
|
|
|
|
+ my $branch = shellex("$gitCmd show-branch",$logger);
|
|
|
|
+ print "On [branch] @ commit: $branch";
|
|
print "$refs\n";
|
|
print "$refs\n";
|
|
my $swpWarning = "\t# Likely a Vi .swp file";
|
|
my $swpWarning = "\t# Likely a Vi .swp file";
|
|
- print "Untracked files:\n";
|
|
|
|
|
|
+
|
|
|
|
+ my $untrackedTotal = scalar @$untrackedRef;
|
|
|
|
+ print "* $untrackedTotal untracked file(s):\n";
|
|
foreach my $file ( @$untrackedRef ) {
|
|
foreach my $file ( @$untrackedRef ) {
|
|
if ( $file =~ m/.swp/ ) {
|
|
if ( $file =~ m/.swp/ ) {
|
|
print "\t$file $swpWarning\n";
|
|
print "\t$file $swpWarning\n";
|
|
@@ -102,7 +111,9 @@ if ( defined $args{'view'} ) {
|
|
print "\t$file\n";
|
|
print "\t$file\n";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- print "Modified files:\n";
|
|
|
|
|
|
+
|
|
|
|
+ my $modifiedTotal = scalar @$modifiedRef;
|
|
|
|
+ print "* $modifiedTotal modified file(s):\n";
|
|
foreach my $file ( @$modifiedRef ) {
|
|
foreach my $file ( @$modifiedRef ) {
|
|
if ( $file =~ m/.swp/ ) {
|
|
if ( $file =~ m/.swp/ ) {
|
|
print "\t$file $swpWarning\n";
|
|
print "\t$file $swpWarning\n";
|
|
@@ -111,7 +122,8 @@ if ( defined $args{'view'} ) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- print "Files added to commit:\n";
|
|
|
|
|
|
+ my $commitTotal = scalar @$addedRef;
|
|
|
|
+ print "* $commitTotal file(s) added to commit:\n";
|
|
foreach my $file ( @$addedRef ) {
|
|
foreach my $file ( @$addedRef ) {
|
|
if ( $file =~ m/.swp/ ) {
|
|
if ( $file =~ m/.swp/ ) {
|
|
print "\t$file $swpWarning\n";
|
|
print "\t$file $swpWarning\n";
|
|
@@ -120,7 +132,8 @@ if ( defined $args{'view'} ) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- print "Files to be deleted from commit:\n";
|
|
|
|
|
|
+ my $deletedTotal = scalar @$deletedRef;
|
|
|
|
+ print "* $deletedTotal file(s) to be deleted from commit:\n";
|
|
foreach my $file ( @$deletedRef ) {
|
|
foreach my $file ( @$deletedRef ) {
|
|
if ( $file =~ m/.swp/ ) {
|
|
if ( $file =~ m/.swp/ ) {
|
|
print "\t$file $swpWarning\n";
|
|
print "\t$file $swpWarning\n";
|