summaryrefslogtreecommitdiffstats
path: root/pkg/commands
AgeCommit message (Collapse)Author
2023-05-23Merge pull request #2656 from mazharz/gitlab-merge-request-urlJesse Duffield
Update gitlab merge request URL to match new routing
2023-05-23Fix discard logicJesse Duffield
Missed a spot a couple PR's ago. We had an integration test which caught this but which was skipped due to index.lock file issues. The test was also broken for other reasons due to it not having been running for a while, so I've fixed that up too.
2023-05-23Construct arg vector manually rather than parse stringJesse Duffield
By constructing an arg vector manually, we no longer need to quote arguments Mandate that args must be passed when building a command Now you need to provide an args array when building a command. There are a handful of places where we need to deal with a string, such as with user-defined custom commands, and for those we now require that at the callsite they use str.ToArgv to do that. I don't want to provide a method out of the box for it because I want to discourage its use. For some reason we were invoking a command through a shell when amending a commit, and I don't believe we needed to do that as there was nothing user- supplied about the command. So I've switched to using a regular command out- side the shell there
2023-05-22Update gitlab commit URL to match new routingMazhar Zandsalimi
2023-05-21Update gitlab merge request URL to match new routingMazhar Zandsalimi
2023-05-20Don't keep commits that become empty during a rebaseStefan Haller
The only exception is when moving a custom patch for an entire commit to an earlier commit; in this case the source commit becomes empty, but we want to keep it, mainly for consistency with moving the patch to a later commit, which behaves the same. In all other cases where we rebase, it's confusing when empty commits are kept; the most common example is rebasing a branch onto master, where master already contains some of the commits of our branch. In this case we simply want to drop these.
2023-05-20Refactor interface for ApplyPatchJesse Duffield
2023-05-20Add convenience builder for git commandsJesse Duffield
2023-05-20Increase test coverageJesse Duffield
2023-05-19Support ignoring whitespace on stashJesse Duffield
2023-05-16Add config git.mainBranchesStefan Haller
It defaults to {"master", "main"}, but can be set to whatever branch names are used as base branches, e.g. {"master", "devel", "v1.0-hotfixes"}. It is used for color-coding the shas in the commit list, i.e. to decide whether commits are green or yellow.
2023-05-12Make "merged" take precedence over "unpushed"Stefan Haller
Previously, when rebasing a branch onto a newer master, all commits from the previous fork point up to its head were marked red (unpushed), including the commits that are on master already. While this is technically correct from the perspective of the current branch's upstream, it's not what most people expect, intuitively; they want to see where the current branch starts, relative to master. So all commits of master should be green, and then the commits of the current branch in red.
2023-05-02chore(git_commands): support old git version (`git rebase --empty=keep`)Ryooooooga
2023-05-01Merge pull request #2552 from stefanhaller/support-stacked-branchesJesse Duffield
2023-04-30Split commit message panel into commit summary and commit description panelSean
When we use the one panel for the entire commit message, its tricky to have a keybinding both for adding a newline and submitting. By having two panels: one for the summary line and one for the description, we allow for 'enter' to submit the message when done from the summary panel, and 'enter' to add a newline when done from the description panel. Alt-enter, for those who can use that key combo, also works for submitting the message from the description panel. For those who can't use that key combo, and don't want to remap the keybinding, they can hit tab to go back to the summary panel and then 'enter' to submit the message. We have some awkwardness in that both contexts (i.e. panels) need to appear and disappear in tandem and we don't have a great way of handling that concept, so we just push both contexts one after the other, and likewise remove both contexts when we escape.
2023-04-29Make RebaseCommands.AmendTo more robustStefan Haller
This fixes two problems with the "amend commit with staged changes" command: 1. Amending to a fixup commit didn't work (this would create a commmit with the title "fixup! fixup! original title" and keep that at the top of the branch) 2. Unrelated fixup commits would be squashed too. The added integration test verifies that both of these problems are fixed.
2023-04-29Refactor to tighten interface to lazygit daemonJesse Duffield
2023-04-29Refactor: simplify PrepareInteractiveRebaseCommand APIStefan Haller
Instead of passing a bunch of different options in PrepareInteractiveRebaseCommandOpts, where it was unclear how they interact if several are set, have only a single field "instruction" which can be set to one of various different instructions. The functionality of replacing the entire todo file with our own is no longer available; it is only possible to prepend todos to the existing file. Also, instead of using different env vars for the various rebase operations that we want to tell the daemon to do, use a single one that contains a json-encoded struct with all available instructions. This makes the protocol much clearer, and makes it easier to extend in the future.
2023-04-29Implement moving commits up/down in terms of daemonStefan Haller
2023-04-29Implement "move patch to selected commit" in terms of daemonStefan Haller
2023-04-29Implement squash, fixup, drop, and reword in terms of daemonStefan Haller
2023-04-29Extract EditRebaseTodo into a function in utils.rebaseTodoStefan Haller
We want to reuse it from the daemon code in the next commit.
2023-04-29Implement "edit commit" in terms of the new EditRebase functionStefan Haller
2023-04-29Use --rebase-merges for interactive rebaseStefan Haller
At the moment it doesn't make a big difference, because the vast majority of callers create a list of todos themselves to completely replace what git came up with. We're changing this in the following commits though, and then it's helpful to preserve merges.
2023-04-29Put gitCommon.version back in deps_test.goStefan Haller
This was reverted in 3546ab8f21, but shouldn't have.
2023-04-29Merge pull request #2558 from stefanhaller/allow-resetting-author-during-rebaseJesse Duffield
2023-04-29Merge pull request #2548 from AKARSHITJOSHI/fix/tagPushJesse Duffield
2023-04-24Merge pull request #2557 from noahziheng/feature/add-gitea-prJesse Duffield
2023-04-18feat: add gitea to hosting serviceNoah Gao
2023-04-18Allow resetting author of HEAD commit during rebaseStefan Haller
2023-04-17Revert "feat: support for `push --force-if-includes`"Ryooooooga
This reverts commit e00f248cf72785429e2bafc4bcd7bf39528163a5.
2023-04-16Change push tag commandPersonal
Signed-off-by: AKARSHITJOSHI <akarshitjoshi@gmail.com>
2023-04-15refactor: introduce a struct to pack theAzraelSec
`PrepareInteractiveRebaseCommand` function
2023-04-15feat: allow to perform a rebase with breaking before the first commitAzraelSec
2023-04-15feat: let interactive rebase prepend commands to the default todo fileAzraelSec
2023-04-15Make moving todo commits more robustStefan Haller
2023-04-15Make EditRebaseTodo more robustStefan Haller
It used to work on the assumption that rebasing commits in lazygit's model correspond one-to-one to lines in the git-rebase-todo file, which isn't necessarily true (e.g. when users use "git rebase --edit-todo" at the custom command prompt and add a "break" between lines).
2023-04-15Add GitVersion field to NewIntegrationTestArgsStefan Haller
It can be used to specify which git versions a given test should or should not run on.
2023-04-15Show update-ref commands in rebase todo listStefan Haller
This is useful when working with stacked branches, because you can now move "pick" entries across an update-ref command and you can tell exactly which branch the commit will end up in. It's also useful to spot situations where the --update-refs option didn't work as desired. For example, if you duplicate a branch and want to rebase only one of the branches but not the other (maybe for testing); if you have rebase.updateRefs=true in your git config, then rebasing one branch will move the other branch along. To solve this we'll have to introduce a way to delete the update-ref entry (maybe by hitting backspace?); this is out of scope for this PR, so for now users will have to type "git rebase --edit-todo" into the custom command prompt to sort this out. We will also have to prevent users from trying to turn update-ref commands into other commands like "pick" or "drop"; we'll do this later in this branch.
2023-04-15Make getHydratedRebasingCommits more robustStefan Haller
So far the algorithm worked on the assumption that the output of the "git show" command corresponds one-to-one to the lines of the rebase-todo file. This assumption doesn't hold once we start to include todo lines that don't have a sha (like update-ref), or when the todo file contains multiple entries for the same sha. This should never happen normally, but it can if users manually edit the todo file and duplicate a line.
2023-04-15Store commit.Action as an enum instead of a stringStefan Haller
The main reason for doing this (besides the reasons given for Status in the previous commit) is that it allows us to easily convert from TodoCommand to Action and back. This will be needed later in the branch. Fortunately, TodoCommand is one-based, so this allows us to add an ActionNone constant with the value 0.
2023-04-15Store commit.Status as an enum instead of a stringStefan Haller
This is unrelated to the changes in this PR, but since we are doing the same thing for the commit.Action field in the next commit, it makes sense to do it for Status too for consistency. Modelling this as an enum feels more natural than modelling it as a string, since there's a finite set of possible values. And it saves a little bit of memory (not very much, since none of the strings were heap-allocated, but still).
2023-04-13Merge pull request #2544 from scallaway/git-diff-detect-renamesJesse Duffield
2023-04-13Merge pull request #2523 from stefanhaller/editor-configJesse Duffield
2023-04-13Change OpenCommand to Open and OpenLinkCommand to OpenLinkStefan Haller
We do this for consistency with the edit settings. The old names are kept as a fallback for now.
2023-04-13Don't set platform defaults on OSConfig struct immediatelyStefan Haller
Instead, query the platform defaults only if the config is empty. This will be necessary later to distinguish an empty config from a default config, so that we can give deprecation warnings.
2023-04-13Remove line number support for "open" commandStefan Haller
The "open" command is supposed to behave in the same way as double-clicking a file in the Finder/Explorer. The concept of jumping to a specific line in the file doesn't make sense for this; use "edit" instead.
2023-04-13Add support for falling back to legacy edit configStefan Haller
2023-04-13Implement edit presetsStefan Haller
2023-04-13Fix windows testsStefan Haller
Now that the tests run again, it turns out that they actually fail, so fix them.