#1382 - Add git repository detection code
| Identifier | #1382 |
|---|---|
| Issue type | Feature request or suggestion |
| Title | Add git repository detection code |
| Status | Completed |
| Handling member | Chris Graham |
| Addon | core |
| Description | It can be useful to auto-detect what git repository Composr is from, e.g. to customise a config file when switching between branches.
We can add a new function to do it, but it must be in anything that loads the config file. |
| Steps to reproduce | |
| Additional information | /**
* Find the git branch name. * * @return ?ID_TEXT Branch name (NULL: not in git) */ function git_repos() { $path=dirname(__FILE__).'/.git/HEAD'; if (!is_file($path)) return ''; $lines=file($path); $parts=explode('/',$lines[0]); return trim(end($parts)); } |
| Funded? | No |
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".


Comments
It doesn't matter if the config editor erases it, a programmer won't normally be using that anyway.