Skip to content

Commit fe77bb1

Browse files
matthiaskJunio C Hamano
authored andcommitted
annotate: display usage information if no filename was given
Signed-off-by: Matthias Kestenholz <[email protected]>
1 parent d0ad165 commit fe77bb1

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

git-annotate.perl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
use strict;
1111
use Getopt::Long;
1212
use POSIX qw(strftime gmtime);
13+
use File::Basename qw(basename dirname);
1314

1415
sub usage() {
15-
print STDERR 'Usage: ${\basename $0} [-s] [-S revs-file] file [ revision ]
16+
print STDERR "Usage: ${\basename $0} [-s] [-S revs-file] file [ revision ]
1617
-l, --long
1718
Show long rev (Defaults off)
1819
-t, --time
@@ -23,7 +24,7 @@ ()
2324
Use revs from revs-file instead of calling git-rev-list
2425
-h, --help
2526
This message.
26-
';
27+
";
2728

2829
exit(1);
2930
}
@@ -35,7 +36,7 @@ ()
3536
"help|h" => \$help,
3637
"rename|r" => \$rename,
3738
"rev-file|S=s" => \$rev_file);
38-
if (!$rc or $help) {
39+
if (!$rc or $help or !@ARGV) {
3940
usage();
4041
}
4142

0 commit comments

Comments
 (0)