|
@@ -8,7 +8,7 @@ use Log::Log4perl qw(:easy);
|
|
|
# TODO: This needs to be scoped properly
|
|
|
use lib "/usr/local/lib";
|
|
|
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 stashAndReset);
|
|
|
|
|
|
if ( ! -d ".git" ) {
|
|
|
print "Not a git dir, exiting...\n";
|
|
@@ -60,6 +60,7 @@ GetOptions(
|
|
|
'view',
|
|
|
'reset-from-master',
|
|
|
'branch-from-master',
|
|
|
+ 'commit-msg=s',
|
|
|
);
|
|
|
|
|
|
sub printHelp {
|
|
@@ -70,8 +71,10 @@ Usage:
|
|
|
--view
|
|
|
Display git status of files and other information
|
|
|
|
|
|
- --push-all
|
|
|
- Push all untracked and modified files (can be used with interactive mode)
|
|
|
+ --push-all [--commit-msg]
|
|
|
+ Push all untracked and modified files
|
|
|
+ * (can be used with interactive mode)
|
|
|
+ * can provide a commit msg with --commit-msg (otherwise a generic will be provided)
|
|
|
|
|
|
--interactive
|
|
|
Enable interactive mode with supported opts
|
|
@@ -183,11 +186,14 @@ if ( defined $args{'push-all'} ) {
|
|
|
|
|
|
addFiles(\@filesToCommit,$logger);
|
|
|
|
|
|
- if ( defined $args{'interactive'} ) {
|
|
|
+ if ( defined $args{'interactive'} && ! defined $args{'commit-msg'}) {
|
|
|
print "Enter a commit message: ";
|
|
|
my $input = <STDIN>;
|
|
|
chomp $input;
|
|
|
commitChanges($input,$logger);
|
|
|
+ } elsif ( defined $args{'commit-msg'} ) {
|
|
|
+ my $commitMsg = "$args{'commit-msg'}";
|
|
|
+ commitChanges($commitMsg,$logger);
|
|
|
} else {
|
|
|
my $epoch = time();
|
|
|
my $commitMsg = "Generic Commit at $epoch";
|
|
@@ -217,3 +223,9 @@ if ( defined $args{'push-all'} ) {
|
|
|
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+if ( defined $args{'reset-from-master'} ) {
|
|
|
+
|
|
|
+ stashAndReset($logger);
|
|
|
+
|
|
|
+}
|