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
991dab2d
Commit
991dab2d
authored
Jul 16, 2014
by
Linquize
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure \n is at the end of config file before a new section is written
parent
ad082501
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
src/config_file.c
+3
-3
No files found.
src/config_file.c
View file @
991dab2d
...
...
@@ -1522,6 +1522,9 @@ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *p
git_filebuf_write
(
&
file
,
reader
->
buffer
.
ptr
,
reader
->
buffer
.
size
);
if
(
reader
->
buffer
.
size
>
0
&&
*
(
reader
->
buffer
.
ptr
+
reader
->
buffer
.
size
-
1
)
!=
'\n'
)
git_filebuf_write
(
&
file
,
"
\n
"
,
1
);
/* And now if we just need to add a variable */
if
(
!
section_matches
&&
write_section
(
&
file
,
section
)
<
0
)
goto
rewrite_fail
;
...
...
@@ -1536,9 +1539,6 @@ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *p
}
/* If we are here, there is at least a section line */
if
(
reader
->
buffer
.
size
>
0
&&
*
(
reader
->
buffer
.
ptr
+
reader
->
buffer
.
size
-
1
)
!=
'\n'
)
git_filebuf_write
(
&
file
,
"
\n
"
,
1
);
q
=
quotes_for_value
(
value
);
git_filebuf_printf
(
&
file
,
"
\t
%s = %s%s%s
\n
"
,
name
,
q
,
value
,
q
);
}
...
...
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