Subject: Re: bug#8159: file-name-sans-version fails for some git files

From: Eli Zaretskii <[email-masked]>
Date: Thu, 03 Mar 2011 05:58:06 +0200

> Date: Wed, 2 Mar 2011 22:31:12 +0000
> From: Reuben Thomas <[email-masked]>
> Cc: 
> 
> filenames like foo.js.~HEAD~1~ aren't handled properly because of the
> internal tilde.

What would be the "proper" handling of such a file name?  What is the
"version" here?

> This is easily fixable by adding tilde to the character class matched
> against (in emacs-23 it's in the source of file-name-sans-version; in
> the trunk it's in the more accessible file-name-version-regexp).
> 
> It seems to me that git is commonly-enough used that this is probably
> worth fixing in the source rather than leaving to users who notice the
> problem (especially in emacs-23, where it means redefining
> file-name-sans-version).

file-name-sans-versions is used by Emacs to produce backup file
names.  The file name you mention is not in the format of backup file
names that Emacs uses.  Extending file-name-sans-versions in the way
you suggest is not enough; we need also extend the format of backup
file names to support this.  Otherwise, removing the "version", then
adding another one will not produce a file name in this format.