Re: Bug with --abbrev option in git log?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mário Guimarães  <mario.luis.guimaraes@xxxxxxxxx> writes:

> In the Git repository run this command:
>
> git log --raw -r -c --abbrev=6 --pretty=oneline -n1
> a7144d4bc5ab58f306a1e5c73b27196fb999a63d

This is not one of my object, so above won't be usable as
reproduction recipe.  But that is OK.

> 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

The above command tells us that you locally have an object whose
name begins with 05ba1d3, which I do not have.  But my history
shared with the entire world has an object whose name begins with
05ba1d7, and I am reasonably sure that your repository has it, since
it is a part of 17f26a9e (git-am: fix shell quoting, 2009-01-14).

So in my repository, 05ba1d is enough to uniquely identify 05ba1d7,
but in your repository 05ba1d is not enough to uniquely identify
05ba1d3, because 05ba1d7 also exists in your repository.  And when
the object cannot be uniquely specified with the given abbreviation
width, Git makes sure its output is usable to uniquely identify the
object it wants to name.

In short, I think what you observed is totally expected.

The documentation has some room for improvement, I also think.

How about saying something like this?



 Documentation/diff-options.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git i/Documentation/diff-options.txt w/Documentation/diff-options.txt
index ee52b65e46..114e440c5b 100644
--- i/Documentation/diff-options.txt
+++ w/Documentation/diff-options.txt
@@ -446,7 +446,8 @@ endif::git-format-patch[]
 --abbrev[=<n>]::
 	Instead of showing the full 40-byte hexadecimal object
 	name in diff-raw format output and diff-tree header
-	lines, show only a partial prefix.
+	lines, show only a partial prefix that uses at least '<n>'
+	hexdigits.
 	In diff-patch output format, `--full-index` takes higher
 	precedence, i.e. if `--full-index` is specified, full blob
 	names will be shown regardless of `--abbrev`.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux