git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] describe-doc: clarify default length of abbreviation

From
Anders Höckersten via GitGitGadget <gitgitgadget@gmail.com>
Date
May 16, 2021, 07:32 UTC
Message-ID
<pull.1026.git.git.1621150366442.gitgitgadget@gmail.com>
From: =?UTF-8?q?Anders=20H=C3=B6ckersten?= <anders@hockersten.se>

Clarify the default length used for the abbreviated form used for commits in git describe.

The behavior was modified in Git 2.11.0, but the documentation was not updated to clarify the new behavior.

Signed-off-by: Anders Höckersten <anders@hockersten.se>
---
    describe-doc: clarify default length of abbreviation
    
    Clarify the default length used for the abbreviated form used for
    commits in git describe.
    
    The behavior was modified in Git 2.11.0, but the documentation was not
    updated to clarify the new behavior.
    
    Signed-off-by: Anders Höckersten anders@hockersten.se
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1026%2Fahockersten%2Fdescribe-doc-abbreviation-clarification-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1026/ahockersten/describe-doc-abbreviation-clarification-v1
Pull-Request: https://github.com/git/git/pull/1026
 Documentation/git-describe.txt | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt
index a88f6ae2c6e7..f3f41cfac496 100644
--- a/Documentation/git-describe.txt
+++ b/Documentation/git-describe.txt
@@ -63,10 +63,11 @@ OPTIONS
 	Automatically implies --tags.
 
 --abbrev=<n>::
-	Instead of using the default 7 hexadecimal digits as the
-	abbreviated object name, use <n> digits, or as many digits
-	as needed to form a unique object name.  An <n> of 0
-	will suppress long format, only showing the closest tag.
+	Instead of using the default number of hexadecimal digits (which
+	will vary according to the size of the repository with a default of 
+	7) of the abbreviated object name, use <n> digits, or as many digits
+	as needed to form a unique object name.  An <n> of 0 will suppress 
+	long format, only showing the closest tag.
 
 --candidates=<n>::
 	Instead of considering only the 10 most recent tags as
@@ -139,8 +140,11 @@ at the end.
 
 The number of additional commits is the number
 of commits which would be displayed by "git log v1.0.4..parent".
-The hash suffix is "-g" + unambiguous abbreviation for the tip commit
-of parent (which was `2414721b194453f058079d897d13c4e377f92dc6`).
+The hash suffix is "-g" + an unambigous abbreviation for the tip commit
+of parent (which was `2414721b194453f058079d897d13c4e377f92dc6`). The 
+length of the abbreviation scales as the repository grows, using the 
+approximate number of objects in the repository and a bit of math 
+around the birthday paradox, and defaults to a minimum of 7.
 The "g" prefix stands for "git" and is used to allow describing the version of
 a software depending on the SCM the software is managed with. This is useful
 in an environment where people may use different SCMs.

base-commit: 48bf2fa8bad054d66bd79c6ba903c89c704201f7
-- 
gitgitgadget
Next: Junio C Hamano
Message 1 of 11 in “describe-doc: clarify default length of abbreviation”
  1. describe-doc: clarify default length of abbreviationAnders Höckersten via GitGitGadget, May 16, 2021
  2. Junio C HamanoMay 16, 2021
  3. Bagas SanjayaMay 16, 2021
  4. Anders HöckerstenMay 16, 2021
  5. Junio C HamanoMay 16, 2021
  6. Anders HöckerstenMay 17, 2021
  7. Felipe ContrerasMay 16, 2021
  8. Robert P. J. DayMay 16, 2021
  9. Felipe ContrerasMay 16, 2021
  10. describe-doc: clarify default length of abbreviationAnders Höckersten via GitGitGadget, May 17, 2021
  11. Derrick StoleeMay 17, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.