* bug#59011: 29.0.50; change to vc-git-working-revision breaks vc-git-mode-line-string
@ 2022-11-04 6:53 Jonas Bernoulli
2022-11-04 16:34 ` Philip Kaludercic
0 siblings, 1 reply; 2+ messages in thread
From: Jonas Bernoulli @ 2022-11-04 6:53 UTC (permalink / raw)
To: 59011; +Cc: Philip Kaludercic
Since 307ad210040251ea0de2e7f453350c4497bda874 `vc-git-working-revision'
may return the name of a reference (aka symbolic commit) instead of the
full sha1 hash, as it used to always do.
When that name is shorter than seven characters, then that change breaks
`vc-git-mode-line-string', which expects to be able to extract the first
seven characters of the string returned by `vc-git-working-revision'.
(By the way, it is not correct to abbreviate a commit hash to the first
N characters using (substring hash 0 N). Even in a small repository
there is a risk that such a naive abbreviation is ambiguous. Instead of
doing that, one should use Git to perform the abbreviation; that way one
can request an abbreviation of a certain length, and Git will comply --
unless doing that would be ambiguous, in which case it returns a longer
abbreviation.)
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#59011: 29.0.50; change to vc-git-working-revision breaks vc-git-mode-line-string
2022-11-04 6:53 bug#59011: 29.0.50; change to vc-git-working-revision breaks vc-git-mode-line-string Jonas Bernoulli
@ 2022-11-04 16:34 ` Philip Kaludercic
0 siblings, 0 replies; 2+ messages in thread
From: Philip Kaludercic @ 2022-11-04 16:34 UTC (permalink / raw)
To: Jonas Bernoulli; +Cc: 59011
Jonas Bernoulli <jonas@bernoul.li> writes:
> Since 307ad210040251ea0de2e7f453350c4497bda874 `vc-git-working-revision'
> may return the name of a reference (aka symbolic commit) instead of the
> full sha1 hash, as it used to always do.
>
> When that name is shorter than seven characters, then that change breaks
> `vc-git-mode-line-string', which expects to be able to extract the first
> seven characters of the string returned by `vc-git-working-revision'.
This was already touched on in bug#58709, and I believe it is best to
revert the change for now.
The motivation for the change was to make selecting revisions for the
new `vc-prepare-patch' command, but perhaps it would be better to handle
the issue somewhere else like in vc-*-revision-table.
> (By the way, it is not correct to abbreviate a commit hash to the first
> N characters using (substring hash 0 N). Even in a small repository
> there is a risk that such a naive abbreviation is ambiguous. Instead of
> doing that, one should use Git to perform the abbreviation; that way one
> can request an abbreviation of a certain length, and Git will comply --
> unless doing that would be ambiguous, in which case it returns a longer
> abbreviation.)
If this is only done in the mode line, then I don't think there is too
much harm in doing so (it isn't fed back into git at any point), though
using a proper abbreviation would technically preferable.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-04 16:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-04 6:53 bug#59011: 29.0.50; change to vc-git-working-revision breaks vc-git-mode-line-string Jonas Bernoulli
2022-11-04 16:34 ` Philip Kaludercic
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.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).