Merge branch 'ew/server-info-remove-crufts'

"git update-server-info" used to leave stale packfiles in its
output, which has been corrected.

* ew/server-info-remove-crufts:
  server-info: do not list unlinked packs
This commit is contained in:
Junio C Hamano 2019-06-17 10:15:15 -07:00
Родитель ac97dc4fa9 e941c48d49
Коммит 63b6b4b7e1
2 изменённых файлов: 9 добавлений и 11 удалений

Просмотреть файл

@ -1,4 +1,5 @@
#include "cache.h"
#include "dir.h"
#include "repository.h"
#include "refs.h"
#include "object.h"
@ -283,26 +284,21 @@ static void init_pack_info(const char *infofile, int force)
{
struct packed_git *p;
int stale;
int i = 0;
int i;
size_t alloc = 0;
for (p = get_all_packs(the_repository); p; p = p->next) {
/* we ignore things on alternate path since they are
* not available to the pullers in general.
*/
if (!p->pack_local)
if (!p->pack_local || !file_exists(p->pack_name))
continue;
i++;
}
num_pack = i;
info = xcalloc(num_pack, sizeof(struct pack_info *));
for (i = 0, p = get_all_packs(the_repository); p; p = p->next) {
if (!p->pack_local)
continue;
assert(i < num_pack);
i = num_pack++;
ALLOC_GROW(info, num_pack, alloc);
info[i] = xcalloc(1, sizeof(struct pack_info));
info[i]->p = p;
info[i]->old_num = -1;
i++;
}
if (infofile && !force)

Просмотреть файл

@ -71,6 +71,8 @@ test_expect_success 'gc --keep-largest-pack' '
git gc --keep-largest-pack &&
( cd .git/objects/pack && ls *.pack ) >pack-list &&
test_line_count = 2 pack-list &&
awk "/^P /{print \$2}" <.git/objects/info/packs >pack-info &&
test_line_count = 2 pack-info &&
test_path_is_file $BASE_PACK &&
git fsck
)