Skip to content
Snippets Groups Projects
Commit 25e9cafe authored by Nick Thomas's avatar Nick Thomas
Browse files

Fix blob removal

parent 29a2bf4f
No related branches found
No related tags found
1 merge request!1Initial implementation of an elasticsearch indexer in Go
Pipeline #
Loading
Loading
@@ -44,8 +44,8 @@ func (i *Indexer) SubmitBlob(f *git.File, _, toCommit string) error {
return nil
}
 
func (i *Indexer) RemoveBlob(file *git.File, _, toCommit string) error {
blobID := GenerateBlobID(toCommit, i.Submitter.ParentID())
func (i *Indexer) RemoveBlob(file *git.File, _, _ string) error {
blobID := GenerateBlobID(i.Submitter.ParentID(), file.Path)
 
i.Submitter.Remove(blobID)
return nil
Loading
Loading
Loading
Loading
@@ -68,16 +68,32 @@ func run(from, to string) error {
cmd.Stderr = os.Stderr
 
if from != "" {
cmd.Env = append(cmd.Env, "ID_FROM="+from)
cmd.Env = append(cmd.Env, "FROM_SHA="+from)
}
 
if to != "" {
cmd.Env = append(cmd.Env, "ID_TO="+to)
cmd.Env = append(cmd.Env, "TO_SHA="+to)
}
 
return cmd.Run()
}
 
func TestIndexingRemovesFiles(t *testing.T) {
checkDeps(t)
c, td := buildIndex(t)
defer td()
// The commit before files/empty is removed - so it should be indexed
assert.NoError(t, run("", "19e2e9b4ef76b422ce1154af39a91323ccc57434"))
_, err := c.GetBlob("files/empty")
assert.NoError(t, err)
// Now we expect it to have been removed
assert.NoError(t, run("19e2e9b4ef76b422ce1154af39a91323ccc57434", "08f22f255f082689c0d7d39d19205085311542bc"))
_, err = c.GetBlob("files/empty")
assert.Error(t, err)
}
func TestIndexingGitlabTest(t *testing.T) {
checkDeps(t)
c, td := buildIndex(t)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment