Code cleanups
authorSimon 'corecode' Schubert <[email protected]>
Wed, 24 Jan 2007 08:25:43 +0000 (24 09:25 +0100)
committerSimon 'corecode' Schubert <[email protected]>
Wed, 24 Jan 2007 08:25:43 +0000 (24 09:25 +0100)
git/internal/loose.rb

index 505c556..d740d4e 100644 (file)
@@ -17,12 +17,10 @@ module Git module Internal
 
       path = @directory+'/'+sha1[0...2]+'/'+sha1[2..40]
       begin
-        File.stat(path)
+        get_raw_object(File.read(path))
       rescue Errno::ENOENT
-        return nil
+        nil
       end
-      f = File.open(path)
-      return get_raw_object(f.read)
     end
 
     def get_raw_object(buf)
@@ -37,8 +35,7 @@ module Git module Internal
           raise LooseObjectError, "invalid object header"
         end
         type, size = header.split(/ /, 2)
-        if !%w(blob tree commit tag).include?(type) ||
-          size !~ /^\d+$/
+        if !%w(blob tree commit tag).include?(type) || size !~ /^\d+$/
           raise LooseObjectError, "invalid object header"
         end
         type = type.to_sym