Fix cecil update script
[mono.git] / mcs / class / Mono.Cecil / update.rb
index afbe0b2d80d3d950c13365d8ff7af36e116ba47d..2466592bd99fba20b24dba5643921262d2f97512 100644 (file)
@@ -23,8 +23,18 @@ sources.each { |source, destination|
        }
 }
 
-log = IO.popen("git log -n1")
+dir = Dir.pwd
 
-File.open("revision", File::WRONLY|File::TRUNC|File::CREAT, 0644) { |f|
-       f << log.gets[("commit ".length)..-1]
-}
+begin
+       Dir.chdir(repository) 
+
+       log = IO.popen("git log -n1")
+
+       Dir.chdir(dir)
+
+       File.open("revision", File::WRONLY|File::TRUNC|File::CREAT, 0644) do |f|
+               f << log.gets[("commit ".length)..-1]
+       end
+rescue
+       Dir.chdir(dir)
+end