jesseduffield.lazygit/pkg
Stefan Haller 81b497d186 Don't ask to force-push if the remote rejected updates
Lazygit has two ways to decide whether it needs to ask the user to force-push:
1. if it knows ahead of time that the push will fail because the branch has
diverged, by looking at the incoming/outgoing information that it shows as ↑3↓7.
2. by examining the error that comes back when the push has failed.

The second situation should happen only rarely, because lazygit fetches every
minute by default, so the ↑3↓7 information is usually up to date. It might not
be if the user turned off auto-fetch (or increased the auto-fetch interval).
However, in this case it's almost always harmful to prompt the user to
force-push, because we know that the reason for diverging is that something was
pushed to the remote, and we would wipe it out by force-pushing. In such a
situation, the more likely user action is to pull the remote changes and then
push normally again.

So just remove the second prompt, and replace it by a better error message when
we detect that updates were rejected remotely.

A little bit of history archeology reveals that the second prompt was added at a
time where we didn't have the first one yet, so at that time it made sense to
have it; but when the first prompt was added, we should have removed the second.
2024-03-17 07:38:58 +01:00
..
app Support range select in rebase actions 2024-01-23 17:23:56 +11:00
cheatsheet Render keybinding cheatsheet as markdown table 2024-01-28 08:12:01 +11:00
commands Allow deleting update-ref todos 2024-03-16 22:01:13 +01:00
common Add AppState to common.Common 2023-09-04 17:48:39 +02:00
config Show popup message with breaking changes on startup 2024-03-12 13:27:14 +01:00
constants Improve keybinding descriptions 2024-01-28 08:12:01 +11:00
env Support bare worktrees where worktree does not have its own .git file 2023-08-07 22:40:53 +10:00
fakes cleanup integration test code 2023-02-26 12:54:13 +11:00
gui Don't ask to force-push if the remote rejected updates 2024-03-17 07:38:58 +01:00
i18n Don't ask to force-push if the remote rejected updates 2024-03-17 07:38:58 +01:00
integration Allow deleting update-ref todos 2024-03-16 22:01:13 +01:00
jsonschema Add UserConfig jsonschema generation script 2023-12-02 10:46:24 +01:00
logs Remove secureexec package 2023-07-30 19:59:51 +10:00
snake integrate snake game into lazygit 2022-12-30 12:18:59 +11:00
tasks Refactor repo_paths.go to use git rev-parse 2024-01-24 08:40:01 +01:00
theme Standardise display of range selection across views 2024-01-19 10:47:21 +11:00
updates Construct arg vector manually rather than parse string 2023-05-23 19:49:19 +10:00
utils Allow deleting update-ref todos 2024-03-16 22:01:13 +01:00