summaryrefslogtreecommitdiffstats
path: root/pkg/commands
AgeCommit message (Collapse)Author
2024-03-09Replace DOS linefeeds with Unix line feeds when loading a commit messageStefan Haller
I have seen some commit messages that contain CRLF instead of just LF; I'm not sure if these were created by a broken git client, but they exist, so we need to deal with them. Editing them when rewording a commit sort of works, but is a little strange; the \r characters are invisble, so you need an extra arrow key press to skip over them. In the next commit we are going to add more logic related to line breaks, and it is getting confused by the \r, so it is becoming more important to fix this. The easiest fix is to normalize the line endings right after loading.
2024-03-07Show all submodules recursivelyStefan Haller
2024-03-07Pass entire submodule to UpdateUrl instead of name and path separatelyStefan Haller
This will make the next commit slightly simpler.
2024-03-07Fix deleting submodule where name and path are differentStefan Haller
2024-03-02Remove support for old-style non-interactive rebasesStefan Haller
When doing a non-interactive rebase using a version of git earlier than 2.26, or by explicitly calling `git -c rebase.backend=apply rebase`, lazygit can display the pending todos by parsing the numbered patch files in `.git/rebase-apply/`. Unfortunately, support for this has been broken for more than three years because of the change in 682db77401e (the string literal "normal" should have been changed to REBASE_MODE_NORMAL instead of REBASE_MODE_MERGING). It's not an important bug since you can only get into this situation by doing a rebase outside of lazygit, and then only with a pretty old git version or by using very uncommon git options. So instead of fixing the bug, just remove the code.
2024-03-02Break git.merging.args config into separate arguments on whitespaceStefan Haller
This makes it possible again to pass multiple arguments, for example "--ff-only --autostash". This won't work correctly if you want to use an argument that contains a space, but it's very unlikely that people will want to do that, so I think this is good enough.
2024-03-02Add a test that demonstrates a bug with multiple args in git.merging.args configStefan Haller
We are currently passing the whole string as a single argument, which doesn't work of course.
2024-02-21Add author filtering to commit viewTristan Déplantes
This commit introduces a new feature to the commit view, allowing users to filter commits based on the author's name or email address. Similar to the existing path filtering functionality, accessible through <c-s>, this feature allows users to filter the commit history by the currently selected commit's author if the commit view is focused, or by typing in the author's name or email address. This feature adds an entry to the filtering menu, to provide users with a familiar and intuitive experience
2024-02-18Set diff.noprefix=false for all other diff commands tooStefan Haller
This fixes problems with being able to stage things in a custom patch correctly.
2024-02-18Fix problems with patches if `git diff` was customized with config.Matthias Richerzhagen
2024-02-16Deprecate git.log.showGraph and git.log.order configAlex March
Added identical properties to AppState that should eventually have their defaults set.
2024-02-13Support range select removing files from a commitAaron Hoffman
2024-01-28Support selecting file range in patch builderAaron Hoffman
test: add move_range_to_index test: add toggle_range
2024-01-28Show mode-specific keybinding suggestionsJesse Duffield
As part of making lazygit more discoverable, there are certain keys which you almost certainly need to press when you're in a given mode e.g. 'v' to paste commits when cherry-picking. This commit prominently shows these keybinding suggestions alongside the others in the option view. I'm using the same colours for these keybindings as is associated with the mode elsewhere e.g. yellow for rebasing and cyan for cherry-picking. The cherry-picking one is a bit weird because we also use cyan text to show loaders and app status at the bottom left so it may be confusing, but I haven't personally found it awkward from having tested it out myself. Previously we would render these options whenever a new context was activated, but now that we need to re-render options whenever a mode changes, I'm instead rendering them on each screen re-render (i.e. in the layout function). Given how cheap it is to render this text, I think it's fine performance-wise.
2024-01-26Use inline status for fetching remotesStefan Haller
2024-01-25Support range select for staging/discarding filesJesse Duffield
As part of this, you must now press enter on a merge conflict file to focus the merge view; you can no longer press space and if you do it will raise an error.
2024-01-24Refactor repo_paths.go to use git rev-parseJohn Whitley
This changes GetRepoPaths() to pull information from `git rev-parse` instead of effectively reimplementing git's logic for pathfinding. This change fixes issues with bare repos, esp. versioned homedir use cases, by aligning lazygit's path handling to what git itself does. This change also enables lazygit to run from arbitrary subdirectories of a repository, including correct handling of symlinks, including "deep" symlinks into a repo, worktree, a repo's submodules, etc. Integration tests are now resilient against unintended side effects from the host's environment variables. Of necessity, $PATH and $TERM are the only env vars allowed through now.
2024-01-23Support range select in rebase actionsJesse Duffield
2024-01-19Standardise display of range selection across viewsJesse Duffield
We're not fully standardising here: different contexts can store their range state however they like. What we are standardising on is that now the view is always responsible for highlighting the selected lines, meaning the context/controller needs to tell the view where the range start is. Two convenient benefits from this change: 1) we no longer need bespoke code in integration tests for asserting on selected lines because we can just ask the view 2) line selection in staging/patch-building/merge-conflicts views now look the same as in list views i.e. the highlight applies to the whole line (including trailing space) I also noticed a bug with merge conflicts not rendering the selection on focus though I suspect it wasn't a bug with any real consequences when the view wasn't displaying the selection. I'm going to scrap the selectedRangeBgColor config and just let it use the single line background color. Hopefully nobody cares, but there's really no need for an extra config.
2024-01-10Obtain remote URL by calling "ls-remote --get-url" instead of using git configStefan Haller
This has the advantage that it still works when the user has configured aliases using the insteadOf feature [1]. [1] https://git-scm.com/docs/git-config/2.42.0#Documentation/git-config.txt-urlltbasegtinsteadOf)
2024-01-10Allow multiple fetch commands (or fetch and pull) to run concurrentlyStefan Haller
Git has a bug [1] whereby running multiple fetch commands at the same time causes all of them to append their information to the .git/FETCH_HEAD file, causing the next git pull that wants to use the information to become confused, and show an error like "Cannot rebase onto multiple branches". This error would occur when pressing "f" and "p" in quick succession in the files panel, but also when pressing "p" while a background fetch happens to be running. One likely situation for this is pressing "p" right after startup. Since lazygit never uses the information written to .git/FETCH_HEAD, it's best to avoid writing to it, which fixes the scenarios described above. However, it doesn't fix the problem of repeatedly pressing "f" quickly on the checked-out branch; since we call "git pull" in that case, the above fix doesn't help there. We'll address this separately in another PR. [1] See https://public-inbox.org/git/xmqqy1daffk8.fsf@gitster.g/ for more information.
2024-01-10Extract a function fetchCommandBuilderStefan Haller
2024-01-10Add a method GitVersion.IsAtLeastStefan Haller
2024-01-10Add command to find base commit for creating a fixupStefan Haller
2024-01-09Simplify GetCommitMessageStefan Haller
Use git log instead of git rev-list, this way we don't get a line "commit <sha>" at the beginning that we then have to discard again. The test TestGetCommitMsg is becoming a bit pointless now, since it just compares that input and output are identical.
2024-01-09Add command to open git difftoolStefan Haller
2024-01-09Remove unused functionStefan Haller
2024-01-03Replace copy SHA with copy subject on commit 'y s'Karim Khaleel
2023-12-27Add a sort order menu for local branchesAlex March
2023-12-27chore: use null char as a stash entries divider during loadingAzraelSec
2023-12-27feat: add age on stash linesAzraelSec
2023-12-22Implement a sort order menu for remote branchesAlex March
2023-12-07feat: introduce a copy menu into the file viewAzraelSec
2023-12-02Add UserConfig jsonschema generation scriptKarim Khaleel
2023-10-08Remove sync mutexStefan Haller
I'm pretty convinced we don't need it. Git itself does a good job of making sure that concurrent operations don't corrupt anything.
2023-10-08Add inline status for pushing tags and deleting remote tagsStefan Haller
2023-10-08Add inline status for pushing/pulling/fast-forwarding branchesStefan Haller
When pulling/pushing/fast-forwarding a branch, show this state in the branches list for that branch for as long as the operation takes, to make it easier to see when it's done (without having to stare at the status bar in the lower left). This will hopefully help with making these operations feel more predictable, now that we no longer show a loader panel for them.
2023-10-04Remove redundant `len` checkEng Zer Jun
From the Go specification [1]: "3. If the map is nil, the number of iterations is 0." `len` returns 0 if the map is nil [2]. Therefore, checking `len(v) > 0` before a loop is unnecessary. [1]: https://go.dev/ref/spec#For_range [2]: https://pkg.go.dev/builtin#len Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-09-18Allow cherry-picking commits during a rebaseStefan Haller
This can be useful when you know that a cherry-picked commit would conflict at the tip of your branch, but doesn't at the beginning of the branch (or somewhere in the middle). In that case you want to be able to edit the commit before where you want to insert the cherry-picked commits, and then paste to insert them into the todo list at that point.
2023-09-18Add StatusCommands.IsInNormalRebase and IsInInteractiveRebaseStefan Haller
... and implement RebaseMode in terms of these.
2023-09-09Add coauthor (#2)Orlando Maussa
Add co-author to commits Add addCoAuthor command for commits - Implement the `addCoAuthor` command to add co-authors to commits. - Utilize suggestions helpers to populate author names from the suggestions list. - Added command to gui at `LocalCommitsController`. This commit introduces the `addCoAuthor` command, which allows users to easily add co-authors to their commits. The co-author names are populated from the suggestions list, minimizing the chances of user input errors. The co-authors are added using the Co-authored-by metadata format recognized by GitHub and GitLab.
2023-09-05Move diff context size from UserConfig to AppStateStefan Haller
2023-09-04Don't pass ignoreWhitespace to git commandsStefan Haller
Now that AppState is available via common.Common, they can take it from there.
2023-09-04Add AppState to common.CommonStefan Haller
2023-09-04Add support for external diff commands (e.g. difftastic)Stefan Haller
2023-09-04Add explicit --no-ext-diff arg to CommitCommands.ShowCmdObjStefan Haller
We do this for ShowFileDiffCmdObj and WorktreeFileDiffCmdObj too, so why not here.
2023-08-29Add "Show divergence from upstream" entry to Upstream menu in branches panelStefan Haller
2023-08-29Add option RefToShowDivergenceFrom to GetCommitsOptionsStefan Haller
Not used yet.
2023-08-29Don't return commits from setCommitMergedStatusesStefan Haller
Since the slice stores pointers to objects, and we're only modifying the objects but not the slice itself, there's no need to return it and assign it back. This will allow us to call the function for subslices of commits. Also, move the condition that checks for an empty string inside the function; we're going to call it from more than one place, so this makes it easier.
2023-08-28Allow adding a port to webDomain part of services config (#2908)Jesse Duffield