Class AbbrevConfig

java.lang.Object
org.eclipse.jgit.lib.AbbrevConfig

public final class AbbrevConfig extends Object
Git configuration option <a href=https://git-scm.com/docs/git-config#Documentation/git-config.txt-coreabbrev"> core.abbrev
Since:
6.1
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private int
    All other possible abbreviation lengths.
    static final int
    The minimum value of abbrev
    static final AbbrevConfig
    No abbreviation
    private static final String
     
    private static final String
     
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    private static AbbrevConfig
    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.
    Parse string value of core.abbrev git option for a given repository
     

    Methods inherited from class java.lang.Object

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

    • VALUE_NO

      private static final String VALUE_NO
      See Also:
    • VALUE_AUTO

      private static final String VALUE_AUTO
      See Also:
    • MIN_ABBREV

      public static final int MIN_ABBREV
      The minimum value of abbrev
      See Also:
    • NO

      public static final AbbrevConfig NO
      No abbreviation
    • 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 Details

    • AbbrevConfig

      private AbbrevConfig(int abbrev)
      Parameters:
      abbrev -
  • Method Details

    • 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
    • parseFromConfig

      public static AbbrevConfig parseFromConfig(Repository repo) throws InvalidConfigurationException
      Parse string value of core.abbrev git option for a given repository
      Parameters:
      repo - repository
      Returns:
      the parsed AbbrevConfig
      Throws:
      InvalidConfigurationException - if value of core.abbrev is invalid
    • 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 String toString()
      Overrides:
      toString in class Object