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
4470ea39
Commit
4470ea39
authored
Jul 25, 2023
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cli: use cli_repository_open
parent
90d3cc6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
src/cli/cmd_cat_file.c
+2
-1
src/cli/cmd_hash_object.c
+2
-1
No files found.
src/cli/cmd_cat_file.c
View file @
4470ea39
...
...
@@ -137,6 +137,7 @@ static int print_pretty(git_object *object)
int
cmd_cat_file
(
int
argc
,
char
**
argv
)
{
cli_repository_open_options
open_opts
=
{
argv
+
1
,
argc
-
1
};
git_repository
*
repo
=
NULL
;
git_object
*
object
=
NULL
;
git_object_t
type
;
...
...
@@ -151,7 +152,7 @@ int cmd_cat_file(int argc, char **argv)
return
0
;
}
if
(
git_repository_open_ext
(
&
repo
,
"."
,
GIT_REPOSITORY_OPEN_FROM_ENV
,
NULL
)
<
0
)
if
(
cli_repository_open
(
&
repo
,
&
open_opts
)
<
0
)
return
cli_error_git
();
if
((
giterr
=
git_revparse_single
(
&
object
,
repo
,
object_spec
))
<
0
)
{
...
...
src/cli/cmd_hash_object.c
View file @
4470ea39
...
...
@@ -90,6 +90,7 @@ static int hash_buf(
int
cmd_hash_object
(
int
argc
,
char
**
argv
)
{
cli_repository_open_options
open_opts
=
{
argv
+
1
,
argc
-
1
};
git_repository
*
repo
=
NULL
;
git_odb
*
odb
=
NULL
;
git_oid_t
oid_type
;
...
...
@@ -111,7 +112,7 @@ int cmd_hash_object(int argc, char **argv)
return
cli_error_usage
(
"invalid object type '%s'"
,
type_name
);
if
(
write_object
&&
(
git_repository_open_ext
(
&
repo
,
"."
,
GIT_REPOSITORY_OPEN_FROM_ENV
,
NULL
)
<
0
||
(
cli_repository_open
(
&
repo
,
&
open_opts
)
<
0
||
git_repository_odb
(
&
odb
,
repo
)
<
0
))
{
ret
=
cli_error_git
();
goto
done
;
...
...
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