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
6eb240b0
Commit
6eb240b0
authored
Jul 26, 2012
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Checkout: use caller's flags for open()
parent
095ccc01
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
src/checkout.c
+15
-15
No files found.
src/checkout.c
View file @
6eb240b0
...
...
@@ -64,8 +64,14 @@ static int blob_contents_to_file(git_repository *repo, git_buf *fnbuf,
const
git_oid
*
id
,
tree_walk_data
*
data
)
{
int
retcode
=
GIT_ERROR
;
int
fd
=
-
1
;
git_buf
contents
=
GIT_BUF_INIT
;
/* Deal with pre-existing files */
if
(
git_path_exists
(
git_buf_cstr
(
fnbuf
))
&&
data
->
opts
->
existing_file_action
==
GIT_CHECKOUT_SKIP_EXISTING
)
return
0
;
/* Allow disabling of filters */
if
(
data
->
opts
->
disable_filters
)
{
git_blob
*
blob
;
...
...
@@ -78,23 +84,17 @@ static int blob_contents_to_file(git_repository *repo, git_buf *fnbuf,
}
if
(
retcode
<
0
)
goto
bctf_cleanup
;
/* Deal with pre-existing files */
if
(
git_path_exists
(
git_buf_cstr
(
fnbuf
))
&&
data
->
opts
->
existing_file_action
==
GIT_CHECKOUT_SKIP_EXISTING
)
if
((
retcode
=
git_futils_mkpath2file
(
git_buf_cstr
(
fnbuf
),
data
->
opts
->
dir_mode
))
<
0
)
goto
bctf_cleanup
;
/* TODO: use p_open with flags */
int
fd
=
git_futils_creat_withpath
(
git_buf_cstr
(
fnbuf
),
data
->
opts
->
dir_mode
,
data
->
opts
->
file_mode
);
if
(
fd
>=
0
)
{
if
(
!
p_write
(
fd
,
git_buf_cstr
(
&
contents
),
git_buf_len
(
&
contents
)))
retcode
=
0
;
else
retcode
=
GIT_ERROR
;
p_close
(
fd
);
}
fd
=
p_open
(
git_buf_cstr
(
fnbuf
),
data
->
opts
->
file_open_flags
,
data
->
opts
->
file_mode
);
if
(
fd
<
0
)
goto
bctf_cleanup
;
if
(
!
p_write
(
fd
,
git_buf_cstr
(
&
contents
),
git_buf_len
(
&
contents
)))
retcode
=
0
;
else
retcode
=
GIT_ERROR
;
p_close
(
fd
);
bctf_cleanup:
git_buf_free
(
&
contents
);
...
...
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