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
e9403024
Commit
e9403024
authored
Sep 24, 2015
by
Patrick Steinhardt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refdb: look for reflog in commondir
parent
e0a6c28e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
1 deletions
+66
-1
src/refdb_fs.c
+1
-1
tests/worktree/reflog.c
+65
-0
No files found.
src/refdb_fs.c
View file @
e9403024
...
...
@@ -1582,7 +1582,7 @@ static int create_new_reflog_file(const char *filepath)
GIT_INLINE
(
int
)
retrieve_reflog_path
(
git_buf
*
path
,
git_repository
*
repo
,
const
char
*
name
)
{
return
git_buf_join3
(
path
,
'/'
,
repo
->
path_repository
,
GIT_REFLOG_DIR
,
name
);
return
git_buf_join3
(
path
,
'/'
,
repo
->
commondir
,
GIT_REFLOG_DIR
,
name
);
}
static
int
refdb_reflog_fs__ensure_log
(
git_refdb_backend
*
_backend
,
const
char
*
name
)
...
...
tests/worktree/reflog.c
0 → 100644
View file @
e9403024
#include "clar_libgit2.h"
#include "worktree_helpers.h"
#include "reflog.h"
#define COMMON_REPO "testrepo"
#define WORKTREE_REPO "testrepo-worktree"
#define REFLOG "refs/heads/testrepo-worktree"
#define REFLOG_MESSAGE "reflog message"
static
worktree_fixture
fixture
=
WORKTREE_FIXTURE_INIT
(
COMMON_REPO
,
WORKTREE_REPO
);
void
test_worktree_reflog__initialize
(
void
)
{
setup_fixture_worktree
(
&
fixture
);
}
void
test_worktree_reflog__cleanup
(
void
)
{
cleanup_fixture_worktree
(
&
fixture
);
}
void
test_worktree_reflog__read
(
void
)
{
git_reflog
*
reflog
;
const
git_reflog_entry
*
entry
;
cl_git_pass
(
git_reflog_read
(
&
reflog
,
fixture
.
worktree
,
REFLOG
));
cl_assert_equal_i
(
git_reflog_entrycount
(
reflog
),
1
);
entry
=
git_reflog_entry_byindex
(
reflog
,
0
);
cl_assert
(
entry
!=
NULL
);
cl_assert_equal_s
(
git_reflog_entry_message
(
entry
),
"branch: Created from HEAD"
);
git_reflog_free
(
reflog
);
}
void
test_worktree_reflog__append_then_read
(
void
)
{
git_reflog
*
reflog
,
*
parent_reflog
;
const
git_reflog_entry
*
entry
;
git_reference
*
head
;
git_signature
*
sig
;
const
git_oid
*
oid
;
cl_git_pass
(
git_repository_head
(
&
head
,
fixture
.
worktree
));
cl_assert
((
oid
=
git_reference_target
(
head
))
!=
NULL
);
cl_git_pass
(
git_signature_now
(
&
sig
,
"foo"
,
"foo@bar"
));
cl_git_pass
(
git_reflog_read
(
&
reflog
,
fixture
.
worktree
,
REFLOG
));
cl_git_pass
(
git_reflog_append
(
reflog
,
oid
,
sig
,
REFLOG_MESSAGE
));
git_reflog_write
(
reflog
);
cl_git_pass
(
git_reflog_read
(
&
parent_reflog
,
fixture
.
repo
,
REFLOG
));
entry
=
git_reflog_entry_byindex
(
parent_reflog
,
0
);
cl_assert
(
git_oid_cmp
(
oid
,
&
entry
->
oid_old
)
==
0
);
cl_assert
(
git_oid_cmp
(
oid
,
&
entry
->
oid_cur
)
==
0
);
git_reference_free
(
head
);
git_signature_free
(
sig
);
git_reflog_free
(
reflog
);
git_reflog_free
(
parent_reflog
);
}
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