radicle-dev / radicle-git

Everything Radicle growing around Git
Other
35 stars 5 forks source link

radicle-git-ext: Display timezone offset in the format git2 expects. #128

Closed xphoniex closed 1 year ago

xphoniex commented 1 year ago

Currently timezone offset is shown as absolute minutes, whereas git/git2 expects HH:MM format.

Par exemple, patch ef9b36f0eb5e89e21a55505fdee4cc140b639fc2 opened by cloudhead:

⮀ rad patch show ef9b36f
╭──────────────────────────────────────────────────────────────────────────────────╮
│ Title    node: Delete unsigned refs on fetch                                     │
│ Patch    ef9b36f0eb5e89e21a55505fdee4cc140b639fc2                                │
│ Author   did:key:z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT                │
│ Head     2598886018db208ddc04a68a3e160daa93ddd7f0                                │
│ Commits  ahead 0, behind 101                                                     │
│ Status   merged                                                                  │
│                                                                                  │
│ Deletes refs that are not included in a remote's *sigrefs*,                      │
│ since they shouldn't be replicated.                                              │
├──────────────────────────────────────────────────────────────────────────────────┤
│ ● opened by did:key:z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT 3 weeks ago │
│ ↑ updated to 10da89b13075989b594df062e1818b5f2fdb23d9 (58fc51e) 2 weeks ago      │
│ ✓ merged by did:key:z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT 2 weeks ago │
│ ↑ updated to 054d60061d38b25777fa995b5b897e94a808d94c (2598886) 2 weeks ago      │
╰──────────────────────────────────────────────────────────────────────────────────╯

should be showing timezone of CEST which is UTC+02 however:

⮀ pwd
/.radicle/storage/z3gqcJUoA1n9HaHKufZs5FCSGazv5

⮀ git cat-file -p ef9b36f0eb5e89e21a55505fdee4cc140b639fc2
tree 7cb005cc3b629db6f8b2d106d9a21fe3533a90a5
parent 8202e586164b03d5ec69e7a6c2aa63d90f55d44f
author radicle <radicle@localhost> 1681830067 +0120
committer radicle <radicle@localhost> 1681830067 +0120
gpgsig -----BEGIN SSH SIGNATURE-----
 U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgvjrQogRxxLjzzWns8+mKJAGzEX
 4fm2ALoN7pyvD2ttQAAAAHcmFkaWNsZQAAAAAAAAAGc2hhMjU2AAAAUwAAAAtzc2gtZWQy
 NTUxOQAAAEC/jmUR3eeQZuAhYNPShNns3+17fuwbjscDClxyOts2hVFFIZHY/yJy3f+Onq
 807vx25oHA6feEMqj8EhtV6gEO
 -----END SSH SIGNATURE-----

Create patch

Rad-Resource: 8202e586164b03d5ec69e7a6c2aa63d90f55d44f

it's showing 120 minutes, not the expected timezone, which is +0200.

xphoniex commented 1 year ago

I seem to have broken the tests and adding https://github.com/radicle-dev/radicle-git/pull/128/commits/8196ebfaab9cf7895b95b757e9470170d42e5a22 didn't help either.

FintanH commented 1 year ago

Thanks for finding the issue! It was missing the parse logic as well, silly me :facepalm: I pushed a combined commit and added more detail to the git message