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
d284b3de
Commit
d284b3de
authored
Jul 16, 2012
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reflog: rename git_reflog_write() to git_reflog_append()
parent
59341a5d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
include/git2/reflog.h
+2
-2
src/reflog.c
+1
-1
tests-clar/refs/reflog/reflog.c
+8
-8
No files found.
include/git2/reflog.h
View file @
d284b3de
...
@@ -33,7 +33,7 @@ GIT_BEGIN_DECL
...
@@ -33,7 +33,7 @@ GIT_BEGIN_DECL
GIT_EXTERN
(
int
)
git_reflog_read
(
git_reflog
**
reflog
,
git_reference
*
ref
);
GIT_EXTERN
(
int
)
git_reflog_read
(
git_reflog
**
reflog
,
git_reference
*
ref
);
/**
/**
*
Write a new
reflog for the given reference
*
Add a new entry to the
reflog for the given reference
*
*
* If there is no reflog file for the given
* If there is no reflog file for the given
* reference yet, it will be created.
* reference yet, it will be created.
...
@@ -48,7 +48,7 @@ GIT_EXTERN(int) git_reflog_read(git_reflog **reflog, git_reference *ref);
...
@@ -48,7 +48,7 @@ GIT_EXTERN(int) git_reflog_read(git_reflog **reflog, git_reference *ref);
* @param msg the reflog message
* @param msg the reflog message
* @return 0 or an error code
* @return 0 or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reflog_
write
(
git_reference
*
ref
,
const
git_oid
*
oid_old
,
const
git_signature
*
committer
,
const
char
*
msg
);
GIT_EXTERN
(
int
)
git_reflog_
append
(
git_reference
*
ref
,
const
git_oid
*
oid_old
,
const
git_signature
*
committer
,
const
char
*
msg
);
/**
/**
* Rename the reflog for the given reference
* Rename the reflog for the given reference
...
...
src/reflog.c
View file @
d284b3de
...
@@ -216,7 +216,7 @@ int git_reflog_read(git_reflog **reflog, git_reference *ref)
...
@@ -216,7 +216,7 @@ int git_reflog_read(git_reflog **reflog, git_reference *ref)
return
error
;
return
error
;
}
}
int
git_reflog_
write
(
git_reference
*
ref
,
const
git_oid
*
oid_old
,
int
git_reflog_
append
(
git_reference
*
ref
,
const
git_oid
*
oid_old
,
const
git_signature
*
committer
,
const
char
*
msg
)
const
git_signature
*
committer
,
const
char
*
msg
)
{
{
int
error
;
int
error
;
...
...
tests-clar/refs/reflog/reflog.c
View file @
d284b3de
...
@@ -36,7 +36,7 @@ void test_refs_reflog_reflog__cleanup(void)
...
@@ -36,7 +36,7 @@ void test_refs_reflog_reflog__cleanup(void)
void
test_refs_reflog_reflog__
write
_then_read
(
void
)
void
test_refs_reflog_reflog__
append
_then_read
(
void
)
{
{
// write a reflog for a given reference and ensure it can be read back
// write a reflog for a given reference and ensure it can be read back
git_repository
*
repo2
;
git_repository
*
repo2
;
...
@@ -55,10 +55,10 @@ void test_refs_reflog_reflog__write_then_read(void)
...
@@ -55,10 +55,10 @@ void test_refs_reflog_reflog__write_then_read(void)
cl_git_pass
(
git_signature_now
(
&
committer
,
"foo"
,
"foo@bar"
));
cl_git_pass
(
git_signature_now
(
&
committer
,
"foo"
,
"foo@bar"
));
cl_git_pass
(
git_reflog_
write
(
ref
,
NULL
,
committer
,
NULL
));
cl_git_pass
(
git_reflog_
append
(
ref
,
NULL
,
committer
,
NULL
));
cl_git_fail
(
git_reflog_
write
(
ref
,
NULL
,
committer
,
"no ancestor NULL for an existing reflog"
));
cl_git_fail
(
git_reflog_
append
(
ref
,
NULL
,
committer
,
"no ancestor NULL for an existing reflog"
));
cl_git_fail
(
git_reflog_
write
(
ref
,
NULL
,
committer
,
"no
\n
newline"
));
cl_git_fail
(
git_reflog_
append
(
ref
,
NULL
,
committer
,
"no
\n
newline"
));
cl_git_pass
(
git_reflog_
write
(
ref
,
&
oid
,
committer
,
commit_msg
));
cl_git_pass
(
git_reflog_
append
(
ref
,
&
oid
,
committer
,
commit_msg
));
/* Reopen a new instance of the repository */
/* Reopen a new instance of the repository */
cl_git_pass
(
git_repository_open
(
&
repo2
,
"testrepo.git"
));
cl_git_pass
(
git_repository_open
(
&
repo2
,
"testrepo.git"
));
...
@@ -94,7 +94,7 @@ void test_refs_reflog_reflog__write_then_read(void)
...
@@ -94,7 +94,7 @@ void test_refs_reflog_reflog__write_then_read(void)
git_reference_free
(
lookedup_ref
);
git_reference_free
(
lookedup_ref
);
}
}
void
test_refs_reflog_reflog__dont_
write
_bad
(
void
)
void
test_refs_reflog_reflog__dont_
append
_bad
(
void
)
{
{
// avoid writing an obviously wrong reflog
// avoid writing an obviously wrong reflog
git_reference
*
ref
;
git_reference
*
ref
;
...
@@ -110,12 +110,12 @@ void test_refs_reflog_reflog__dont_write_bad(void)
...
@@ -110,12 +110,12 @@ void test_refs_reflog_reflog__dont_write_bad(void)
cl_git_pass
(
git_signature_now
(
&
committer
,
"foo"
,
"foo@bar"
));
cl_git_pass
(
git_signature_now
(
&
committer
,
"foo"
,
"foo@bar"
));
/* Write the reflog for the new branch */
/* Write the reflog for the new branch */
cl_git_pass
(
git_reflog_
write
(
ref
,
NULL
,
committer
,
NULL
));
cl_git_pass
(
git_reflog_
append
(
ref
,
NULL
,
committer
,
NULL
));
/* Try to update the reflog with wrong information:
/* Try to update the reflog with wrong information:
* It's no new reference, so the ancestor OID cannot
* It's no new reference, so the ancestor OID cannot
* be NULL. */
* be NULL. */
cl_git_fail
(
git_reflog_
write
(
ref
,
NULL
,
committer
,
NULL
));
cl_git_fail
(
git_reflog_
append
(
ref
,
NULL
,
committer
,
NULL
));
git_signature_free
(
committer
);
git_signature_free
(
committer
);
...
...
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