Indexing a repository with the indexer-cli (using -i and -r parameters) creates an empty packed index.

Caused by the fact that the IndexSearcher obtained before indexer.scan() is called is the same one that is passed to the IndexPackingUpdate, however, once indexer.scan() is executed, the context's (directory) content is replaced with the temporay one (used for downloading) but the previously returned IndexSearcher is invalidated by the DefaultIndexingContext.openAndWarmup() method that is called for the new index directory. Any packing operation that is attempted from this point will produce an empty packed index instead of using the actual index content produced by the indexer.scan() method.

Fixed by acquireing the indexSearcher *after* the indexer.scan() method finishes, so that the pack operation works with the actual data and produces a proper packed index.
1 file changed