mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-18 17:00:30 -04:00
Cleanup
This commit is contained in:
parent
5cc2023a45
commit
5726ee708f
@ -197,11 +197,7 @@ void filesystem_extractor_<LoggerPolicy>::extract(filesystem_v2& fs,
|
||||
DWARFS_THROW(runtime_error, "getattr() failed");
|
||||
}
|
||||
|
||||
auto path = entry.path();
|
||||
|
||||
DWARFS_CHECK(path[0] == '/', "path expected to start with /");
|
||||
|
||||
::archive_entry_set_pathname(ae, path.c_str() + 1); // drop leading /
|
||||
::archive_entry_set_pathname(ae, entry.path().c_str());
|
||||
::archive_entry_copy_stat(ae, &stbuf);
|
||||
|
||||
if (S_ISLNK(inode.mode())) {
|
||||
|
@ -160,8 +160,10 @@ std::string dir_entry_view::path() const {
|
||||
|
||||
void dir_entry_view::append_path_to(std::string& s) const {
|
||||
if (auto p = parent()) {
|
||||
p->append_path_to(s);
|
||||
s += '/';
|
||||
if (!p->is_root()) {
|
||||
p->append_path_to(s);
|
||||
s += '/';
|
||||
}
|
||||
}
|
||||
if (!is_root()) {
|
||||
s += name();
|
||||
|
@ -238,10 +238,6 @@ class metadata_ final : public metadata_v2::impl {
|
||||
return inode_view(meta_.entries()[index], inode, &meta_);
|
||||
}
|
||||
|
||||
dir_entry_view make_dir_entry_view(uint32_t self_index) const {
|
||||
return dir_entry_view::from_dir_entry_index(self_index, &meta_);
|
||||
}
|
||||
|
||||
dir_entry_view
|
||||
make_dir_entry_view(uint32_t self_index, uint32_t parent_index) const {
|
||||
return dir_entry_view::from_dir_entry_index(self_index, parent_index,
|
||||
|
@ -458,7 +458,11 @@ void basic_end_to_end_test(std::string const& compressor,
|
||||
struct ::stat stbuf;
|
||||
ASSERT_EQ(0, fs.getattr(e.inode(), &stbuf));
|
||||
inodes.push_back(stbuf.st_ino);
|
||||
EXPECT_TRUE(entries.emplace(e.path(), stbuf).second);
|
||||
auto path = e.path();
|
||||
if (!path.empty()) {
|
||||
path = "/" + path;
|
||||
}
|
||||
EXPECT_TRUE(entries.emplace(path, stbuf).second);
|
||||
});
|
||||
|
||||
EXPECT_EQ(entries.size(), dwarfs::test::statmap.size() + 2 * with_devices +
|
||||
|
@ -286,18 +286,18 @@ TEST_P(compat_filesystem, backwards_compat) {
|
||||
|
||||
std::map<std::string, struct ::stat> ref_entries{
|
||||
{"", make_stat(S_IFDIR | 0755, 8)},
|
||||
{"/bench.sh", make_stat(S_IFREG | 0644, 1517)},
|
||||
{"/dev", make_stat(S_IFDIR | 0755, 0)},
|
||||
{"/empty", make_stat(S_IFDIR | 0755, 1)},
|
||||
{"/empty/alsoempty", make_stat(S_IFDIR | 0755, 0)},
|
||||
{"/foo", make_stat(S_IFDIR | 0755, 3)},
|
||||
{"/foo/bad", make_stat(S_IFLNK | 0777, 6)},
|
||||
{"/foo/bar", make_stat(S_IFREG | 0644, 0)},
|
||||
{"/foo/bla.sh", make_stat(S_IFREG | 0644, 1517)},
|
||||
{"/foobar", make_stat(S_IFLNK | 0777, 7)},
|
||||
{"/format.sh", make_stat(S_IFREG | 0755, 94)},
|
||||
{"/perl-exec.sh", make_stat(S_IFREG | 0644, 87)},
|
||||
{"/test.py", make_stat(S_IFREG | 0644, 1012)},
|
||||
{"bench.sh", make_stat(S_IFREG | 0644, 1517)},
|
||||
{"dev", make_stat(S_IFDIR | 0755, 0)},
|
||||
{"empty", make_stat(S_IFDIR | 0755, 1)},
|
||||
{"empty/alsoempty", make_stat(S_IFDIR | 0755, 0)},
|
||||
{"foo", make_stat(S_IFDIR | 0755, 3)},
|
||||
{"foo/bad", make_stat(S_IFLNK | 0777, 6)},
|
||||
{"foo/bar", make_stat(S_IFREG | 0644, 0)},
|
||||
{"foo/bla.sh", make_stat(S_IFREG | 0644, 1517)},
|
||||
{"foobar", make_stat(S_IFLNK | 0777, 7)},
|
||||
{"format.sh", make_stat(S_IFREG | 0755, 94)},
|
||||
{"perl-exec.sh", make_stat(S_IFREG | 0644, 87)},
|
||||
{"test.py", make_stat(S_IFREG | 0644, 1012)},
|
||||
};
|
||||
|
||||
for (auto mp : {&filesystem_v2::walk, &filesystem_v2::walk_inode_order}) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user