@matheusbsbs / matheus-bagliano / commits / 38c9c9b798
Fork 0

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 <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Sep 6, 2007 at 18:51 UTC 38c9c9b798a0df875968ae49d699298131dfa24d
3 files changed +19 -19
Documentation/gitattributes.txt
+3 -3
@@ -424,10 +424,10 @@ frotz unspecified
424 Creating an archive
425 ~~~~~~~~~~~~~~~~~~~
426
427 -`specfile`
428 -^^^^^^^^^^
427 +`export-subst`
428 +^^^^^^^^^^^^^^
429
430 -If the attribute `specfile` is set for a file then git will expand
430 +If the attribute `export-subst` is set for a file then git will expand
431 several placeholders when adding this file to an archive. The
432 expansion depends on the availability of a commit ID, i.e. if
433 gitlink:git-archive[1] has been given a tree instead of a commit or a
builtin-archive.c
+7 -7
@@ -81,8 +81,8 @@ static int run_remote_archiver(const char *remote, int argc,
81 return !!rv;
82 }
83
84 -static void *format_specfile(const struct commit *commit, const char *format,
85 - unsigned long *sizep)
84 +static void *format_subst(const struct commit *commit, const char *format,
85 + unsigned long *sizep)
86 {
87 unsigned long len = *sizep, result_len = 0;
88 const char *a = format;
@@ -131,22 +131,22 @@ static void *convert_to_archive(const char *path,
131 const void *src, unsigned long *sizep,
132 const struct commit *commit)
133 {
134 - static struct git_attr *attr_specfile;
134 + static struct git_attr *attr_export_subst;
135 struct git_attr_check check[1];
136
137 if (!commit)
138 return NULL;
139
140 - if (!attr_specfile)
141 - attr_specfile = git_attr("specfile", 8);
140 + if (!attr_export_subst)
141 + attr_export_subst = git_attr("export-subst", 12);
142
143 - check[0].attr = attr_specfile;
143 + check[0].attr = attr_export_subst;
144 if (git_checkattr(path, ARRAY_SIZE(check), check))
145 return NULL;
146 if (!ATTR_TRUE(check[0].value))
147 return NULL;
148
149 - return format_specfile(commit, src, sizep);
149 + return format_subst(commit, src, sizep);
150 }
151
152 void *sha1_file_to_archive(const char *path, const unsigned char *sha1,
t/t5000-tar-tree.sh
+9 -9
@@ -28,7 +28,7 @@ commit id embedding:
28 TAR=${TAR:-tar}
29 UNZIP=${UNZIP:-unzip}
30
31 -SPECFILEFORMAT=%H%n
31 +SUBSTFORMAT=%H%n
32
33 test_expect_success \
34 'populate workdir' \
@@ -36,7 +36,7 @@ test_expect_success \
36 echo simple textfile >a/a &&
37 mkdir a/bin &&
38 cp /bin/sh a/bin &&
39 - printf "A\$Format:%s\$O" "$SPECFILEFORMAT" >a/specfile &&
39 + printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile &&
40 ln -s a a/l1 &&
41 (p=long_path_to_a_file && cd a &&
42 for depth in 1 2 3 4 5; do mkdir $p && cd $p; done &&
@@ -108,20 +108,20 @@ test_expect_success \
108 'diff -r a c/prefix/a'
109
110 test_expect_success \
111 - 'create an archive with a specfile' \
112 - 'echo specfile specfile >a/.gitattributes &&
111 + 'create an archive with a substfile' \
112 + 'echo substfile export-subst >a/.gitattributes &&
113 git archive HEAD >f.tar &&
114 rm a/.gitattributes'
115
116 test_expect_success \
117 - 'extract specfile' \
117 + 'extract substfile' \
118 '(mkdir f && cd f && $TAR xf -) <f.tar'
119
120 test_expect_success \
121 - 'validate specfile contents' \
122 - 'git log --max-count=1 "--pretty=format:A${SPECFILEFORMAT}O" HEAD \
123 - >f/a/specfile.expected &&
124 - diff f/a/specfile.expected f/a/specfile'
121 + 'validate substfile contents' \
122 + 'git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \
123 + >f/a/substfile.expected &&
124 + diff f/a/substfile.expected f/a/substfile'
125
126 test_expect_success \
127 'git archive --format=zip' \