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
fedd0f9e
Commit
fedd0f9e
authored
Apr 17, 2013
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refs: Do not union the peel
parent
13421eee
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
15 deletions
+12
-15
src/refdb_fs.c
+1
-1
src/refs.c
+10
-10
src/refs.h
+1
-4
No files found.
src/refdb_fs.c
View file @
fedd0f9e
...
...
@@ -645,7 +645,7 @@ static int loose_write(refdb_fs_backend *backend, const git_reference *ref)
if
(
ref
->
type
==
GIT_REF_OID
)
{
char
oid
[
GIT_OID_HEXSZ
+
1
];
git_oid_fmt
(
oid
,
&
ref
->
target
.
direct
.
oid
);
git_oid_fmt
(
oid
,
&
ref
->
target
.
oid
);
oid
[
GIT_OID_HEXSZ
]
=
'\0'
;
git_filebuf_printf
(
&
file
,
"%s
\n
"
,
oid
);
...
...
src/refs.c
View file @
fedd0f9e
...
...
@@ -83,10 +83,10 @@ git_reference *git_reference__alloc(
return
NULL
;
ref
->
type
=
GIT_REF_OID
;
git_oid_cpy
(
&
ref
->
target
.
direct
.
oid
,
oid
);
git_oid_cpy
(
&
ref
->
target
.
oid
,
oid
);
if
(
peel
!=
NULL
)
git_oid_cpy
(
&
ref
->
target
.
direct
.
peel
,
peel
);
git_oid_cpy
(
&
ref
->
peel
,
peel
);
return
ref
;
}
...
...
@@ -322,17 +322,17 @@ const git_oid *git_reference_target(const git_reference *ref)
if
(
ref
->
type
!=
GIT_REF_OID
)
return
NULL
;
return
&
ref
->
target
.
direct
.
oid
;
return
&
ref
->
target
.
oid
;
}
const
git_oid
*
git_reference_target_peel
(
const
git_reference
*
ref
)
{
assert
(
ref
);
if
(
ref
->
type
!=
GIT_REF_OID
||
git_oid_iszero
(
&
ref
->
target
.
direct
.
peel
))
if
(
ref
->
type
!=
GIT_REF_OID
||
git_oid_iszero
(
&
ref
->
peel
))
return
NULL
;
return
&
ref
->
target
.
direct
.
peel
;
return
&
ref
->
peel
;
}
const
char
*
git_reference_symbolic_target
(
const
git_reference
*
ref
)
...
...
@@ -491,7 +491,7 @@ int git_reference_rename(
*/
if
(
ref
->
type
==
GIT_REF_OID
)
{
result
=
git_reference__alloc
(
ref
->
db
,
new_name
,
&
ref
->
target
.
direct
.
oid
,
&
ref
->
target
.
direct
.
peel
);
&
ref
->
target
.
oid
,
&
ref
->
peel
);
}
else
if
(
ref
->
type
==
GIT_REF_SYMBOLIC
)
{
result
=
git_reference__alloc_symbolic
(
ref
->
db
,
new_name
,
ref
->
target
.
symbolic
);
}
else
{
...
...
@@ -833,7 +833,7 @@ int git_reference_cmp(git_reference *ref1, git_reference *ref2)
if
(
type1
==
GIT_REF_SYMBOLIC
)
return
strcmp
(
ref1
->
target
.
symbolic
,
ref2
->
target
.
symbolic
);
return
git_oid_cmp
(
&
ref1
->
target
.
direct
.
oid
,
&
ref2
->
target
.
direc
t
.
oid
);
return
git_oid_cmp
(
&
ref1
->
target
.
oid
,
&
ref2
->
targe
t
.
oid
);
}
static
int
reference__update_terminal
(
...
...
@@ -969,12 +969,12 @@ int git_reference_peel(
return
peel_error
(
error
,
ref
,
"Cannot resolve reference"
);
}
if
(
!
git_oid_iszero
(
&
resolved
->
target
.
direct
.
peel
))
{
if
(
!
git_oid_iszero
(
&
resolved
->
peel
))
{
error
=
git_object_lookup
(
&
target
,
git_reference_owner
(
ref
),
&
resolved
->
target
.
direct
.
peel
,
GIT_OBJ_ANY
);
git_reference_owner
(
ref
),
&
resolved
->
peel
,
GIT_OBJ_ANY
);
}
else
{
error
=
git_object_lookup
(
&
target
,
git_reference_owner
(
ref
),
&
resolved
->
target
.
direct
.
oid
,
GIT_OBJ_ANY
);
git_reference_owner
(
ref
),
&
resolved
->
target
.
oid
,
GIT_OBJ_ANY
);
}
if
(
error
<
0
)
{
...
...
src/refs.h
View file @
fedd0f9e
...
...
@@ -52,14 +52,11 @@ struct git_reference {
git_ref_t
type
;
union
{
struct
{
git_oid
oid
;
git_oid
peel
;
}
direct
;
char
*
symbolic
;
}
target
;
git_oid
peel
;
char
name
[
0
];
};
...
...
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