<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,6 +1,8 @@
 class AddShaCache &lt; ActiveRecord::Migration
   def self.up
-    add_column :git_configurations, :sha_array, :text
+    #:longtext not supported?
+    add_column :git_configurations, :sha_array, :text, :limit =&gt; 4.megabytes # 4 GIG limit (4,294,967,296) 
+    # execute &quot;ALTER TABLE git_configurations ADD COLUMN sha_array LONGTEXT&quot; 
     add_column :git_configurations, :last_pull_datetime, :datetime
     add_column :git_configurations, :last_pull_path, :string
   end</diff>
      <filename>db/migrate/3_add_sha_cache.rb</filename>
    </modified>
    <modified>
      <diff>@@ -110,6 +110,7 @@ class GitRepository
       revision = Revision.new(self)
       # RAILS_DEFAULT_LOGGER.info &quot;!!!\n!!! revision #{i}/#{commit.id}: #{commit.inspect}\n!!!&quot;
       revision.number = i
+      RAILS_DEFAULT_LOGGER.info &quot;!!!\n!!! revision #{i}/#{commit.id}: author nil!?\n!!!&quot; if commit.author.nil?
       revision.version_control_user = commit.author.name
       revision.mingle_user = @version_control_users[commit.author.email] if @version_control_users 
       revision.time = commit.authored_date
@@ -127,7 +128,13 @@ class GitRepository
   def revision(number)
     # RAILS_DEFAULT_LOGGER.info &quot;\n!!! GitRepository::revision [#{number}] !!!&quot;
     init_sha_array
-    revisions(number, number).first || (RAILS_DEFAULT_LOGGER.warn &quot;!!!\nCOULD NOT FIND REVISION NUMBER[#{number}]\n!!!&quot; &amp;&amp; (raise NoSuchRevisionError.new))
+    revision = revisions(number, number).first
+    if revision.nil?
+      RAILS_DEFAULT_LOGGER.warn &quot;!!!\n!!!!COULD NOT FIND REVISION NUMBER[#{number}] sha_array-size:#{@sha_array.size}\n!!!&quot;
+      raise NoSuchRevisionError.new
+    else
+      revision
+    end
   end
   
   def ==(other)
@@ -139,6 +146,7 @@ class GitRepository
     revision_number = youngest_revision_number if revision_number == 'HEAD'
     revision_number = revision_number.to_i
     if revision_number &lt; 1 or revision_number &gt; youngest_revision_number
+      RAILS_DEFAULT_LOGGER.warn &quot;!!!\n!!!!NODE:COULD NOT FIND REVISION NUMBER[#{revision_number}] sha_array-size:#{@sha_array.size}\n!!!&quot;
       raise NoSuchRevisionError.new
     end
     path = self.root_path if path.blank?
@@ -168,16 +176,35 @@ class GitRepository
       @revision_number = nil
       @revision = nil
       @path = path
-      if !git_item.nil?
-        @git_item = git_item
-      else
-        @git_item = @git_repo.tree(&quot;#{git_commit_sha}&quot;)
-        unless root_node?
-          path_components.each do |c|
-            @git_item = @git_item.send('/',c)
+      # RAILS_DEFAULT_LOGGER.info &quot;!!!\nnode.initialize[#{git_commit_sha}:#{path}]\n!!!&quot;
+      begin
+        if !git_item.nil?
+          @git_item = git_item
+        else
+          return (@git_item = @git_repo.tree(&quot;#{git_commit_sha}&quot;)) if root_node?
+          # RAILS_DEFAULT_LOGGER.info &quot;!!!\nnode.initialize.git_node_info[#{git_commit_sha}:display[#{display_path}]path[#{path}]\n!!!&quot;
+          git_node_info = Git.new(@git_repo.path).ls_tree({}, @git_commit_sha, &quot;-- .&quot; + display_path).chomp(&quot;\n&quot;)
+          # RAILS_DEFAULT_LOGGER.info &quot;!!!\nnode.initialize.git_node_info return [#{git_node_info}]\n!!!&quot;
+          mode, type, sha, name = git_node_info.split(%r{[\s\t]})
+          # RAILS_DEFAULT_LOGGER.info &quot;!!!\nnode.initialize.split [mode:#{mode},type:#{type},sha:#{sha},name:#{name}]\n!!!&quot;
+          if type == &quot;tree&quot;
+            @git_item = Grit::Tree.create(@git_repo,{:id =&gt; sha, :mode =&gt; mode, :name =&gt; name})
+          elsif type == &quot;blob&quot;
+            @git_item = Grit::Blob.create(@git_repo,{:id =&gt; sha, :mode =&gt; mode, :name =&gt; name})
+          elsif type == &quot;commit&quot;
+            RAILS_DEFAULT_LOGGER.warn &quot;!!!\nnode.initialize.could_not_create_git_item-commit-submodule[#{git_commit_sha}:display[#{display_path}]path[#{path}]\n!!!&quot;
+            @git_item = nil
+          else  
+            RAILS_DEFAULT_LOGGER.warn &quot;!!!\nnode.initialize.could_not_create_git_item-unknown-type[#{git_commit_sha}:display[#{display_path}]path[#{path}]\n!!!&quot;
+            @git_item = nil
           end
         end
-      end      
+      rescue Exception =&gt; e
+        # TODO : Figure out why this is happening : should always be able to get the git_item for a node, given a commit sha
+        # Is it possible that mingle is sending in paths for deleted nodes for a commit?
+        RAILS_DEFAULT_LOGGER.info &quot;!!!\nnode.initialize.exception[#{git_commit_sha}:#{path}]\n#{e.inspect}]\n!!!&quot;
+        return
+      end
     end
 
     def display_path
@@ -197,14 +224,16 @@ class GitRepository
     end
 
     def children
-      return [] if file?
+      return [] if file? || @git_item.nil?
       @git_item.contents.collect do |item|
-        Node.new(@repository, absolut_path_for(item.name), @git_commit_sha, item)
+        # TODO : Should we handle viewing submodules?  Grit returns nil for child if ls-tree returns &quot;commit&quot;
+        Node.new(@repository, absolut_path_for(item.name), @git_commit_sha, item) if !item.nil?
       end
     end
     
     def binary?
       return false if dir?
+      return true if !@git_item.nil?
       return @git_item.mime_type != Grit::Blob::DEFAULT_MIME_TYPE
     end
     
@@ -218,6 +247,7 @@ class GitRepository
     end
     
     def file?
+      return false if @git_item.nil?
       @git_item.kind_of?(Grit::Blob)
     end
 
@@ -238,11 +268,16 @@ class GitRepository
         #   return 1
         # end
         @revision_number = @repository.revision_of_sha(commit_of_node)
+        if @revision_number.nil?
+          # TODO : FIX THIS - this should not be happening
+          RAILS_DEFAULT_LOGGER.info &quot;!!!\nNode::revision_number::revision_number_not_found[#{commit_of_node}:#{display_path}]\n!!!&quot;
+          return 1
+        end
         # RAILS_DEFAULT_LOGGER.info &quot;!!!\nNode::revision_number::revision_number[#{@revision_number}]\n!!!&quot;
         @revision_number
       rescue Exception =&gt; e
         # raise NoSuchRevisionError.new
-        RAILS_DEFAULT_LOGGER.warn &quot;!!!\nNode::revision_number::revision_number_not_found[#{@git_commit_sha}]\n!!!&quot;
+        RAILS_DEFAULT_LOGGER.warn &quot;!!!\nNode::revision_number::revision_number_exception[#{sha}:#{display_path}]\n#{e.inspect}\n!!!&quot;
         1
       end
     end
@@ -269,6 +304,8 @@ class GitRepository
     end
 
     def dir?
+      # should submodule/commit directories be returned as directories?
+      return false if @git_item.nil?
       @git_item.kind_of?(Grit::Tree)
     end
     
@@ -341,7 +378,7 @@ class GitRepository
         repo = repository.repo
         sha = @revision.sha
         previous_commit = repo.commit(sha).parents[0]
-        RAILS_DEFAULT_LOGGER.debug &quot;!!!\n!!!(#{repo.path}) getting diff for commit:#{sha} path:#{path}\n!!!&quot;
+        # RAILS_DEFAULT_LOGGER.debug &quot;!!!\n!!!(#{repo.path}) getting diff for commit:#{sha} path:#{path}\n!!!&quot;
         begin
           Timeout::timeout(10) do
             diffs = Commit.diff(repo, previous_commit.id, sha, [path])
@@ -364,7 +401,7 @@ class GitRepository
 
       def html_diff
         # RAILS_DEFAULT_LOGGER.info &quot;!!! Revision::ChangePath::html_diff[#{@path}] !!!&quot;
-        return '' if node.nil? || node.dir? || node.binary?
+        return &quot;&quot; if node.nil? || node.dir? || node.binary?
         chunks_html = diff_chunks.collect do |chunk|
           chunk.lines.collect do |line|
             html_class = case
@@ -439,7 +476,7 @@ class GitRepository
     end
 
     def involves?(mingle_user)
-      mingle_user.name == self.user
+      mingle.user ? mingle_user.name == self.user : false
     end  
 
     def last?</diff>
      <filename>lib/git_repository.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,8 +4,8 @@ TODO:
 - Error processing
 - Short shas where appropriate
 Known Defects to Fix:
-- Repeated revisions on the history page (doesn't seem to happen for smaller projects), but the revision list seems to start getting repeats from the last revision back
-- Sometimes get uncaught exception GitRepository::NoSuchRevisionError - again for larger repos - generally prevents source view from displaying
+- Repeated revisions on the history page (doesn't seem to happen for smaller projects), but the revision list seems to start getting repeats from the last revision back (turned out to be problem with submodules)
+- Sometimes get uncaught exception GitRepository::NoSuchRevisionError - again for larger repos - generally prevents source view from displaying (submodule problem)
 Performance Enhancements:
 - Change calls within revisions to Commit.changelist (new function that returns just the --name-status array) @done
 - Move actual diff to ChangePath.diff @done
@@ -24,4 +24,4 @@ Wanted from Mingle API:
 - Access to the Revisions table to store additional information (in our case the SHA of the commit)
 Misc:
 - link from commit column on source view to display revision history
-- switch from :text to :longtext for the sha_array
\ No newline at end of file
+- switch from :text to :longtext for the sha_array @done
\ No newline at end of file</diff>
      <filename>todo.taskpaper</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>526e6bd0445ce0cf1733569a718e866f60910ba1</id>
    </parent>
  </parents>
  <author>
    <name>Don Mullen</name>
    <email>don@thinkrelevance.com</email>
  </author>
  <url>http://github.com/donmullen/mingle_git/commit/1d050260ffa7c8abf28c20ed53aec271e213c9ce</url>
  <id>1d050260ffa7c8abf28c20ed53aec271e213c9ce</id>
  <committed-date>2008-08-11T04:24:47-07:00</committed-date>
  <authored-date>2008-08-11T04:24:47-07:00</authored-date>
  <message>submodule detection and better node creation - did not resolve all runcoderun problems</message>
  <tree>fca2db3f1202c3dc83a501806b65a3650dabe55a</tree>
  <committer>
    <name>Don Mullen</name>
    <email>don@thinkrelevance.com</email>
  </committer>
</commit>
