summaryrefslogtreecommitdiff
path: root/builtin/repack.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2022-10-22 00:21:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-10-22 01:03:52 (GMT)
commita4880b20cc9e56518f6aef96c31b256124731ea6 (patch)
treecf8e0984155599e93ea72a8344100766e67bf70b /builtin/repack.c
parentb639606fd0e20584edd2515236fcc69ada24e430 (diff)
downloadgit-a4880b20cc9e56518f6aef96c31b256124731ea6.zip
git-a4880b20cc9e56518f6aef96c31b256124731ea6.tar.gz
git-a4880b20cc9e56518f6aef96c31b256124731ea6.tar.bz2
repack: expand error message for missing pack files
If pack-objects tells us it generated pack $hash, we expect to find .tmp-$$-pack-$hash.pack, .idx, .rev, and so on. Some of these files are optional, but others are not. For the required ones, we'll bail with an error if any of them is missing. The error message is just "missing required file", which is a bit vague. We should be more clear that it is not the user's fault, but rather that the sub-pgoram we called is not operating as expected. In practice, nobody should ever see this message, as it would generally only be caused by a bug in Git. It probably doesn't make sense to convert this to a BUG(), though, as there are other (unlikely) possibilities, such as somebody else racily deleting the files, filesystem errors causing stat() to fail, and so on. A nice side effect here is that we stop relying on fname_old in this code path, which will let us deal with it only in the first part of the conditional. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/repack.c')
-rw-r--r--builtin/repack.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/repack.c b/builtin/repack.c
index b5bd9e5..d1929bb 100644
--- a/builtin/repack.c
+++ b/builtin/repack.c
@@ -1030,7 +1030,8 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
if (rename(fname_old, fname))
die_errno(_("renaming '%s' failed"), fname_old);
} else if (!exts[ext].optional)
- die(_("missing required file: %s"), fname_old);
+ die(_("pack-objects did not write a '%s' file for pack %s-%s"),
+ exts[ext].name, packtmp, item->string);
else if (unlink(fname) < 0 && errno != ENOENT)
die_errno(_("could not unlink: %s"), fname);