git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* Bug with --abbrev option in git log?
@ 2020-11-04  0:55 Mário Guimarães
  2020-11-04  1:12 ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Mário Guimarães @ 2020-11-04  0:55 UTC (permalink / raw)
  To: git

Hello Git community,

please see next what I believe to be a bug with the  --abbrev option in git log.
If this is not a bug, can someone explain why Git is giving this output?

Thanks
Mário Guimarães

======================================================
Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)

In the Git repository run this command:

git log --raw -r -c --abbrev=6 --pretty=oneline -n1
a7144d4bc5ab58f306a1e5c73b27196fb999a63d

What did you expect to happen? (Expected behavior)

I was expecting to get this line in the output

::100644 100644 100644 639a41 111378 05ba1d MM Documentation/git-rebase.txt

What happened instead? (Actual behavior)

I got the following line instead

::100644 100644 100644 639a41 111378 05ba1d3 MM Documentation/git-rebase.txt

What's different between what you expected and what actually happened?

Since `--abbrev` is set to 6 the expected hash is `05ba1d` not `05ba1d3`.

Anything else you want to add:

If --abbrev is set to N then the size of all hashes should be the
first N hex digits.

The problem with `--abbrev` is more evident with values below 7. Try with 1, 2,
3, 4, and 5, to see for yourself.

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.29.2
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Darwin 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52
PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64
compiler info: clang: 12.0.0 (clang-1200.0.32.21)
libc info: no libc information available
$SHELL (typically, interactive shell): /bin/bash


[Enabled Hooks]
======================================================

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-11-07 15:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-04  0:55 Bug with --abbrev option in git log? Mário Guimarães
2020-11-04  1:12 ` Junio C Hamano
2020-11-04  1:44   ` [PATCH] doc: clarify that most --abbrev[=<n>] are about minimum length Junio C Hamano
2020-11-04 13:24     ` Derrick Stolee
2020-11-04 22:01       ` [PATCH v2] doc: clarify that --abbrev=<n> is about the " Junio C Hamano
2020-11-07 15:09         ` Derrick Stolee
2020-11-04  2:11   ` Bug with --abbrev option in git log? Mário Guimarães

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).