Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
repack: turn exts array into array-of-struct
author
Jeff King
<peff@peff.net>
Sat, 21 Dec 2013 14:00:23 +0000
(09:00 -0500)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 30 Dec 2013 20:19:23 +0000
(12:19 -0800)
This is slightly more verbose, but will let us annotate the
extensions with further options in future commits.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/repack.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
b328c21
)
diff --git
a/builtin/repack.c
b/builtin/repack.c
index 2e88975e0c53b950505ecb87570717b2aa40eb37..a176de2f85a8a9a0f0b5443df3e8ad62daa3eb0a 100644
(file)
--- a/
builtin/repack.c
+++ b/
builtin/repack.c
@@
-115,7
+115,12
@@
static void remove_redundant_pack(const char *dir_name, const char *base_name)
int cmd_repack(int argc, const char **argv, const char *prefix)
{
int cmd_repack(int argc, const char **argv, const char *prefix)
{
- const char *exts[] = {".pack", ".idx"};
+ struct {
+ const char *name;
+ } exts[] = {
+ {".pack"},
+ {".idx"},
+ };
struct child_process cmd;
struct string_list_item *item;
struct argv_array cmd_args = ARGV_ARRAY_INIT;
struct child_process cmd;
struct string_list_item *item;
struct argv_array cmd_args = ARGV_ARRAY_INIT;
@@
-261,14
+266,14
@@
int cmd_repack(int argc, const char **argv, const char *prefix)
for (ext = 0; ext < ARRAY_SIZE(exts); ext++) {
char *fname, *fname_old;
fname = mkpathdup("%s/%s%s", packdir,
for (ext = 0; ext < ARRAY_SIZE(exts); ext++) {
char *fname, *fname_old;
fname = mkpathdup("%s/%s%s", packdir,
- item->string, exts[ext]);
+ item->string, exts[ext]
.name
);
if (!file_exists(fname)) {
free(fname);
continue;
}
fname_old = mkpath("%s/old-%s%s", packdir,
if (!file_exists(fname)) {
free(fname);
continue;
}
fname_old = mkpath("%s/old-%s%s", packdir,
- item->string, exts[ext]);
+ item->string, exts[ext]
.name
);
if (file_exists(fname_old))
if (unlink(fname_old))
failed = 1;
if (file_exists(fname_old))
if (unlink(fname_old))
failed = 1;
@@
-319,9
+324,9
@@
int cmd_repack(int argc, const char **argv, const char *prefix)
char *fname, *fname_old;
struct stat statbuffer;
fname = mkpathdup("%s/pack-%s%s",
char *fname, *fname_old;
struct stat statbuffer;
fname = mkpathdup("%s/pack-%s%s",
- packdir, item->string, exts[ext]);
+ packdir, item->string, exts[ext]
.name
);
fname_old = mkpathdup("%s-%s%s",
fname_old = mkpathdup("%s-%s%s",
- packtmp, item->string, exts[ext]);
+ packtmp, item->string, exts[ext]
.name
);
if (!stat(fname_old, &statbuffer)) {
statbuffer.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
chmod(fname_old, statbuffer.st_mode);
if (!stat(fname_old, &statbuffer)) {
statbuffer.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
chmod(fname_old, statbuffer.st_mode);
@@
-340,7
+345,7
@@
int cmd_repack(int argc, const char **argv, const char *prefix)
fname = mkpath("%s/old-pack-%s%s",
packdir,
item->string,
fname = mkpath("%s/old-pack-%s%s",
packdir,
item->string,
- exts[ext]);
+ exts[ext]
.name
);
if (remove_path(fname))
warning(_("removing '%s' failed"), fname);
}
if (remove_path(fname))
warning(_("removing '%s' failed"), fname);
}