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
f04c7dca
Commit
f04c7dca
authored
Jan 15, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2050 from libgit2/cmn/always-reflog-message
refs: remove the _with_log differentiation
parents
dec1ac75
0b28217b
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
162 additions
and
271 deletions
+162
-271
include/git2/refs.h
+24
-128
src/branch.c
+1
-1
src/commit.c
+1
-1
src/push.c
+1
-1
src/refs.c
+53
-59
src/refs.h
+1
-1
src/remote.c
+1
-1
src/repository.c
+4
-4
src/reset.c
+1
-1
src/stash.c
+2
-2
src/tag.c
+2
-2
src/transports/local.c
+1
-1
tests/checkout/tree.c
+1
-1
tests/commit/write.c
+1
-1
tests/diff/rename.c
+3
-3
tests/merge/merge_helpers.c
+1
-1
tests/merge/workdir/simple.c
+1
-1
tests/merge/workdir/trivial.c
+1
-1
tests/refs/branches/delete.c
+1
-1
tests/refs/branches/ishead.c
+3
-3
tests/refs/branches/iterator.c
+2
-2
tests/refs/crashes.c
+1
-1
tests/refs/create.c
+8
-8
tests/refs/createwithlog.c
+1
-1
tests/refs/delete.c
+1
-1
tests/refs/foreachglob.c
+1
-1
tests/refs/overwrite.c
+13
-13
tests/refs/pack.c
+2
-2
tests/refs/reflog/reflog.c
+5
-5
tests/refs/rename.c
+5
-5
tests/refs/revparse.c
+2
-1
tests/refs/settargetwithlog.c
+1
-1
tests/refs/setter.c
+5
-5
tests/refs/unicode.c
+1
-1
tests/refs/update.c
+1
-1
tests/repo/head.c
+3
-3
tests/repo/repo_helpers.c
+1
-1
tests/stash/save.c
+1
-1
tests/submodule/lookup.c
+1
-1
tests/threads/refdb.c
+3
-3
No files found.
include/git2/refs.h
View file @
f04c7dca
...
@@ -89,37 +89,9 @@ GIT_EXTERN(int) git_reference_dwim(git_reference **out, git_repository *repo, co
...
@@ -89,37 +89,9 @@ GIT_EXTERN(int) git_reference_dwim(git_reference **out, git_repository *repo, co
* This function will return an error if a reference already exists with the
* This function will return an error if a reference already exists with the
* given name unless `force` is true, in which case it will be overwritten.
* given name unless `force` is true, in which case it will be overwritten.
*
*
* @param out Pointer to the newly created reference
* The signature and message for the reflog will be ignored if the
* @param repo Repository where that reference will live
* reference does not belong in the standard set (HEAD, branches and
* @param name The name of the reference
* remote-tracking branches) and and it does not have a reflog.
* @param target The target of the reference
* @param force Overwrite existing references
* @return 0 on success, GIT_EEXISTS, GIT_EINVALIDSPEC or an error code
*/
GIT_EXTERN
(
int
)
git_reference_symbolic_create
(
git_reference
**
out
,
git_repository
*
repo
,
const
char
*
name
,
const
char
*
target
,
int
force
);
/**
* Create a new symbolic reference and update the reflog with a given
* message.
*
* A symbolic reference is a reference name that refers to another
* reference name. If the other name moves, the symbolic name will move,
* too. As a simple example, the "HEAD" reference might refer to
* "refs/heads/master" while on the "master" branch of a repository.
*
* The symbolic reference will be created in the repository and written to
* the disk. The generated reference object must be freed by the user.
*
* Valid reference names must follow one of two patterns:
*
* 1. Top-level names must contain only capital letters and underscores,
* and must begin and end with a letter. (e.g. "HEAD", "ORIG_HEAD").
* 2. Names prefixed with "refs/" can be almost anything. You must avoid
* the characters '~', '^', ':', '\\', '?', '[', and '*', and the
* sequences ".." and "@{" which have special meaning to revparse.
*
* This function will return an error if a reference already exists with the
* given name unless `force` is true, in which case it will be overwritten.
*
*
* @param out Pointer to the newly created reference
* @param out Pointer to the newly created reference
* @param repo Repository where that reference will live
* @param repo Repository where that reference will live
...
@@ -127,18 +99,10 @@ GIT_EXTERN(int) git_reference_symbolic_create(git_reference **out, git_repositor
...
@@ -127,18 +99,10 @@ GIT_EXTERN(int) git_reference_symbolic_create(git_reference **out, git_repositor
* @param target The target of the reference
* @param target The target of the reference
* @param force Overwrite existing references
* @param force Overwrite existing references
* @param signature The identity that will used to populate the reflog entry
* @param signature The identity that will used to populate the reflog entry
* @param log_message The one line long message that has to be appended
* @param log_message The one line long message to be appended to the reflog
* to the reflog
* @return 0 on success, GIT_EEXISTS, GIT_EINVALIDSPEC or an error code
* @return 0 on success, EEXISTS, EINVALIDSPEC or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reference_symbolic_create_with_log
(
GIT_EXTERN
(
int
)
git_reference_symbolic_create
(
git_reference
**
out
,
git_repository
*
repo
,
const
char
*
name
,
const
char
*
target
,
int
force
,
const
git_signature
*
signature
,
const
char
*
log_message
);
git_reference
**
out
,
git_repository
*
repo
,
const
char
*
name
,
const
char
*
target
,
int
force
,
const
git_signature
*
signature
,
const
char
*
log_message
);
/**
/**
* Create a new direct reference.
* Create a new direct reference.
...
@@ -163,57 +127,21 @@ GIT_EXTERN(int) git_reference_symbolic_create_with_log(
...
@@ -163,57 +127,21 @@ GIT_EXTERN(int) git_reference_symbolic_create_with_log(
* This function will return an error if a reference already exists with the
* This function will return an error if a reference already exists with the
* given name unless `force` is true, in which case it will be overwritten.
* given name unless `force` is true, in which case it will be overwritten.
*
*
* @param out Pointer to the newly created reference
* The signature and message for the reflog will be ignored if the
* @param repo Repository where that reference will live
* reference does not belong in the standard set (HEAD, branches and
* @param name The name of the reference
* remote-tracking branches) and and it does not have a reflog.
* @param id The object id pointed to by the reference.
* @param force Overwrite existing references
* @return 0 on success, GIT_EEXISTS, GIT_EINVALIDSPEC or an error code
*/
GIT_EXTERN
(
int
)
git_reference_create
(
git_reference
**
out
,
git_repository
*
repo
,
const
char
*
name
,
const
git_oid
*
id
,
int
force
);
/**
* Create a new direct reference and update the reflog with a given
* message.
*
* A direct reference (also called an object id reference) refers directly
* to a specific object id (a.k.a. OID or SHA) in the repository. The id
* permanently refers to the object (although the reference itself can be
* moved). For example, in libgit2 the direct ref "refs/tags/v0.17.0"
* refers to OID 5b9fac39d8a76b9139667c26a63e6b3f204b3977.
*
* The direct reference will be created in the repository and written to
* the disk. The generated reference object must be freed by the user.
*
* Valid reference names must follow one of two patterns:
*
* 1. Top-level names must contain only capital letters and underscores,
* and must begin and end with a letter. (e.g. "HEAD", "ORIG_HEAD").
* 2. Names prefixed with "refs/" can be almost anything. You must avoid
* the characters '~', '^', ':', '\\', '?', '[', and '*', and the
* sequences ".." and "@{" which have special meaning to revparse.
*
* This function will return an error if a reference already exists with the
* given name unless `force` is true, in which case it will be overwritten.
*
*
* @param out Pointer to the newly created reference
* @param out Pointer to the newly created reference
* @param repo Repository where that reference will live
* @param repo Repository where that reference will live
* @param name The name of the reference
* @param name The name of the reference
* @param id The object id pointed to by the reference.
* @param id The object id pointed to by the reference.
* @param force Overwrite existing references
* @param force Overwrite existing references
* @param force Overwrite existing references
* @param signature The identity that will used to populate the reflog entry
* @param signature The identity that will used to populate the reflog entry
* @param log_message The one line long message that has to be appended
* @param log_message The one line long message to be appended to the reflog
* to the reflog
* @return 0 on success, GIT_EEXISTS, GIT_EINVALIDSPEC or an error code
* @return 0 on success, EEXISTS, EINVALIDSPEC or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reference_create_with_log
(
GIT_EXTERN
(
int
)
git_reference_create
(
git_reference
**
out
,
git_repository
*
repo
,
const
char
*
name
,
const
git_oid
*
id
,
int
force
,
const
git_signature
*
signature
,
const
char
*
log_message
);
git_reference
**
out
,
git_repository
*
repo
,
const
char
*
name
,
const
git_oid
*
id
,
int
force
,
const
git_signature
*
signature
,
const
char
*
log_message
);
/**
/**
* Get the OID pointed to by a direct reference.
* Get the OID pointed to by a direct reference.
...
@@ -307,35 +235,18 @@ GIT_EXTERN(git_repository *) git_reference_owner(const git_reference *ref);
...
@@ -307,35 +235,18 @@ GIT_EXTERN(git_repository *) git_reference_owner(const git_reference *ref);
* The target name will be checked for validity.
* The target name will be checked for validity.
* See `git_reference_create_symbolic()` for rules about valid names.
* See `git_reference_create_symbolic()` for rules about valid names.
*
*
* @param out Pointer to the newly created reference
* The signature and message for the reflog will be ignored if the
* @param ref The reference
* reference does not belong in the standard set (HEAD, branches and
* @param target The new target for the reference
* remote-tracking branches) and and it does not have a reflog.
* @return 0 on success, GIT_EINVALIDSPEC or an error code
*/
GIT_EXTERN
(
int
)
git_reference_symbolic_set_target
(
git_reference
**
out
,
git_reference
*
ref
,
const
char
*
target
);
/**
* Create a new reference with the same name as the given reference but a
* different symbolic target and update the reflog with a given message.
*
* The reference must be a symbolic reference, otherwise this will fail.
*
* The new reference will be written to disk, overwriting the given reference.
*
* The target name will be checked for validity.
* See `git_reference_create_symbolic()` for rules about valid names.
*
*
* @param out Pointer to the newly created reference
* @param out Pointer to the newly created reference
* @param ref The reference
* @param ref The reference
* @param target The new target for the reference
* @param target The new target for the reference
* @param signature The identity that will used to populate the reflog entry
* @param signature The identity that will used to populate the reflog entry
* @param log_message The one line long message t
hat has to be appended
* @param log_message The one line long message t
o be appended to the reflog
* @return 0 on success, EINVALIDSPEC or an error code
* @return 0 on success,
GIT_
EINVALIDSPEC or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reference_symbolic_set_target
_with_log
(
GIT_EXTERN
(
int
)
git_reference_symbolic_set_target
(
git_reference
**
out
,
git_reference
**
out
,
git_reference
*
ref
,
git_reference
*
ref
,
const
char
*
target
,
const
char
*
target
,
...
@@ -349,33 +260,18 @@ GIT_EXTERN(int) git_reference_symbolic_set_target_with_log(
...
@@ -349,33 +260,18 @@ GIT_EXTERN(int) git_reference_symbolic_set_target_with_log(
*
*
* The new reference will be written to disk, overwriting the given reference.
* The new reference will be written to disk, overwriting the given reference.
*
*
* @param out Pointer to the newly created reference
* The signature and message for the reflog will be ignored if the
* @param ref The reference
* reference does not belong in the standard set (HEAD, branches and
* @param id The new target OID for the reference
* remote-tracking branches) and and it does not have a reflog.
* @return 0 or an error code
*/
GIT_EXTERN
(
int
)
git_reference_set_target
(
git_reference
**
out
,
git_reference
*
ref
,
const
git_oid
*
id
);
/**
* Create a new reference with the same name as the given reference but a
* different OID target and update the reflog with a given message.
*
* The reference must be a direct reference, otherwise this will fail.
*
* The new reference will be written to disk, overwriting the given reference.
*
*
* @param out Pointer to the newly created reference
* @param out Pointer to the newly created reference
* @param ref The reference
* @param ref The reference
* @param id The new target OID for the reference
* @param id The new target OID for the reference
* @param signature The identity that will used to populate the reflog entry
* @param signature The identity that will used to populate the reflog entry
* @param log_message The one line long message that has to be appended
* @param log_message The one line long message to be appended to the reflog
* to the reflog
* @return 0 or an error code
* @return 0 or an error code
*/
*/
GIT_EXTERN
(
int
)
git_reference_set_target
_with_log
(
GIT_EXTERN
(
int
)
git_reference_set_target
(
git_reference
**
out
,
git_reference
**
out
,
git_reference
*
ref
,
git_reference
*
ref
,
const
git_oid
*
id
,
const
git_oid
*
id
,
...
...
src/branch.c
View file @
f04c7dca
...
@@ -72,7 +72,7 @@ int git_branch_create(
...
@@ -72,7 +72,7 @@ int git_branch_create(
goto
cleanup
;
goto
cleanup
;
error
=
git_reference_create
(
&
branch
,
repository
,
error
=
git_reference_create
(
&
branch
,
repository
,
git_buf_cstr
(
&
canonical_branch_name
),
git_commit_id
(
commit
),
force
);
git_buf_cstr
(
&
canonical_branch_name
),
git_commit_id
(
commit
),
force
,
NULL
,
NULL
);
if
(
!
error
)
if
(
!
error
)
*
ref_out
=
branch
;
*
ref_out
=
branch
;
...
...
src/commit.c
View file @
f04c7dca
...
@@ -112,7 +112,7 @@ int git_commit_create_from_oids(
...
@@ -112,7 +112,7 @@ int git_commit_create_from_oids(
git_buf_free
(
&
commit
);
git_buf_free
(
&
commit
);
if
(
update_ref
!=
NULL
)
if
(
update_ref
!=
NULL
)
return
git_reference__update_terminal
(
repo
,
update_ref
,
oid
);
return
git_reference__update_terminal
(
repo
,
update_ref
,
oid
,
NULL
,
NULL
);
return
0
;
return
0
;
...
...
src/push.c
View file @
f04c7dca
...
@@ -241,7 +241,7 @@ int git_push_update_tips(git_push *push)
...
@@ -241,7 +241,7 @@ int git_push_update_tips(git_push *push)
giterr_clear
();
giterr_clear
();
else
else
goto
on_error
;
goto
on_error
;
}
else
if
((
error
=
git_reference_create
(
NULL
,
push
->
remote
->
repo
,
git_buf_cstr
(
&
remote_ref_name
),
&
push_spec
->
loid
,
1
))
<
0
)
}
else
if
((
error
=
git_reference_create
(
NULL
,
push
->
remote
->
repo
,
git_buf_cstr
(
&
remote_ref_name
),
&
push_spec
->
loid
,
1
,
NULL
,
NULL
))
<
0
)
goto
on_error
;
goto
on_error
;
}
}
...
...
src/refs.c
View file @
f04c7dca
...
@@ -393,32 +393,20 @@ static int reference__create(
...
@@ -393,32 +393,20 @@ static int reference__create(
return
0
;
return
0
;
}
}
int
git_reference_create
(
static
int
log_signature
(
git_signature
**
out
,
git_repository
*
repo
)
git_reference
**
ref_out
,
git_repository
*
repo
,
const
char
*
name
,
const
git_oid
*
oid
,
int
force
)
{
{
git_signature
*
who
;
int
error
;
int
error
;
git_signature
*
who
;
assert
(
oid
);
if
(((
error
=
git_signature_default
(
&
who
,
repo
))
<
0
)
&&
((
error
=
git_signature_now
(
&
who
,
"unknown"
,
"unknown"
))
<
0
))
/* Should we return an error if there is no default? */
if
(((
error
=
git_signature_default
(
&
who
,
repo
))
<
0
)
&&
((
error
=
git_signature_now
(
&
who
,
"unknown"
,
"unknown"
))
<
0
))
{
return
error
;
return
error
;
}
error
=
reference__create
(
ref_out
,
repo
,
name
,
oid
,
NULL
,
force
,
who
,
NULL
);
*
out
=
who
;
return
0
;
git_signature_free
(
who
);
return
error
;
}
}
int
git_reference_create
_with_log
(
int
git_reference_create
(
git_reference
**
ref_out
,
git_reference
**
ref_out
,
git_repository
*
repo
,
git_repository
*
repo
,
const
char
*
name
,
const
char
*
name
,
...
@@ -427,24 +415,26 @@ int git_reference_create_with_log(
...
@@ -427,24 +415,26 @@ int git_reference_create_with_log(
const
git_signature
*
signature
,
const
git_signature
*
signature
,
const
char
*
log_message
)
const
char
*
log_message
)
{
{
assert
(
oid
&&
signature
);
int
error
;
git_signature
*
who
=
NULL
;
assert
(
oid
);
return
reference__create
(
if
(
!
signature
)
{
if
((
error
=
log_signature
(
&
who
,
repo
))
<
0
)
return
error
;
else
signature
=
who
;
}
error
=
reference__create
(
ref_out
,
repo
,
name
,
oid
,
NULL
,
force
,
signature
,
log_message
);
ref_out
,
repo
,
name
,
oid
,
NULL
,
force
,
signature
,
log_message
);
}
int
git_reference_symbolic_create
(
git_signature_free
(
who
);
git_reference
**
ref_out
,
return
error
;
git_repository
*
repo
,
const
char
*
name
,
const
char
*
target
,
int
force
)
{
assert
(
target
);
return
reference__create
(
ref_out
,
repo
,
name
,
NULL
,
target
,
force
,
NULL
,
NULL
);
}
}
int
git_reference_symbolic_create
_with_log
(
int
git_reference_symbolic_create
(
git_reference
**
ref_out
,
git_reference
**
ref_out
,
git_repository
*
repo
,
git_repository
*
repo
,
const
char
*
name
,
const
char
*
name
,
...
@@ -453,10 +443,23 @@ int git_reference_symbolic_create_with_log(
...
@@ -453,10 +443,23 @@ int git_reference_symbolic_create_with_log(
const
git_signature
*
signature
,
const
git_signature
*
signature
,
const
char
*
log_message
)
const
char
*
log_message
)
{
{
assert
(
target
&&
signature
);
int
error
;
git_signature
*
who
=
NULL
;
assert
(
target
);
if
(
!
signature
)
{
if
((
error
=
log_signature
(
&
who
,
repo
))
<
0
)
return
error
;
else
signature
=
who
;
}
return
reference__create
(
error
=
reference__create
(
ref_out
,
repo
,
name
,
NULL
,
target
,
force
,
signature
,
log_message
);
ref_out
,
repo
,
name
,
NULL
,
target
,
force
,
signature
,
log_message
);
git_signature_free
(
who
);
return
error
;
}
}
static
int
ensure_is_an_updatable_direct_reference
(
git_reference
*
ref
)
static
int
ensure_is_an_updatable_direct_reference
(
git_reference
*
ref
)
...
@@ -471,21 +474,6 @@ static int ensure_is_an_updatable_direct_reference(git_reference *ref)
...
@@ -471,21 +474,6 @@ static int ensure_is_an_updatable_direct_reference(git_reference *ref)
int
git_reference_set_target
(
int
git_reference_set_target
(
git_reference
**
out
,
git_reference
**
out
,
git_reference
*
ref
,
git_reference
*
ref
,
const
git_oid
*
id
)
{
int
error
;
assert
(
out
&&
ref
&&
id
);
if
((
error
=
ensure_is_an_updatable_direct_reference
(
ref
))
<
0
)
return
error
;
return
git_reference_create
(
out
,
ref
->
db
->
repo
,
ref
->
name
,
id
,
1
);
}
int
git_reference_set_target_with_log
(
git_reference
**
out
,
git_reference
*
ref
,
const
git_oid
*
id
,
const
git_oid
*
id
,
const
git_signature
*
signature
,
const
git_signature
*
signature
,
const
char
*
log_message
)
const
char
*
log_message
)
...
@@ -493,12 +481,11 @@ int git_reference_set_target_with_log(
...
@@ -493,12 +481,11 @@ int git_reference_set_target_with_log(
int
error
;
int
error
;
assert
(
out
&&
ref
&&
id
);
assert
(
out
&&
ref
&&
id
);
assert
(
signature
&&
log_message
);
if
((
error
=
ensure_is_an_updatable_direct_reference
(
ref
))
<
0
)
if
((
error
=
ensure_is_an_updatable_direct_reference
(
ref
))
<
0
)
return
error
;
return
error
;
return
git_reference_create
_with_log
(
return
git_reference_create
(
out
,
ref
->
db
->
repo
,
ref
->
name
,
id
,
1
,
signature
,
log_message
);
out
,
ref
->
db
->
repo
,
ref
->
name
,
id
,
1
,
signature
,
log_message
);
}
}
...
@@ -514,7 +501,9 @@ static int ensure_is_an_updatable_symbolic_reference(git_reference *ref)
...
@@ -514,7 +501,9 @@ static int ensure_is_an_updatable_symbolic_reference(git_reference *ref)
int
git_reference_symbolic_set_target
(
int
git_reference_symbolic_set_target
(
git_reference
**
out
,
git_reference
**
out
,
git_reference
*
ref
,
git_reference
*
ref
,
const
char
*
target
)
const
char
*
target
,
const
git_signature
*
signature
,
const
char
*
log_message
)
{
{
int
error
;
int
error
;
...
@@ -523,7 +512,8 @@ int git_reference_symbolic_set_target(
...
@@ -523,7 +512,8 @@ int git_reference_symbolic_set_target(
if
((
error
=
ensure_is_an_updatable_symbolic_reference
(
ref
))
<
0
)
if
((
error
=
ensure_is_an_updatable_symbolic_reference
(
ref
))
<
0
)
return
error
;
return
error
;
return
git_reference_symbolic_create
(
out
,
ref
->
db
->
repo
,
ref
->
name
,
target
,
1
);
return
git_reference_symbolic_create
(
out
,
ref
->
db
->
repo
,
ref
->
name
,
target
,
1
,
signature
,
log_message
);
}
}
static
int
reference__rename
(
git_reference
**
out
,
git_reference
*
ref
,
const
char
*
new_name
,
int
force
,
static
int
reference__rename
(
git_reference
**
out
,
git_reference
*
ref
,
const
char
*
new_name
,
int
force
,
...
@@ -1020,7 +1010,9 @@ static int reference__update_terminal(
...
@@ -1020,7 +1010,9 @@ static int reference__update_terminal(
git_repository
*
repo
,
git_repository
*
repo
,
const
char
*
ref_name
,
const
char
*
ref_name
,
const
git_oid
*
oid
,
const
git_oid
*
oid
,
int
nesting
)
int
nesting
,
const
git_signature
*
signature
,
const
char
*
log_message
)
{
{
git_reference
*
ref
;
git_reference
*
ref
;
int
error
=
0
;
int
error
=
0
;
...
@@ -1035,7 +1027,7 @@ static int reference__update_terminal(
...
@@ -1035,7 +1027,7 @@ static int reference__update_terminal(
/* If we haven't found the reference at all, create a new reference. */
/* If we haven't found the reference at all, create a new reference. */
if
(
error
==
GIT_ENOTFOUND
)
{
if
(
error
==
GIT_ENOTFOUND
)
{
giterr_clear
();
giterr_clear
();
return
git_reference_create
(
NULL
,
repo
,
ref_name
,
oid
,
0
);
return
git_reference_create
(
NULL
,
repo
,
ref_name
,
oid
,
0
,
signature
,
log_message
);
}
}
if
(
error
<
0
)
if
(
error
<
0
)
...
@@ -1044,11 +1036,11 @@ static int reference__update_terminal(
...
@@ -1044,11 +1036,11 @@ static int reference__update_terminal(
/* If the ref is a symbolic reference, follow its target. */
/* If the ref is a symbolic reference, follow its target. */
if
(
git_reference_type
(
ref
)
==
GIT_REF_SYMBOLIC
)
{
if
(
git_reference_type
(
ref
)
==
GIT_REF_SYMBOLIC
)
{
error
=
reference__update_terminal
(
repo
,
git_reference_symbolic_target
(
ref
),
oid
,
error
=
reference__update_terminal
(
repo
,
git_reference_symbolic_target
(
ref
),
oid
,
nesting
+
1
);
nesting
+
1
,
signature
,
log_message
);
git_reference_free
(
ref
);
git_reference_free
(
ref
);
}
else
{
}
else
{
git_reference_free
(
ref
);
git_reference_free
(
ref
);
error
=
git_reference_create
(
NULL
,
repo
,
ref_name
,
oid
,
1
);
error
=
git_reference_create
(
NULL
,
repo
,
ref_name
,
oid
,
1
,
signature
,
log_message
);
}
}
return
error
;
return
error
;
...
@@ -1062,9 +1054,11 @@ static int reference__update_terminal(
...
@@ -1062,9 +1054,11 @@ static int reference__update_terminal(
int
git_reference__update_terminal
(
int
git_reference__update_terminal
(
git_repository
*
repo
,
git_repository
*
repo
,
const
char
*
ref_name
,
const
char
*
ref_name
,
const
git_oid
*
oid
)
const
git_oid
*
oid
,
const
git_signature
*
signature
,
const
char
*
log_message
)
{
{
return
reference__update_terminal
(
repo
,
ref_name
,
oid
,
0
);
return
reference__update_terminal
(
repo
,
ref_name
,
oid
,
0
,
signature
,
log_message
);
}
}
int
git_reference_has_log
(
git_repository
*
repo
,
const
char
*
refname
)
int
git_reference_has_log
(
git_repository
*
repo
,
const
char
*
refname
)
...
...
src/refs.h
View file @
f04c7dca
...
@@ -68,7 +68,7 @@ git_reference *git_reference__set_name(git_reference *ref, const char *name);
...
@@ -68,7 +68,7 @@ git_reference *git_reference__set_name(git_reference *ref, const char *name);
int
git_reference__normalize_name_lax
(
char
*
buffer_out
,
size_t
out_size
,
const
char
*
name
);
int
git_reference__normalize_name_lax
(
char
*
buffer_out
,
size_t
out_size
,
const
char
*
name
);
int
git_reference__normalize_name
(
git_buf
*
buf
,
const
char
*
name
,
unsigned
int
flags
);
int
git_reference__normalize_name
(
git_buf
*
buf
,
const
char
*
name
,
unsigned
int
flags
);
int
git_reference__update_terminal
(
git_repository
*
repo
,
const
char
*
ref_name
,
const
git_oid
*
oid
);
int
git_reference__update_terminal
(
git_repository
*
repo
,
const
char
*
ref_name
,
const
git_oid
*
oid
,
const
git_signature
*
signature
,
const
char
*
log_message
);
int
git_reference__is_valid_name
(
const
char
*
refname
,
unsigned
int
flags
);
int
git_reference__is_valid_name
(
const
char
*
refname
,
unsigned
int
flags
);
int
git_reference__is_branch
(
const
char
*
ref_name
);
int
git_reference__is_branch
(
const
char
*
ref_name
);
int
git_reference__is_remote
(
const
char
*
ref_name
);
int
git_reference__is_remote
(
const
char
*
ref_name
);
...
...
src/remote.c
View file @
f04c7dca
...
@@ -1027,7 +1027,7 @@ static int update_tips_for_spec(git_remote *remote, git_refspec *spec, git_vecto
...
@@ -1027,7 +1027,7 @@ static int update_tips_for_spec(git_remote *remote, git_refspec *spec, git_vecto
continue
;
continue
;
/* In autotag mode, don't overwrite any locally-existing tags */
/* In autotag mode, don't overwrite any locally-existing tags */
error
=
git_reference_create
(
&
ref
,
remote
->
repo
,
refname
.
ptr
,
&
head
->
oid
,
!
autotag
);
error
=
git_reference_create
(
&
ref
,
remote
->
repo
,
refname
.
ptr
,
&
head
->
oid
,
!
autotag
,
NULL
,
NULL
);
if
(
error
<
0
&&
error
!=
GIT_EEXISTS
)
if
(
error
<
0
&&
error
!=
GIT_EEXISTS
)
goto
on_error
;
goto
on_error
;
...
...
src/repository.c
View file @
f04c7dca
...
@@ -1863,11 +1863,11 @@ int git_repository_set_head(
...
@@ -1863,11 +1863,11 @@ int git_repository_set_head(
if
(
!
error
)
{
if
(
!
error
)
{
if
(
git_reference_is_branch
(
ref
))
if
(
git_reference_is_branch
(
ref
))
error
=
git_reference_symbolic_create
(
&
new_head
,
repo
,
GIT_HEAD_FILE
,
git_reference_name
(
ref
),
1
);
error
=
git_reference_symbolic_create
(
&
new_head
,
repo
,
GIT_HEAD_FILE
,
git_reference_name
(
ref
),
1
,
NULL
,
NULL
);
else
else
error
=
git_repository_set_head_detached
(
repo
,
git_reference_target
(
ref
));
error
=
git_repository_set_head_detached
(
repo
,
git_reference_target
(
ref
));
}
else
if
(
looks_like_a_branch
(
refname
))
}
else
if
(
looks_like_a_branch
(
refname
))
error
=
git_reference_symbolic_create
(
&
new_head
,
repo
,
GIT_HEAD_FILE
,
refname
,
1
);
error
=
git_reference_symbolic_create
(
&
new_head
,
repo
,
GIT_HEAD_FILE
,
refname
,
1
,
NULL
,
NULL
);
git_reference_free
(
ref
);
git_reference_free
(
ref
);
git_reference_free
(
new_head
);
git_reference_free
(
new_head
);
...
@@ -1891,7 +1891,7 @@ int git_repository_set_head_detached(
...
@@ -1891,7 +1891,7 @@ int git_repository_set_head_detached(
if
((
error
=
git_object_peel
(
&
peeled
,
object
,
GIT_OBJ_COMMIT
))
<
0
)
if
((
error
=
git_object_peel
(
&
peeled
,
object
,
GIT_OBJ_COMMIT
))
<
0
)
goto
cleanup
;
goto
cleanup
;
error
=
git_reference_create
(
&
new_head
,
repo
,
GIT_HEAD_FILE
,
git_object_id
(
peeled
),
1
);
error
=
git_reference_create
(
&
new_head
,
repo
,
GIT_HEAD_FILE
,
git_object_id
(
peeled
),
1
,
NULL
,
NULL
);
cleanup:
cleanup:
git_object_free
(
object
);
git_object_free
(
object
);
...
@@ -1916,7 +1916,7 @@ int git_repository_detach_head(
...
@@ -1916,7 +1916,7 @@ int git_repository_detach_head(
if
((
error
=
git_object_lookup
(
&
object
,
repo
,
git_reference_target
(
old_head
),
GIT_OBJ_COMMIT
))
<
0
)
if
((
error
=
git_object_lookup
(
&
object
,
repo
,
git_reference_target
(
old_head
),
GIT_OBJ_COMMIT
))
<
0
)
goto
cleanup
;
goto
cleanup
;
error
=
git_reference_create
(
&
new_head
,
repo
,
GIT_HEAD_FILE
,
git_reference_target
(
old_head
),
1
);
error
=
git_reference_create
(
&
new_head
,
repo
,
GIT_HEAD_FILE
,
git_reference_target
(
old_head
),
1
,
NULL
,
NULL
);
cleanup:
cleanup:
git_object_free
(
object
);
git_object_free
(
object
);
...
...
src/reset.c
View file @
f04c7dca
...
@@ -131,7 +131,7 @@ int git_reset(
...
@@ -131,7 +131,7 @@ int git_reset(
/* move HEAD to the new target */
/* move HEAD to the new target */
if
((
error
=
git_reference__update_terminal
(
repo
,
GIT_HEAD_FILE
,
if
((
error
=
git_reference__update_terminal
(
repo
,
GIT_HEAD_FILE
,
git_object_id
(
commit
)))
<
0
)
git_object_id
(
commit
)
,
NULL
,
NULL
))
<
0
)
goto
cleanup
;
goto
cleanup
;
if
(
reset_type
==
GIT_RESET_HARD
)
{
if
(
reset_type
==
GIT_RESET_HARD
)
{
...
...
src/stash.c
View file @
f04c7dca
...
@@ -417,7 +417,7 @@ static int update_reflog(
...
@@ -417,7 +417,7 @@ static int update_reflog(
if
((
error
=
git_reference_ensure_log
(
repo
,
GIT_REFS_STASH_FILE
))
<
0
)
if
((
error
=
git_reference_ensure_log
(
repo
,
GIT_REFS_STASH_FILE
))
<
0
)
return
error
;
return
error
;
error
=
git_reference_create
_with_log
(
&
stash
,
repo
,
GIT_REFS_STASH_FILE
,
w_commit_oid
,
1
,
stasher
,
message
);
error
=
git_reference_create
(
&
stash
,
repo
,
GIT_REFS_STASH_FILE
,
w_commit_oid
,
1
,
stasher
,
message
);
git_reference_free
(
stash
);
git_reference_free
(
stash
);
...
@@ -628,7 +628,7 @@ int git_stash_drop(
...
@@ -628,7 +628,7 @@ int git_stash_drop(
entry
=
git_reflog_entry_byindex
(
reflog
,
0
);
entry
=
git_reflog_entry_byindex
(
reflog
,
0
);
git_reference_free
(
stash
);
git_reference_free
(
stash
);
if
((
error
=
git_reference_create
(
&
stash
,
repo
,
GIT_REFS_STASH_FILE
,
&
entry
->
oid_cur
,
1
)
<
0
))
if
((
error
=
git_reference_create
(
&
stash
,
repo
,
GIT_REFS_STASH_FILE
,
&
entry
->
oid_cur
,
1
,
NULL
,
NULL
)
<
0
))
goto
cleanup
;
goto
cleanup
;
/* We need to undo the writing that we just did */
/* We need to undo the writing that we just did */
...
...
src/tag.c
View file @
f04c7dca
...
@@ -271,7 +271,7 @@ static int git_tag_create__internal(
...
@@ -271,7 +271,7 @@ static int git_tag_create__internal(
}
else
}
else
git_oid_cpy
(
oid
,
git_object_id
(
target
));
git_oid_cpy
(
oid
,
git_object_id
(
target
));
error
=
git_reference_create
(
&
new_ref
,
repo
,
ref_name
.
ptr
,
oid
,
allow_ref_overwrite
);
error
=
git_reference_create
(
&
new_ref
,
repo
,
ref_name
.
ptr
,
oid
,
allow_ref_overwrite
,
NULL
,
NULL
);
cleanup:
cleanup:
git_reference_free
(
new_ref
);
git_reference_free
(
new_ref
);
...
@@ -376,7 +376,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
...
@@ -376,7 +376,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
return
-
1
;
return
-
1
;
}
}
error
=
git_reference_create
(
&
new_ref
,
repo
,
ref_name
.
ptr
,
oid
,
allow_ref_overwrite
);
error
=
git_reference_create
(
&
new_ref
,
repo
,
ref_name
.
ptr
,
oid
,
allow_ref_overwrite
,
NULL
,
NULL
);
git_reference_free
(
new_ref
);
git_reference_free
(
new_ref
);
git_buf_free
(
&
ref_name
);
git_buf_free
(
&
ref_name
);
...
...
src/transports/local.c
View file @
f04c7dca
...
@@ -315,7 +315,7 @@ static int local_push_update_remote_ref(
...
@@ -315,7 +315,7 @@ static int local_push_update_remote_ref(
if
(
lref
)
{
if
(
lref
)
{
/* Create or update a ref */
/* Create or update a ref */
if
((
error
=
git_reference_create
(
NULL
,
remote_repo
,
rref
,
loid
,
if
((
error
=
git_reference_create
(
NULL
,
remote_repo
,
rref
,
loid
,
!
git_oid_iszero
(
roid
)))
<
0
)
!
git_oid_iszero
(
roid
)
,
NULL
,
NULL
))
<
0
)
return
error
;
return
error
;
}
else
{
}
else
{
/* Delete a ref */
/* Delete a ref */
...
...
tests/checkout/tree.c
View file @
f04c7dca
...
@@ -484,7 +484,7 @@ void assert_conflict(
...
@@ -484,7 +484,7 @@ void assert_conflict(
/* Make HEAD point to this branch */
/* Make HEAD point to this branch */
cl_git_pass
(
git_reference_symbolic_create
(
cl_git_pass
(
git_reference_symbolic_create
(
&
head
,
g_repo
,
"HEAD"
,
git_reference_name
(
branch
),
1
));
&
head
,
g_repo
,
"HEAD"
,
git_reference_name
(
branch
),
1
,
NULL
,
NULL
));
git_reference_free
(
head
);
git_reference_free
(
head
);
git_reference_free
(
branch
);
git_reference_free
(
branch
);
...
...
tests/commit/write.c
View file @
f04c7dca
...
@@ -116,7 +116,7 @@ void test_commit_write__root(void)
...
@@ -116,7 +116,7 @@ void test_commit_write__root(void)
cl_assert
(
head_old
!=
NULL
);
cl_assert
(
head_old
!=
NULL
);
git_reference_free
(
head
);
git_reference_free
(
head
);
cl_git_pass
(
git_reference_symbolic_create
(
&
head
,
g_repo
,
"HEAD"
,
branch_name
,
1
));
cl_git_pass
(
git_reference_symbolic_create
(
&
head
,
g_repo
,
"HEAD"
,
branch_name
,
1
,
NULL
,
NULL
));
cl_git_pass
(
git_commit_create_v
(
cl_git_pass
(
git_commit_create_v
(
&
commit_id
,
/* out id */
&
commit_id
,
/* out id */
...
...
tests/diff/rename.c
View file @
f04c7dca
...
@@ -945,7 +945,7 @@ void test_diff_rename__rejected_match_can_match_others(void)
...
@@ -945,7 +945,7 @@ void test_diff_rename__rejected_match_can_match_others(void)
cl_git_pass
(
git_reference_lookup
(
&
head
,
g_repo
,
"HEAD"
));
cl_git_pass
(
git_reference_lookup
(
&
head
,
g_repo
,
"HEAD"
));
cl_git_pass
(
git_reference_symbolic_set_target
(
cl_git_pass
(
git_reference_symbolic_set_target
(
&
selfsimilar
,
head
,
"refs/heads/renames_similar"
));
&
selfsimilar
,
head
,
"refs/heads/renames_similar"
,
NULL
,
NULL
));
cl_git_pass
(
git_checkout_head
(
g_repo
,
&
opts
));
cl_git_pass
(
git_checkout_head
(
g_repo
,
&
opts
));
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
...
@@ -1030,7 +1030,7 @@ void test_diff_rename__rejected_match_can_match_others_two(void)
...
@@ -1030,7 +1030,7 @@ void test_diff_rename__rejected_match_can_match_others_two(void)
cl_git_pass
(
git_reference_lookup
(
&
head
,
g_repo
,
"HEAD"
));
cl_git_pass
(
git_reference_lookup
(
&
head
,
g_repo
,
"HEAD"
));
cl_git_pass
(
git_reference_symbolic_set_target
(
cl_git_pass
(
git_reference_symbolic_set_target
(
&
selfsimilar
,
head
,
"refs/heads/renames_similar_two"
));
&
selfsimilar
,
head
,
"refs/heads/renames_similar_two"
,
NULL
,
NULL
));
cl_git_pass
(
git_checkout_head
(
g_repo
,
&
opts
));
cl_git_pass
(
git_checkout_head
(
g_repo
,
&
opts
));
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
...
@@ -1088,7 +1088,7 @@ void test_diff_rename__rejected_match_can_match_others_three(void)
...
@@ -1088,7 +1088,7 @@ void test_diff_rename__rejected_match_can_match_others_three(void)
cl_git_pass
(
git_reference_lookup
(
&
head
,
g_repo
,
"HEAD"
));
cl_git_pass
(
git_reference_lookup
(
&
head
,
g_repo
,
"HEAD"
));
cl_git_pass
(
git_reference_symbolic_set_target
(
cl_git_pass
(
git_reference_symbolic_set_target
(
&
selfsimilar
,
head
,
"refs/heads/renames_similar_two"
));
&
selfsimilar
,
head
,
"refs/heads/renames_similar_two"
,
NULL
,
NULL
));
cl_git_pass
(
git_checkout_head
(
g_repo
,
&
opts
));
cl_git_pass
(
git_checkout_head
(
g_repo
,
&
opts
));
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
...
...
tests/merge/merge_helpers.c
View file @
f04c7dca
...
@@ -87,7 +87,7 @@ int merge_branches(git_merge_result **result, git_repository *repo, const char *
...
@@ -87,7 +87,7 @@ int merge_branches(git_merge_result **result, git_repository *repo, const char *
head_checkout_opts
.
checkout_strategy
=
GIT_CHECKOUT_FORCE
;
head_checkout_opts
.
checkout_strategy
=
GIT_CHECKOUT_FORCE
;
cl_git_pass
(
git_reference_symbolic_create
(
&
head_ref
,
repo
,
"HEAD"
,
ours_branch
,
1
));
cl_git_pass
(
git_reference_symbolic_create
(
&
head_ref
,
repo
,
"HEAD"
,
ours_branch
,
1
,
NULL
,
NULL
));
cl_git_pass
(
git_checkout_head
(
repo
,
&
head_checkout_opts
));
cl_git_pass
(
git_checkout_head
(
repo
,
&
head_checkout_opts
));
cl_git_pass
(
git_reference_lookup
(
&
theirs_ref
,
repo
,
theirs_branch
));
cl_git_pass
(
git_reference_lookup
(
&
theirs_ref
,
repo
,
theirs_branch
));
...
...
tests/merge/workdir/simple.c
View file @
f04c7dca
...
@@ -406,7 +406,7 @@ void test_merge_workdir_simple__directory_file(void)
...
@@ -406,7 +406,7 @@ void test_merge_workdir_simple__directory_file(void)
{
0100644
,
"f5504f36e6f4eb797a56fc5bac6c6c7f32969bf2"
,
3
,
"file-5/new"
},
{
0100644
,
"f5504f36e6f4eb797a56fc5bac6c6c7f32969bf2"
,
3
,
"file-5/new"
},
};
};
cl_git_pass
(
git_reference_symbolic_create
(
&
head
,
repo
,
GIT_HEAD_FILE
,
GIT_REFS_HEADS_DIR
OURS_DIRECTORY_FILE
,
1
));
cl_git_pass
(
git_reference_symbolic_create
(
&
head
,
repo
,
GIT_HEAD_FILE
,
GIT_REFS_HEADS_DIR
OURS_DIRECTORY_FILE
,
1
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_name_to_id
(
&
head_commit_id
,
repo
,
GIT_HEAD_FILE
));
cl_git_pass
(
git_reference_name_to_id
(
&
head_commit_id
,
repo
,
GIT_HEAD_FILE
));
cl_git_pass
(
git_commit_lookup
(
&
head_commit
,
repo
,
&
head_commit_id
));
cl_git_pass
(
git_commit_lookup
(
&
head_commit
,
repo
,
&
head_commit_id
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
head_commit
,
GIT_RESET_HARD
));
cl_git_pass
(
git_reset
(
repo
,
(
git_object
*
)
head_commit
,
GIT_RESET_HARD
));
...
...
tests/merge/workdir/trivial.c
View file @
f04c7dca
...
@@ -42,7 +42,7 @@ static int merge_trivial(const char *ours, const char *theirs, bool automerge)
...
@@ -42,7 +42,7 @@ static int merge_trivial(const char *ours, const char *theirs, bool automerge)
opts
.
merge_tree_opts
.
automerge_flags
|=
automerge
?
0
:
GIT_MERGE_AUTOMERGE_NONE
;
opts
.
merge_tree_opts
.
automerge_flags
|=
automerge
?
0
:
GIT_MERGE_AUTOMERGE_NONE
;
git_buf_printf
(
&
branch_buf
,
"%s%s"
,
GIT_REFS_HEADS_DIR
,
ours
);
git_buf_printf
(
&
branch_buf
,
"%s%s"
,
GIT_REFS_HEADS_DIR
,
ours
);
cl_git_pass
(
git_reference_symbolic_create
(
&
our_ref
,
repo
,
"HEAD"
,
branch_buf
.
ptr
,
1
));
cl_git_pass
(
git_reference_symbolic_create
(
&
our_ref
,
repo
,
"HEAD"
,
branch_buf
.
ptr
,
1
,
NULL
,
NULL
));
cl_git_pass
(
git_checkout_head
(
repo
,
&
checkout_opts
));
cl_git_pass
(
git_checkout_head
(
repo
,
&
checkout_opts
));
...
...
tests/refs/branches/delete.c
View file @
f04c7dca
...
@@ -14,7 +14,7 @@ void test_refs_branches_delete__initialize(void)
...
@@ -14,7 +14,7 @@ void test_refs_branches_delete__initialize(void)
cl_git_pass
(
git_repository_open
(
&
repo
,
"testrepo.git"
));
cl_git_pass
(
git_repository_open
(
&
repo
,
"testrepo.git"
));
cl_git_pass
(
git_oid_fromstr
(
&
id
,
"be3563ae3f795b2b4353bcce3a527ad0a4f7f644"
));
cl_git_pass
(
git_oid_fromstr
(
&
id
,
"be3563ae3f795b2b4353bcce3a527ad0a4f7f644"
));
cl_git_pass
(
git_reference_create
(
&
fake_remote
,
repo
,
"refs/remotes/nulltoken/master"
,
&
id
,
0
));
cl_git_pass
(
git_reference_create
(
&
fake_remote
,
repo
,
"refs/remotes/nulltoken/master"
,
&
id
,
0
,
NULL
,
NULL
));
}
}
void
test_refs_branches_delete__cleanup
(
void
)
void
test_refs_branches_delete__cleanup
(
void
)
...
...
tests/refs/branches/ishead.c
View file @
f04c7dca
...
@@ -98,9 +98,9 @@ void test_refs_branches_ishead__only_direct_references_are_considered(void)
...
@@ -98,9 +98,9 @@ void test_refs_branches_ishead__only_direct_references_are_considered(void)
git_repository_free
(
repo
);
git_repository_free
(
repo
);
repo
=
cl_git_sandbox_init
(
"testrepo.git"
);
repo
=
cl_git_sandbox_init
(
"testrepo.git"
);
cl_git_pass
(
git_reference_symbolic_create
(
&
linked
,
repo
,
"refs/heads/linked"
,
"refs/heads/master"
,
0
));
cl_git_pass
(
git_reference_symbolic_create
(
&
linked
,
repo
,
"refs/heads/linked"
,
"refs/heads/master"
,
0
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_symbolic_create
(
&
super
,
repo
,
"refs/heads/super"
,
"refs/heads/linked"
,
0
));
cl_git_pass
(
git_reference_symbolic_create
(
&
super
,
repo
,
"refs/heads/super"
,
"refs/heads/linked"
,
0
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_symbolic_create
(
&
head
,
repo
,
GIT_HEAD_FILE
,
"refs/heads/super"
,
1
));
cl_git_pass
(
git_reference_symbolic_create
(
&
head
,
repo
,
GIT_HEAD_FILE
,
"refs/heads/super"
,
1
,
NULL
,
NULL
));
cl_assert_equal_i
(
false
,
git_branch_is_head
(
linked
));
cl_assert_equal_i
(
false
,
git_branch_is_head
(
linked
));
cl_assert_equal_i
(
false
,
git_branch_is_head
(
super
));
cl_assert_equal_i
(
false
,
git_branch_is_head
(
super
));
...
...
tests/refs/branches/iterator.c
View file @
f04c7dca
...
@@ -12,7 +12,7 @@ void test_refs_branches_iterator__initialize(void)
...
@@ -12,7 +12,7 @@ void test_refs_branches_iterator__initialize(void)
cl_git_pass
(
git_repository_open
(
&
repo
,
"testrepo.git"
));
cl_git_pass
(
git_repository_open
(
&
repo
,
"testrepo.git"
));
cl_git_pass
(
git_oid_fromstr
(
&
id
,
"be3563ae3f795b2b4353bcce3a527ad0a4f7f644"
));
cl_git_pass
(
git_oid_fromstr
(
&
id
,
"be3563ae3f795b2b4353bcce3a527ad0a4f7f644"
));
cl_git_pass
(
git_reference_create
(
&
fake_remote
,
repo
,
"refs/remotes/nulltoken/master"
,
&
id
,
0
));
cl_git_pass
(
git_reference_create
(
&
fake_remote
,
repo
,
"refs/remotes/nulltoken/master"
,
&
id
,
0
,
NULL
,
NULL
));
}
}
void
test_refs_branches_iterator__cleanup
(
void
)
void
test_refs_branches_iterator__cleanup
(
void
)
...
@@ -113,7 +113,7 @@ void test_refs_branches_iterator__retrieve_remote_symbolic_HEAD_when_present(voi
...
@@ -113,7 +113,7 @@ void test_refs_branches_iterator__retrieve_remote_symbolic_HEAD_when_present(voi
};
};
git_reference_free
(
fake_remote
);
git_reference_free
(
fake_remote
);
cl_git_pass
(
git_reference_symbolic_create
(
&
fake_remote
,
repo
,
"refs/remotes/nulltoken/HEAD"
,
"refs/remotes/nulltoken/master"
,
0
));
cl_git_pass
(
git_reference_symbolic_create
(
&
fake_remote
,
repo
,
"refs/remotes/nulltoken/HEAD"
,
"refs/remotes/nulltoken/master"
,
0
,
NULL
,
NULL
));
assert_retrieval
(
GIT_BRANCH_REMOTE
,
3
);
assert_retrieval
(
GIT_BRANCH_REMOTE
,
3
);
...
...
tests/refs/crashes.c
View file @
f04c7dca
...
@@ -7,7 +7,7 @@ void test_refs_crashes__double_free(void)
...
@@ -7,7 +7,7 @@ void test_refs_crashes__double_free(void)
const
char
*
REFNAME
=
"refs/heads/xxx"
;
const
char
*
REFNAME
=
"refs/heads/xxx"
;
cl_git_pass
(
git_repository_open
(
&
repo
,
cl_fixture
(
"testrepo.git"
)));
cl_git_pass
(
git_repository_open
(
&
repo
,
cl_fixture
(
"testrepo.git"
)));
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
repo
,
REFNAME
,
"refs/heads/master"
,
0
));
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
repo
,
REFNAME
,
"refs/heads/master"
,
0
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_lookup
(
&
ref2
,
repo
,
REFNAME
));
cl_git_pass
(
git_reference_lookup
(
&
ref2
,
repo
,
REFNAME
));
cl_git_pass
(
git_reference_delete
(
ref
));
cl_git_pass
(
git_reference_delete
(
ref
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
...
...
tests/refs/create.c
View file @
f04c7dca
...
@@ -32,7 +32,7 @@ void test_refs_create__symbolic(void)
...
@@ -32,7 +32,7 @@ void test_refs_create__symbolic(void)
git_oid_fromstr
(
&
id
,
current_master_tip
);
git_oid_fromstr
(
&
id
,
current_master_tip
);
/* Create and write the new symbolic reference */
/* Create and write the new symbolic reference */
cl_git_pass
(
git_reference_symbolic_create
(
&
new_reference
,
g_repo
,
new_head_tracker
,
current_head_target
,
0
));
cl_git_pass
(
git_reference_symbolic_create
(
&
new_reference
,
g_repo
,
new_head_tracker
,
current_head_target
,
0
,
NULL
,
NULL
));
/* Ensure the reference can be looked-up... */
/* Ensure the reference can be looked-up... */
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
new_head_tracker
));
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
new_head_tracker
));
...
@@ -73,7 +73,7 @@ void test_refs_create__deep_symbolic(void)
...
@@ -73,7 +73,7 @@ void test_refs_create__deep_symbolic(void)
git_oid_fromstr
(
&
id
,
current_master_tip
);
git_oid_fromstr
(
&
id
,
current_master_tip
);
cl_git_pass
(
git_reference_symbolic_create
(
&
new_reference
,
g_repo
,
new_head_tracker
,
current_head_target
,
0
));
cl_git_pass
(
git_reference_symbolic_create
(
&
new_reference
,
g_repo
,
new_head_tracker
,
current_head_target
,
0
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
new_head_tracker
));
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
new_head_tracker
));
cl_git_pass
(
git_reference_resolve
(
&
resolved_ref
,
looked_up_ref
));
cl_git_pass
(
git_reference_resolve
(
&
resolved_ref
,
looked_up_ref
));
cl_assert
(
git_oid_cmp
(
&
id
,
git_reference_target
(
resolved_ref
))
==
0
);
cl_assert
(
git_oid_cmp
(
&
id
,
git_reference_target
(
resolved_ref
))
==
0
);
...
@@ -95,7 +95,7 @@ void test_refs_create__oid(void)
...
@@ -95,7 +95,7 @@ void test_refs_create__oid(void)
git_oid_fromstr
(
&
id
,
current_master_tip
);
git_oid_fromstr
(
&
id
,
current_master_tip
);
/* Create and write the new object id reference */
/* Create and write the new object id reference */
cl_git_pass
(
git_reference_create
(
&
new_reference
,
g_repo
,
new_head
,
&
id
,
0
));
cl_git_pass
(
git_reference_create
(
&
new_reference
,
g_repo
,
new_head
,
&
id
,
0
,
NULL
,
NULL
));
/* Ensure the reference can be looked-up... */
/* Ensure the reference can be looked-up... */
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
new_head
));
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
new_head
));
...
@@ -130,7 +130,7 @@ void test_refs_create__oid_unknown(void)
...
@@ -130,7 +130,7 @@ void test_refs_create__oid_unknown(void)
git_oid_fromstr
(
&
id
,
"deadbeef3f795b2b4353bcce3a527ad0a4f7f644"
);
git_oid_fromstr
(
&
id
,
"deadbeef3f795b2b4353bcce3a527ad0a4f7f644"
);
/* Create and write the new object id reference */
/* Create and write the new object id reference */
cl_git_fail
(
git_reference_create
(
&
new_reference
,
g_repo
,
new_head
,
&
id
,
0
));
cl_git_fail
(
git_reference_create
(
&
new_reference
,
g_repo
,
new_head
,
&
id
,
0
,
NULL
,
NULL
));
/* Ensure the reference can't be looked-up... */
/* Ensure the reference can't be looked-up... */
cl_git_fail
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
new_head
));
cl_git_fail
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
new_head
));
...
@@ -144,10 +144,10 @@ void test_refs_create__propagate_eexists(void)
...
@@ -144,10 +144,10 @@ void test_refs_create__propagate_eexists(void)
/* Make sure it works for oid and for symbolic both */
/* Make sure it works for oid and for symbolic both */
git_oid_fromstr
(
&
oid
,
current_master_tip
);
git_oid_fromstr
(
&
oid
,
current_master_tip
);
error
=
git_reference_create
(
&
ref
,
g_repo
,
current_head_target
,
&
oid
,
false
);
error
=
git_reference_create
(
&
ref
,
g_repo
,
current_head_target
,
&
oid
,
false
,
NULL
,
NULL
);
cl_assert
(
error
==
GIT_EEXISTS
);
cl_assert
(
error
==
GIT_EEXISTS
);
error
=
git_reference_symbolic_create
(
&
ref
,
g_repo
,
"HEAD"
,
current_head_target
,
false
);
error
=
git_reference_symbolic_create
(
&
ref
,
g_repo
,
"HEAD"
,
current_head_target
,
false
,
NULL
,
NULL
);
cl_assert
(
error
==
GIT_EEXISTS
);
cl_assert
(
error
==
GIT_EEXISTS
);
}
}
...
@@ -161,8 +161,8 @@ void test_refs_create__creating_a_reference_with_an_invalid_name_returns_EINVALI
...
@@ -161,8 +161,8 @@ void test_refs_create__creating_a_reference_with_an_invalid_name_returns_EINVALI
git_oid_fromstr
(
&
id
,
current_master_tip
);
git_oid_fromstr
(
&
id
,
current_master_tip
);
cl_assert_equal_i
(
GIT_EINVALIDSPEC
,
git_reference_create
(
cl_assert_equal_i
(
GIT_EINVALIDSPEC
,
git_reference_create
(
&
new_reference
,
g_repo
,
name
,
&
id
,
0
));
&
new_reference
,
g_repo
,
name
,
&
id
,
0
,
NULL
,
NULL
));
cl_assert_equal_i
(
GIT_EINVALIDSPEC
,
git_reference_symbolic_create
(
cl_assert_equal_i
(
GIT_EINVALIDSPEC
,
git_reference_symbolic_create
(
&
new_reference
,
g_repo
,
name
,
current_head_target
,
0
));
&
new_reference
,
g_repo
,
name
,
current_head_target
,
0
,
NULL
,
NULL
));
}
}
tests/refs/createwithlog.c
View file @
f04c7dca
...
@@ -35,7 +35,7 @@ void test_refs_createwithlog__creating_a_direct_reference_adds_a_reflog_entry(vo
...
@@ -35,7 +35,7 @@ void test_refs_createwithlog__creating_a_direct_reference_adds_a_reflog_entry(vo
cl_git_pass
(
git_signature_now
(
&
signature
,
"foo"
,
"foo@bar"
));
cl_git_pass
(
git_signature_now
(
&
signature
,
"foo"
,
"foo@bar"
));
cl_git_pass
(
cl_git_pass
(
git_reference_create
_with_log
(
&
reference
,
g_repo
,
name
,
&
id
,
0
,
signature
,
message
));
git_reference_create
(
&
reference
,
g_repo
,
name
,
&
id
,
0
,
signature
,
message
));
cl_git_pass
(
git_reflog_read
(
&
reflog
,
g_repo
,
name
));
cl_git_pass
(
git_reflog_read
(
&
reflog
,
g_repo
,
name
));
cl_assert_equal_sz
(
1
,
git_reflog_entrycount
(
reflog
));
cl_assert_equal_sz
(
1
,
git_reflog_entrycount
(
reflog
));
...
...
tests/refs/delete.c
View file @
f04c7dca
...
@@ -66,7 +66,7 @@ void test_refs_delete__packed_only(void)
...
@@ -66,7 +66,7 @@ void test_refs_delete__packed_only(void)
git_oid_fromstr
(
&
id
,
current_master_tip
);
git_oid_fromstr
(
&
id
,
current_master_tip
);
/* Create and write the new object id reference */
/* Create and write the new object id reference */
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
new_ref
,
&
id
,
0
));
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
new_ref
,
&
id
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
/* Lookup the reference */
/* Lookup the reference */
...
...
tests/refs/foreachglob.c
View file @
f04c7dca
...
@@ -12,7 +12,7 @@ void test_refs_foreachglob__initialize(void)
...
@@ -12,7 +12,7 @@ void test_refs_foreachglob__initialize(void)
cl_git_pass
(
git_repository_open
(
&
repo
,
"testrepo.git"
));
cl_git_pass
(
git_repository_open
(
&
repo
,
"testrepo.git"
));
cl_git_pass
(
git_oid_fromstr
(
&
id
,
"be3563ae3f795b2b4353bcce3a527ad0a4f7f644"
));
cl_git_pass
(
git_oid_fromstr
(
&
id
,
"be3563ae3f795b2b4353bcce3a527ad0a4f7f644"
));
cl_git_pass
(
git_reference_create
(
&
fake_remote
,
repo
,
"refs/remotes/nulltoken/master"
,
&
id
,
0
));
cl_git_pass
(
git_reference_create
(
&
fake_remote
,
repo
,
"refs/remotes/nulltoken/master"
,
&
id
,
0
,
NULL
,
NULL
));
}
}
void
test_refs_foreachglob__cleanup
(
void
)
void
test_refs_foreachglob__cleanup
(
void
)
...
...
tests/refs/overwrite.c
View file @
f04c7dca
...
@@ -27,8 +27,8 @@ void test_refs_overwrite__symbolic(void)
...
@@ -27,8 +27,8 @@ void test_refs_overwrite__symbolic(void)
git_reference
*
ref
,
*
branch_ref
;
git_reference
*
ref
,
*
branch_ref
;
/* The target needds to exist and we need to check the name has changed */
/* The target needds to exist and we need to check the name has changed */
cl_git_pass
(
git_reference_symbolic_create
(
&
branch_ref
,
g_repo
,
ref_branch_name
,
ref_master_name
,
0
));
cl_git_pass
(
git_reference_symbolic_create
(
&
branch_ref
,
g_repo
,
ref_branch_name
,
ref_master_name
,
0
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
g_repo
,
ref_name
,
ref_branch_name
,
0
));
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
g_repo
,
ref_name
,
ref_branch_name
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
/* Ensure it points to the right place*/
/* Ensure it points to the right place*/
...
@@ -38,8 +38,8 @@ void test_refs_overwrite__symbolic(void)
...
@@ -38,8 +38,8 @@ void test_refs_overwrite__symbolic(void)
git_reference_free
(
ref
);
git_reference_free
(
ref
);
/* Ensure we can't create it unless we force it to */
/* Ensure we can't create it unless we force it to */
cl_git_fail
(
git_reference_symbolic_create
(
&
ref
,
g_repo
,
ref_name
,
ref_master_name
,
0
));
cl_git_fail
(
git_reference_symbolic_create
(
&
ref
,
g_repo
,
ref_name
,
ref_master_name
,
0
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
g_repo
,
ref_name
,
ref_master_name
,
1
));
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
g_repo
,
ref_name
,
ref_master_name
,
1
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
/* Ensure it points to the right place */
/* Ensure it points to the right place */
...
@@ -63,7 +63,7 @@ void test_refs_overwrite__object_id(void)
...
@@ -63,7 +63,7 @@ void test_refs_overwrite__object_id(void)
git_reference_free
(
ref
);
git_reference_free
(
ref
);
/* Create it */
/* Create it */
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
ref_name
,
&
id
,
0
));
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
ref_name
,
&
id
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
cl_git_pass
(
git_reference_lookup
(
&
ref
,
g_repo
,
ref_test_name
));
cl_git_pass
(
git_reference_lookup
(
&
ref
,
g_repo
,
ref_test_name
));
...
@@ -72,8 +72,8 @@ void test_refs_overwrite__object_id(void)
...
@@ -72,8 +72,8 @@ void test_refs_overwrite__object_id(void)
git_reference_free
(
ref
);
git_reference_free
(
ref
);
/* Ensure we can't overwrite unless we force it */
/* Ensure we can't overwrite unless we force it */
cl_git_fail
(
git_reference_create
(
&
ref
,
g_repo
,
ref_name
,
&
id
,
0
));
cl_git_fail
(
git_reference_create
(
&
ref
,
g_repo
,
ref_name
,
&
id
,
0
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
ref_name
,
&
id
,
1
));
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
ref_name
,
&
id
,
1
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
/* Ensure it has been overwritten */
/* Ensure it has been overwritten */
...
@@ -94,10 +94,10 @@ void test_refs_overwrite__object_id_with_symbolic(void)
...
@@ -94,10 +94,10 @@ void test_refs_overwrite__object_id_with_symbolic(void)
git_oid_cpy
(
&
id
,
git_reference_target
(
ref
));
git_oid_cpy
(
&
id
,
git_reference_target
(
ref
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
ref_name
,
&
id
,
0
));
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
ref_name
,
&
id
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
cl_git_fail
(
git_reference_symbolic_create
(
&
ref
,
g_repo
,
ref_name
,
ref_master_name
,
0
));
cl_git_fail
(
git_reference_symbolic_create
(
&
ref
,
g_repo
,
ref_name
,
ref_master_name
,
0
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
g_repo
,
ref_name
,
ref_master_name
,
1
));
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
g_repo
,
ref_name
,
ref_master_name
,
1
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
/* Ensure it points to the right place */
/* Ensure it points to the right place */
...
@@ -120,11 +120,11 @@ void test_refs_overwrite__symbolic_with_object_id(void)
...
@@ -120,11 +120,11 @@ void test_refs_overwrite__symbolic_with_object_id(void)
git_reference_free
(
ref
);
git_reference_free
(
ref
);
/* Create the symbolic ref */
/* Create the symbolic ref */
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
g_repo
,
ref_name
,
ref_master_name
,
0
));
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
g_repo
,
ref_name
,
ref_master_name
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
/* It shouldn't overwrite unless we tell it to */
/* It shouldn't overwrite unless we tell it to */
cl_git_fail
(
git_reference_create
(
&
ref
,
g_repo
,
ref_name
,
&
id
,
0
));
cl_git_fail
(
git_reference_create
(
&
ref
,
g_repo
,
ref_name
,
&
id
,
0
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
ref_name
,
&
id
,
1
));
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
ref_name
,
&
id
,
1
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
/* Ensure it points to the right place */
/* Ensure it points to the right place */
...
...
tests/refs/pack.c
View file @
f04c7dca
...
@@ -93,11 +93,11 @@ void test_refs_pack__symbolic(void)
...
@@ -93,11 +93,11 @@ void test_refs_pack__symbolic(void)
for
(
i
=
0
;
i
<
100
;
++
i
)
{
for
(
i
=
0
;
i
<
100
;
++
i
)
{
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/symbolic-%03d"
,
i
);
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/symbolic-%03d"
,
i
);
cl_git_pass
(
git_reference_symbolic_create
(
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
g_repo
,
name
,
"refs/heads/master"
,
0
));
&
ref
,
g_repo
,
name
,
"refs/heads/master"
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/direct-%03d"
,
i
);
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/direct-%03d"
,
i
);
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
name
,
&
head
,
0
));
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
name
,
&
head
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
}
}
...
...
tests/refs/reflog/reflog.c
View file @
f04c7dca
...
@@ -82,7 +82,7 @@ void test_refs_reflog_reflog__append_then_read(void)
...
@@ -82,7 +82,7 @@ void test_refs_reflog_reflog__append_then_read(void)
/* Create a new branch pointing at the HEAD */
/* Create a new branch pointing at the HEAD */
git_oid_fromstr
(
&
oid
,
current_master_tip
);
git_oid_fromstr
(
&
oid
,
current_master_tip
);
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
new_ref
,
&
oid
,
0
));
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
new_ref
,
&
oid
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
cl_git_pass
(
git_signature_now
(
&
committer
,
"foo"
,
"foo@bar"
));
cl_git_pass
(
git_signature_now
(
&
committer
,
"foo"
,
"foo@bar"
));
...
@@ -189,11 +189,11 @@ void test_refs_reflog_reflog__write_only_std_locations(void)
...
@@ -189,11 +189,11 @@ void test_refs_reflog_reflog__write_only_std_locations(void)
git_oid_fromstr
(
&
id
,
current_master_tip
);
git_oid_fromstr
(
&
id
,
current_master_tip
);
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
"refs/heads/foo"
,
&
id
,
1
));
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
"refs/heads/foo"
,
&
id
,
1
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
"refs/tags/foo"
,
&
id
,
1
));
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
"refs/tags/foo"
,
&
id
,
1
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
"refs/notes/foo"
,
&
id
,
1
));
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
"refs/notes/foo"
,
&
id
,
1
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
assert_has_reflog
(
true
,
"refs/heads/foo"
);
assert_has_reflog
(
true
,
"refs/heads/foo"
);
...
@@ -210,7 +210,7 @@ void test_refs_reflog_reflog__write_when_explicitly_active(void)
...
@@ -210,7 +210,7 @@ void test_refs_reflog_reflog__write_when_explicitly_active(void)
git_oid_fromstr
(
&
id
,
current_master_tip
);
git_oid_fromstr
(
&
id
,
current_master_tip
);
git_reference_ensure_log
(
g_repo
,
"refs/tags/foo"
);
git_reference_ensure_log
(
g_repo
,
"refs/tags/foo"
);
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
"refs/tags/foo"
,
&
id
,
1
));
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
"refs/tags/foo"
,
&
id
,
1
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
assert_has_reflog
(
true
,
"refs/tags/foo"
);
assert_has_reflog
(
true
,
"refs/tags/foo"
);
}
}
tests/refs/rename.c
View file @
f04c7dca
...
@@ -268,15 +268,15 @@ void test_refs_rename__overwrite(void)
...
@@ -268,15 +268,15 @@ void test_refs_rename__overwrite(void)
git_oid_cpy
(
&
id
,
git_reference_target
(
ref
));
git_oid_cpy
(
&
id
,
git_reference_target
(
ref
));
/* Create loose references */
/* Create loose references */
cl_git_pass
(
git_reference_create
(
&
ref_one
,
g_repo
,
ref_one_name
,
&
id
,
0
));
cl_git_pass
(
git_reference_create
(
&
ref_one
,
g_repo
,
ref_one_name
,
&
id
,
0
,
NULL
,
NULL
));
cl_git_pass
(
git_reference_create
(
&
ref_two
,
g_repo
,
ref_two_name
,
&
id
,
0
));
cl_git_pass
(
git_reference_create
(
&
ref_two
,
g_repo
,
ref_two_name
,
&
id
,
0
,
NULL
,
NULL
));
/* Pack everything */
/* Pack everything */
cl_git_pass
(
git_repository_refdb
(
&
refdb
,
g_repo
));
cl_git_pass
(
git_repository_refdb
(
&
refdb
,
g_repo
));
cl_git_pass
(
git_refdb_compress
(
refdb
));
cl_git_pass
(
git_refdb_compress
(
refdb
));
/* Attempt to create illegal reference */
/* Attempt to create illegal reference */
cl_git_fail
(
git_reference_create
(
&
ref_one_new
,
g_repo
,
ref_one_name_new
,
&
id
,
0
));
cl_git_fail
(
git_reference_create
(
&
ref_one_new
,
g_repo
,
ref_one_name_new
,
&
id
,
0
,
NULL
,
NULL
));
/* Illegal reference couldn't be created so this is supposed to fail */
/* Illegal reference couldn't be created so this is supposed to fail */
cl_git_fail
(
git_reference_lookup
(
&
ref_one_new
,
g_repo
,
ref_one_name_new
));
cl_git_fail
(
git_reference_lookup
(
&
ref_one_new
,
g_repo
,
ref_one_name_new
));
...
@@ -301,7 +301,7 @@ void test_refs_rename__prefix(void)
...
@@ -301,7 +301,7 @@ void test_refs_rename__prefix(void)
git_oid_cpy
(
&
id
,
git_reference_target
(
ref
));
git_oid_cpy
(
&
id
,
git_reference_target
(
ref
));
/* Create loose references */
/* Create loose references */
cl_git_pass
(
git_reference_create
(
&
ref_two
,
g_repo
,
ref_two_name
,
&
id
,
0
));
cl_git_pass
(
git_reference_create
(
&
ref_two
,
g_repo
,
ref_two_name
,
&
id
,
0
,
NULL
,
NULL
));
/* An existing reference... */
/* An existing reference... */
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
ref_two_name
));
cl_git_pass
(
git_reference_lookup
(
&
looked_up_ref
,
g_repo
,
ref_two_name
));
...
@@ -334,7 +334,7 @@ void test_refs_rename__move_up(void)
...
@@ -334,7 +334,7 @@ void test_refs_rename__move_up(void)
git_oid_cpy
(
&
id
,
git_reference_target
(
ref
));
git_oid_cpy
(
&
id
,
git_reference_target
(
ref
));
/* Create loose references */
/* Create loose references */
cl_git_pass
(
git_reference_create
(
&
ref_two
,
g_repo
,
ref_two_name_new
,
&
id
,
0
));
cl_git_pass
(
git_reference_create
(
&
ref_two
,
g_repo
,
ref_two_name_new
,
&
id
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref_two
);
git_reference_free
(
ref_two
);
/* An existing reference... */
/* An existing reference... */
...
...
tests/refs/revparse.c
View file @
f04c7dca
...
@@ -596,7 +596,8 @@ void test_refs_revparse__issue_994(void)
...
@@ -596,7 +596,8 @@ void test_refs_revparse__issue_994(void)
repo
,
repo
,
"refs/remotes/origin/bim_with_3d@11296"
,
"refs/remotes/origin/bim_with_3d@11296"
,
git_reference_target
(
head
),
git_reference_target
(
head
),
0
));
0
,
NULL
,
NULL
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"origin/bim_with_3d@11296"
));
cl_git_pass
(
git_revparse_single
(
&
target
,
repo
,
"origin/bim_with_3d@11296"
));
git_object_free
(
target
);
git_object_free
(
target
);
...
...
tests/refs/settargetwithlog.c
View file @
f04c7dca
...
@@ -38,7 +38,7 @@ void test_refs_settargetwithlog__updating_a_direct_reference_adds_a_reflog_entry
...
@@ -38,7 +38,7 @@ void test_refs_settargetwithlog__updating_a_direct_reference_adds_a_reflog_entry
cl_git_pass
(
git_signature_now
(
&
signature
,
"foo"
,
"foo@bar"
));
cl_git_pass
(
git_signature_now
(
&
signature
,
"foo"
,
"foo@bar"
));
cl_git_pass
(
git_reference_set_target
_with_log
(
cl_git_pass
(
git_reference_set_target
(
&
reference_out
,
reference
,
&
target_id
,
signature
,
message
));
&
reference_out
,
reference
,
&
target_id
,
signature
,
message
));
cl_git_pass
(
git_reflog_read
(
&
reflog
,
g_repo
,
br2_name
));
cl_git_pass
(
git_reflog_read
(
&
reflog
,
g_repo
,
br2_name
));
...
...
tests/refs/setter.c
View file @
f04c7dca
...
@@ -34,7 +34,7 @@ void test_refs_setter__update_direct(void)
...
@@ -34,7 +34,7 @@ void test_refs_setter__update_direct(void)
cl_git_pass
(
git_reference_lookup
(
&
test_ref
,
g_repo
,
ref_test_name
));
cl_git_pass
(
git_reference_lookup
(
&
test_ref
,
g_repo
,
ref_test_name
));
cl_assert
(
git_reference_type
(
test_ref
)
==
GIT_REF_OID
);
cl_assert
(
git_reference_type
(
test_ref
)
==
GIT_REF_OID
);
cl_git_pass
(
git_reference_set_target
(
&
new_ref
,
test_ref
,
&
id
));
cl_git_pass
(
git_reference_set_target
(
&
new_ref
,
test_ref
,
&
id
,
NULL
,
NULL
));
git_reference_free
(
test_ref
);
git_reference_free
(
test_ref
);
git_reference_free
(
new_ref
);
git_reference_free
(
new_ref
);
...
@@ -53,7 +53,7 @@ void test_refs_setter__update_symbolic(void)
...
@@ -53,7 +53,7 @@ void test_refs_setter__update_symbolic(void)
cl_assert
(
git_reference_type
(
head
)
==
GIT_REF_SYMBOLIC
);
cl_assert
(
git_reference_type
(
head
)
==
GIT_REF_SYMBOLIC
);
cl_assert
(
strcmp
(
git_reference_symbolic_target
(
head
),
ref_master_name
)
==
0
);
cl_assert
(
strcmp
(
git_reference_symbolic_target
(
head
),
ref_master_name
)
==
0
);
cl_git_pass
(
git_reference_symbolic_set_target
(
&
new_head
,
head
,
ref_test_name
));
cl_git_pass
(
git_reference_symbolic_set_target
(
&
new_head
,
head
,
ref_test_name
,
NULL
,
NULL
));
git_reference_free
(
new_head
);
git_reference_free
(
new_head
);
git_reference_free
(
head
);
git_reference_free
(
head
);
...
@@ -73,7 +73,7 @@ void test_refs_setter__cant_update_direct_with_symbolic(void)
...
@@ -73,7 +73,7 @@ void test_refs_setter__cant_update_direct_with_symbolic(void)
cl_assert
(
git_reference_type
(
ref
)
==
GIT_REF_OID
);
cl_assert
(
git_reference_type
(
ref
)
==
GIT_REF_OID
);
git_oid_cpy
(
&
id
,
git_reference_target
(
ref
));
git_oid_cpy
(
&
id
,
git_reference_target
(
ref
));
cl_git_fail
(
git_reference_symbolic_set_target
(
&
new
,
ref
,
ref_name
));
cl_git_fail
(
git_reference_symbolic_set_target
(
&
new
,
ref
,
ref_name
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
}
}
...
@@ -90,10 +90,10 @@ void test_refs_setter__cant_update_symbolic_with_direct(void)
...
@@ -90,10 +90,10 @@ void test_refs_setter__cant_update_symbolic_with_direct(void)
git_reference_free
(
ref
);
git_reference_free
(
ref
);
/* Create the symbolic ref */
/* Create the symbolic ref */
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
g_repo
,
ref_name
,
ref_master_name
,
0
));
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
g_repo
,
ref_name
,
ref_master_name
,
0
,
NULL
,
NULL
));
/* Can't set an OID on a direct ref */
/* Can't set an OID on a direct ref */
cl_git_fail
(
git_reference_set_target
(
&
new
,
ref
,
&
id
));
cl_git_fail
(
git_reference_set_target
(
&
new
,
ref
,
&
id
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
}
}
tests/refs/unicode.c
View file @
f04c7dca
...
@@ -24,7 +24,7 @@ void test_refs_unicode__create_and_lookup(void)
...
@@ -24,7 +24,7 @@ void test_refs_unicode__create_and_lookup(void)
/* Create the reference */
/* Create the reference */
cl_git_pass
(
git_reference_lookup
(
&
ref0
,
repo
,
master
));
cl_git_pass
(
git_reference_lookup
(
&
ref0
,
repo
,
master
));
cl_git_pass
(
git_reference_create
(
cl_git_pass
(
git_reference_create
(
&
ref1
,
repo
,
REFNAME
,
git_reference_target
(
ref0
),
0
));
&
ref1
,
repo
,
REFNAME
,
git_reference_target
(
ref0
),
0
,
NULL
,
NULL
));
cl_assert_equal_s
(
REFNAME
,
git_reference_name
(
ref1
));
cl_assert_equal_s
(
REFNAME
,
git_reference_name
(
ref1
));
git_reference_free
(
ref0
);
git_reference_free
(
ref0
);
...
...
tests/refs/update.c
View file @
f04c7dca
...
@@ -22,5 +22,5 @@ void test_refs_update__updating_the_target_of_a_symref_with_an_invalid_name_retu
...
@@ -22,5 +22,5 @@ void test_refs_update__updating_the_target_of_a_symref_with_an_invalid_name_retu
cl_assert_equal_i
(
GIT_REF_SYMBOLIC
,
git_reference_type
(
head
));
cl_assert_equal_i
(
GIT_REF_SYMBOLIC
,
git_reference_type
(
head
));
git_reference_free
(
head
);
git_reference_free
(
head
);
cl_assert_equal_i
(
GIT_EINVALIDSPEC
,
git_reference_symbolic_create
(
&
head
,
g_repo
,
GIT_HEAD_FILE
,
"refs/heads/inv@{id"
,
1
));
cl_assert_equal_i
(
GIT_EINVALIDSPEC
,
git_reference_symbolic_create
(
&
head
,
g_repo
,
GIT_HEAD_FILE
,
"refs/heads/inv@{id"
,
1
,
NULL
,
NULL
));
}
}
tests/repo/head.c
View file @
f04c7dca
...
@@ -26,7 +26,7 @@ void test_repo_head__head_detached(void)
...
@@ -26,7 +26,7 @@ void test_repo_head__head_detached(void)
cl_assert_equal_i
(
true
,
git_repository_head_detached
(
repo
));
cl_assert_equal_i
(
true
,
git_repository_head_detached
(
repo
));
/* take the reop back to it's original state */
/* take the reop back to it's original state */
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/master"
,
1
));
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/master"
,
1
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
cl_assert_equal_i
(
false
,
git_repository_head_detached
(
repo
));
cl_assert_equal_i
(
false
,
git_repository_head_detached
(
repo
));
...
@@ -44,7 +44,7 @@ void test_repo_head__unborn_head(void)
...
@@ -44,7 +44,7 @@ void test_repo_head__unborn_head(void)
/* take the repo back to it's original state */
/* take the repo back to it's original state */
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/master"
,
1
));
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
repo
,
"HEAD"
,
"refs/heads/master"
,
1
,
NULL
,
NULL
));
cl_assert
(
git_repository_head_unborn
(
repo
)
==
0
);
cl_assert
(
git_repository_head_unborn
(
repo
)
==
0
);
git_reference_free
(
ref
);
git_reference_free
(
ref
);
...
@@ -156,7 +156,7 @@ void test_repo_head__detach_head_Fails_if_HEAD_and_point_to_a_non_commitish(void
...
@@ -156,7 +156,7 @@ void test_repo_head__detach_head_Fails_if_HEAD_and_point_to_a_non_commitish(void
{
{
git_reference
*
head
;
git_reference
*
head
;
cl_git_pass
(
git_reference_symbolic_create
(
&
head
,
repo
,
GIT_HEAD_FILE
,
"refs/tags/point_to_blob"
,
1
));
cl_git_pass
(
git_reference_symbolic_create
(
&
head
,
repo
,
GIT_HEAD_FILE
,
"refs/tags/point_to_blob"
,
1
,
NULL
,
NULL
));
cl_git_fail
(
git_repository_detach_head
(
repo
));
cl_git_fail
(
git_repository_detach_head
(
repo
));
...
...
tests/repo/repo_helpers.c
View file @
f04c7dca
...
@@ -7,7 +7,7 @@ void make_head_unborn(git_repository* repo, const char *target)
...
@@ -7,7 +7,7 @@ void make_head_unborn(git_repository* repo, const char *target)
{
{
git_reference
*
head
;
git_reference
*
head
;
cl_git_pass
(
git_reference_symbolic_create
(
&
head
,
repo
,
GIT_HEAD_FILE
,
target
,
1
));
cl_git_pass
(
git_reference_symbolic_create
(
&
head
,
repo
,
GIT_HEAD_FILE
,
target
,
1
,
NULL
,
NULL
));
git_reference_free
(
head
);
git_reference_free
(
head
);
}
}
...
...
tests/stash/save.c
View file @
f04c7dca
...
@@ -174,7 +174,7 @@ void test_stash_save__cannot_stash_against_an_unborn_branch(void)
...
@@ -174,7 +174,7 @@ void test_stash_save__cannot_stash_against_an_unborn_branch(void)
{
{
git_reference
*
head
;
git_reference
*
head
;
cl_git_pass
(
git_reference_symbolic_create
(
&
head
,
repo
,
"HEAD"
,
"refs/heads/unborn"
,
1
));
cl_git_pass
(
git_reference_symbolic_create
(
&
head
,
repo
,
"HEAD"
,
"refs/heads/unborn"
,
1
,
NULL
,
NULL
));
cl_assert_equal_i
(
GIT_EUNBORNBRANCH
,
cl_assert_equal_i
(
GIT_EUNBORNBRANCH
,
git_stash_save
(
&
stash_tip_oid
,
repo
,
signature
,
NULL
,
GIT_STASH_DEFAULT
));
git_stash_save
(
&
stash_tip_oid
,
repo
,
signature
,
NULL
,
GIT_STASH_DEFAULT
));
...
...
tests/submodule/lookup.c
View file @
f04c7dca
...
@@ -108,7 +108,7 @@ void test_submodule_lookup__lookup_even_with_unborn_head(void)
...
@@ -108,7 +108,7 @@ void test_submodule_lookup__lookup_even_with_unborn_head(void)
/* put us on an unborn branch */
/* put us on an unborn branch */
cl_git_pass
(
git_reference_symbolic_create
(
cl_git_pass
(
git_reference_symbolic_create
(
&
head
,
g_repo
,
"HEAD"
,
"refs/heads/garbage"
,
1
));
&
head
,
g_repo
,
"HEAD"
,
"refs/heads/garbage"
,
1
,
NULL
,
NULL
));
git_reference_free
(
head
);
git_reference_free
(
head
);
/* lookup existing */
/* lookup existing */
...
...
tests/threads/refdb.c
View file @
f04c7dca
...
@@ -58,7 +58,7 @@ void test_threads_refdb__iterator(void)
...
@@ -58,7 +58,7 @@ void test_threads_refdb__iterator(void)
for
(
r
=
0
;
r
<
200
;
++
r
)
{
for
(
r
=
0
;
r
<
200
;
++
r
)
{
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/direct-%03d"
,
r
);
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/direct-%03d"
,
r
);
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
name
,
&
head
,
0
));
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
name
,
&
head
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
}
}
...
@@ -102,7 +102,7 @@ static void *create_refs(void *arg)
...
@@ -102,7 +102,7 @@ static void *create_refs(void *arg)
for
(
i
=
0
;
i
<
10
;
++
i
)
{
for
(
i
=
0
;
i
<
10
;
++
i
)
{
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/thread-%03d-%02d"
,
*
id
,
i
);
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/thread-%03d-%02d"
,
*
id
,
i
);
cl_git_pass
(
git_reference_create
(
&
ref
[
i
],
g_repo
,
name
,
&
head
,
0
));
cl_git_pass
(
git_reference_create
(
&
ref
[
i
],
g_repo
,
name
,
&
head
,
0
,
NULL
,
NULL
));
if
(
i
==
5
)
{
if
(
i
==
5
)
{
git_refdb
*
refdb
;
git_refdb
*
refdb
;
...
@@ -165,7 +165,7 @@ void test_threads_refdb__edit_while_iterate(void)
...
@@ -165,7 +165,7 @@ void test_threads_refdb__edit_while_iterate(void)
for
(
r
=
0
;
r
<
50
;
++
r
)
{
for
(
r
=
0
;
r
<
50
;
++
r
)
{
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/starter-%03d"
,
r
);
snprintf
(
name
,
sizeof
(
name
),
"refs/heads/starter-%03d"
,
r
);
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
name
,
&
head
,
0
));
cl_git_pass
(
git_reference_create
(
&
ref
,
g_repo
,
name
,
&
head
,
0
,
NULL
,
NULL
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
}
}
...
...
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