Class AbbrevConfig


  • public final class AbbrevConfig
    extends java.lang.Object
    Git configuration option core.abbrev
    Since:
    6.1
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int abbrev
      All other possible abbreviation lengths.
      static int MIN_ABBREV
      The minimum value of abbrev
      static AbbrevConfig NO
      No abbreviation
      private static java.lang.String VALUE_AUTO  
      private static java.lang.String VALUE_NO  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private AbbrevConfig​(int abbrev)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static AbbrevConfig auto​(Repository repo)
      An appropriate value is computed based on the approximate number of packed objects in a repository, which hopefully is enough for abbreviated object names to stay unique for some time.
      static int capAbbrev​(int len)
      Cap configured core.abbrev to range between minimum of 4 and number of hex-digits of a full object id.
      int get()
      Get the configured abbreviation length for object ids.
      static AbbrevConfig parseFromConfig​(Repository repo)
      Parse string value of core.abbrev git option for a given repository
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • MIN_ABBREV

        public static final int MIN_ABBREV
        The minimum value of abbrev
        See Also:
        Constant Field Values
      • abbrev

        private int abbrev
        All other possible abbreviation lengths. Valid range 4 to number of hex-digits of an unabbreviated object id (40 for SHA1 object ids, jgit doesn't support SHA256 yet).
    • Constructor Detail

      • AbbrevConfig

        private AbbrevConfig​(int abbrev)
        Parameters:
        abbrev -
    • Method Detail

      • capAbbrev

        public static int capAbbrev​(int len)
        Cap configured core.abbrev to range between minimum of 4 and number of hex-digits of a full object id.
        Parameters:
        len - configured number of hex-digits to abbreviate object ids to
        Returns:
        core.abbrev capped to range between minimum of 4 and number of hex-digits of a full object id
      • auto

        private static AbbrevConfig auto​(Repository repo)
        An appropriate value is computed based on the approximate number of packed objects in a repository, which hopefully is enough for abbreviated object names to stay unique for some time.
        Parameters:
        repo -
        Returns:
        appropriate value computed based on the approximate number of packed objects in a repository
      • get

        public int get()
        Get the configured abbreviation length for object ids.
        Returns:
        the configured abbreviation length for object ids
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object