lib/braid/operations.rb in braid-0.5 vs lib/braid/operations.rb in braid-0.6

- old
+ new

@@ -137,30 +137,34 @@ end end class Git < Proxy def commit(message, *args) + cmd = "git commit --no-verify" + if message # allow nil + message_file = Tempfile.new("braid_commit") + message_file.print("Braid: #{message}") + message_file.flush + cmd << " -F #{message_file.path}" + end + cmd << " #{args.join(' ')}" unless args.empty? + status, out, err = exec(cmd) + message_file.unlink if message_file - commit_message_file = Tempfile.new("braid_commit", ".") - commit_message_file.print("Braid: " + message) - commit_message_file.flush - status, out, err = exec("git commit -F #{commit_message_file.path} --no-verify #{args.join(' ')}") - commit_message_file.unlink - if status == 0 true elsif out.match(/nothing.* to commit/) false else raise ShellExecutionError, err end end - def fetch(remote = nil) - args = remote && "-n #{remote}" + def fetch(remote = nil, *args) + args.unshift "-n #{remote}" if remote # open4 messes with the pipes of index-pack - sh("git fetch #{args} 2>&1 >/dev/null") + sh("git fetch #{args.join(' ')} 2>&1 >/dev/null") end def checkout(treeish) invoke(:checkout, treeish) true @@ -180,9 +184,14 @@ end # Implies tracking. def remote_add(remote, path, branch) invoke(:remote, "add", "-t #{branch} -m #{branch}", remote, path) + true + end + + def remote_rm(remote) + invoke(:remote, "rm", remote) true end # Checks git and svn remotes. def remote_url(remote)