sourcegraph / zoekt

Fast trigram based code search
Apache License 2.0
736 stars 83 forks source link

zoekt-indexserver - Prune branches when fetching git repository #768

Closed xavier-calland closed 6 months ago

xavier-calland commented 6 months ago

zoekt-indexserver fetches the git repository to have an up-to-date repository with all branches. https://github.com/sourcegraph/zoekt/blob/6df055493b1600051e467b79d296fa292f658d3f/cmd/zoekt-indexserver/main.go#L131-L132

When a branch is deleted in the repository, it still exists in the index because fetch does not prune deleted branches.

Adding the --prune parameter to the fetch command guarantees an up-to-date list of branches

cmd := exec.Command("git", "--git-dir", dir, "fetch", "origin", "--prune") 
keegancsmith commented 6 months ago

FYI you don't need to file an issue first if you have already diagnosed the code problem, feel free to just send a PR :)

xavier-calland commented 6 months ago

:ok_hand: :slightly_smiling_face:

isker commented 6 months ago

@keegancsmith @xavier-calland looks like one of you ought to close this?

And #763 too.