summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Bögershausen <tboegi@web.de>2014-02-02 16:09:56 +0100
committerJunio C Hamano <gitster@pobox.com>2014-02-05 12:01:45 -0800
commitb32876b5353987e8bae56f41004e722461a8b87d (patch)
treede459b8f7bba54248f13624b49a424869237b098
parent9d7fbfd20422cd23fdb346ac8d609b45b4d37001 (diff)
downloadgit-tb/repack-fix-renames.tar.gz
repack.c: rename a few variablestb/repack-fix-renames
Rename the variables to match what they are used for: fname for the final name of the new packfile, fname_old for the name of the existing one, and fname_tmp for the temporary name pack-objects created the new packfile in. Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/repack.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/builtin/repack.c b/builtin/repack.c
index fe315772d8..3b013535c7 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -316,33 +316,33 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
/* Now the ones with the same name are out of the way... */
for_each_string_list_item(item, &names) {
for (ext = 0; ext < 2; ext++) {
- char *fname, *fname_old;
+ char *fname, *fname_tmp;
struct stat statbuffer;
fname = mkpathdup("%s/pack-%s%s",
packdir, item->string, exts[ext]);
- fname_old = mkpathdup("%s-%s%s",
+ fname_tmp = mkpathdup("%s-%s%s",
packtmp, item->string, exts[ext]);
- if (!stat(fname_old, &statbuffer)) {
+ if (!stat(fname_tmp, &statbuffer)) {
statbuffer.st_mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH);
- chmod(fname_old, statbuffer.st_mode);
+ chmod(fname_tmp, statbuffer.st_mode);
}
- if (rename(fname_old, fname))
- die_errno(_("renaming '%s' failed"), fname_old);
+ if (rename(fname_tmp, fname))
+ die_errno(_("renaming '%s' into '%s' failed"), fname_tmp, fname);
free(fname);
- free(fname_old);
+ free(fname_tmp);
}
}
/* Remove the "old-" files */
for_each_string_list_item(item, &names) {
for (ext = 0; ext < 2; ext++) {
- char *fname;
- fname = mkpath("%s/old-%s%s",
+ char *fname_old;
+ fname_old = mkpath("%s/old-%s%s",
packdir,
item->string,
exts[ext]);
- if (remove_path(fname))
- warning(_("removing '%s' failed"), fname);
+ if (remove_path(fname_old))
+ warning(_("removing '%s' failed"), fname_old);
}
}