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
8db9fd3b
Unverified
Commit
8db9fd3b
authored
Feb 02, 2019
by
Etienne Samson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refdb: documentation
parent
5fc27aac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
22 deletions
+58
-22
include/git2/sys/refdb_backend.h
+57
-21
src/refdb_fs.c
+1
-1
No files found.
include/git2/sys/refdb_backend.h
View file @
8db9fd3b
...
@@ -58,11 +58,12 @@ struct git_reference_iterator {
...
@@ -58,11 +58,12 @@ struct git_reference_iterator {
/** An instance for a custom backend */
/** An instance for a custom backend */
struct
git_refdb_backend
{
struct
git_refdb_backend
{
unsigned
int
version
;
unsigned
int
version
;
/**< The backend API version */
/**
/**
* Queries the refdb backend to determine if the given ref_name
* Queries the refdb backend for the existence of a reference.
* exists. A refdb implementation must provide this function.
*
* A refdb implementation must provide this function.
*/
*/
int
GIT_CALLBACK
(
exists
)(
int
GIT_CALLBACK
(
exists
)(
int
*
exists
,
int
*
exists
,
...
@@ -70,8 +71,9 @@ struct git_refdb_backend {
...
@@ -70,8 +71,9 @@ struct git_refdb_backend {
const
char
*
ref_name
);
const
char
*
ref_name
);
/**
/**
* Queries the refdb backend for a given reference. A refdb
* Queries the refdb backend for a given reference.
* implementation must provide this function.
*
* A refdb implementation must provide this function.
*/
*/
int
GIT_CALLBACK
(
lookup
)(
int
GIT_CALLBACK
(
lookup
)(
git_reference
**
out
,
git_reference
**
out
,
...
@@ -88,82 +90,116 @@ struct git_refdb_backend {
...
@@ -88,82 +90,116 @@ struct git_refdb_backend {
struct
git_refdb_backend
*
backend
,
struct
git_refdb_backend
*
backend
,
const
char
*
glob
);
const
char
*
glob
);
/*
/**
* Writes the given reference to the refdb. A refdb implementation
* Writes the given reference to the refdb.
* must provide this function.
*
* A refdb implementation must provide this function.
*/
*/
int
GIT_CALLBACK
(
write
)(
git_refdb_backend
*
backend
,
int
GIT_CALLBACK
(
write
)(
git_refdb_backend
*
backend
,
const
git_reference
*
ref
,
int
force
,
const
git_reference
*
ref
,
int
force
,
const
git_signature
*
who
,
const
char
*
message
,
const
git_signature
*
who
,
const
char
*
message
,
const
git_oid
*
old
,
const
char
*
old_target
);
const
git_oid
*
old
,
const
char
*
old_target
);
/**
* Rename a reference in the refdb.
*
* A refdb implementation must provide this function.
*/
int
GIT_CALLBACK
(
rename
)(
int
GIT_CALLBACK
(
rename
)(
git_reference
**
out
,
git_refdb_backend
*
backend
,
git_reference
**
out
,
git_refdb_backend
*
backend
,
const
char
*
old_name
,
const
char
*
new_name
,
int
force
,
const
char
*
old_name
,
const
char
*
new_name
,
int
force
,
const
git_signature
*
who
,
const
char
*
message
);
const
git_signature
*
who
,
const
char
*
message
);
/**
/**
* Deletes the given reference (and if necessary its reflog)
* Deletes the given reference from the refdb.
* from the refdb. A refdb implementation must provide this
*
* function.
* If it exists, its reflog should be deleted as well.
*
* A refdb implementation must provide this function.
*/
*/
int
GIT_CALLBACK
(
del
)(
git_refdb_backend
*
backend
,
const
char
*
ref_name
,
const
git_oid
*
old_id
,
const
char
*
old_target
);
int
GIT_CALLBACK
(
del
)(
git_refdb_backend
*
backend
,
const
char
*
ref_name
,
const
git_oid
*
old_id
,
const
char
*
old_target
);
/**
/**
* Suggests that the given refdb compress or optimize its references.
* Suggests that the given refdb compress or optimize its references.
* This mechanism is implementation specific. (For on-disk reference
*
* databases, this may pack all loose references.) A refdb
* This mechanism is implementation specific. For on-disk reference
* implementation may provide this function; if it is not provided,
* databases, this may pack all loose references.
* nothing will be done.
*
* A refdb implementation may provide this function; if it is not
* provided, nothing will be done.
*/
*/
int
GIT_CALLBACK
(
compress
)(
git_refdb_backend
*
backend
);
int
GIT_CALLBACK
(
compress
)(
git_refdb_backend
*
backend
);
/**
/**
* Query whether a particular reference has a log (may be empty)
* Query whether a particular reference has a log (may be empty)
*
* A refdb implementation must provide this function.
*/
*/
int
GIT_CALLBACK
(
has_log
)(
git_refdb_backend
*
backend
,
const
char
*
refname
);
int
GIT_CALLBACK
(
has_log
)(
git_refdb_backend
*
backend
,
const
char
*
refname
);
/**
/**
* Make sure a particular reference will have a reflog which
* Make sure a particular reference will have a reflog which
* will be appended to on writes.
* will be appended to on writes.
*
* A refdb implementation must provide this function.
*/
*/
int
GIT_CALLBACK
(
ensure_log
)(
git_refdb_backend
*
backend
,
const
char
*
refname
);
int
GIT_CALLBACK
(
ensure_log
)(
git_refdb_backend
*
backend
,
const
char
*
refname
);
/**
/**
* Frees any resources held by the refdb (including the `git_refdb_backend`
* Frees any resources held by the refdb (including the `git_refdb_backend`
* itself). A refdb backend implementation must provide this function.
* itself).
*
* A refdb backend implementation must provide this function.
*/
*/
void
GIT_CALLBACK
(
free
)(
git_refdb_backend
*
backend
);
void
GIT_CALLBACK
(
free
)(
git_refdb_backend
*
backend
);
/**
/**
* Read the reflog for the given reference name.
* Read the reflog for the given reference name.
*
* A refdb implementation must provide this function.
*/
*/
int
GIT_CALLBACK
(
reflog_read
)(
git_reflog
**
out
,
git_refdb_backend
*
backend
,
const
char
*
name
);
int
GIT_CALLBACK
(
reflog_read
)(
git_reflog
**
out
,
git_refdb_backend
*
backend
,
const
char
*
name
);
/**
/**
* Write a reflog to disk.
* Write a reflog to disk.
*
* A refdb implementation must provide this function.
*/
*/
int
GIT_CALLBACK
(
reflog_write
)(
git_refdb_backend
*
backend
,
git_reflog
*
reflog
);
int
GIT_CALLBACK
(
reflog_write
)(
git_refdb_backend
*
backend
,
git_reflog
*
reflog
);
/**
/**
* Rename a reflog
* Rename a reflog.
*
* A refdb implementation must provide this function.
*/
*/
int
GIT_CALLBACK
(
reflog_rename
)(
git_refdb_backend
*
_backend
,
const
char
*
old_name
,
const
char
*
new_name
);
int
GIT_CALLBACK
(
reflog_rename
)(
git_refdb_backend
*
_backend
,
const
char
*
old_name
,
const
char
*
new_name
);
/**
/**
* Remove a reflog.
* Remove a reflog.
*
* A refdb implementation must provide this function.
*/
*/
int
GIT_CALLBACK
(
reflog_delete
)(
git_refdb_backend
*
backend
,
const
char
*
name
);
int
GIT_CALLBACK
(
reflog_delete
)(
git_refdb_backend
*
backend
,
const
char
*
name
);
/**
/**
* Lock a reference. The opaque parameter will be passed to the unlock function
* Lock a reference.
*
* The opaque parameter will be passed to the unlock function.
*
* A refdb implementation may provide this function; if it is not
* provided, the transaction API will fail to work.
*/
*/
int
GIT_CALLBACK
(
lock
)(
void
**
payload_out
,
git_refdb_backend
*
backend
,
const
char
*
refname
);
int
GIT_CALLBACK
(
lock
)(
void
**
payload_out
,
git_refdb_backend
*
backend
,
const
char
*
refname
);
/**
/**
* Unlock a reference. Only one of target or symbolic_target
* Unlock a reference.
* will be set. success indicates whether to update the
*
* reference or discard the lock (if it's false)
* Only one of target or symbolic_target will be set.
* `success` will be true if the reference should be update, false if
* the lock must be discarded.
*
* A refdb implementation must provide this function if a `lock`
* implementation is provided.
*/
*/
int
GIT_CALLBACK
(
unlock
)(
git_refdb_backend
*
backend
,
void
*
payload
,
int
success
,
int
update_reflog
,
int
GIT_CALLBACK
(
unlock
)(
git_refdb_backend
*
backend
,
void
*
payload
,
int
success
,
int
update_reflog
,
const
git_reference
*
ref
,
const
git_signature
*
sig
,
const
char
*
message
);
const
git_reference
*
ref
,
const
git_signature
*
sig
,
const
char
*
message
);
...
...
src/refdb_fs.c
View file @
8db9fd3b
...
@@ -1904,7 +1904,7 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
...
@@ -1904,7 +1904,7 @@ static int reflog_append(refdb_fs_backend *backend, const git_reference *ref, co
!
(
old
&&
new
))
!
(
old
&&
new
))
return
0
;
return
0
;
/* From here on is_sym
ob
lic also means that it's HEAD */
/* From here on is_sym
bo
lic also means that it's HEAD */
if
(
old
)
{
if
(
old
)
{
git_oid_cpy
(
&
old_id
,
old
);
git_oid_cpy
(
&
old_id
,
old
);
...
...
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