Re: Git archive and trailing "/" in prefix
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:47:29
On Thu, 8 Oct 2009, Sergio Callegari wrote:
The git-archive man page indicates that if the --prefix option is passed to git-archive, it is compulsory to end the prefix with a "/"
Yeah, that part is intentional. And:
As a matter of fact, the archiver behaves quite strangely if that slash is missing. Files in the root of the working dir are added to the archive with their own name modified by the prefix and the same happens for working dir sub-directories.
So far so good. But
However, no file present in the sub-directories, nor sub-sub-directories are added.
Ok, that is a bug. It's supposed to just add the prefix to everything, and it sounds like it's simply broken. I wonder how long it's been broken? Perhaps forever.
I would like to know if there some reason why a trailing "/" is not added automatically to the prefix when it is missing and the prefix is not empty. Would that break anything?
It really was meant to be useful to prefix things without forcing a directory structure. IOW, being able to use "--prefix=compat-" and just have everything unpack with their own names, but with the prefix. Whether anybody uses that, and whether it's worth it, I can't say. Linus