summaryrefslogtreecommitdiffstats
path: root/pkg
AgeCommit message (Collapse)Author
2024-06-02Add HEAD: when referencing upstream branchJordan
Update unit tests
2024-06-01Make "Find base commit for fixup" work with hunks with only added linesStefan Haller
To understand what this does and why, read the design document that I'm about to add in the next commit.
2024-06-01Extract a function findCommitStefan Haller
It's not much code, but it turns three lines of code into one, and since we need to do this a few more times in the next commit, it's worth it.
2024-06-01Return errors from blameDeletedLines instead of just logging themStefan Haller
I guess when I originally wrote this code I just didn't know how to do that...
2024-06-01Also return hunks with only added lines from parseDiffStefan Haller
We aren't using them, yet, except for deciding whether to show the warning about hunks with only added lines. Add a bit of test coverage for parseDiff while we're at it.
2024-06-01Make parseDiff a non-member function so that we can test it more easilyStefan Haller
2024-06-01Rename deletedLineInfo to hunkStefan Haller
We'll use it with a more general meaning later in this branch.
2024-06-01Add user config `expandedSidePanelWeight`Stefan Haller
2024-06-01Add test for ExpandFocusedSidePanel configStefan Haller
2024-06-01Add integration test for pushing when the remote is not stored locallyStefan Haller
The test needs all three fixes from this branch to succeed.
2024-06-01Use --force instead of --force-with-lease when remote is not stored locallyStefan Haller
--force-with-lease simply doesn't work in this case, it will always return a "stale info" error.
2024-06-01Rename Force to ForceWithLeaseStefan Haller
This describes better what it is, and we're going to add the regular --force in the next commit. No change in behavior in this commit.
2024-06-01Ask to force push if server rejected the update, if remote not stored locallyStefan Haller
This broke with 81b497d186 (#3387). In that PR I claimed that we never want to ask for force-pushing if the server rejected the update, on the assumption that this can only happen because the remote tracking branch is not up to date, and users should just fetch in this case. However, I didn't realize it's even possible to have a branch whose upstream branch is not stored locally; in this case we can't tell ahead of time whether a force push is going to be necessary, so we _have_ to rely on the server response to find out. But we only want to do that in this specific case, so this is not quite an exact revert of 81b497d186.
2024-06-01Don't force-push if the remote branch is not stored locallyStefan Haller
This broke with #3528. If the remote branch is not stored locally, we only see question marks in the branch status. In this case we can't tell whether we need to force-push, so it's best to assume that we don't, and see if the server rejects the push, and react to that by asking to force push. This second part is also broken right now, we'll fix this in the next commit.
2024-05-31Fix boolean config keys not appearing in the generated Config.mdStefan Haller
The reason why they didn't appear is that they didn't get a default value in the generated schema; this commit fixes that.
2024-05-31Remove an outdated commentStefan Haller
Lazygit doesn't touch this, the comment is just not true. I wonder if we need the config at all, actually; I'd be in favor of removing it.
2024-05-29Refresh branches and reflog independently when sorting branches by dateStefan Haller
When branches are sorted by recency we have this logic that first loads the branches so that they can be rendered quickly; in parallel, it starts loading the reflog in the background, and when that's done, it loads the branches again so that they get their recency values. This means that branches are loaded twice at startup. We don't need this logic when branches are not sorted by recency, so we can simply load branches and reflog in parallel like everything else. This shouldn't change any user observable behavior, it just avoids doing unnecessary work at startup.
2024-05-29Fix out-of-date commentStefan Haller
The behavior described in the comment is no longer what we do, it was changed in ae66f720f5; we now always reuse the state.
2024-05-26Fix tooltip of fixup commandfix-tooltip-for-fixupStefan Haller
2024-05-26Fix calculation of tooltip heightStefan Haller
For tooltips that are just one or two characters longer than the available width, the last word would be cut off. On my screen this happened for the tooltip for the fixup command.
2024-05-20Add property outputTitle to CustomCommandStefan Haller
It can optionally be used to set the title of the panel that shows the output of a command (when showOutput is true). If left unset, the command string is used as the title.
2024-05-20feat: focus on local commits view after moving code into new commitAzraelSec
2024-05-19Make Keybindings definition in UserConfig struct lastKarim Khaleel
This makes the generated default config in Config.md match the original order.
2024-05-19Add default lazygit config generator for Config.md from JSON schemaKarim Khaleel
2024-05-19Set default value for WindowSize config to pass validationKarim Khaleel
2024-05-19Remove unnecesary schema validations in user configKarim Khaleel
2024-05-19Correctly request force-pushing in triangular workflowsStefan Haller
To determine whether we need to ask for force pushing, we need to query the push branch rather than the upstream branch, in case they are not the same.
2024-05-19Add ahead/behind information for @{push}Stefan Haller
In a triangular workflow the branch that you're pulling from is not the same as the one that you are pushing to. For example, some people find it useful to set the upstream branch to origin/master so that pulling effectively rebases onto master, and set the push.default git config to "current" so that "feature" pushes to origin/feature. Another example is a fork-based workflow where "feature" has upstream set to upstream/main, and the repo has remote.pushDefault set to "origin", so pushing on "feature" pushes to origin/feature. This commit adds new fields to models.Branch that store the ahead/behind information against the push branch; for the "normal" workflow where you pull and push from/to the upstream branch, AheadForPush/BehindForPush will be the same as AheadForPull/BehindForPull.
2024-05-19Rename Pushables/Pullables to AheadForPull/BehindForPullStefan Haller
In preparation for adding AheadForPush/BehindForPush in the next commit.
2024-05-19Add test demonstrating the problem with force-pushing in a triangular workflowStefan Haller
Our code doesn't realize that we need to prompt the user to force push, when the branch is up-to-date with its upstream but not with the branch that we're pushing to.
2024-05-19Rename PushBranch to PushBranchAndSetUpstreamStefan Haller
It is unexpected that a function called PushBranch also sets the upstream branch; also, we want to add a PushBranch function in the next commit that doesn't.
2024-05-19Create shims for all model classes in SessionStateLoaderStefan Haller
This guards against accidentally renaming a model field and thereby breaking user's custom commands. With this change we'll get a build failure when we do that.
2024-05-19Remove redundant variable dedeclarationsJesse Duffield
In go 1.22, loop variables are redeclared with each iteration of the loop, rather than simple updated on each iteration. This means that we no longer need to manually redeclare variables when they're closed over by a function.
2024-05-19Show delete/edit keybindings in suggestions subtitle if availableStefan Haller
2024-05-19Allow editing a custom command from the suggestions list by pressing 'e'Stefan Haller
For custom commands it is useful to select an earlier command and have it copied to the prompt for further editing. This can be done by hitting 'e' now. For other types of suggestion panels we don't enable this behavior, as you can't create arbitrary new items there that don't already exist as a suggestion.
2024-05-19Support deleting items from the custom commands historyStefan Haller
In the custom commands panel you can now tab to the suggestions and hit 'd' to delete items from there. Useful if you mistyped a command and don't want it to appear in your history any more.
2024-05-19improve `nvim-remote` modeCharlie Moog
- If _not_ inside a neovim session, treat as a normal nvim session and suspend lazygit. - If inside a neovim session: - Do not try to suspend lazygit. - Send `q` keystroke to neovim session to quit lazygit. - Send filename/line/etc. to neovim session.
2024-05-18Fix stashing partialy staged files for git version >= 2.35.0dsolerhww
Use `git stash push --staged` git feature available on git version > 2.35.0.
2024-05-15Use ScanLinesAndTruncateWhenLongerThanBuffer instead of bufio.ScanLinesStefan Haller
2024-05-15Put subject last in git log's prettyFormatStefan Haller
We are going to truncate overly long lines returned from git log, and the most likely field that is going to make the line too long is the subject; so we must put it last, otherwise we'd end up with not enough fields to split when it's too long. It might not be obvious from the diff what's happening to the mock command output in the test: it didn't have the divergence field (">") at all, which was kind of a bug. It didn't matter for these tests though, because we are not testing the divergence here, and our production code happens to be resilient against it missing. But now we must add the ">" field before the subject.
2024-05-15Implement ScanLinesAndTruncateWhenLongerThanBufferStefan Haller
2024-05-15Handle scanner error in RunAndProcessLinesStefan Haller
Scanners can return errors (e.g. ErrTooLong), and if we don't handle it, the cmd.Wait() call below will block forever because nobody drains the command's output. This happens for CommitLoader.GetCommits when there's a commit whose subject line is longer than approx. 65500 characters; in that case, lazygit would lock up completely. With this fix it remains usable, but the commit list is truncated before the bad commit, which is not good enough. We'll improve that in the remaining commits of this branch.
2024-05-15Add tests for clicking in status side panelStefan Haller
To prevent this from breaking again. All three tests would fail without the fix from the previous commit.
2024-05-15Fix clicking in status side panelStefan Haller
Seems to have been broken since that big refactoring in March 23.
2024-05-05Fix deadlock reportingfix-deadlock-reportingStefan Haller
Deadlock reporting broke in e1ceb6892a; since then, it was *off* when running debug builds normally, but *on* when debugging an integration test. Both of which are exactly opposite of what we want.
2024-05-01Add commitPrefix for defining a prefix for any projectJonathan Duck
2024-04-30Enable the commit graph in the divergence viewStefan Haller
2024-04-28chore: fix some comments and typosknowmost
Signed-off-by: knowmost <knowmost@outlook.com>
2024-04-27Refactor `pkg/gui/presentation/commits.go` slightly to be consistentStefan Haller
Change `func displayCommit()` so all the individual strings are built first, then the whole thing `cols` is put together. Before, most strings were built prior to constructing `cols`, but a few were built inside the `cols` construction.
2024-04-27Add config option for length of commit hash displayed in commits viewOlivia Bahr
- Add config option `commitHashLength` to to pkg/config/user_config.go - Changed the hash display in pkg/gui/presentation/commits.go