Skip to content

Remove cache dirs when using gc #3375

@pared

Description

@pared

Please provide information about your setup
DVC version(i.e. dvc --version), Platform and method of installation (pip, homebrew, pkg Mac, exe (Windows), DEB(Linux), RPM(Linux))

Reproduction script:

#!/bin/bash

rm -rf repo
mkdir repo

pushd repo
git init --quiet
dvc init -q
set -ex

git add -A
git commit -am "init"

echo data1>>data
dvc add data
git add -A 
git commit -am "first commit"

rm data
echo data2>>data
dvc add data
git commit -am "second commit"
git tag v1

rm data
echo data3>>data
dvc add data

dvc gc --all-tags
tree .dvc/cache

gc succesfully removes data from cache, but does not check whether parent dir of file in cache is empty and leave it even if it was empty. We should remove that parent dir if there is no other file inside.

EDIT:
expected output of tree should not contain empty directory in cache.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDid we break something?p3-nice-to-haveIt should be done this or next sprint

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions