Skip to content

Commit 8e8abaf

Browse files
author
Zalysin Maxim
committed
Fix working with description in bare(non-bare) repository!
1 parent bdf5501 commit 8e8abaf

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Git.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,12 @@ public function log($format = null) {
640640
* @param string $new
641641
*/
642642
public function set_description($new) {
643-
file_put_contents($this->repo_path."/.git/description", $new);
643+
if ($this->bare) {
644+
$path = $this->repo_path;
645+
} else {
646+
$path = $this->repo_path."/.git";
647+
}
648+
file_put_contents($path."/description", $new);
644649
}
645650

646651
/**
@@ -649,7 +654,12 @@ public function set_description($new) {
649654
* @return string
650655
*/
651656
public function get_description() {
652-
return file_get_contents($this->repo_path."/.git/description");
657+
if ($this->bare) {
658+
$path = $this->repo_path;
659+
} else {
660+
$path = $this->repo_path."/.git";
661+
}
662+
return file_get_contents($path."/description");
653663
}
654664

655665
/**

0 commit comments

Comments
 (0)