Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-shell
Commits
2f94bc3e
Commit
2f94bc3e
authored
Sep 15, 2017
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds --force option to push branches.
parent
2b575a8d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
CHANGELOG
CHANGELOG
+3
-0
lib/gitlab_projects.rb
lib/gitlab_projects.rb
+6
-1
spec/gitlab_projects_spec.rb
spec/gitlab_projects_spec.rb
+12
-0
No files found.
CHANGELOG
View file @
2f94bc3e
v5.9.1
- Adds --force option to push branches
v5.9.0
- Support new /internal/pre-receive API endpoint for post-receive operations
- Support new /internal/post-receive API endpoint for post-receive operations
...
...
lib/gitlab_projects.rb
View file @
2f94bc3e
...
...
@@ -116,8 +116,13 @@ class GitlabProjects
# timeout for push
timeout
=
(
ARGV
.
shift
||
120
).
to_i
# push with --force?
forced
=
ARGV
.
delete
(
'--force'
)
if
ARGV
.
include?
(
'--force'
)
$logger
.
info
"Pushing branches from
#{
full_path
}
to remote
#{
remote_name
}
:
#{
ARGV
}
"
cmd
=
%W(git --git-dir=
#{
full_path
}
push --
#{
remote_name
}
)
.
concat
(
ARGV
)
cmd
=
%W(git --git-dir=
#{
full_path
}
push)
cmd
<<
forced
if
forced
cmd
+=
%W(--
#{
remote_name
}
)
.
concat
(
ARGV
)
pid
=
Process
.
spawn
(
*
cmd
)
begin
...
...
spec/gitlab_projects_spec.rb
View file @
2f94bc3e
...
...
@@ -313,6 +313,18 @@ describe GitlabProjects do
expect
(
gl_projects
.
exec
).
to
be
false
end
context
'with --force'
do
let
(
:cmd
)
{
%W(git --git-dir=
#{
full_path
}
push --force --
#{
remote_name
}
#{
branch_name
}
)
}
let
(
:gl_projects
)
{
build_gitlab_projects
(
'push-branches'
,
repos_path
,
project_name
,
remote_name
,
'600'
,
'--force'
,
'master'
)
}
it
'executes the command'
do
expect
(
Process
).
to
receive
(
:spawn
).
with
(
*
cmd
).
and_return
(
pid
)
expect
(
Process
).
to
receive
(
:wait
).
with
(
pid
)
expect
(
gl_projects
.
exec
).
to
be
true
end
end
end
describe
:fetch_remote
do
...
...
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