Permalink
Browse files

[13] Move repository check to its own function

Signed-off-by: DoesntMatter <jaed1@gmx.net>
  • Loading branch information...
DoesntMatter committed Jan 22, 2012
1 parent ca0d0f6 commit 459db2b582f9a929522d7c8106aa35fc9b6190eb
Showing with 17 additions and 8 deletions.
  1. +17 −8 gitlog_to_rss.pl
View
@@ -47,14 +47,9 @@
}
if ($options{'repo'} and $options{'repo'} ne '') {
unless (-d $options{'repo'}) {
print "Repository does not exist in given path!\n";
exit;
}
unless (-d ($options{'repo'} . "/.git")) {
print "Given directory is not a Git repository!\n";
exit;
}
unless (CheckRepo($options{'repo'})) {
ShowHelp();
}
}
else {
ShowHelp();
@@ -96,6 +91,20 @@ sub ShowHelp {
exit;
};
sub CheckRepo {
my $repo = shift || return undef;
unless (-d $repo) {
print "Repository does not exist in given path!\n";
return undef;
}
unless (-d ($repo . "/.git")) {
print "Given directory is not a Git repository!\n";
return undef;
}
return 1;
}
sub ParseGitLog {
my $repo = shift || return undef;
my $cmd = "git log --pretty=tformat:%H%n%cd%n%cn%n%ce%n%s%n%b%m $repo";

0 comments on commit 459db2b

Please sign in to comment.