mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-11-21 04:46:29 +03:00
Show the short hash and subject of a detached HEAD in the new branch prompt
If you press `n` on the row of a detached HEAD in the branches panel,
the title of the prompt contains the full 40-character commit hash.
Since 5dec080719, the Name of a detached HEAD is the full hash.
Describe the commit in the same way as when you press `n` on it in the
commits panel.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f7c07e4fc2
commit
d2321ca27b
2 files changed
+6
-4
No files matched your search
@@ -746,7 +746,12 @@ func (self *BranchesController) rename(branch *models.Branch) error {
|
||||
}
|
||||
|
||||
func (self *BranchesController) newBranch(selectedBranch *models.Branch) error {
|
||||
return self.c.Helpers().Refs.NewBranch(selectedBranch.FullRefName(), selectedBranch.RefName(), "")
|
||||
fromName := selectedBranch.RefName()
|
||||
if selectedBranch.DetachedHead {
|
||||
// The RefName of a detached HEAD is the full hash of its commit
|
||||
fromName = models.CommitDescription(selectedBranch.Name, selectedBranch.Subject)
|
||||
}
|
||||
return self.c.Helpers().Refs.NewBranch(selectedBranch.FullRefName(), fromName, "")
|
||||
}
|
||||
|
||||
func (self *BranchesController) createPullRequestMenu(selectedBranch *models.Branch, checkedOutBranch *models.Branch) error {
|
||||
|
||||
@@ -25,10 +25,7 @@ var DetachedHead = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Press(keys.Universal.New)
|
||||
|
||||
t.ExpectPopup().Prompt().
|
||||
/* EXPECTED:
|
||||
Title(MatchesRegexp(`^New branch name \(branch is off of '[0-9a-f]{7} commit-09'\)$`)).
|
||||
ACTUAL: */
|
||||
Title(MatchesRegexp(`^New branch name \(branch is off of '[0-9a-f]{40}'\)$`)).
|
||||
Type("new-branch").
|
||||
Confirm()
|
||||
|
||||
|
||||
Reference in new issue
Block a user