Skip to content

Commit

Permalink
stop process when no rx .git-local/ exists
Browse files Browse the repository at this point in the history
  • Loading branch information
François Gannaz committed Apr 29, 2014
1 parent 77c4d90 commit 27f683e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions git-local
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,18 @@ for ($ARGV[0]) {
when ('status') {
shift @ARGV;
GetOptions($cmd_opts, "verbose|v");
require_local_repo();
local_status($cmd_opts, @ARGV);
}
when ('add') {
shift @ARGV;
$cmd_opts = { gitignore => 1 };
GetOptions($cmd_opts, "gitignore!");
require_local_repo();
local_add($cmd_opts, @ARGV);
}
default {
require_local_repo();
local_git(@ARGV);
}
}
Expand Down Expand Up @@ -102,6 +105,13 @@ BEGIN {
or die("Could not append to file!");
}

sub require_local_repo {
die(
"A git-local repository could not be found or read in\n $localdir\n"
. "Consider using\n git local init\n"
) unless -d -r -x $localdir;
}

sub local_status {
my $o = shift;
my @files = grep { /^[^-]/ } @_; # TODO: better parsing (notably for "--")
Expand Down

0 comments on commit 27f683e

Please sign in to comment.