Skip to content

Commit

Permalink
Add '--fakeexitcode' option.
Browse files Browse the repository at this point in the history
  • Loading branch information
daveewart committed Jan 3, 2013
1 parent a3eca95 commit a79dc09
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ function cvsdiff () { cvs diff $@ | colordiff |less -R; }

Note that the function name, cvsdiff, can be customized.

By default colordiff returns the exit code of the underlying diff invocation
(if there is one), but there are some circumstances where it is useful to force
colordiff's exit code to be zero: to do this use the option '--fakeexitcode':

colordiff --fakeexitcode ...

Files

/etc/colordiffrc
Expand Down
10 changes: 8 additions & 2 deletions colordiff.pl
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,12 @@ sub detect_diff_type {

my $enable_verifymode;
my $specified_difftype;
my $enable_fakeexitcode;
GetOptions(
# --enable-verifymode option is for testing behaviour of colordiff
# against standard test diffs
"verifymode" => \$enable_verifymode,
"fakeexitcode" => \$enable_fakeexitcode,
"difftype=s" => \$specified_difftype
# TODO - check that specified type is valid, issue warning if not
);
Expand Down Expand Up @@ -490,5 +492,9 @@ sub detect_diff_type {
s/$/$colour{off}/;
print "$_";
}

exit $exitcode;
if (defined $enable_fakeexitcode) {
exit 0;
}
else {
exit $exitcode;
}
11 changes: 11 additions & 0 deletions colordiff.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,17 @@ function cvsdiff () { cvs diff $@ | colordiff |less -R; }

<para>Note that the function name, cvsdiff, can be customized.</para>

<para>By default colordiff returns the exit code of the underlying diff
invocation (if there is one), but there are some circumstances where it is
useful to force colordiff's exit code to be zero: to do this use the option
'--fakeexitcode':

<screen>
colordiff --fakeexitcode ...
</screen>

</para>

</refsect1>

<refsect1 id='files'><title>Files</title>
Expand Down

0 comments on commit a79dc09

Please sign in to comment.