prune --repos: fix uninitialized access
commit38d2ab633180e183653d781e5787e2842000f09f
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Tue, 29 Jul 2014 13:50:26 +0000 (29 20:50 +0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 29 Jul 2014 20:42:13 +0000 (29 13:42 -0700)
treebe9528f7fb093395271e833fc3be471f3acf2933
parent4f25b3169d44c9bc72cf173dc207d37649c16277
prune --repos: fix uninitialized access

There's a code path in prune_repo_dir() that does not initialize 'st'
buffer, which is checked by the caller, prune_repos_dir(). Instead
of leaking some prune logic out to prune_repos_dir(), move 'st' into
prune_repo_dir().

Another bug that is fixed while at there is the "return 0" at the end
of prune_repo_dir() instead of '1', meaning "keep the checkout" while
we want "keep the checkout _unless_ its last update is older than
expire limit". Set correct expire limit in the test as well.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/prune.c
t/t2026-prune-linked-checkouts.sh