Re: Bug in git archive + .gitattributes + relative path
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 6, 2023, 17:27 UTC
- Message-ID
- <xmqqcz5lbxiq.fsf@gitster.g>
- In-Reply-To
- <70f10864-2cc7-cb9e-f868-2ac0011cad58@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 24 quoted lines
> Subject: [PATCH] archive: add --strip-components > > Allow removing leading elements from paths of archive entries. That's > useful when archiving sub-directories and not wanting to keep the > common path prefix, e.g.: > > $ git archive --strip-components=1 HEAD sha1dc | tar tf - > .gitattributes > LICENSE.txt > sha1.c > sha1.h > ubc_check.c > ubc_check.h > > The same can be achieved by specifying a tree instead of a commit and > a pathspec: > > $ git archive HEAD:sha1dc | tar tf - > .gitattributes > LICENSE.txt > sha1.c > sha1.h > ubc_check.c > ubc_check.h
Another way I am not sure is working as designed is
$ cd sha1dc && git archive HEAD . | tar tf -
.gitattributes
LICENSE.txt
sha1.c
sha1.h
ubc_check.c
ubc_check.hI didn't check if the attribute look-up is done on the correct path or export-subst kicks in in such a use, though.