mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-11-30 09:16:47 +02:00
Fixed case that a commit message will break git push
This commit is contained in:
parent
bc14b01d03
commit
9fafd7ebc1
@ -70,16 +70,26 @@ func (c *OSCommand) DetectUnamePass(command string, ask func(string) string) err
|
|||||||
errMessage, err := c.RunCommandWithOutputLive(command, func(word string) string {
|
errMessage, err := c.RunCommandWithOutputLive(command, func(word string) string {
|
||||||
ttyText = ttyText + " " + word
|
ttyText = ttyText + " " + word
|
||||||
|
|
||||||
// prompt and patterns to check if the user needs to input a username / password
|
type Prompt struct {
|
||||||
prompts := map[string]string{
|
pattern string
|
||||||
"password": `Password\s*for\s*'.+':`,
|
canAskFor bool
|
||||||
"username": `Username\s*for\s*'.+':`,
|
}
|
||||||
|
prompts := map[string]Prompt{
|
||||||
|
"password": Prompt{
|
||||||
|
pattern: `Password\s*for\s*'.+':`,
|
||||||
|
canAskFor: true,
|
||||||
|
},
|
||||||
|
"username": Prompt{
|
||||||
|
pattern: `Username\s*for\s*'.+':`,
|
||||||
|
canAskFor: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for prompt, pattern := range prompts {
|
for askFor, propmt := range prompts {
|
||||||
if match, _ := regexp.MatchString(pattern, ttyText); match {
|
if match, _ := regexp.MatchString(propmt.pattern, ttyText); match && propmt.canAskFor {
|
||||||
|
propmt.canAskFor = false
|
||||||
ttyText = ""
|
ttyText = ""
|
||||||
return ask(prompt)
|
return ask(askFor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user