blame: compute abbreviation width that ensures uniqueness
commitb31272f704d03258a90b0e83e0f5c8df5c038ae6
authorJunio C Hamano <gitster@pobox.com>
Mon, 2 Jul 2012 07:54:00 +0000 (2 00:54 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 Jul 2012 07:54:19 +0000 (2 00:54 -0700)
treeb8c6a25923b5bc17522c1bf821a09c63f51e5c99
parentf174a2583c9f42315b60205890fa67a79a1f1669
blame: compute abbreviation width that ensures uniqueness

Julia Lawall noticed that in linux-next repository the commit object
60d5c9f5 (shown with the default abbreviation width baked into "git
blame") in output from

  $ git blame -L 3675,3675 60d5c9f5b -- \
      drivers/staging/brcm80211/brcmfmac/wl_iw.c

is no longer unique in the repository, which results in "short SHA1
60d5c9f5 is ambiguous".

Compute the minimum abbreviation width that ensures uniqueness when
the user did not specify the --abbrev option to avoid this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/blame.c