started diff parser
[phpgitweb.git] / htdocs / lib / GitCommand.class.php
index 1e4b07f6b4c29e4001c22e2bc2031804ea7809ee..86174b5e6e29551eba91a7757378208d913fe9eb 100644 (file)
@@ -153,17 +153,18 @@ class GitCommand {
                                $files = explode("\t", $entry['file']);
                                $entry['from_file'] = $files[0];
                                $entry['to_file'] = $files[1];
-                       }
+                       } else
+                               $entry['from_file'] = $entry['to_file'] = $entry['file'];
                } else if(preg_match('/^(::+)((?:[0-7]{6} )+)((?:[0-9a-fA-F]{40} )+)([a-zA-Z]+)\t(.*)$/i', $line, $matches)) {
                        $entry['parents'] = strlen($matches[1]);
                        $from_modes = explode(" ", $matches[2]);
-                       $entry['from_mode'] = array_slice($from_modes, 1);
+                       $entry['from_mode'] = array_slice($from_modes, 1, -1);
                        $entry['to_mode'] = $from_modes[0];
                        $from_ids = explode(" ", $matches[3]);
-                       $entry['from_id'] = array_slice($from_ids, 1);
+                       $entry['from_id'] = array_slice($from_ids, 1, -1);
                        $entry['to_id'] = $from_ids[0];
                        $entry['status'] = str_split($matches[4]);
-                       $entry['file'] = $matches[5];
+                       $entry['file'] = $entry['from_file'] = $entry['to_file'] = $matches[5];
                }
                return $entry;
        }