init-db: rename 'template' variables
Rename C++ keyword in order to bring the codebase closer to being able to be compiled with a C++ compiler. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Williams committed
Feb 14, 2018 at 10:59 UTC
fa0fccae6ab1ad242d8805baf5acb7e5d4518540
1 file changed
+15
-15
builtin/init-db.c
+15
-15
@@ -24,11 +24,11 @@ static int init_is_bare_repository = 0;
24
static int init_shared_repository = -1;
25
static const char *init_db_template_dir;
26
27
-static void copy_templates_1(struct strbuf *path, struct strbuf *template,
27
+static void copy_templates_1(struct strbuf *path, struct strbuf *template_path,
28
DIR *dir)
29
{
30
size_t path_baselen = path->len;
31
- size_t template_baselen = template->len;
31
+ size_t template_baselen = template_path->len;
32
struct dirent *de;
33
34
/* Note: if ".git/hooks" file exists in the repository being
@@ -44,12 +44,12 @@ static void copy_templates_1(struct strbuf *path, struct strbuf *template,
44
int exists = 0;
45
46
strbuf_setlen(path, path_baselen);
47
- strbuf_setlen(template, template_baselen);
47
+ strbuf_setlen(template_path, template_baselen);
48
49
if (de->d_name[0] == '.')
50
continue;
51
strbuf_addstr(path, de->d_name);
52
- strbuf_addstr(template, de->d_name);
52
+ strbuf_addstr(template_path, de->d_name);
53
if (lstat(path->buf, &st_git)) {
54
if (errno != ENOENT)
55
die_errno(_("cannot stat '%s'"), path->buf);
@@ -57,36 +57,36 @@ static void copy_templates_1(struct strbuf *path, struct strbuf *template,
57
else
58
exists = 1;
59
60
- if (lstat(template->buf, &st_template))
61
- die_errno(_("cannot stat template '%s'"), template->buf);
60
+ if (lstat(template_path->buf, &st_template))
61
+ die_errno(_("cannot stat template '%s'"), template_path->buf);
62
63
if (S_ISDIR(st_template.st_mode)) {
64
- DIR *subdir = opendir(template->buf);
64
+ DIR *subdir = opendir(template_path->buf);
65
if (!subdir)
66
- die_errno(_("cannot opendir '%s'"), template->buf);
66
+ die_errno(_("cannot opendir '%s'"), template_path->buf);
67
strbuf_addch(path, '/');
68
- strbuf_addch(template, '/');
69
- copy_templates_1(path, template, subdir);
68
+ strbuf_addch(template_path, '/');
69
+ copy_templates_1(path, template_path, subdir);
70
closedir(subdir);
71
}
72
else if (exists)
73
continue;
74
else if (S_ISLNK(st_template.st_mode)) {
75
struct strbuf lnk = STRBUF_INIT;
76
- if (strbuf_readlink(&lnk, template->buf, 0) < 0)
77
- die_errno(_("cannot readlink '%s'"), template->buf);
76
+ if (strbuf_readlink(&lnk, template_path->buf, 0) < 0)
77
+ die_errno(_("cannot readlink '%s'"), template_path->buf);
78
if (symlink(lnk.buf, path->buf))
79
die_errno(_("cannot symlink '%s' '%s'"),
80
lnk.buf, path->buf);
81
strbuf_release(&lnk);
82
}
83
else if (S_ISREG(st_template.st_mode)) {
84
- if (copy_file(path->buf, template->buf, st_template.st_mode))
84
+ if (copy_file(path->buf, template_path->buf, st_template.st_mode))
85
die_errno(_("cannot copy '%s' to '%s'"),
86
- template->buf, path->buf);
86
+ template_path->buf, path->buf);
87
}
88
else
89
- error(_("ignoring template %s"), template->buf);
89
+ error(_("ignoring template %s"), template_path->buf);
90
}
91
}
92