* [PATCH] cindex: fix prune to not wipe out the entire index
@ 2023-04-21 11:52 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2023-04-21 11:52 UTC (permalink / raw)
To: meta
Oops :x I noticed this while I was working on a major optimization
for prune...
---
lib/PublicInbox/CodeSearchIdx.pm | 2 +-
t/cindex.t | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm
index 97123133..fa761ed0 100644
--- a/lib/PublicInbox/CodeSearchIdx.pm
+++ b/lib/PublicInbox/CodeSearchIdx.pm
@@ -803,7 +803,7 @@ EOM
my $f = "$git_dir/objects/info/alternates";
open $ALT_FH{$fmt}, '>', $f or die "open($f): $!";
}
- say { $ALT_FH{$fmt} } $out or die "say: $!";
+ say { $ALT_FH{$fmt} } $objdir or die "say: $!";
}
sub prep_alternate_start {
diff --git a/t/cindex.t b/t/cindex.t
index d40f73ff..8b89ebff 100644
--- a/t/cindex.t
+++ b/t/cindex.t
@@ -165,6 +165,8 @@ if ('--prune') {
$csrch->reopen;
is(scalar($csrch->mset('s:hi')->items), 0,
'hit stays pruned since GIT_DIR was previously pruned');
+ isnt(scalar($csrch->mset('s:NUL')->items), 0,
+ 'prune did not clobber entire index');
}
File::Path::remove_tree("$tmp/ext");
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-21 11:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-21 11:52 [PATCH] cindex: fix prune to not wipe out the entire index Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).