feat: show git branch if available#7532
Merged
Merged
Conversation
Contributor
|
💡 To request a new review, comment |
| // Since we can't easily mock git commands in this test environment, | ||
| // we just test that the function returns either a string or null | ||
| const result = getGitBranch(); | ||
| expect(typeof result === "string" || result === null).toBe(true); |
Contributor
There was a problem hiding this comment.
Assertion is too weak and effectively tautological for a string | null return type; consider mocking git/execSync to assert specific outcomes (e.g., branch string in repo, null on failure).
Prompt for AI agents
Address the following comment on extensions/cli/src/util/git.test.ts at line 83:
<comment>Assertion is too weak and effectively tautological for a string | null return type; consider mocking git/execSync to assert specific outcomes (e.g., branch string in repo, null on failure).</comment>
<file context>
@@ -74,4 +74,13 @@ describe("git utilities - GitHub Actions detection", () => {
+ // Since we can't easily mock git commands in this test environment,
+ // we just test that the function returns either a string or null
+ const result = getGitBranch();
+ expect(typeof result === "string" || result === null).toBe(true);
+ });
+ });
</file context>
tingwai
previously approved these changes
Sep 5, 2025
Contributor
tingwai
left a comment
There was a problem hiding this comment.
Nice touch with checking screen width so we don't try to fit too much if its not wide enough
Contributor
|
🎉 This PR is included in version 1.13.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Shows git branch if available
Prioritizes branch over owner/repo on smaller widths
CON-3746
Summary by cubic
Show the current git branch in the CLI status bar. On narrow terminals, the branch is prioritized over owner/repo; falls back to repo or cwd. Addresses CON-3746.
New Features
Refactors