lib/git_cli/push.rb in git_cli-0.11.4 vs lib/git_cli/push.rb in git_cli-0.12.0
- old
+ new
@@ -13,15 +13,17 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+require_relative 'branch'
module GitCli
module Push
+ include Branch
- def push_changes(repos, branch = "master")
+ def push_changes(repos, branch = nil)
check_vcs
#check_repos
raise_if_empty(repos, "Push to repository name cannot be empty", GitCliException)
raise_if_false(is_repos_exist?(repos), "Given repository name '#{repos}' is not configured for this workspace", GitCliException)
@@ -31,10 +33,13 @@
cmd << @wsPath
cmd << "&&"
cmd << @vcs.exe_path
cmd << "push"
cmd << repos
+ if is_empty?(branch)
+ branch = current_branch
+ end
cmd << branch
cmdln = cmd.join " "
log_debug "Push : #{cmdln}"
@@ -42,11 +47,11 @@
[st.success?, res.strip]
end
end # push_changes
alias :push :push_changes
- def push_changes_with_tags(repos, branch = "master")
+ def push_changes_with_tags(repos, branch = nil)
check_vcs
#check_repos
raise_if_empty(repos, "Push to repository name cannot be empty", GitCliException)
raise_if_false(is_repos_exist?(repos), "Given repository name '#{repos}' is not configured for this workspace", GitCliException)
@@ -56,9 +61,12 @@
cmd << @wsPath
cmd << "&&"
cmd << @vcs.exe_path
cmd << "push"
cmd << repos
+ if is_empty?(branch)
+ branch = current_branch
+ end
cmd << branch
cmd << "--tags"
cmdln = cmd.join " "