public interface

GitDiffBuilder

implements GitDiffCoreBuilder<B extends GitDiffCoreBuilder<B>>
com.atlassian.bitbucket.scm.git.command.diff.GitDiffBuilder

Class Overview

Extends the diff-core builder with options specific to git diff.

Summary

[Expand]
Inherited Constants
From interface com.atlassian.bitbucket.scm.git.command.GitCommandBuilderSupport
Public Methods
@Nonnull GitDiffBuilder contextLines(int value)
Sets the number of context lines which should be included in the git diff output.
@Nonnull GitDiffBuilder defaultContextLines()
Restores the default number of context lines.
@Nonnull GitDiffBuilder dstPrefix(String value)
Sets the prefix to be used by git when outputing the destination path in a diff header.
@Nonnull GitDiffBuilder srcPrefix(String value)
Sets the prefix to be used by git when outputing the source path in a diff header.
@Nonnull GitDiffBuilder whitespace(GitDiffWhitespace value)
[Expand]
Inherited Methods
From interface com.atlassian.bitbucket.scm.CommandBuilderSupport
From interface com.atlassian.bitbucket.scm.git.command.GitCommandBuilderSupport
From interface com.atlassian.bitbucket.scm.git.command.diff.GitDiffCoreBuilder

Public Methods

@Nonnull public GitDiffBuilder contextLines (int value)

Sets the number of context lines which should be included in the git diff output. By default, git uses 3 lines. The provided value must be greater than or equal to 0, since a negative number of context lines has no meaning. defaultContextLines() can be called to restore the default after using a custom value.

Parameters
value the number of context lines to include in the diff output, 0 or higher
Returns
  • this
Throws
IllegalArgumentException if the provided value is negative

@Nonnull public GitDiffBuilder defaultContextLines ()

Restores the default number of context lines.

Returns
  • this

@Nonnull public GitDiffBuilder dstPrefix (String value)

Sets the prefix to be used by git when outputing the destination path in a diff header. The default used by git is "b/".

     diff --git a/file.txt b/file.txt
     index 05feec6..898a7b8 100644
     --- a/file.txt
     +++ b/file.txt
 
Changing this value controls both the b/file.txt in the diff --git header and the +++ path after the index details.

Parameters
value the prefix to display before the destination path, may be empty or null to use the default
Returns
  • this

@Nonnull public GitDiffBuilder srcPrefix (String value)

Sets the prefix to be used by git when outputing the source path in a diff header. The default used by git is "a/".

     diff --git a/file.txt b/file.txt
     index 05feec6..898a7b8 100644
     --- a/file.txt
     +++ b/file.txt
 
Changing this value controls both the a/file.txt in the diff --git header and the --- path after the index details.

Parameters
value the prefix to display before the source path, may be empty or null to use the default
Returns
  • this

@Nonnull public GitDiffBuilder whitespace (GitDiffWhitespace value)

Parameters
value an optional flag to ignore whitespace in the diff
Returns
  • this
Throws
NullPointerException if the provided value is null