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
24d23220
Commit
24d23220
authored
Sep 04, 2013
by
Krzysztof Adamski
Committed by
Russell Belfer
Sep 09, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add -u option to add example.
parent
e8fa14d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
examples/add.c
+11
-2
No files found.
examples/add.c
View file @
24d23220
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
enum
print_options
{
enum
print_options
{
SKIP
=
1
,
SKIP
=
1
,
VERBOSE
=
2
,
VERBOSE
=
2
,
UPDATE
=
4
,
};
};
struct
print_payload
{
struct
print_payload
{
...
@@ -67,7 +68,7 @@ int main (int argc, char** argv)
...
@@ -67,7 +68,7 @@ int main (int argc, char** argv)
struct
print_payload
payload
=
{
0
};
struct
print_payload
payload
=
{
0
};
if
(
argc
<
2
)
{
if
(
argc
<
2
)
{
fprintf
(
stderr
,
"usage: add [-n|--dry-run] [-v|--verbose] file-spec [file-spec] [...]
\n
"
);
fprintf
(
stderr
,
"usage: add [-n|--dry-run] [-v|--verbose]
[-u|--update]
file-spec [file-spec] [...]
\n
"
);
return
1
;
return
1
;
}
}
...
@@ -81,6 +82,9 @@ int main (int argc, char** argv)
...
@@ -81,6 +82,9 @@ int main (int argc, char** argv)
else
if
(
!
strcmp
(
argv
[
i
],
"--dry-run"
)
||
!
strcmp
(
argv
[
i
],
"-n"
))
{
else
if
(
!
strcmp
(
argv
[
i
],
"--dry-run"
)
||
!
strcmp
(
argv
[
i
],
"-n"
))
{
options
|=
SKIP
;
options
|=
SKIP
;
}
}
else
if
(
!
strcmp
(
argv
[
i
],
"--update"
)
||
!
strcmp
(
argv
[
i
],
"-u"
))
{
options
|=
UPDATE
;
}
else
if
(
!
strcmp
(
argv
[
i
],
"--"
))
{
else
if
(
!
strcmp
(
argv
[
i
],
"--"
))
{
break
;
break
;
}
}
...
@@ -111,7 +115,12 @@ int main (int argc, char** argv)
...
@@ -111,7 +115,12 @@ int main (int argc, char** argv)
payload
.
options
=
options
;
payload
.
options
=
options
;
payload
.
repo
=
repo
;
payload
.
repo
=
repo
;
git_index_add_all
(
index
,
&
array
,
0
,
matched_cb
,
&
payload
);
if
(
options
&
UPDATE
)
{
git_index_update_all
(
index
,
&
array
,
matched_cb
,
&
payload
);
}
else
{
git_index_add_all
(
index
,
&
array
,
0
,
matched_cb
,
&
payload
);
}
git_index_write
(
index
);
git_index_write
(
index
);
git_index_free
(
index
);
git_index_free
(
index
);
...
...
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