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
491cecfe
Commit
491cecfe
authored
Feb 04, 2014
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add reflog parameters to git_push_update_tips
parent
0adb0606
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
4 deletions
+29
-4
include/git2/push.h
+7
-1
src/push.c
+7
-2
tests/online/push.c
+15
-1
No files found.
include/git2/push.h
View file @
491cecfe
...
...
@@ -103,10 +103,16 @@ GIT_EXTERN(int) git_push_add_refspec(git_push *push, const char *refspec);
* Update remote tips after a push
*
* @param push The push object
* @param signature The identity to use when updating reflogs
* @param reflog_message The message to insert into the reflogs. If NULL, the
* default is "update by push".
*
* @return 0 or an error code
*/
GIT_EXTERN
(
int
)
git_push_update_tips
(
git_push
*
push
);
GIT_EXTERN
(
int
)
git_push_update_tips
(
git_push
*
push
,
const
git_signature
*
signature
,
const
char
*
reflog_message
);
/**
* Actually push all given refspecs
...
...
src/push.c
View file @
491cecfe
...
...
@@ -194,7 +194,10 @@ int git_push_add_refspec(git_push *push, const char *refspec)
return
0
;
}
int
git_push_update_tips
(
git_push
*
push
)
int
git_push_update_tips
(
git_push
*
push
,
const
git_signature
*
signature
,
const
char
*
reflog_message
)
{
git_buf
remote_ref_name
=
GIT_BUF_INIT
;
size_t
i
,
j
;
...
...
@@ -241,7 +244,9 @@ int git_push_update_tips(git_push *push)
giterr_clear
();
else
goto
on_error
;
}
else
if
((
error
=
git_reference_create
(
NULL
,
push
->
remote
->
repo
,
git_buf_cstr
(
&
remote_ref_name
),
&
push_spec
->
loid
,
1
,
NULL
,
NULL
))
<
0
)
}
else
if
((
error
=
git_reference_create
(
NULL
,
push
->
remote
->
repo
,
git_buf_cstr
(
&
remote_ref_name
),
&
push_spec
->
loid
,
1
,
signature
,
reflog_message
?
reflog_message
:
"update by push"
))
<
0
)
goto
on_error
;
}
...
...
tests/online/push.c
View file @
491cecfe
...
...
@@ -414,11 +414,13 @@ static void do_push(
git_push_options
opts
=
GIT_PUSH_OPTIONS_INIT
;
size_t
i
;
int
pack_progress_calls
=
0
,
transfer_progress_calls
=
0
;
git_signature
*
pusher
;
if
(
_remote
)
{
/* Auto-detect the number of threads to use */
opts
.
pb_parallelism
=
0
;
cl_git_pass
(
git_signature_now
(
&
pusher
,
"Foo Bar"
,
"foo@example.com"
));
cl_git_pass
(
git_remote_connect
(
_remote
,
GIT_DIRECTION_PUSH
));
cl_git_pass
(
git_push_new
(
&
push
,
_remote
));
...
...
@@ -455,13 +457,15 @@ static void do_push(
verify_refs
(
_remote
,
expected_refs
,
expected_refs_len
);
cl_git_pass
(
git_push_update_tips
(
push
));
cl_git_pass
(
git_push_update_tips
(
push
,
pusher
,
"test push"
));
verify_tracking_branches
(
_remote
,
expected_refs
,
expected_refs_len
);
git_push_free
(
push
);
git_remote_disconnect
(
_remote
);
git_signature_free
(
pusher
);
}
}
/* Call push_finish() without ever calling git_push_add_refspec() */
...
...
@@ -528,6 +532,9 @@ void test_online_push__b5_cancel(void)
void
test_online_push__multi
(
void
)
{
git_reflog
*
log
;
const
git_reflog_entry
*
entry
;
const
char
*
specs
[]
=
{
"refs/heads/b1:refs/heads/b1"
,
"refs/heads/b2:refs/heads/b2"
,
...
...
@@ -552,6 +559,13 @@ void test_online_push__multi(void)
do_push
(
specs
,
ARRAY_SIZE
(
specs
),
exp_stats
,
ARRAY_SIZE
(
exp_stats
),
exp_refs
,
ARRAY_SIZE
(
exp_refs
),
0
,
1
);
cl_git_pass
(
git_reflog_read
(
&
log
,
_repo
,
"refs/remotes/test/b1"
));
entry
=
git_reflog_entry_byindex
(
log
,
0
);
cl_assert_equal_s
(
"test push"
,
git_reflog_entry_message
(
entry
));
cl_assert_equal_s
(
"foo@example.com"
,
git_reflog_entry_committer
(
entry
)
->
email
);
git_reflog_free
(
log
);
}
void
test_online_push__implicit_tgt
(
void
)
...
...
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