Support tagged blobs
Support tagged blobs

--- a/include/git/Commit.class.php
+++ b/include/git/Commit.class.php
@@ -658,8 +658,10 @@
 		$projectRefs = $this->GetProject()->GetRefs('tags');
 
 		foreach ($projectRefs as $ref) {
-			if ($ref->GetCommit()->GetHash() === $this->hash) {
-				$tags[] = $ref;
+			if (($ref->GetType() == 'tag') || ($ref->GetType() == 'commit')) {
+				if ($ref->GetCommit()->GetHash() === $this->hash) {
+					$tags[] = $ref;
+				}
 			}
 		}
 

--- a/include/git/Tag.class.php
+++ b/include/git/Tag.class.php
@@ -279,6 +279,22 @@
 			$this->ReadData();
 
 		return $this->taggerTimezone;
+	}
+
+	/**
+	 * GetAge
+	 *
+	 * Gets the tag age
+	 *
+	 * @access public
+	 * @return string age
+	 */
+	public function GetAge()
+	{
+		if (!$this->dataRead)
+			$this->ReadData();
+
+		return time() - $this->taggerEpoch;
 	}
 
 	/**
@@ -431,6 +447,9 @@
 					}
 				}
 				break;
+			case 'blob':
+				$this->object = $this->GetProject()->GetBlob($objectHash);
+				break;
 		}
 	}
 
@@ -509,6 +528,9 @@
 					}
 				}
 				break;
+			case 'blob':
+				$this->object = $this->GetProject()->GetBlob($objectHash);
+				break;
 		}
 	}
 
@@ -560,6 +582,8 @@
 			$this->object = $this->object->GetHash();
 		} else if ($this->type == 'tag') {
 			$this->object = $this->object->GetName();
+		} else if ($this->type == 'blob') {
+			$this->object = $this->object->GetHash();
 		}
 
 		$this->objectReferenced = true;
@@ -584,6 +608,8 @@
 			$this->object = $this->GetProject()->GetCommit($this->object);
 		} else if ($this->type == 'tag') {
 			$this->object = $this->GetProject()->GetTag($this->object);
+		} else if ($this->type == 'blob') {
+			$this->object = $this->GetProject()->GetBlob($this->object);
 		}
 
 		$this->objectReferenced = false;

--- a/templates/tag.tpl
+++ b/templates/tag.tpl
@@ -28,6 +28,9 @@
        {elseif $objtype == 'tag'}
          <td class="monospace"><a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=tag&amp;h={$object->GetName()}" class="list">{$object->GetHash()}</a></td>
          <td class="link"><a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=tag&amp;h={$object->GetName()}">{t}tag{/t}</a></td>
+       {elseif $objtype == 'blob'}
+         <td class="monospace"><a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=blob&amp;h={$object->GetHash()}" class="list">{$object->GetHash()}</a></td>
+         <td class="link"><a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=blob&amp;h={$object->GetHash()}">{t}blob{/t}</a></td>
        {/if}
      </tr>
      {if $tag->GetTagger()}

--- a/templates/taglist.tpl
+++ b/templates/taglist.tpl
@@ -15,11 +15,13 @@
 	   {assign var=object value=$tag->GetObject()}
 	   {assign var=tagcommit value=$tag->GetCommit()}
 	   {assign var=objtype value=$tag->GetType()}
-           <td><em>{$tagcommit->GetAge()|agestring}</em></td>
+           <td><em>{if $tagcommit}{$tagcommit->GetAge()|agestring}{else}{$tag->GetAge()|agestring}{/if}</em></td>
            <td>
 	   {if $objtype == 'commit'}
 		   <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=commit&amp;h={$object->GetHash()}" class="list"><strong>{$tag->GetName()}</strong></a>
 	   {elseif $objtype == 'tag'}
+		   <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=tag&amp;h={$tag->GetName()}" class="list"><strong>{$tag->GetName()}</strong></a>
+	   {elseif $objtype == 'blob'}
 		   <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=tag&amp;h={$tag->GetName()}" class="list"><strong>{$tag->GetName()}</strong></a>
 	   {/if}
 	   </td>
@@ -33,8 +35,12 @@
              {if !$tag->LightTag()}
    	       <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=tag&amp;h={$tag->GetName()}">{t}tag{/t}</a> | 
              {/if}
+	     {if $objtype == 'blob'}
+		<a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=blob&amp;h={$object->GetHash()}">{t}blob{/t}</a>
+	     {else}
              <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=commit&amp;h={$tagcommit->GetHash()}">{t}commit{/t}</a>
 	      | <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=shortlog&amp;h={$tagcommit->GetHash()}">{t}shortlog{/t}</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=log&amp;h={$tagcommit->GetHash()}">{t}log{/t}</a> | <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=snapshot&amp;h={$tagcommit->GetHash()}" class="snapshotTip">{t}snapshot{/t}</a>
+	      {/if}
            </td>
        </tr>
      {/foreach}

comments