Class DiffCommand

    • Constructor Detail

      • DiffCommand

        protected DiffCommand​(Repository repo)
        Parameters:
        repo -
    • Method Detail

      • call

        public java.util.List<DiffEntry> call()
                                       throws GitAPIException
        Executes the Diff command with all the options and parameters collected by the setter methods (e.g. setCached(boolean) of this class. Each instance of this class should only be used for one invocation of the command. Don't call this method twice on an instance.
        Specified by:
        call in interface java.util.concurrent.Callable<java.util.List<DiffEntry>>
        Specified by:
        call in class GitCommand<java.util.List<DiffEntry>>
        Returns:
        a DiffEntry for each path which is different
        Throws:
        GitAPIException - or subclass thereof when an error occurs
      • setCached

        public DiffCommand setCached​(boolean cached)
        Parameters:
        cached - whether to view the changes you staged for the next commit
        Returns:
        this instance
      • setPathFilter

        public DiffCommand setPathFilter​(TreeFilter pathFilter)
        Parameters:
        pathFilter - parameter, used to limit the diff to the named path
        Returns:
        this instance
      • setShowNameAndStatusOnly

        public DiffCommand setShowNameAndStatusOnly​(boolean showNameAndStatusOnly)
        Parameters:
        showNameAndStatusOnly - whether to return only names and status of changed files
        Returns:
        this instance
      • setOutputStream

        public DiffCommand setOutputStream​(java.io.OutputStream out)
        Parameters:
        out - the stream to write line data
        Returns:
        this instance
      • setContextLines

        public DiffCommand setContextLines​(int contextLines)
        Set number of context lines instead of the usual three.
        Parameters:
        contextLines - the number of context lines
        Returns:
        this instance
      • setSourcePrefix

        public DiffCommand setSourcePrefix​(java.lang.String sourcePrefix)
        Set the given source prefix instead of "a/".
        Parameters:
        sourcePrefix - the prefix
        Returns:
        this instance
      • setDestinationPrefix

        public DiffCommand setDestinationPrefix​(java.lang.String destinationPrefix)
        Set the given destination prefix instead of "b/".
        Parameters:
        destinationPrefix - the prefix
        Returns:
        this instance
      • setProgressMonitor

        public DiffCommand setProgressMonitor​(ProgressMonitor monitor)
        The progress monitor associated with the diff operation. By default, this is set to NullProgressMonitor
        Parameters:
        monitor - a progress monitor
        Returns:
        this instance
        See Also:
        NullProgressMonitor