Do not crash list view when seeing a fully empty git repository
[phorkie.git] / www / edit.php
index e7e6fbcc9422de965b928d162fb18d989f30c6ad..1ced7b6a64fc812745bebb7ec7b32ba3cafa3fd7 100644 (file)
@@ -22,7 +22,14 @@ $repopo = new Repository_Post($repo);
 if ($repopo->process($_POST, $_SESSION)) {
     $anchor = '';
     if ($file instanceof File) {
-        $anchor = '#' . $file->getAnchorName();
+        if (isset($repopo->renameMap[$file->getFilename()])) {
+            $anchor = '#'
+                . $repo->getFileByName(
+                    $repopo->renameMap[$file->getFilename()]
+                )->getAnchorName();
+        } else {
+            $anchor = '#' . $file->getAnchorName();
+        }
     } else if ($file === 'newfile' && $repopo->newfileName) {
         $anchor = '#' . $repo->getFileByName($repopo->newfileName)->getAnchorName();
     }