Commit ea5b51b
committed
fix(repository): dereference reflog identity correctly
Since its introduction in commit 81520c9 (Update to libgit2 v0.23),
the reflog identity getter (Repository.ident) has been
passing the (char **) variables directly to ffi.string()
as C-strings, when they really are pointers to C-strings.
Fix by dereferencing the pointer to a C-string first.
Furthermore, Repository.ident assumes that libgit2 holds
a valid C-string, when the reflog identity is initialized
to NULL, and can be explicitly set to such with `set_ident
(None, None)`. So map None to ffi.NULL (which maybe_string()
happens to already do, so I simply delegated to that...).
I also added a few regression tests to ensure neither issue
shows up again.
Signed-off-by: Ethan Meng <ethan@rapidcow.org>1 parent 7fd5bfd commit ea5b51b
2 files changed
Lines changed: 15 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
1585 | 1585 | | |
1586 | 1586 | | |
1587 | 1587 | | |
1588 | | - | |
| 1588 | + | |
1589 | 1589 | | |
1590 | 1590 | | |
1591 | 1591 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
644 | 657 | | |
645 | 658 | | |
646 | 659 | | |
| |||
0 commit comments