Class CombinedFileHeader


  • public class CombinedFileHeader
    extends FileHeader
    A file in the Git "diff --cc" or "diff --combined" format.

    A combined diff shows an n-way comparison between two or more ancestors and the final revision. Its primary function is to perform code reviews on a merge which introduces changes not in any ancestor.

    • Constructor Detail

      • CombinedFileHeader

        CombinedFileHeader​(byte[] b,
                           int offset)
    • Method Detail

      • getHunks

        public java.util.List<? extends CombinedHunkHeader> getHunks()
        Get hunks altering this file; in order of appearance in patch
        Overrides:
        getHunks in class FileHeader
        Returns:
        hunks altering this file; in order of appearance in patch.
      • getParentCount

        public int getParentCount()

        Overrides:
        getParentCount in class FileHeader
        Returns:
        number of ancestor revisions mentioned in this diff.
      • getOldMode

        public FileMode getOldMode()
        Get the old file mode

        Overrides:
        getOldMode in class DiffEntry
        Returns:
        get the file mode of the first parent.
      • getOldMode

        public FileMode getOldMode​(int nthParent)
        Get the file mode of the nth ancestor
        Parameters:
        nthParent - the ancestor to get the mode of
        Returns:
        the mode of the requested ancestor.
      • getOldId

        public AbbreviatedObjectId getOldId​(int nthParent)
        Get the ObjectId of the nth ancestor
        Parameters:
        nthParent - the ancestor to get the object id of
        Returns:
        the id of the requested ancestor.
      • getScriptText

        public java.lang.String getScriptText​(java.nio.charset.Charset ocs,
                                              java.nio.charset.Charset ncs)
        Convert the patch script for this file into a string.
        Overrides:
        getScriptText in class FileHeader
        Parameters:
        ocs - hint character set to decode the old lines with.
        ncs - hint character set to decode the new lines with.
        Returns:
        the patch script, as a Unicode string.
      • getScriptText

        public java.lang.String getScriptText​(java.nio.charset.Charset[] charsetGuess)

        Convert the patch script for this file into a string.

        Overrides:
        getScriptText in class FileHeader
      • parseModeLine

        private void parseModeLine​(int ptr,
                                   int eol)
      • parseDeletedFileMode

        private void parseDeletedFileMode​(int ptr,
                                          int eol)