feat: Add option to truncate git branch names#383
feat: Add option to truncate git branch names#383ethancedwards8 merged 1 commit intodracula:masterfrom
Conversation
Added a new configuration option `@dracula-git-truncate-length` that allows users to limit the maximum length of git branch names displayed in the status bar. This let truncate long branch names and not take the full length of the tmux window. Signed-off-by: Chmouel Boudjnah <chmouel@chmouel.com>
📝 WalkthroughWalkthroughThis PR adds a new configuration option Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Important Action Needed: IP Allowlist UpdateIf your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@scripts/git.sh`:
- Around line 145-148: The branch truncation uses git_truncate_length without
validating it, so invalid values like 0, non-numeric, or negative cause
empty/incorrect slicing; update the logic around getBranch/branch handling to
validate git_truncate_length is a positive integer (e.g., regex '^[1-9][0-9]*$'
or an arithmetic check) before applying
branch="${branch:0:$git_truncate_length}", and if validation fails simply skip
truncation so branch remains intact (reference the checkForGitDir block and
variables branch, git_truncate_length, and repo_name to find and fix the code).
ethancedwards8
left a comment
There was a problem hiding this comment.
how long are your branches? lol
|
@ethancedwards8 hah they are auto generated from the description of a pr/issue/jr so pretty long sometime 🙃 |
Added a new option
@dracula-git-truncate-lengthto limit the maximum length of git branch names displayed in the status bar. This let truncate long branch names and not take the full length of the tmux window.