Gets the currently checked out branch or revision.
()
| 154 | |
| 155 | /** Gets the currently checked out branch or revision. */ |
| 156 | getCurrentBranchOrRevision(): string { |
| 157 | const branchName = this.run(['rev-parse', '--abbrev-ref', 'HEAD']).stdout.trim(); |
| 158 | // If no branch name could be resolved. i.e. `HEAD` has been returned, then Git |
| 159 | // is currently in a detached state. In those cases, we just want to return the |
| 160 | // currently checked out revision/SHA. |
| 161 | if (branchName === 'HEAD') { |
| 162 | return this.run(['rev-parse', 'HEAD']).stdout.trim(); |
| 163 | } |
| 164 | return branchName; |
| 165 | } |
| 166 | |
| 167 | /** Gets whether the current Git repository has uncommitted changes. */ |
| 168 | hasUncommittedChanges(): boolean { |
no test coverage detected