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
412a3808
Commit
412a3808
authored
Jan 15, 2015
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push: remove reflog message override
We always use "update by push".
parent
6bfb990d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
23 deletions
+15
-23
include/git2/remote.h
+5
-6
src/push.c
+2
-4
src/push.h
+1
-5
src/remote.c
+3
-4
tests/network/remote/local.c
+2
-2
tests/online/push.c
+2
-2
No files found.
include/git2/remote.h
View file @
412a3808
...
@@ -376,9 +376,10 @@ GIT_EXTERN(void) git_remote_free(git_remote *remote);
...
@@ -376,9 +376,10 @@ GIT_EXTERN(void) git_remote_free(git_remote *remote);
* Update the tips to the new state
* Update the tips to the new state
*
*
* @param remote the remote to update
* @param remote the remote to update
* @param reflog_message The message to insert into the reflogs. If NULL, the
* @param reflog_message The message to insert into the reflogs. If
* default is "fetch <name>", where <name> is the name of
* NULL and fetching, the default is "fetch <name>", where <name> is
* the remote (or its url, for in-memory remotes).
* the name of the remote (or its url, for in-memory remotes). This
* parameter is ignored when pushing.
* @return 0 or an error code
* @return 0 or an error code
*/
*/
GIT_EXTERN
(
int
)
git_remote_update_tips
(
GIT_EXTERN
(
int
)
git_remote_update_tips
(
...
@@ -420,12 +421,10 @@ GIT_EXTERN(int) git_remote_fetch(
...
@@ -420,12 +421,10 @@ GIT_EXTERN(int) git_remote_fetch(
* @param refspecs the refspecs to use for pushing. If none are
* @param refspecs the refspecs to use for pushing. If none are
* passed, the configured refspecs will be used
* passed, the configured refspecs will be used
* @param opts the options
* @param opts the options
* @param reflog_message message to use for the reflog of upated references
*/
*/
GIT_EXTERN
(
int
)
git_remote_push
(
git_remote
*
remote
,
GIT_EXTERN
(
int
)
git_remote_push
(
git_remote
*
remote
,
const
git_strarray
*
refspecs
,
const
git_strarray
*
refspecs
,
const
git_push_options
*
opts
,
const
git_push_options
*
opts
);
const
char
*
reflog_message
);
/**
/**
* Get a list of the configured remotes for a repo
* Get a list of the configured remotes for a repo
...
...
src/push.c
View file @
412a3808
...
@@ -167,9 +167,7 @@ int git_push_add_refspec(git_push *push, const char *refspec)
...
@@ -167,9 +167,7 @@ int git_push_add_refspec(git_push *push, const char *refspec)
return
0
;
return
0
;
}
}
int
git_push_update_tips
(
int
git_push_update_tips
(
git_push
*
push
)
git_push
*
push
,
const
char
*
reflog_message
)
{
{
git_buf
remote_ref_name
=
GIT_BUF_INIT
;
git_buf
remote_ref_name
=
GIT_BUF_INIT
;
size_t
i
,
j
;
size_t
i
,
j
;
...
@@ -213,7 +211,7 @@ int git_push_update_tips(
...
@@ -213,7 +211,7 @@ int git_push_update_tips(
}
else
{
}
else
{
error
=
git_reference_create
(
NULL
,
push
->
remote
->
repo
,
error
=
git_reference_create
(
NULL
,
push
->
remote
->
repo
,
git_buf_cstr
(
&
remote_ref_name
),
&
push_spec
->
loid
,
1
,
git_buf_cstr
(
&
remote_ref_name
),
&
push_spec
->
loid
,
1
,
reflog_message
?
reflog_message
:
"update by push"
);
"update by push"
);
}
}
}
}
...
...
src/push.h
View file @
412a3808
...
@@ -109,14 +109,10 @@ int git_push_add_refspec(git_push *push, const char *refspec);
...
@@ -109,14 +109,10 @@ int git_push_add_refspec(git_push *push, const char *refspec);
*
*
* @param push The push object
* @param push The push object
* @param signature The identity to use when updating reflogs
* @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
* @return 0 or an error code
*/
*/
int
git_push_update_tips
(
int
git_push_update_tips
(
git_push
*
push
);
git_push
*
push
,
const
char
*
reflog_message
);
/**
/**
* Perform the push
* Perform the push
...
...
src/remote.c
View file @
412a3808
...
@@ -1461,7 +1461,7 @@ int git_remote_update_tips(
...
@@ -1461,7 +1461,7 @@ int git_remote_update_tips(
/* push has its own logic hidden away in the push object */
/* push has its own logic hidden away in the push object */
if
(
remote
->
push
)
{
if
(
remote
->
push
)
{
return
git_push_update_tips
(
remote
->
push
,
reflog_message
);
return
git_push_update_tips
(
remote
->
push
);
}
}
if
(
git_refspec__parse
(
&
tagspec
,
GIT_REFSPEC_TAGS
,
true
)
<
0
)
if
(
git_refspec__parse
(
&
tagspec
,
GIT_REFSPEC_TAGS
,
true
)
<
0
)
...
@@ -2370,8 +2370,7 @@ cleanup:
...
@@ -2370,8 +2370,7 @@ cleanup:
return
error
;
return
error
;
}
}
int
git_remote_push
(
git_remote
*
remote
,
const
git_strarray
*
refspecs
,
const
git_push_options
*
opts
,
int
git_remote_push
(
git_remote
*
remote
,
const
git_strarray
*
refspecs
,
const
git_push_options
*
opts
)
const
char
*
reflog_message
)
{
{
int
error
;
int
error
;
...
@@ -2383,7 +2382,7 @@ int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_
...
@@ -2383,7 +2382,7 @@ int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_
if
((
error
=
git_remote_upload
(
remote
,
refspecs
,
opts
))
<
0
)
if
((
error
=
git_remote_upload
(
remote
,
refspecs
,
opts
))
<
0
)
return
error
;
return
error
;
error
=
git_remote_update_tips
(
remote
,
reflog_message
);
error
=
git_remote_update_tips
(
remote
,
NULL
);
git_remote_disconnect
(
remote
);
git_remote_disconnect
(
remote
);
return
error
;
return
error
;
...
...
tests/network/remote/local.c
View file @
412a3808
...
@@ -464,12 +464,12 @@ void test_network_remote_local__push_delete(void)
...
@@ -464,12 +464,12 @@ void test_network_remote_local__push_delete(void)
cl_git_pass
(
git_remote_create
(
&
remote
,
src_repo
,
"origin"
,
"./target.git"
));
cl_git_pass
(
git_remote_create
(
&
remote
,
src_repo
,
"origin"
,
"./target.git"
));
/* Push the master branch and verify it's there */
/* Push the master branch and verify it's there */
cl_git_pass
(
git_remote_push
(
remote
,
&
specs
,
NULL
,
NULL
));
cl_git_pass
(
git_remote_push
(
remote
,
&
specs
,
NULL
));
cl_git_pass
(
git_reference_lookup
(
&
ref
,
dst_repo
,
"refs/heads/master"
));
cl_git_pass
(
git_reference_lookup
(
&
ref
,
dst_repo
,
"refs/heads/master"
));
git_reference_free
(
ref
);
git_reference_free
(
ref
);
specs
.
strings
=
spec_delete
;
specs
.
strings
=
spec_delete
;
cl_git_pass
(
git_remote_push
(
remote
,
&
specs
,
NULL
,
NULL
));
cl_git_pass
(
git_remote_push
(
remote
,
&
specs
,
NULL
));
cl_git_fail
(
git_reference_lookup
(
&
ref
,
dst_repo
,
"refs/heads/master"
));
cl_git_fail
(
git_reference_lookup
(
&
ref
,
dst_repo
,
"refs/heads/master"
));
git_remote_free
(
remote
);
git_remote_free
(
remote
);
...
...
tests/online/push.c
View file @
412a3808
...
@@ -487,7 +487,7 @@ static void do_push(
...
@@ -487,7 +487,7 @@ static void do_push(
if
(
check_progress_cb
&&
expected_ret
==
GIT_EUSER
)
if
(
check_progress_cb
&&
expected_ret
==
GIT_EUSER
)
data
->
transfer_progress_calls
=
GIT_EUSER
;
data
->
transfer_progress_calls
=
GIT_EUSER
;
error
=
git_remote_push
(
_remote
,
&
specs
,
&
opts
,
"test push"
);
error
=
git_remote_push
(
_remote
,
&
specs
,
&
opts
);
git__free
(
specs
.
strings
);
git__free
(
specs
.
strings
);
if
(
expected_ret
<
0
)
{
if
(
expected_ret
<
0
)
{
...
@@ -608,7 +608,7 @@ void test_online_push__multi(void)
...
@@ -608,7 +608,7 @@ void test_online_push__multi(void)
cl_git_pass
(
git_reflog_read
(
&
log
,
_repo
,
"refs/remotes/test/b1"
));
cl_git_pass
(
git_reflog_read
(
&
log
,
_repo
,
"refs/remotes/test/b1"
));
entry
=
git_reflog_entry_byindex
(
log
,
0
);
entry
=
git_reflog_entry_byindex
(
log
,
0
);
if
(
entry
)
{
if
(
entry
)
{
cl_assert_equal_s
(
"
test
push"
,
git_reflog_entry_message
(
entry
));
cl_assert_equal_s
(
"
update by
push"
,
git_reflog_entry_message
(
entry
));
cl_assert_equal_s
(
"foo@example.com"
,
git_reflog_entry_committer
(
entry
)
->
email
);
cl_assert_equal_s
(
"foo@example.com"
,
git_reflog_entry_committer
(
entry
)
->
email
);
}
}
...
...
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