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
8f17ed80
Commit
8f17ed80
authored
Jul 10, 2012
by
nulltoken
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revparse: simplify the parsing of described object
parent
111ee3fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
14 deletions
+12
-14
src/revparse.c
+12
-14
No files found.
src/revparse.c
View file @
8f17ed80
...
...
@@ -104,7 +104,16 @@ cleanup:
return
error
;
}
extern
int
revparse_lookup_object
(
git_object
**
out
,
git_repository
*
repo
,
const
char
*
spec
);
static
int
maybe_sha_or_abbrev
(
git_object
**
out
,
git_repository
*
repo
,
const
char
*
spec
)
{
git_oid
oid
;
size_t
speclen
=
strlen
(
spec
);
if
(
git_oid_fromstrn
(
&
oid
,
spec
,
speclen
)
<
0
)
return
GIT_ENOTFOUND
;
return
git_object_lookup_prefix
(
out
,
repo
,
&
oid
,
speclen
,
GIT_OBJ_ANY
);
}
static
int
maybe_describe
(
git_object
**
out
,
git_repository
*
repo
,
const
char
*
spec
)
{
...
...
@@ -123,21 +132,10 @@ static int maybe_describe(git_object**out, git_repository *repo, const char *spe
if
(
!
match
)
return
GIT_ENOTFOUND
;
return
revparse_lookup_object
(
out
,
repo
,
substr
+
2
);
}
static
int
maybe_sha_or_abbrev
(
git_object
**
out
,
git_repository
*
repo
,
const
char
*
spec
)
{
git_oid
oid
;
size_t
speclen
=
strlen
(
spec
);
if
(
git_oid_fromstrn
(
&
oid
,
spec
,
speclen
)
<
0
)
return
GIT_ENOTFOUND
;
return
git_object_lookup_prefix
(
out
,
repo
,
&
oid
,
speclen
,
GIT_OBJ_ANY
);
return
maybe_sha_or_abbrev
(
out
,
repo
,
substr
+
2
);
}
int
revparse_lookup_object
(
git_object
**
out
,
git_repository
*
repo
,
const
char
*
spec
)
static
int
revparse_lookup_object
(
git_object
**
out
,
git_repository
*
repo
,
const
char
*
spec
)
{
int
error
;
git_reference
*
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