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>
This commit is contained in:
parent
69caed593e
commit
fa0fccae6a
@ -24,11 +24,11 @@ static int init_is_bare_repository = 0;
|
|||||||
static int init_shared_repository = -1;
|
static int init_shared_repository = -1;
|
||||||
static const char *init_db_template_dir;
|
static const char *init_db_template_dir;
|
||||||
|
|
||||||
static void copy_templates_1(struct strbuf *path, struct strbuf *template,
|
static void copy_templates_1(struct strbuf *path, struct strbuf *template_path,
|
||||||
DIR *dir)
|
DIR *dir)
|
||||||
{
|
{
|
||||||
size_t path_baselen = path->len;
|
size_t path_baselen = path->len;
|
||||||
size_t template_baselen = template->len;
|
size_t template_baselen = template_path->len;
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
|
|
||||||
/* Note: if ".git/hooks" file exists in the repository being
|
/* 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,
|
|||||||
int exists = 0;
|
int exists = 0;
|
||||||
|
|
||||||
strbuf_setlen(path, path_baselen);
|
strbuf_setlen(path, path_baselen);
|
||||||
strbuf_setlen(template, template_baselen);
|
strbuf_setlen(template_path, template_baselen);
|
||||||
|
|
||||||
if (de->d_name[0] == '.')
|
if (de->d_name[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
strbuf_addstr(path, de->d_name);
|
strbuf_addstr(path, de->d_name);
|
||||||
strbuf_addstr(template, de->d_name);
|
strbuf_addstr(template_path, de->d_name);
|
||||||
if (lstat(path->buf, &st_git)) {
|
if (lstat(path->buf, &st_git)) {
|
||||||
if (errno != ENOENT)
|
if (errno != ENOENT)
|
||||||
die_errno(_("cannot stat '%s'"), path->buf);
|
die_errno(_("cannot stat '%s'"), path->buf);
|
||||||
@ -57,36 +57,36 @@ static void copy_templates_1(struct strbuf *path, struct strbuf *template,
|
|||||||
else
|
else
|
||||||
exists = 1;
|
exists = 1;
|
||||||
|
|
||||||
if (lstat(template->buf, &st_template))
|
if (lstat(template_path->buf, &st_template))
|
||||||
die_errno(_("cannot stat template '%s'"), template->buf);
|
die_errno(_("cannot stat template '%s'"), template_path->buf);
|
||||||
|
|
||||||
if (S_ISDIR(st_template.st_mode)) {
|
if (S_ISDIR(st_template.st_mode)) {
|
||||||
DIR *subdir = opendir(template->buf);
|
DIR *subdir = opendir(template_path->buf);
|
||||||
if (!subdir)
|
if (!subdir)
|
||||||
die_errno(_("cannot opendir '%s'"), template->buf);
|
die_errno(_("cannot opendir '%s'"), template_path->buf);
|
||||||
strbuf_addch(path, '/');
|
strbuf_addch(path, '/');
|
||||||
strbuf_addch(template, '/');
|
strbuf_addch(template_path, '/');
|
||||||
copy_templates_1(path, template, subdir);
|
copy_templates_1(path, template_path, subdir);
|
||||||
closedir(subdir);
|
closedir(subdir);
|
||||||
}
|
}
|
||||||
else if (exists)
|
else if (exists)
|
||||||
continue;
|
continue;
|
||||||
else if (S_ISLNK(st_template.st_mode)) {
|
else if (S_ISLNK(st_template.st_mode)) {
|
||||||
struct strbuf lnk = STRBUF_INIT;
|
struct strbuf lnk = STRBUF_INIT;
|
||||||
if (strbuf_readlink(&lnk, template->buf, 0) < 0)
|
if (strbuf_readlink(&lnk, template_path->buf, 0) < 0)
|
||||||
die_errno(_("cannot readlink '%s'"), template->buf);
|
die_errno(_("cannot readlink '%s'"), template_path->buf);
|
||||||
if (symlink(lnk.buf, path->buf))
|
if (symlink(lnk.buf, path->buf))
|
||||||
die_errno(_("cannot symlink '%s' '%s'"),
|
die_errno(_("cannot symlink '%s' '%s'"),
|
||||||
lnk.buf, path->buf);
|
lnk.buf, path->buf);
|
||||||
strbuf_release(&lnk);
|
strbuf_release(&lnk);
|
||||||
}
|
}
|
||||||
else if (S_ISREG(st_template.st_mode)) {
|
else if (S_ISREG(st_template.st_mode)) {
|
||||||
if (copy_file(path->buf, template->buf, st_template.st_mode))
|
if (copy_file(path->buf, template_path->buf, st_template.st_mode))
|
||||||
die_errno(_("cannot copy '%s' to '%s'"),
|
die_errno(_("cannot copy '%s' to '%s'"),
|
||||||
template->buf, path->buf);
|
template_path->buf, path->buf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
error(_("ignoring template %s"), template->buf);
|
error(_("ignoring template %s"), template_path->buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user