The sound distributed version control system

#402 Folders initially recorded as zero-byte files

Closed on April 24, 2021
mwchase on March 27, 2021

I’m not sure when this started happening, but I can get this sequence of actions with alpha 48.

I add a folder to a pijul repository, and I essentially have to record the add twice, because the first time, it records it as a zero-byte file. I discovered this by cloning the first patch only, since it’s impossible to pijul unrecord --reset only the second patch. It fails with the following message: Error: Is a directory (os error 21). Weirdly, this happens even if there are files in the directory in the first change, but the second diff only applies to the folder, regardless.

I just tried to see if I could work around this by doing pijul record --amend afterwards, and even though I’ve got output from pijul diff, the record doesn’t pick up those changes when I amend it.

Here are representative diff lines:

First:

1. File addition: "{{cookiecutter.project_slug}}" in "/"
  up 1.0, new 0:31

2. File addition: "requirements" in "{{cookiecutter.project_slug}}"
  up 0.32, new 33:47

Second:

1. Moved: "{{cookiecutter.project_slug}}" "{{cookiecutter.project_slug}}" +dx 1.0
BF:BFD 1.0 -> 2.0:31/2
up 1.0, down 2.32

2. Moved: "{{cookiecutter.project_slug}}/requirements" "requirements" +dx 2.32
BF:BFD 2.32 -> 2.33:47/2
up 2.32, down 2.48
pmeunier on March 30, 2021

This seems to be due to a version of Pijul older than the one on main. I’ll release a new version today.

Jonathan on April 2, 2021

I have experienced this as well with the latest revision of Pijul (cloned and compiled in my machine), so I think that this is not fixed yet, but I could be wrong.

This breaks applying patches as well, as when you apply the first revision (the one which recorded the directory as zero-byte file) it makes impossible to apply any other patch that does “modifies” the directory, as it is a file now. The workaround I found for patches is to always apply the second revision, and as the second depends on the first one, both gets applied correctly, and the directory is correctly created.

stuebinm on April 17, 2021

Same issue here, using the latest version built via nix (last change in my repo is EEOOHGQQK43J36LQJDSS3UK56M54DXPYE4VB3K4A2XAYGOYDJAXAC; pijul –version gives pijul 1.0.0-alpha.48).

Additionally to what was already mentioned, it breaks (naïvely) switching channels as well, since the working directory actually does contain a directory, not a file as expected by pijul (I have pj as an alias of pijul):

λ: pj init
λ: mkdir dir
λ: pj add dir
λ: pj record
Hash: E7QQ5LOQFE7GKSBHEHJU6AKZA2IBW6GHOQGHQB4W4MPKGMA66HYAC
λ: pj fork elsewhere
λ: pj channel switch elsewhere
Error: Cannot change channel, as there are unrecorded changes.
λ: pj diff
message = ''
timestamp = '2021-04-17T17:49:54.071428822Z'
authors = []

# Dependencies
[2] E7QQ5LOQFE7GKSBHEHJU6AKZA2IBW6GHOQGHQB4W4MPKGMA66HYAC

# Hunks

1. Moved: "dir" "dir" +dx 1.0
BF:BFD 1.0 -> 2.0:5/2
up 1.0, down 2.6
pmeunier on April 24, 2021

Hi! I just tested this today, I can confirm it is fixed. I’ll release a new version of Pijul to crates.io as soon as possible. I can’t at the moment because the repository format must still move a little bit, and I’d like to try and minimise that.

pmeunier closed this discussion on April 24, 2021