Skip to content

Commit

Permalink
gitc commit --no-add option, doing a straight commit if merge commit
Browse files Browse the repository at this point in the history
  • Loading branch information
winton committed Oct 3, 2012
1 parent 7e933ef commit 2d086ee
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/gitcycle.rb
Expand Up @@ -187,6 +187,7 @@ def checkout(*args)


def commit(*args) def commit(*args)
msg = nil msg = nil
no_add = args.delete("--no-add")


if args.empty? if args.empty?
require_git && require_config require_git && require_config
Expand All @@ -205,13 +206,19 @@ def commit(*args)
end end
end end


cmd = "git add . && git add . -u && git commit -a" if no_add
cmd = "git commit"
else
cmd = "git add . && git add . -u && git commit -a"
end


if msg if File.exists?("#{Dir.pwd}/.git/MERGE_HEAD")
run(cmd + "m #{msg.dump}") Kernel.exec(cmd)
elsif msg
run(cmd + " -m #{msg.dump}")
Kernel.exec("git commit --amend") Kernel.exec("git commit --amend")
elsif args.empty? elsif args.empty?
run(cmd) Kernel.exec(cmd)
else else
exec_git(:commit, args) exec_git(:commit, args)
end end
Expand Down

0 comments on commit 2d086ee

Please sign in to comment.