diff options
| author | Junio C Hamano <gitster@pobox.com> | 2022-11-28 12:13:43 +0900 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-11-28 12:13:44 +0900 |
| commit | 7d7ed48dd51562dd19c0c9e2553ac774ad9d3344 (patch) | |
| tree | 25d80be3b4491c009b22280ddc4efda7aa789164 | |
| parent | 15a62fb957178440fe07a0f88b380c53dc9b9f96 (diff) | |
| parent | 69747653523afa3322e0f8dd6a5a7d30184694c3 (diff) | |
| download | git-7d7ed48dd51562dd19c0c9e2553ac774ad9d3344.tar.gz | |
Merge branch 'ew/prune-with-missing-objects-pack'
"git prune" may try to iterate over .git/objects/pack for trash
files to remove in it, and loudly fail when the directory is
missing, which is not necessary. The command has been taught to
ignore such a failure.
* ew/prune-with-missing-objects-pack:
prune: quiet ENOENT on missing directories
| -rw-r--r-- | builtin/prune.c | 4 | ||||
| -rwxr-xr-x | t/t5304-prune.sh | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/builtin/prune.c b/builtin/prune.c index df376b2ed1..2719220108 100644 --- a/builtin/prune.c +++ b/builtin/prune.c @@ -127,7 +127,9 @@ static void remove_temporary_files(const char *path) dir = opendir(path); if (!dir) { - fprintf(stderr, "Unable to open directory %s\n", path); + if (errno != ENOENT) + fprintf(stderr, "Unable to open directory %s: %s\n", + path, strerror(errno)); return; } while ((de = readdir(dir)) != NULL) diff --git a/t/t5304-prune.sh b/t/t5304-prune.sh index 8ae314af58..d65a5f94b4 100755 --- a/t/t5304-prune.sh +++ b/t/t5304-prune.sh @@ -29,6 +29,14 @@ test_expect_success setup ' git gc ' +test_expect_success 'bare repo prune is quiet without $GIT_DIR/objects/pack' ' + git clone -q --shared --template= --bare . bare.git && + rmdir bare.git/objects/pack && + git --git-dir=bare.git prune --no-progress 2>prune.err && + test_must_be_empty prune.err && + rm -r bare.git prune.err +' + test_expect_success 'prune stale packs' ' orig_pack=$(echo .git/objects/pack/*.pack) && >.git/objects/tmp_1.pack && |
