From 8460b2fcd45668d91567c36a22ea4f1b14ba133d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Mon, 3 Sep 2007 20:07:01 +0200 Subject: archive: specfile support (--pretty=format: in archive files) Add support for a new attribute, specfile. Files marked as being specfiles are expanded by git-archive when they are written to an archive. It has no effect on worktree files. The same placeholders as those for the option --pretty=format: of git-log et al. can be used. The attribute is useful for creating auto-updating specfiles. It is limited by the underlying function format_commit_message(), though. E.g. currently there is no placeholder for git-describe like output, and expanded specfiles can't contain NUL bytes. That can be fixed in format_commit_message() later and will then benefit users of git-log, too. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 46f9d591aa..47a621b733 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -421,6 +421,20 @@ frotz unspecified ---------------------------------------------------------------- +Creating an archive +~~~~~~~~~~~~~~~~~~~ + +`specfile` +^^^^^^^^^^ + +If the attribute `specfile` is set for a file then git will expand +several placeholders when adding this file to an archive. The +expansion depends on the availability of a commit ID, i.e. if +gitlink:git-archive[1] has been given a tree instead of a commit or a +tag then no replacement will be done. The placeholders are the same +as those for the option `--pretty=format:` of gitlink:git-log[1]. + + GIT --- Part of the gitlink:git[7] suite -- cgit v1.2.1 From df4a394f91d7d107c2a57e6c1df3638517cab54f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Fri, 7 Sep 2007 00:34:06 +0200 Subject: archive: specfile syntax change: "$Format:%PLCHLDR$" instead of just "%PLCHLDR" (take 2) As suggested by Johannes, --pretty=format: placeholders in specfiles need to be wrapped in $Format:...$ now. This syntax change restricts the expansion of placeholders and makes it easier to use with files that contain non-placeholder percent signs. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 47a621b733..37b3be8b72 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -432,7 +432,10 @@ several placeholders when adding this file to an archive. The expansion depends on the availability of a commit ID, i.e. if gitlink:git-archive[1] has been given a tree instead of a commit or a tag then no replacement will be done. The placeholders are the same -as those for the option `--pretty=format:` of gitlink:git-log[1]. +as those for the option `--pretty=format:` of gitlink:git-log[1], +except that they need to be wrapped like this: `$Format:PLACEHOLDERS$` +in the file. E.g. the string `$Format:%H$` will be replaced by the +commit hash. GIT -- cgit v1.2.1 From 38c9c9b798a0df875968ae49d699298131dfa24d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Thu, 6 Sep 2007 18:51:11 +0200 Subject: archive: rename attribute specfile to export-subst As suggested by Junio and Johannes, change the name of the former attribute specfile to export-subst to indicate its function rather than purpose and to make clear that it is not applied to working tree files. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- Documentation/gitattributes.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Documentation/gitattributes.txt') diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 37b3be8b72..d0e951ee6f 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -424,10 +424,10 @@ frotz unspecified Creating an archive ~~~~~~~~~~~~~~~~~~~ -`specfile` -^^^^^^^^^^ +`export-subst` +^^^^^^^^^^^^^^ -If the attribute `specfile` is set for a file then git will expand +If the attribute `export-subst` is set for a file then git will expand several placeholders when adding this file to an archive. The expansion depends on the availability of a commit ID, i.e. if gitlink:git-archive[1] has been given a tree instead of a commit or a -- cgit v1.2.1