~radicle-link/dev

radicle-link: git-ext: fix to write v1 PROPOSED

Fintan Halpenny: 1
 git-ext: fix to write

 2 files changed, 13 insertions(+), 3 deletions(-)
#810568 nixos-latest.yml failed
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~radicle-link/dev/patches/34229/mbox | git am -3
Learn more about email & git

[PATCH radicle-link v1] git-ext: fix to write Export this patch

Remembering file modes and entering them into a text editor is error
prone when a compiler does not check you have done it
correctly. Unfortunately, there was a missing `0` for the file mode
for writing a tree entry.

Use the `FileMode` enum instead and its instance for `Into<i32>`.

The tracked_reference test that is using `quick_commit` was altered to
test that a tree with sub directories can be written.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
---

Published-as: https://github.com/FintanH/radicle-link/tree/patches/fix%2Ftree-write%2Fv1

 git-ext/src/tree.rs                                  |  4 ++--
 .../t/src/integration/scenario/tracked_references.rs | 12 +++++++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/git-ext/src/tree.rs b/git-ext/src/tree.rs
index 589a781d..86106b5b 100644
--- a/git-ext/src/tree.rs
+++ b/git-ext/src/tree.rs
@@ -69,11 +69,11 @@ impl Tree<'_> {
            match node {
                Blob(data) => {
                    let oid = repo.blob(data)?;
                    builder.insert(name.as_ref(), oid, 0o100644)?;
                    builder.insert(name.as_ref(), oid, git2::FileMode::Blob.into())?;
                },
                Tree(sub) => {
                    let oid = sub.write(repo)?;
                    builder.insert(name.as_ref(), oid, 0o04000)?;
                    builder.insert(name.as_ref(), oid, git2::FileMode::Tree.into())?;
                },
            }
        }
diff --git a/librad/t/src/integration/scenario/tracked_references.rs b/librad/t/src/integration/scenario/tracked_references.rs
index e2d9b729..c58265dd 100644
--- a/librad/t/src/integration/scenario/tracked_references.rs
+++ b/librad/t/src/integration/scenario/tracked_references.rs
@@ -111,7 +111,17 @@ fn can_see_tracked_references() {
                    quick_commit(
                        storage,
                        &urn.with_path(reflike!("refs/heads/master")),
                        vec![("HI", tree::blob(b"Hi Bob"))].into_iter().collect(),
                        vec![
                            ("HI", tree::blob(b"Hi Bob")),
                            (
                                "src",
                                vec![("main.rs", tree::blob(b"fn main() {}"))]
                                    .into_iter()
                                    .collect(),
                            ),
                        ]
                        .into_iter()
                        .collect(),
                        "say hi to bob",
                    )
                }
-- 
2.31.1
LGTM
radicle-link/patches/nixos-latest.yml: FAILED in 15m38s

[git-ext: fix to write][0] from [Fintan Halpenny][1]

[0]: https://lists.sr.ht/~radicle-link/dev/patches/34229
[1]: mailto:fintan.halpenny@gmail.com

✗ #810568 FAILED radicle-link/patches/nixos-latest.yml https://builds.sr.ht/~radicle-link/job/810568