|
1 | 1 | #!/usr/bin/env perl |
2 | 2 |
|
| 3 | +# gitudiff |
| 4 | +# |
| 5 | +# This script extracts a unified-diff between two git SHAs |
| 6 | +# See |
| 7 | +# $ gitdiff --help |
| 8 | +# |
| 9 | + |
3 | 10 | use Getopt::Long; |
4 | 11 | use strict; |
5 | 12 | use Cwd /realpath/; |
@@ -41,19 +48,48 @@ my $suppress_unchanged; |
41 | 48 | my $prefix = ''; |
42 | 49 | my $ignore_whitespace; |
43 | 50 | my $repo = '.'; # cwd |
| 51 | +my $help; |
44 | 52 |
|
45 | 53 | if (!GetOptions("exclude=s" => \@exclude_patterns, |
46 | 54 | "include=s" => \@include_patterns, |
47 | 55 | 'no-unchanged' => \$suppress_unchanged, |
48 | 56 | 'prefix=s' => \$prefix, |
49 | 57 | 'b|blank' => \$ignore_whitespace, |
50 | 58 | 'repo=s' => \$repo, |
51 | | - 'verbose+' => \$verbose) || |
| 59 | + 'verbose+' => \$verbose, |
| 60 | + 'help' => \$help) || |
| 61 | + $help || |
52 | 62 | (2 != scalar(@ARGV) && |
53 | 63 | 3 != scalar(@ARGV)) |
54 | 64 | ) { |
55 | | - print(STDERR |
56 | | - "usage: [(--exclude|include) regexp[,regexp]] [--repo repo] [-b] [dir] base_changelist current_changelist\n'exclude' wins if both exclude and include would match.\n" |
| 65 | + print(STDERR<<EOF |
| 66 | +Usage: |
| 67 | + $0 \\ |
| 68 | + [(--exclude|include) regexp[,regexp]] [--repo repo_directory] \\ |
| 69 | + [-b] [dir] base_SHA current_SHA |
| 70 | +
|
| 71 | + --repo repo_directory: |
| 72 | + your git repo directory. Default is '.'. |
| 73 | + --prefix: |
| 74 | + leading path to strip from file pathnames in the diff report |
| 75 | + --no-unchanged: |
| 76 | + In order to eliminate potential ambiguities caused by multiple |
| 77 | + source files with the same basename, by default, we include |
| 78 | + unchanged file references in the diff report. |
| 79 | + This option removes those entries. |
| 80 | + -b|--blank: |
| 81 | + ignore whitespace changes. |
| 82 | + --include regexp: |
| 83 | + regexp compared to the Perforce path (i.e., starting in |
| 84 | + //p4_repo/...). If 'include' regexps are specified, then only |
| 85 | + Matching references are included in the report; if no |
| 86 | + 'include' regexps are specified, then entries are included unless |
| 87 | + they have been excluded. |
| 88 | + --exclude regexp: |
| 89 | + regexp compared to the Perforce path (i.e., starting in |
| 90 | + //p4_repo/...). Matching entries are removed from the report. |
| 91 | + 'exclude' wins if both exclude and include would match. |
| 92 | +EOF |
57 | 93 | ); |
58 | 94 | exit(1); |
59 | 95 | } |
|
0 commit comments