Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect/Inconsistent handling of empty directories #460

Open
rockenbf opened this issue Nov 7, 2024 · 0 comments
Open

Incorrect/Inconsistent handling of empty directories #460

rockenbf opened this issue Nov 7, 2024 · 0 comments

Comments

@rockenbf
Copy link
Contributor

rockenbf commented Nov 7, 2024

Currently empty directories are not properly handled as shown in the example below. I see two possible solutions:

  1. Have the same behaviour as git and don't track empty directories at all. (my personal recommendation)
  2. Consider empty directories as part of the data and track them properly.

Oxen version: 0.19.6 / 0.19.4
OS version: Pop!_OS 22.04 LTS

Minimal example to reproduce the problem:

user@machine:/tmp$ mkdir test-repo && cd test-repo
user@machine:/tmp/test-repo$ oxen init 
🐂 repository initialized at: "/tmp/test-repo"
user@machine:/tmp/test-repo$ mkdir test-dir
user@machine:/tmp/test-repo$ oxen status 
Untracked Directories
  (use "oxen add <dir>..." to update what will be committed)
  test-dir/ (0 items)

user@machine:/tmp/test-repo$ oxen add test-dir && oxen commit -m "test-commit"
🐂 oxen added 0 files (0 B) in 32ms
Committing with message: test-commit
🐂 commit 8f3912678987072c9b7226bdfb488fb6 -> 'test-commit' in 26ms
user@machine:/tmp/test-repo$ oxen status
On branch main -> 8f3912678987072c9b7226bdfb488fb6

Untracked Directories
  (use "oxen add <dir>..." to update what will be committed)
  test-dir/ (0 items)

extension for nested empty directories:

user@machine:/tmp/test-repo$ mkdir -p  test-dir2/another-dir
user@machine:/tmp/test-repo$ oxen status 
On branch main -> 8f3912678987072c9b7226bdfb488fb6

Untracked Directories
  (use "oxen add <dir>..." to update what will be committed)
  test-dir/  (0 items)
  test-dir2/ (0 items)

user@machine:/tmp/test-repo$ oxen add test-dir2/another-dir
🐂 oxen added 0 files (0 B) in 32ms
fuser@machine:/tmp/test-repo$ oxen status 
On branch main -> 8f3912678987072c9b7226bdfb488fb6

Directories to be committed
  added: test-dir2/another-dir

Untracked Directories
  (use "oxen add <dir>..." to update what will be committed)
  test-dir/  (0 items)
  test-dir2/ (0 items)

user@machine:/tmp/test-repo$ oxen commit -m "test-commit 2"
Committing with message: test-commit 2
🐂 commit fc89bb8af681f4c77eae8430b4f0babe -> 'test-commit 2' in 42ms
user@machine:/tmp/test-repo$ oxen status 
On branch main -> fc89bb8af681f4c77eae8430b4f0babe

Untracked Directories
  (use "oxen add <dir>..." to update what will be committed)
  test-dir/  (0 items)
  test-dir2/ (0 items)

user@machine:/tmp/test-repo$ oxen add test-dir2
🐂 oxen added 0 files (0 B) in 20ms
user@machine:/tmp/test-repo$ oxen status 
On branch main -> fc89bb8af681f4c77eae8430b4f0babe

Directories to be committed
  added: test-dir2/another-dir

Untracked Directories
  (use "oxen add <dir>..." to update what will be committed)
  test-dir/ (0 items)

user@machine:/tmp/test-repo$ oxen commit -m "test-commit 3"
Committing with message: test-commit 3
🐂 commit 6fee636a1158b9d69a4e67584b686795 -> 'test-commit 3' in 62ms
user@machine:/tmp/test-repo$ oxen status 
On branch main -> 6fee636a1158b9d69a4e67584b686795

Untracked Directories
  (use "oxen add <dir>..." to update what will be committed)
  test-dir/  (0 items)
  test-dir2/ (0 items)

user@machine:/tmp/test-repo$ oxen tree
[Commit] 6fee636a1158b9d69a4e67584b686795 "test-commit 3" -> Test User [email protected] parent_ids "fc89bb8af681f4c77eae8430b4f0babe"
  [Dir] d2ae091bb0 "" (0 B) (0 files) (commit 6fee636a11)  (1 children)
    [VNode] 6ab93c9bb4  (1 children)
      [Dir] 7b0849c601 "test-dir2" (0 B) (0 files) (commit 6fee636a11)  (1 children)
        [VNode] b1dc63dc12  (1 children)
          [Dir] e5378f1928 "another-dir" (0 B) (0 files) (commit 6fee636a11)  (0 children)
Time to load tree: 1.06298ms
Time to print tree: 30.118µs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant