07d892d0abd42356efcf99d8c98042563b31cb34
commit 07d892d0abd42356efcf99d8c98042563b31cb34
Author: Simon Waton <spw01@protonmail.com>
Date: Tue May 14 21:59:06 2019 -0400

Generic Commit at 1557885546

diff --git a/.sg/sgLog.txt b/.sg/sgLog.txt
index d3def5e..dc19107 100644
--- a/.sg/sgLog.txt
+++ b/.sg/sgLog.txt
@@ -1,27 +1,31 @@
-2019/05/14 21:42:01 INFO Running: which git 2>&1
-2019/05/14 21:42:01 INFO Returned: 0
-2019/05/14 21:42:01 INFO Running: which git 2>&1
-2019/05/14 21:42:01 INFO Returned: 0
-2019/05/14 21:42:01 INFO Running: /usr/bin/git status -uall --porcelain 2>&1
-2019/05/14 21:42:01 INFO Returned: 0
-2019/05/14 21:42:06 INFO Running: which git 2>&1
-2019/05/14 21:42:06 INFO Returned: 0
-2019/05/14 21:42:06 INFO Running: which git 2>&1
-2019/05/14 21:42:06 INFO Returned: 0
-2019/05/14 21:42:06 INFO Running: /usr/bin/git status -uall --porcelain 2>&1
-2019/05/14 21:42:06 INFO Returned: 0
-2019/05/14 21:42:53 INFO Running: which git 2>&1
-2019/05/14 21:42:53 INFO Returned: 0
-2019/05/14 21:42:53 INFO Running: which git 2>&1
-2019/05/14 21:42:53 INFO Returned: 0
-2019/05/14 21:42:53 INFO Running: /usr/bin/git status -uall --porcelain 2>&1
-2019/05/14 21:42:53 INFO Returned: 0
-2019/05/14 21:44:37 INFO Running: which git 2>&1
-2019/05/14 21:44:37 INFO Returned: 0
-2019/05/14 21:44:37 INFO Running: which git 2>&1
-2019/05/14 21:44:37 INFO Returned: 0
-2019/05/14 21:44:37 INFO Running: /usr/bin/git status -uall --porcelain 2>&1
-2019/05/14 21:44:37 INFO Returned: 0
-2019/05/14 21:44:54 INFO Running: which git 2>&1
-2019/05/14 21:44:54 INFO Returned: 0
-2019/05/14 21:44:54 INFO Running: /usr/bin/git add .sg/sgLog.txt 2>&1
+2019/05/14 21:55:46 INFO Running: which git 2>&1
+2019/05/14 21:55:46 INFO Returned: 0
+2019/05/14 21:55:46 INFO Running: which git 2>&1
+2019/05/14 21:55:46 INFO Returned: 0
+2019/05/14 21:55:46 INFO Running: which git 2>&1
+2019/05/14 21:55:46 INFO Returned: 0
+2019/05/14 21:55:46 INFO Running: /usr/bin/git status -uall --porcelain 2>&1
+2019/05/14 21:55:46 INFO Returned: 0
+2019/05/14 21:55:46 INFO Running: /usr/bin/git show-ref 2>&1
+2019/05/14 21:55:46 INFO Returned: 0
+2019/05/14 21:58:53 INFO Running: which git 2>&1
+2019/05/14 21:58:53 INFO Returned: 0
+2019/05/14 21:58:53 INFO Running: which git 2>&1
+2019/05/14 21:58:53 INFO Returned: 0
+2019/05/14 21:58:53 INFO Running: which git 2>&1
+2019/05/14 21:58:53 INFO Returned: 0
+2019/05/14 21:58:53 INFO Running: /usr/bin/git status -uall --porcelain 2>&1
+2019/05/14 21:58:53 INFO Returned: 0
+2019/05/14 21:58:53 INFO Running: /usr/bin/git show-ref 2>&1
+2019/05/14 21:58:53 INFO Returned: 0
+2019/05/14 21:59:06 INFO Running: which git 2>&1
+2019/05/14 21:59:06 INFO Returned: 0
+2019/05/14 21:59:06 INFO Running: which git 2>&1
+2019/05/14 21:59:06 INFO Returned: 0
+2019/05/14 21:59:06 INFO Running: which git 2>&1
+2019/05/14 21:59:06 INFO Returned: 0
+2019/05/14 21:59:06 INFO Running: /usr/bin/git status -uall --porcelain 2>&1
+2019/05/14 21:59:06 INFO Returned: 0
+2019/05/14 21:59:06 INFO Running: which git 2>&1
+2019/05/14 21:59:06 INFO Returned: 0
+2019/05/14 21:59:06 INFO Running: /usr/bin/git add .sg/sgLog.txt 2>&1
diff --git a/lib/SimplyGit/Git.pm b/lib/SimplyGit/Git.pm
index 26bb668..6550c9e 100644
--- a/lib/SimplyGit/Git.pm
+++ b/lib/SimplyGit/Git.pm
@@ -57,6 +57,7 @@ sub returnState {
my @untracked;
my @modified;
my @added;
+ my @deleted;
foreach my $file ( @statusLines ) {
$file =~ m/^\ {0,1}([A-Z?]{1,2})\ {1,2}(.*)/;
my $fileAttrs = $1;
@@ -76,10 +77,14 @@ sub returnState {
push(@added, $filename) unless grep $_ eq $filename, @added;
}

+ if ( $attr =~ m/[D]/ ) {
+ push(@deleted, $filename) unless grep $_ eq $filename, @deleted;
+ }
+
}
}

- return ( \@untracked, \@modified, \@added );
+ return ( \@untracked, \@modified, \@added, \@deleted );

}

diff --git a/sg b/sg
index ff376c9..8d5d326 100755
--- a/sg
+++ b/sg
@@ -45,6 +45,7 @@ my $log_conf = q(

Log::Log4perl::init(\$log_conf);
my $logger = get_logger();
+my $gitCmd = findBin("git",$logger);

my %args;
GetOptions(
@@ -87,8 +88,11 @@ if ( scalar keys %args < 1 ) {
}


+# This functionality is mainly here to test building out Git.pm, and doesn't really offer anything that regular git doesn't
if ( defined $args{'view'} ) {
- my ( $untrackedRef, $modifiedRef, $addedRef ) = returnState($logger);
+ my ( $untrackedRef, $modifiedRef, $addedRef, $deletedRef ) = returnState($logger);
+ my $refs = shellex("$gitCmd show-ref",$logger);
+ print "$refs\n";
my $swpWarning = "\t# Likely a Vi .swp file";
print "Untracked files:\n";
foreach my $file ( @$untrackedRef ) {
@@ -116,8 +120,17 @@ if ( defined $args{'view'} ) {
}
}

+ print "Files to be deleted from commit:\n";
+ foreach my $file ( @$deletedRef ) {
+ if ( $file =~ m/.swp/ ) {
+ print "\t$file $swpWarning\n";
+ } else {
+ print "\t$file\n";
+ }
+ }
}

+# This functionality is mainly here to test building out Git.pm, and doesn't really offer anything that regular git doesn't
if ( defined $args{'push-all'} ) {

my ( $untrackedRef, $modifiedRef ) = returnState($logger);