worktree: Read worktree specific reflog for HEAD#4577
worktree: Read worktree specific reflog for HEAD#4577pks-t merged 1 commit intolibgit2:masterfrom csware:reflog-worktree-head
Conversation
|
|
||
| GIT_INLINE(int) retrieve_reflog_path(git_buf *path, git_repository *repo, const char *name) | ||
| { | ||
| if (strcmp("HEAD", name) == 0) |
There was a problem hiding this comment.
We would prefer the constant GIT_HEAD_FILE here, eg:
if (strcmp(name, GIT_HEAD_FILE) == 0)
There was a problem hiding this comment.
Yeah, haven't found that constant when coding.
|
|
||
| entry = git_reflog_entry_byindex(reflog, 0); | ||
| cl_assert(entry != NULL); | ||
| cl_assert_equal_s(git_reflog_entry_message(entry), "checkout: moving from 099fabac3a9ea935598528c27f866e34089c2eff to testrepo-worktree"); |
There was a problem hiding this comment.
Our cl_assert tests are for expected followed by actual. Could you please flip-flop these, eg:
`cl_assert_equal_i(1, git_reflog_entrycount)refcount)`, and
`cl_assert_equal_s("checkout: ...", git_reflog_entry_message(entry))`
There was a problem hiding this comment.
I just copied the test case from this file, so it's also flipped there...
|
|
||
| cl_git_pass(git_reflog_read(&reflog, fixture.repo, "HEAD")); | ||
| // there is no logs/HEAD in the common repo | ||
| cl_assert_equal_i(git_reflog_entrycount(reflog), 0); |
There was a problem hiding this comment.
Here also, if you would please flip-flop these values:
cl_assert_equal_i(0, git_reflog...)
|
I have a few minor comments on the codestyle - I think that it would make sense for @pks-t to weigh in on the actual functionality, since he's the worktree expert. |
pks-t
left a comment
There was a problem hiding this comment.
Thanks for this PR, looks good to me. Only thing left is a C++-style comment. Other than that, I'm fine with it
| git_reflog *reflog; | ||
|
|
||
| cl_git_pass(git_reflog_read(&reflog, fixture.repo, "HEAD")); | ||
| // there is no logs/HEAD in the parent repo |
There was a problem hiding this comment.
C++-style comments are not allowed in libgit2 due to us using C90
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
Thanks @csware, looks good! |
Wrong reflog for
HEADis read for worktree.Fixes issue #4566.