Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
eb0a3afd
Commit
eb0a3afd
authored
7 years ago
by
Sven Strickroth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
worktree: Read worktree specific reflog for HEAD
Signed-off-by: Sven Strickroth <email@cs-ware.de>
parent
2a11eaf3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
src/refdb_fs.c
+2
-0
tests/worktree/reflog.c
+26
-0
No files found.
src/refdb_fs.c
View file @
eb0a3afd
...
...
@@ -1603,6 +1603,8 @@ static int create_new_reflog_file(const char *filepath)
GIT_INLINE
(
int
)
retrieve_reflog_path
(
git_buf
*
path
,
git_repository
*
repo
,
const
char
*
name
)
{
if
(
strcmp
(
name
,
GIT_HEAD_FILE
)
==
0
)
return
git_buf_join3
(
path
,
'/'
,
repo
->
gitdir
,
GIT_REFLOG_DIR
,
name
);
return
git_buf_join3
(
path
,
'/'
,
repo
->
commondir
,
GIT_REFLOG_DIR
,
name
);
}
...
...
This diff is collapsed.
Click to expand it.
tests/worktree/reflog.c
View file @
eb0a3afd
...
...
@@ -22,6 +22,32 @@ void test_worktree_reflog__cleanup(void)
cleanup_fixture_worktree
(
&
fixture
);
}
void
test_worktree_reflog__read_worktree_HEAD
(
void
)
{
git_reflog
*
reflog
;
const
git_reflog_entry
*
entry
;
cl_git_pass
(
git_reflog_read
(
&
reflog
,
fixture
.
worktree
,
"HEAD"
));
cl_assert_equal_i
(
1
,
git_reflog_entrycount
(
reflog
));
entry
=
git_reflog_entry_byindex
(
reflog
,
0
);
cl_assert
(
entry
!=
NULL
);
cl_assert_equal_s
(
"checkout: moving from 099fabac3a9ea935598528c27f866e34089c2eff to testrepo-worktree"
,
git_reflog_entry_message
(
entry
));
git_reflog_free
(
reflog
);
}
void
test_worktree_reflog__read_parent_HEAD
(
void
)
{
git_reflog
*
reflog
;
cl_git_pass
(
git_reflog_read
(
&
reflog
,
fixture
.
repo
,
"HEAD"
));
/* there is no logs/HEAD in the parent repo */
cl_assert_equal_i
(
0
,
git_reflog_entrycount
(
reflog
));
git_reflog_free
(
reflog
);
}
void
test_worktree_reflog__read
(
void
)
{
git_reflog
*
reflog
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment