$f = FALSE; for ($i = 1; !$f; $i++) { $branch = sprintf('%s/%02d', Config::GIT_CONFLICT_BRANCH_DIR, $i); try { $f = fopen(sprintf('%s/refs/heads/%s', $repo->dir, $branch), 'xb'); } catch (Exception $e) { /* * fopen() will raise a warning if the file already * exists, which Core will make into an Exception. */ } } flock($f, LOCK_EX); } foreach ($pending as $obj) { $obj->write(); } ftruncate($f, 0); fwrite($f, sha1_hex($newcommit->getName())); fclose($f); if ($fast_forward || $fast_merge) { redirect($page->getURL()); } else { redirect(sprintf('%s/:merge/%s?fresh', Config::PATH, join('/', array_map('urlencode', explode('/', $branch))))); } // }}} $committed = TRUE; } } if (!$committed) { $view->setTemplate('page-edit.php');