Oxen-AI / Oxen

Oxen.ai's core rust library, server, and CLI
https://oxen.ai
Apache License 2.0
201 stars 12 forks source link

Add command re-adds folders that are already committed #461

Open rockenbf opened 2 weeks ago

rockenbf commented 2 weeks ago

When running oxen add * in a clean (fully committed) repo that has files in sub-folders, the sub-folders ar added again and show as to be committed in oxen status. I assume this could have a similar root-cause as issue #460.

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-folder && cd test-folder
user@machine:/tmp/test-repo/test-folder$ printf '%s\n' 'name,age' 'bob,12' 'jane,13' 'joe,14' > people.txt
user@machine:/tmp/test-repo/test-folder$ oxen add people.txt 
🐂 oxen added 0 files (0 B) in 46ms
user@machine:/tmp/test-repo/test-folder$ oxen status 
Untracked Directories
  (use "oxen add <dir>..." to update what will be committed)
  test-folder/ (1 item)

user@machine:/tmp/test-repo/test-folder$ cd ..
user@machine:/tmp/test-repo$ oxen status 
Untracked Directories
  (use "oxen add <dir>..." to update what will be committed)
  test-folder/ (1 item)

user@machine:/tmp/test-repo$ oxen add test-folder
🐂 oxen added 1 files (31 B) in 25ms
user@machine:/tmp/test-repo$ oxen status
Directories to be committed
  added: test-folder with 1 file

Files to be committed:
  (use "oxen restore --staged <file> ..." to unstage)
  new file: test-folder/people.txt

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

nothing to commit, working tree clean
user@machine:/tmp/test-repo$ oxen add *
🐂 oxen added 0 files (0 B) in 30ms
user@machine:/tmp/test-repo$ oxen status 
On branch main -> 9384274310a1a38e80c576f08eef5602

Directories to be committed
  added: test-folder
gschoeni commented 2 weeks ago

Interesting, it could also be an issue with doing the operations while you are in the subdirectory. We will take a look 🕵️