Code

tests: unset COLUMNS inherited from environment
[git.git] / builtin / prune-packed.c
index f9463deec2f5a5875ee9870e67c990a2fea942db..b58a2e1eb28d0eb94cc6863c64af7e0ac816caea 100644 (file)
@@ -35,8 +35,6 @@ static void prune_dir(int i, DIR *dir, char *pathname, int len, int opts)
                        unlink_or_warn(pathname);
                display_progress(progress, i + 1);
        }
-       pathname[len] = 0;
-       rmdir(pathname);
 }
 
 void prune_packed_objects(int opts)
@@ -65,6 +63,8 @@ void prune_packed_objects(int opts)
                        continue;
                prune_dir(i, d, pathname, len + 3, opts);
                closedir(d);
+               pathname[len + 2] = '\0';
+               rmdir(pathname);
        }
        stop_progress(&progress);
 }