* General questions - git archive a .j2 file with keyword expansion in the header section
@ 2021-08-19 21:28 Lin, Nathan (GSE)
2021-08-19 22:28 ` Jeff King
0 siblings, 1 reply; 2+ messages in thread
From: Lin, Nathan (GSE) @ 2021-08-19 21:28 UTC (permalink / raw)
To: git@vger.kernel.org
Hello Devs,
Got a question on using git keyword expansion on a .j2 template file. Keyword expansion does not seem to work with .j2 file. Please see below a snippet of my attempt to archive test.cfg.j2 containing git keyword expansions in the header. It works if I changes the .j2 file extension to something else, say .yaml. I have not been able to find any information about issue. Can you please review and advise? Thank you.
[root@da ~]# cat Ansible_Playbooks/Day0/roles/hpe-bm-kickstart/templates/test.cfg.j2
##############################################################################
# Author : $Format: %an <%ae>$
# Commit : $Format: %h$
# Date : $Format: %cs$
#
##############################################################################
[root@da ~]# git archive --format=tgz HEAD --output=test.tar.gz Ansible_Playbooks/Day0/roles/hpe-bm-kickstart/templates/test.cfg.j2
[root@da ~]# tar -xf test.tar.gz --directory test
[root@da ~]# cat test
test/ test.tar.gz
[root@da ~]# cat test
test/ test.tar.gz
[root@da ~]# cat test/Ansible_Playbooks/Day0/roles/hpe-bm-kickstart/templates/test.cfg.j2
##############################################################################
# Author : $Format: %an <%ae>$
# Commit : $Format: %h$
# Date : $Format: %cs$
#
##############################################################################
[root@da ~]#
Regards,
Nathan Lin
Solutions Engineer
Global Sales Engineering (GSE)
https://hpe.com/info/askgse (Internal site)
+1 (281) 204-4077 Office
Houston, TX
hpe.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: General questions - git archive a .j2 file with keyword expansion in the header section
2021-08-19 21:28 General questions - git archive a .j2 file with keyword expansion in the header section Lin, Nathan (GSE)
@ 2021-08-19 22:28 ` Jeff King
0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2021-08-19 22:28 UTC (permalink / raw)
To: Lin, Nathan (GSE); +Cc: git@vger.kernel.org
On Thu, Aug 19, 2021 at 09:28:11PM +0000, Lin, Nathan (GSE) wrote:
> Got a question on using git keyword expansion on a .j2 template file.
> Keyword expansion does not seem to work with .j2 file. Please see
> below a snippet of my attempt to archive test.cfg.j2 containing git
> keyword expansions in the header. It works if I changes the .j2 file
> extension to something else, say .yaml. I have not been able to find
> any information about issue. Can you please review and advise? Thank
> you.
Do you have .gitattributes entries that tell Git it should apply the
"export-subst" attribute to any files? If so, does it cover .yaml files,
but not .j2?
-Peff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-19 22:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 21:28 General questions - git archive a .j2 file with keyword expansion in the header section Lin, Nathan (GSE)
2021-08-19 22:28 ` Jeff King
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.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).