Commit Graph
8 Commits
Author SHA1 Message Date
Han Xu 7f80ab117d git-commit: remove useless check when converting trailers to string.
Signed-off-by: Han Xu <keepsimple@gmail.com>
2023-02-08 00:26:46 -08:00
Fintan Halpenny 7036923712 nix: update to rust-1.67
Rust 1.67 was announced[0].

Update the nix sources to be on par with the latest rustc version.

This required fixes to clippy warnings for using variable
interpolation for format strings.

There was also an advisory error related to libgit2-sys[1], which is
transitively depended on via git2. The fix is included in the 0.16.1
version of git2.

[0]: https://blog.rust-lang.org/2023/01/26/Rust-1.67.0.html
[1]: https://rustsec.org/advisories/RUSTSEC-2023-0003

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2023-01-30 11:00:22 +00:00
Fintan Halpenny a65ff27e22 git-commit: add Time accessors
Previously, there was no way to access the seconds and offset fields
of the Time type.

Add methods for accessing the fields.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-12-19 15:54:52 +00:00
Fintan Halpenny 295b0d25e5 git-commit: fix to lack of newline separation
There was an issue where the trailers were not properly separated from
the commit message itself. In fact, a new line is not added if there
are not trailers either.

Add a fix to add a newline after the commit message. Also adding test
cases to test 0, 1, or 2 trailers in a git commit.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-11-28 10:07:08 +00:00
Fintan Halpenny ae4e7bce59 git-commit: fix for trailer handling
If a Commit was constructed with trailers, they would not be added to
the buffer for committing.

Fix this by parsing the message by inspecting each line for a
potential trailer, if there is one then store it for later, otherwise
keep it as part of the message. This means that a message stays intact
even if a trailer that is expected to parse did not.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-11-04 14:45:10 +00:00
Fintan Halpenny fefe20343f git-commit: add a description field to Cargo.toml
Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-11-04 12:53:53 +00:00
Fintan Halpenny 9dec69a29a git-commit: add trailers to Commit
Add git trailers to the data of the Commit.

For convenience, git2 is used to extract the git trailers and they are
then converted to `OwnedTrailer`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-11-04 12:33:17 +00:00
Fintan Halpenny 8745e46745 git-commit: introduce git-commit crate
Porting the commit code that is found in heartwood[0]. It represents a
parsed git commit object -- sans the id for the commit itself.

[0]: https://github.com/radicle-dev/heartwood/blob/16b22d9178fa6a1aaf2ecb01ec97e067399c5286/radicle/src/git.rs#L392-L575

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
2022-11-04 12:33:17 +00:00