git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: "Mário Guimarães" <mario.luis.guimaraes@gmail.com>
To: git@vger.kernel.org
Subject: Bug with --abbrev option in git log?
Date: Wed, 4 Nov 2020 00:55:36 +0000	[thread overview]
Message-ID: <CAF7CYk51BC0KcsBb0KjKWAj17AMU2c9Y6Y81ddwX6oOAFYhT8w@mail.gmail.com> (raw)

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]
======================================================

             reply	other threads:[~2020-11-04  0:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04  0:55 Mário Guimarães [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAF7CYk51BC0KcsBb0KjKWAj17AMU2c9Y6Y81ddwX6oOAFYhT8w@mail.gmail.com \
    --to=mario.luis.guimaraes@gmail.com \
    --cc=git@vger.kernel.org \
    --subject='Re: Bug with --abbrev option in git log?' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).