jesseduffield.lazygit/pkg
Stefan Haller 59303981f9 Simplify startBackgroundFetch
This code had a lot of logic that (fortunately) didn't work because it was
buggy:

- it was supposed to wait for the auto-fetch delay before fetching for the first
  time in case we start with a repo that we had open in a previous session (i.e.
  that appears in the recent repos list). This code actually ran always, not
  just for known repos, because the IsNewRepo flag is only set later, after this
  function runs. Fortunately, the code didn't work, because time.After starts a
  timer but doesn't wait for it (to do that, it would have to be
  `<-time.After`).
- if the first fetch fails with error 128, it was supposed to show an error
  message and not start the background fetch loop. Fortunately, this didn't work
  because 1) it was guarded by isNew which is always false here, and 2) because
  git's error message in this case is actually "exit code: 128", not "exit
  status 128" (maybe this has changed in git at some point).

I find both of these undesirable. Whenever I open a repo I want an auto-fetch to
be triggered immediately to get my branch information up to date as quickly as
possible. And if the initial fetch fails (e.g. because one of my remotes is
offline or doesn't exist any more), then that's no reason not to start the
auto-fetch loop anyway.

So let's simplify the code to do what it did before, but with much fewer lines
of code.
2024-12-01 10:44:26 +01:00
..
app Add changeToFixup field to MoveFixupCommitDown 2024-09-15 11:19:39 +02:00
cheatsheet Initialize translation set after reading user config 2024-08-18 10:24:52 +02:00
commands use unsigned integer in test and fix CI/linter complaint 2024-11-19 08:21:19 +11:00
common Make common.UserConfig an atomic.Pointer for safe concurrent access 2024-08-18 10:24:52 +02:00
config use an unsigned_64 for DiffContextSize and add saturated add/subtract 2024-11-19 08:21:19 +11:00
constants Make the links in the status panel point to the current version rather than master 2024-03-22 08:13:59 +01: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 Simplify startBackgroundFetch 2024-12-01 10:44:26 +01:00
i18n pkg/gui: Allow user to select remote and branch when creating a PR 2024-11-23 11:52:21 +11:00
integration Bump gocui and adapt lazygit code 2024-12-01 10:40:08 +01:00
jsonschema Let schema/config.json end with a line feed 2024-11-30 15:03:29 +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 Use ScanLinesAndTruncateWhenLongerThanBuffer instead of bufio.ScanLines 2024-05-15 13:27:01 +02:00
theme Highlight inactive selection in bold 2024-06-23 14:43:13 +02:00
updates Change direct access to Common.UserConfig to a getter 2024-08-18 10:24:52 +02:00
utils Fix ForEachLineInFile to not lose the last line if it doesn't end with a LF 2024-10-09 15:37:08 +02:00