lib/rim/sync_module_helper.rb in esr-rim-1.1.5 vs lib/rim/sync_module_helper.rb in esr-rim-1.2.0
- old
+ new
@@ -20,10 +20,11 @@
private
# export +revision+ of +mod+ into working copy
# BEWARE: any changes to the working copy target dir will be lost!
def export_module(message)
+ changes = false
RIM::git_session(@dest_root) do |d|
start_sha1 = d.rev_sha1("HEAD")
git_path = module_git_path(@remote_path)
RIM::git_session(git_path) do |s|
if !s.rev_sha1(@module_info.target_revision)
@@ -42,29 +43,13 @@
@rim_info.to_dir(local_path)
DirtyCheck.mark_clean(local_path)
end
temp_commit(d, "commit changes") if needs_commit?(d)
d.execute("git reset --soft #{start_sha1}")
- commit(message) if d.uncommited_changes?
+ changes = d.uncommited_changes?
+ commit(d, message || "rim sync: module #{@module_info.local_path}") if changes
end
- end
-
- def commit(message)
- RIM::git_session(@dest_root) do |s|
- msg_file = Tempfile.new('message')
- begin
- if message
- msg_file << message
- else
- msg_file << "rim sync: module #{@module_info.local_path}"
- end
- msg_file.close
- s.execute("git add --all")
- s.execute("git commit -F #{msg_file.path}")
- ensure
- msg_file.close(true)
- end
- end
+ changes
end
def needs_commit?(session)
# do we need to commit something?
stat = session.status(@module_info.local_path)