mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-29 02:35:39 -04:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
daf1fd3419 | ||
|
|
54d0ebeff0 | ||
|
|
af9699e59a | ||
|
|
d92c6d116b | ||
|
|
343a3e466a | ||
|
|
16f5348790 | ||
|
|
5979b40546 | ||
|
|
a5f78d3222 | ||
|
|
f3791e6ab6 | ||
|
|
130801dbf6 | ||
|
|
67bb7f62c5 | ||
|
|
52b1c42d38 | ||
|
|
11616190ee | ||
|
|
e5137b86cf | ||
|
|
ac3824bd7c | ||
|
|
56c9d5abeb | ||
|
|
c9196812a2 | ||
|
|
caca62b89e | ||
|
|
e15e4951ab | ||
|
|
e3944c1707 | ||
|
|
0d155e1478 | ||
|
|
2fa4ee2cac | ||
|
|
a7bfeca9c0 | ||
|
|
ab23539c0c | ||
|
|
01eece3737 | ||
|
|
57220ba478 | ||
|
|
6636d0c15a | ||
|
|
269d89ea51 | ||
|
|
dcf264b182 | ||
|
|
e37d7d5ad2 | ||
|
|
988162848a | ||
|
|
ed9519a241 | ||
|
|
7731311674 | ||
|
|
853a04dfd0 | ||
|
|
c02709698c | ||
|
|
555ab8735a | ||
|
|
20fe43f972 | ||
|
|
0fd7b9baa4 | ||
|
|
19921b7c42 | ||
|
|
c37376af74 | ||
|
|
9dbde94952 | ||
|
|
3915cb6e71 | ||
|
|
ba6cfc1f85 | ||
|
|
46ebfbbe87 | ||
|
|
3012306ac3 | ||
|
|
e987d4b519 | ||
|
|
190954568e | ||
|
|
f117eed614 | ||
|
|
a5698b86fa | ||
|
|
050a91b7d1 | ||
|
|
0b524293e1 | ||
|
|
ff4ae4a544 | ||
|
|
a0aa7a1940 | ||
|
|
6065908b0d | ||
|
|
a32be7e9fa | ||
|
|
fcf30caf40 | ||
|
|
aad2622278 | ||
|
|
2f4cedd025 | ||
|
|
e883f74f3c | ||
|
|
a1838d33e7 | ||
|
|
7e85cdd027 | ||
|
|
31e54eadaa | ||
|
|
02ca07a9be | ||
|
|
5dff9af027 | ||
|
|
437daf2f74 | ||
|
|
c0141685fe | ||
|
|
4856c96521 | ||
|
|
49f8dc2ce4 | ||
|
|
afc3061c51 | ||
|
|
2bed09ef67 | ||
|
|
0a78d0016e | ||
|
|
c0e3922d02 | ||
|
|
638c9c5fe7 | ||
|
|
e48e7a2ebc | ||
|
|
d2723ff2dd | ||
|
|
7db8fb8e9c | ||
|
|
abf914c923 | ||
|
|
698f9287d4 | ||
|
|
632695f71c | ||
|
|
ef0d319686 | ||
|
|
0397ede8a6 | ||
|
|
333802fffc | ||
|
|
3722824298 | ||
|
|
542478546d | ||
|
|
9ea2ff8f41 | ||
|
|
55236802c3 | ||
|
|
4baf008ac7 | ||
|
|
d768327814 | ||
|
|
0864affc8f | ||
|
|
40d6800fd3 | ||
|
|
20d0b4316d | ||
|
|
fe429c6184 | ||
|
|
a77dcbe3a1 | ||
|
|
2a87c048b9 |
@@ -16,6 +16,12 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get Latest Tag
|
||||
run: |
|
||||
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1) || echo "v0.0.0")
|
||||
echo "Latest tag: $latest_tag"
|
||||
echo "latest_tag=$latest_tag" >> $GITHUB_ENV
|
||||
|
||||
- name: Check for changes since last release
|
||||
run: |
|
||||
if [ -z "$(git diff --name-only ${{ env.latest_tag }})" ]; then
|
||||
@@ -53,9 +59,8 @@ jobs:
|
||||
|
||||
- name: Calculate next version
|
||||
run: |
|
||||
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1) || echo "v0.0.0")
|
||||
echo "Latest tag: $latest_tag"
|
||||
IFS='.' read -r major minor patch <<< "$latest_tag"
|
||||
echo "Latest tag: ${{ env.latest_tag }}"
|
||||
IFS='.' read -r major minor patch <<< "${{ env.latest_tag }}"
|
||||
new_minor=$((minor + 1))
|
||||
new_tag="$major.$new_minor.0"
|
||||
echo "New tag: $new_tag"
|
||||
@@ -69,4 +74,4 @@ jobs:
|
||||
git tag ${{ env.new_tag }}
|
||||
git push origin ${{ env.new_tag }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_API_TOKEN }}
|
||||
|
||||
+25
-16
@@ -47,6 +47,10 @@ gui:
|
||||
# One of: 'margin' (default) | 'jump'
|
||||
scrollOffBehavior: margin
|
||||
|
||||
# The number of spaces per tab; used for everything that's shown in the main view, but probably mostly relevant for diffs.
|
||||
# Note that when using a pager, the pager has its own tab width setting, so you need to pass it separately in the pager command.
|
||||
tabWidth: 4
|
||||
|
||||
# If true, capture mouse events.
|
||||
# When mouse events are captured, it's a little harder to select text: e.g. requiring you to hold the option key when on macOS.
|
||||
mouseEvents: true
|
||||
@@ -166,7 +170,7 @@ gui:
|
||||
showListFooter: true
|
||||
|
||||
# If true, display the files in the file views as a tree. If false, display the files as a flat list.
|
||||
# This can be toggled from within Lazygit with the '~' key, but that will not change the default.
|
||||
# This can be toggled from within Lazygit with the '`' key, but that will not change the default.
|
||||
showFileTree: true
|
||||
|
||||
# If true, show the number of lines changed per file in the Files view
|
||||
@@ -341,14 +345,6 @@ git:
|
||||
# If true, do not allow force pushes
|
||||
disableForcePushing: false
|
||||
|
||||
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix
|
||||
commitPrefix:
|
||||
# pattern to match on. E.g. for 'feature/AB-123' to match on the AB-123 use "^\\w+\\/(\\w+-\\w+).*"
|
||||
pattern: ""
|
||||
|
||||
# Replace directive. E.g. for 'feature/AB-123' to start the commit message with 'AB-123 ' use "[$1] "
|
||||
replace: ""
|
||||
|
||||
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-branch-name-prefix
|
||||
branchPrefix: ""
|
||||
|
||||
@@ -922,27 +918,40 @@ Where:
|
||||
## Predefined commit message prefix
|
||||
|
||||
In situations where certain naming pattern is used for branches and commits, pattern can be used to populate commit message with prefix that is parsed from the branch name.
|
||||
If you define multiple naming patterns, they will be attempted in order until one matches.
|
||||
|
||||
Example:
|
||||
Example hitting first match:
|
||||
|
||||
- Branch name: feature/AB-123
|
||||
- Commit message: [AB-123] Adding feature
|
||||
- Generated commit message prefix: [AB-123]
|
||||
|
||||
Example hitting second match:
|
||||
|
||||
- Branch name: CD-456_fix_problem
|
||||
- Generated commit message prefix: (CD-456)
|
||||
|
||||
```yaml
|
||||
git:
|
||||
commitPrefix:
|
||||
pattern: "^\\w+\\/(\\w+-\\w+).*"
|
||||
replace: '[$1] '
|
||||
- pattern: "^\\w+\\/(\\w+-\\w+).*"
|
||||
replace: '[$1] '
|
||||
- pattern: "^([^_]+)_.*" # Take all text prior to the first underscore
|
||||
replace: '($1) '
|
||||
```
|
||||
|
||||
If you want repository-specific prefixes, you can map them with `commitPrefixes`. If you have both `commitPrefixes` defined and an entry in `commitPrefixes` for the current repo, the `commitPrefixes` entry is given higher precedence. Repository folder names must be an exact match.
|
||||
If you want repository-specific prefixes, you can map them with `commitPrefixes`. If you have both entries in `commitPrefix` defined and an repository match in `commitPrefixes` for the current repo, the `commitPrefixes` entries will be attempted first. Repository folder names must be an exact match.
|
||||
|
||||
```yaml
|
||||
git:
|
||||
commitPrefixes:
|
||||
my_project: # This is repository folder name
|
||||
pattern: "^\\w+\\/(\\w+-\\w+).*"
|
||||
replace: '[$1] '
|
||||
- pattern: "^\\w+\\/(\\w+-\\w+).*"
|
||||
replace: '[$1] '
|
||||
commitPrefix:
|
||||
- pattern: "^(\\w+)-.*" # A more general match for any leading word
|
||||
replace : '[$1] '
|
||||
- pattern: ".*" # The final fallthrough regex that copies over the whole branch name
|
||||
replace : '[$0] '
|
||||
```
|
||||
|
||||
> [!IMPORTANT]
|
||||
|
||||
@@ -297,6 +297,7 @@ Your commands can contain placeholder strings using Go's [template syntax](https
|
||||
|
||||
```
|
||||
SelectedCommit
|
||||
SelectedCommitRange
|
||||
SelectedFile
|
||||
SelectedPath
|
||||
SelectedLocalBranch
|
||||
@@ -314,6 +315,11 @@ CheckedOutBranch
|
||||
|
||||
To see what fields are available on e.g. the `SelectedFile`, see [here](https://github.com/jesseduffield/lazygit/blob/master/pkg/gui/services/custom_commands/models.go) (all the modelling lives in the same file).
|
||||
|
||||
We don't support accessing all elements of a range selection yet. We might add this in the future, but as a special case you can access the range of selected commits by using `SelectedCommitRange`, which has two properties `.To` and `.From` which are the hashes of the bottom and top selected commits, respectively. This is useful for passing them to a git command that operates on a range of commits. For example, to create patches for all selected commits, you might use
|
||||
```yml
|
||||
command: "git format-patch {{.SelectedCommitRange.From}}^..{{.SelectedCommitRange.To}}"
|
||||
```
|
||||
|
||||
## Keybinding collisions
|
||||
|
||||
If your custom keybinding collides with an inbuilt keybinding that is defined for the same context, only the custom keybinding will be executed. This also applies to the global context. However, one caveat is that if you have a custom keybinding defined on the global context for some key, and there is an in-built keybinding defined for the same key and for a specific context (say the 'files' context), then the in-built keybinding will take precedence. See how to change in-built keybindings [here](https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#keybindings)
|
||||
|
||||
@@ -20,11 +20,15 @@
|
||||
| `<pgup>` | Pgup |
|
||||
| `<pgdown>` | Pgdn |
|
||||
| `<up>` | ArrowUp |
|
||||
| `<s-up>` | ShiftArrowUp |
|
||||
| `<down>` | ArrowDown |
|
||||
| `<s-down>` | ShiftArrowDown |
|
||||
| `<left>` | ArrowLeft |
|
||||
| `<right>` | ArrowRight |
|
||||
| `<tab>` | Tab |
|
||||
| `<backtab>` | Backtab |
|
||||
| `<enter>` | Enter |
|
||||
| `<a-enter>` | AltEnter |
|
||||
| `<esc>` | Esc |
|
||||
| `<backspace>` | Backspace |
|
||||
| `<c-space>` | CtrlSpace |
|
||||
|
||||
@@ -56,6 +56,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy path to clipboard | |
|
||||
| `` y `` | Copy to clipboard | |
|
||||
| `` c `` | Checkout | Checkout file. This replaces the file in your working tree with the version from the selected commit. |
|
||||
| `` d `` | Remove | Discard this commit's changes to this file. This runs an interactive rebase in the background, so you may get a merge conflict if a later commit also changes this file. |
|
||||
| `` o `` | Open file | Open file in default application. |
|
||||
@@ -352,6 +353,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy tag to clipboard | |
|
||||
| `` <space> `` | Checkout | Checkout the selected tag as a detached HEAD. |
|
||||
| `` n `` | New tag | Create new tag from current commit. You'll be prompted to enter a tag name and optional description. |
|
||||
| `` d `` | Delete | View delete options for local/remote tag. |
|
||||
|
||||
@@ -134,6 +134,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | ファイル名をクリップボードにコピー | |
|
||||
| `` y `` | Copy to clipboard | |
|
||||
| `` c `` | チェックアウト | Checkout file. This replaces the file in your working tree with the version from the selected commit. |
|
||||
| `` d `` | Remove | Discard this commit's changes to this file. This runs an interactive rebase in the background, so you may get a merge conflict if a later commit also changes this file. |
|
||||
| `` o `` | ファイルを開く | Open file in default application. |
|
||||
@@ -182,6 +183,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy tag to clipboard | |
|
||||
| `` <space> `` | チェックアウト | Checkout the selected tag as a detached HEAD. |
|
||||
| `` n `` | タグを作成 | Create new tag from current commit. You'll be prompted to enter a tag name and optional description. |
|
||||
| `` d `` | Delete | View delete options for local/remote tag. |
|
||||
|
||||
@@ -189,7 +189,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||
| `` <c-y> `` | 풀 리퀘스트 URL을 클립보드에 복사 | |
|
||||
| `` c `` | 이름으로 체크아웃 | Checkout by name. In the input box you can enter '-' to switch to the last branch. |
|
||||
| `` F `` | 강제 체크아웃 | Force checkout selected branch. This will discard all local changes in your working directory before checking out the selected branch. |
|
||||
| `` d `` | Delete | View delete options for local/remote branch. |
|
||||
| `` d `` | 삭제 | View delete options for local/remote branch. |
|
||||
| `` r `` | 체크아웃된 브랜치를 이 브랜치에 리베이스 | Rebase the checked-out branch onto the selected branch. |
|
||||
| `` M `` | 현재 브랜치에 병합 | View options for merging the selected item into the current branch (regular merge, squash merge) |
|
||||
| `` f `` | Fast-forward this branch from its upstream | Fast-forward selected branch from its upstream. |
|
||||
@@ -247,7 +247,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||
| `` n `` | 새 브랜치 생성 | |
|
||||
| `` M `` | 현재 브랜치에 병합 | View options for merging the selected item into the current branch (regular merge, squash merge) |
|
||||
| `` r `` | 체크아웃된 브랜치를 이 브랜치에 리베이스 | Rebase the checked-out branch onto the selected branch. |
|
||||
| `` d `` | Delete | Delete the remote branch from the remote. |
|
||||
| `` d `` | 삭제 | Delete the remote branch from the remote. |
|
||||
| `` u `` | Set as upstream | Set the selected remote branch as the upstream of the checked-out branch. |
|
||||
| `` s `` | Sort order | |
|
||||
| `` g `` | View reset options | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
@@ -263,7 +263,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||
| `` <c-o> `` | 커밋 해시를 클립보드에 복사 | |
|
||||
| `` <c-r> `` | Reset cherry-picked (copied) commits selection | |
|
||||
| `` b `` | Bisect 옵션 보기 | |
|
||||
| `` s `` | Squash | Squash the selected commit into the commit below it. The selected commit's message will be appended to the commit below it. |
|
||||
| `` s `` | 스쿼시 | Squash the selected commit into the commit below it. The selected commit's message will be appended to the commit below it. |
|
||||
| `` f `` | Fixup | Meld the selected commit into the commit below it. Similar to squash, but the selected commit's message will be discarded. |
|
||||
| `` r `` | 커밋메시지 변경 | Reword the selected commit's message. |
|
||||
| `` R `` | 에디터에서 커밋메시지 수정 | |
|
||||
@@ -299,6 +299,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | 파일명을 클립보드에 복사 | |
|
||||
| `` y `` | 클립보드에 복사 | |
|
||||
| `` c `` | 체크아웃 | Checkout file |
|
||||
| `` d `` | Remove | Discard this commit's changes to this file |
|
||||
| `` o `` | 파일 닫기 | Open file in default application. |
|
||||
@@ -323,11 +324,12 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy tag to clipboard | |
|
||||
| `` <space> `` | 체크아웃 | Checkout the selected tag as a detached HEAD. |
|
||||
| `` n `` | 태그를 생성 | Create new tag from current commit. You'll be prompted to enter a tag name and optional description. |
|
||||
| `` d `` | Delete | View delete options for local/remote tag. |
|
||||
| `` d `` | 삭제 | View delete options for local/remote tag. |
|
||||
| `` P `` | 태그를 push | Push the selected tag to a remote. You'll be prompted to select a remote. |
|
||||
| `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` g `` | 초기화 | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` <c-t> `` | Open external diff tool (git difftool) | |
|
||||
| `` <enter> `` | 커밋 보기 | |
|
||||
| `` w `` | View worktree options | |
|
||||
@@ -340,7 +342,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||
| `` <c-o> `` | 파일명을 클립보드에 복사 | |
|
||||
| `` <space> `` | Staged 전환 | Toggle staged for selected file. |
|
||||
| `` <c-b> `` | 파일을 필터하기 (Staged/unstaged) | |
|
||||
| `` y `` | Copy to clipboard | |
|
||||
| `` y `` | 클립보드에 복사 | |
|
||||
| `` c `` | 커밋 변경내용 | Commit staged changes. |
|
||||
| `` w `` | Commit changes without pre-commit hook | |
|
||||
| `` A `` | 마지맛 커밋 수정 | |
|
||||
@@ -356,7 +358,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||
| `` <enter> `` | Stage individual hunks/lines for file, or collapse/expand for directory | If the selected item is a file, focus the staging view so you can stage individual hunks/lines. If the selected item is a directory, collapse/expand it. |
|
||||
| `` d `` | View 'discard changes' options | View options for discarding changes to the selected file. |
|
||||
| `` g `` | View upstream reset options | |
|
||||
| `` D `` | Reset | View reset options for working tree (e.g. nuking the working tree). |
|
||||
| `` D `` | 초기화 | View reset options for working tree (e.g. nuking the working tree). |
|
||||
| `` ` `` | 파일 트리뷰로 전환 | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory. |
|
||||
| `` <c-t> `` | Open external diff tool (git difftool) | |
|
||||
| `` M `` | Git mergetool를 열기 | Run `git mergetool`. |
|
||||
|
||||
@@ -129,6 +129,7 @@ _Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Kopieer de bestandsnaam naar het klembord | |
|
||||
| `` y `` | Copy to clipboard | |
|
||||
| `` c `` | Uitchecken | Bestand uitchecken |
|
||||
| `` d `` | Remove | Uitsluit deze commit zijn veranderingen aan dit bestand |
|
||||
| `` o `` | Open bestand | Open file in default application. |
|
||||
@@ -352,6 +353,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy tag to clipboard | |
|
||||
| `` <space> `` | Uitchecken | Checkout the selected tag as a detached HEAD. |
|
||||
| `` n `` | Creëer tag | Create new tag from current commit. You'll be prompted to enter a tag name and optional description. |
|
||||
| `` d `` | Delete | View delete options for local/remote tag. |
|
||||
|
||||
@@ -238,6 +238,7 @@ Jeśli chcesz zamiast tego rozpocząć interaktywny rebase od wybranego commita,
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Kopiuj ścieżkę do schowka | |
|
||||
| `` y `` | Kopiuj do schowka | |
|
||||
| `` c `` | Przełącz | Przełącz plik. Zastępuje plik w twoim drzewie roboczym wersją z wybranego commita. |
|
||||
| `` d `` | Usuń | Odrzuć zmiany w tym pliku z tego commita. Uruchamia interaktywny rebase w tle, więc możesz otrzymać konflikt scalania, jeśli późniejszy commit również zmienia ten plik. |
|
||||
| `` o `` | Otwórz plik | Otwórz plik w domyślnej aplikacji. |
|
||||
@@ -333,6 +334,7 @@ Jeśli chcesz zamiast tego rozpocząć interaktywny rebase od wybranego commita,
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy tag to clipboard | |
|
||||
| `` <space> `` | Przełącz | Przełącz wybrany tag jako odłączoną głowę (detached HEAD). |
|
||||
| `` n `` | Nowy tag | Utwórz nowy tag z bieżącego commita. Zostaniesz poproszony o wprowadzenie nazwy tagu i opcjonalnego opisu. |
|
||||
| `` d `` | Usuń | Wyświetl opcje usuwania lokalnego/odległego tagu. |
|
||||
|
||||
@@ -0,0 +1,379 @@
|
||||
_This file is auto-generated. To update, make the changes in the pkg/i18n directory and then run `go generate ./...` from the project root._
|
||||
|
||||
# Lazygit Keybindings
|
||||
|
||||
_Legend: `<c-b>` means ctrl+b, `<a-b>` means alt+b, `B` means shift+b_
|
||||
|
||||
## Combinações globais de teclas
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-r> `` | Mudar para um repositório recente | |
|
||||
| `` <pgup> (fn+up/shift+k) `` | Scroll up main window | |
|
||||
| `` <pgdown> (fn+down/shift+j) `` | Scroll down main window | |
|
||||
| `` @ `` | View command log options | View options for the command log e.g. show/hide the command log and focus the command log. |
|
||||
| `` P `` | Empurre (Push) | Faça push do branch atual para o seu branch upstream. Se nenhum upstream estiver configurado, você será solicitado a configurar um branch a montante. |
|
||||
| `` p `` | Puxar (Pull) | Puxe alterações do controle remoto para o ramo atual. Se nenhum upstream estiver configurado, será solicitado configurar um ramo a montante. |
|
||||
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
||||
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
||||
| `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view. |
|
||||
| `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view. |
|
||||
| `` : `` | Execute shell command | Bring up a prompt where you can enter a shell command to execute. |
|
||||
| `` <c-p> `` | View custom patch options | |
|
||||
| `` m `` | Ver opções de mesclar/rebase | Ver opções para abortar/continuar/pular o merge/rebase atual. |
|
||||
| `` R `` | Atualizar | Atualize o estado do git (ou seja, execute `git status`, `git branch`, etc em segundo plano para atualizar o conteúdo de painéis). Isso não executa `git fetch`. |
|
||||
| `` + `` | Next screen mode (normal/half/fullscreen) | |
|
||||
| `` _ `` | Prev screen mode | |
|
||||
| `` ? `` | Open keybindings menu | |
|
||||
| `` <c-s> `` | View filter options | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
| `` W `` | View diffing options | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
|
||||
| `` <c-e> `` | View diffing options | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
|
||||
| `` q `` | Sair | |
|
||||
| `` <esc> `` | Cancel | |
|
||||
| `` <c-w> `` | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view. |
|
||||
| `` z `` | Desfazer | O reflog será usado para determinar qual comando git para executar para desfazer o último comando git. Isto não inclui mudanças na árvore de trabalho; apenas compromissos são tidos em consideração. |
|
||||
| `` <c-z> `` | Refazer | O reflog será usado para determinar qual comando git para executar para refazer o último comando git. Isto não inclui mudanças na árvore de trabalho; apenas compromissos são tidos em consideração. |
|
||||
|
||||
## List panel navigation
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` , `` | Previous page | |
|
||||
| `` . `` | Next page | |
|
||||
| `` < `` | Scroll to top | |
|
||||
| `` > `` | Scroll to bottom | |
|
||||
| `` v `` | Toggle range select | |
|
||||
| `` <s-down> `` | Range select down | |
|
||||
| `` <s-up> `` | Range select up | |
|
||||
| `` / `` | Search the current view by text | |
|
||||
| `` H `` | Scroll left | |
|
||||
| `` L `` | Scroll right | |
|
||||
| `` ] `` | Next tab | |
|
||||
| `` [ `` | Previous tab | |
|
||||
|
||||
## Arquivos
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy path to clipboard | |
|
||||
| `` <space> `` | Etapa | Alternar para staging para o arquivo selecionado. |
|
||||
| `` <c-b> `` | Filtrar arquivos por status | |
|
||||
| `` y `` | Copy to clipboard | |
|
||||
| `` c `` | Commit | Submeter mudanças em staging |
|
||||
| `` w `` | Commit changes without pre-commit hook | |
|
||||
| `` A `` | Alterar último commit | |
|
||||
| `` C `` | Enviar alteração usando um editor Git | |
|
||||
| `` <c-f> `` | Encontrar commit da base para consertar | Encontre o commit em que as suas mudanças atuais estão se baseando, para alterar/consertar o commit. Isso poupa-te você de ter que olhar pelos commits da sua branch um por um para ver qual commit deve ser alterado/consertado
|
||||
Veja a documentação:
|
||||
<https://github.com/jesseduffield/lazygit/tree/master/docs/Fixup_Commits.md> |
|
||||
| `` e `` | Editar | Abrir arquivo no editor externo. |
|
||||
| `` o `` | Abrir arquivo | Abrir arquivo no aplicativo padrão. |
|
||||
| `` i `` | Ignore or exclude file | |
|
||||
| `` r `` | Atualizar arquivos | |
|
||||
| `` s `` | Stash | Stash all changes. For other variations of stashing, use the view stash options keybinding. |
|
||||
| `` S `` | View stash options | View stash options (e.g. stash all, stash staged, stash unstaged). |
|
||||
| `` a `` | Stage completo | Alternar para todos os arquivos na árvore de trabalho |
|
||||
| `` <enter> `` | Stage lines / Colapso diretório | Se o item selecionado for um arquivo, o foco na exibição de preparo para o estágio de cenas/linhas individuais. Se o item selecionado for um diretório, recolher/expandi-lo. |
|
||||
| `` d `` | Discard | View options for discarding changes to the selected file. |
|
||||
| `` g `` | View upstream reset options | |
|
||||
| `` D `` | Reset | View reset options for working tree (e.g. nuking the working tree). |
|
||||
| `` ` `` | Alternar exibição de árvore de arquivo | Alternar a visualização de arquivo entre layout plano e layout de árvore. Layout plano mostra todos os caminhos de arquivo em uma única lista, layout de árvore agrupa arquivos por diretório. |
|
||||
| `` <c-t> `` | Abrir ferramenta de diff externa (git difftool) | |
|
||||
| `` M `` | Abrir ferramenta de merge externa | Execute `git mergetool`. |
|
||||
| `` f `` | Buscar | Buscar alterações do controle remoto. |
|
||||
| `` - `` | Collapse all files | Collapse all directories in the files tree |
|
||||
| `` = `` | Expand all files | Expand all directories in the file tree |
|
||||
| `` / `` | Search the current view by text | |
|
||||
|
||||
## Branches locais
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy branch name to clipboard | |
|
||||
| `` i `` | Show git-flow options | |
|
||||
| `` <space> `` | Verificar | Checar item selecionado |
|
||||
| `` n `` | Nova branch | |
|
||||
| `` o `` | Create pull request | |
|
||||
| `` O `` | View create pull request options | |
|
||||
| `` <c-y> `` | Copiar URL do pull request para área de transferência | |
|
||||
| `` c `` | Checar por nome | Checar por nome. Na caixa de entrada você pode inserir '-' para trocar para a última branch |
|
||||
| `` F `` | Forçar checagem | Forçar checagem da branch selecionada. Isso irá descartar todas as mudanças no seu diretório de trabalho antes cheque a branch selecionada |
|
||||
| `` d `` | Delete | View delete options for local/remote branch. |
|
||||
| `` r `` | Refazer | Refazer a branch checada na branch selecionada |
|
||||
| `` M `` | Mesclar | Ver opções para mesclar o item selecionado no branch atual (mesclar regularmente, mesclar squash) |
|
||||
| `` f `` | Avanço rápido | Encaminhamento rápido de branch selecionada a partir do upstream. |
|
||||
| `` T `` | New tag | |
|
||||
| `` s `` | Sort order | |
|
||||
| `` g `` | Reset | |
|
||||
| `` R `` | Rename branch | |
|
||||
| `` u `` | View upstream options | View options relating to the branch's upstream e.g. setting/unsetting the upstream and resetting to the upstream. |
|
||||
| `` <c-t> `` | Abrir ferramenta de diff externa (git difftool) | |
|
||||
| `` <enter> `` | View commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Branches remotos
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy branch name to clipboard | |
|
||||
| `` <space> `` | Verificar | Checar a nova branch baseada na brach remota selecionada, ou a branch remota como HEAD, desanexado |
|
||||
| `` n `` | Nova branch | |
|
||||
| `` M `` | Mesclar | Ver opções para mesclar o item selecionado no branch atual (mesclar regularmente, mesclar squash) |
|
||||
| `` r `` | Refazer | Refazer a branch checada na branch selecionada |
|
||||
| `` d `` | Delete | Delete the remote branch from the remote. |
|
||||
| `` u `` | Set as upstream | Set the selected remote branch as the upstream of the checked-out branch. |
|
||||
| `` s `` | Sort order | |
|
||||
| `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` <c-t> `` | Abrir ferramenta de diff externa (git difftool) | |
|
||||
| `` <enter> `` | View commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Commit files
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy path to clipboard | |
|
||||
| `` y `` | Copy to clipboard | |
|
||||
| `` c `` | Verificar | Checkout file. This replaces the file in your working tree with the version from the selected commit. |
|
||||
| `` d `` | Remove | Discard this commit's changes to this file. This runs an interactive rebase in the background, so you may get a merge conflict if a later commit also changes this file. |
|
||||
| `` o `` | Abrir arquivo | Abrir arquivo no aplicativo padrão. |
|
||||
| `` e `` | Editar | Abrir arquivo no editor externo. |
|
||||
| `` <c-t> `` | Abrir ferramenta de diff externa (git difftool) | |
|
||||
| `` <space> `` | Toggle file included in patch | Toggle whether the file is included in the custom patch. See https://github.com/jesseduffield/lazygit#rebase-magic-custom-patches. |
|
||||
| `` a `` | Toggle all files | Add/remove all commit's files to custom patch. See https://github.com/jesseduffield/lazygit#rebase-magic-custom-patches. |
|
||||
| `` <enter> `` | Enter file / Toggle directory collapsed | If a file is selected, enter the file so that you can add/remove individual lines to the custom patch. If a directory is selected, toggle the directory. |
|
||||
| `` ` `` | Alternar exibição de árvore de arquivo | Alternar a visualização de arquivo entre layout plano e layout de árvore. Layout plano mostra todos os caminhos de arquivo em uma única lista, layout de árvore agrupa arquivos por diretório. |
|
||||
| `` - `` | Collapse all files | Collapse all directories in the files tree |
|
||||
| `` = `` | Expand all files | Expand all directories in the file tree |
|
||||
| `` / `` | Search the current view by text | |
|
||||
|
||||
## Commits
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy commit hash to clipboard | |
|
||||
| `` <c-r> `` | Reset copied (cherry-picked) commits selection | |
|
||||
| `` b `` | View bisect options | |
|
||||
| `` s `` | Squash | Squash o commit selecionado no commit abaixo dele. A mensagem do commit selecionado será anexada ao commit abaixo dele. |
|
||||
| `` f `` | Fixup | Faça o commit selecionado no commit abaixo dele. Semelhante para o squash, mas a mensagem do commit selecionado será descartada. |
|
||||
| `` r `` | Reword | Repetir a mensagem de submissão selecionada. |
|
||||
| `` R `` | Republicar com o editor | |
|
||||
| `` d `` | Descartar | Solte o commit selecionado. Isso irá remover o commit do branch através de uma rebase. Se o commit faz com que as alterações em commits posteriores dependem, você pode precisar resolver conflitos de merge. |
|
||||
| `` e `` | Editar (iniciar rebase interativa) | Editar o commit selecionado. Use isto para iniciar uma rebase interativa a partir do commit selecionado. Quando já estiver no meio da reconstrução, isto irá marcar o commit selecionado para edição, o que significa que ao continuar com a reformulação. a rebase irá pausar no commit selecionado para permitir que você faça alterações. |
|
||||
| `` i `` | Start interactive rebase | Start an interactive rebase for the commits on your branch. This will include all commits from the HEAD commit down to the first merge commit or main branch commit.
|
||||
If you would instead like to start an interactive rebase from the selected commit, press `e`. |
|
||||
| `` p `` | Escolher | Marque o commit selecionado para ser escolhido (quando meados da base). Isso significa que o commit será mantido ao continuar o rebase. |
|
||||
| `` F `` | Create fixup commit | Create 'fixup!' commit for the selected commit. Later on, you can press `S` on this same commit to apply all above fixup commits. |
|
||||
| `` S `` | Apply fixup commits | Squash all 'fixup!' commits, either above the selected commit, or all in current branch (autosquash). |
|
||||
| `` <c-j> `` | Mover commit um para baixo | |
|
||||
| `` <c-k> `` | Mover o commit um para cima | |
|
||||
| `` V `` | Colar (cherry-pick) | |
|
||||
| `` B `` | Mark as base commit for rebase | Select a base commit for the next rebase. When you rebase onto a branch, only commits above the base commit will be brought across. This uses the `git rebase --onto` command. |
|
||||
| `` A `` | Modificar | Alterar o commit com mudanças em sted. Se o commit selecionado for o commit HEAD, ele executará o `git commit --amend`. Caso contrário, o compromisso será alterado por meio de uma base de apoio. |
|
||||
| `` a `` | Alterar atributo de commit | Definir/Redefinir autor de submissão ou co-autor definido. |
|
||||
| `` t `` | Reverter | Crie um commit reverter para o commit selecionado, que aplica as alterações do commit selecionado em reverso. |
|
||||
| `` T `` | Tag commit | Create a new tag pointing at the selected commit. You'll be prompted to enter a tag name and optional description. |
|
||||
| `` <c-l> `` | View log options | View options for commit log e.g. changing sort order, hiding the git graph, showing the whole git graph. |
|
||||
| `` <space> `` | Verificar | Checkout the selected commit as a detached HEAD. |
|
||||
| `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). |
|
||||
| `` o `` | Open commit in browser | |
|
||||
| `` n `` | Create new branch off of commit | |
|
||||
| `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Copiar (cherry-pick) | Marcar commit como copiado. Então, dentro da visualização local de commits, você pode pressionar `V` para colar (cherry-pick) o(s) commit(s) copiado(s) em seu branch de check-out. A qualquer momento você pode pressionar `<esc>` para cancelar a seleção. |
|
||||
| `` <c-t> `` | Abrir ferramenta de diff externa (git difftool) | |
|
||||
| `` <enter> `` | View files | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Search the current view by text | |
|
||||
|
||||
## Confirmation panel
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <enter> `` | Confirmar | |
|
||||
| `` <esc> `` | Fechar/Cancelar | |
|
||||
|
||||
## Etiquetas
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy tag to clipboard | |
|
||||
| `` <space> `` | Verificar | Checar a tag selecionada como um HEAD, desanexado |
|
||||
| `` n `` | New tag | Create new tag from current commit. You'll be prompted to enter a tag name and optional description. |
|
||||
| `` d `` | Delete | View delete options for local/remote tag. |
|
||||
| `` P `` | Push tag | Push the selected tag to a remote. You'll be prompted to select a remote. |
|
||||
| `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` <c-t> `` | Abrir ferramenta de diff externa (git difftool) | |
|
||||
| `` <enter> `` | View commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Menu
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <enter> `` | Executar | |
|
||||
| `` <esc> `` | Fechar | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Painel Principal (Normal)
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` mouse wheel down (fn+up) `` | Scroll down | |
|
||||
| `` mouse wheel up (fn+down) `` | Scroll up | |
|
||||
|
||||
## Painel Principal (preparação)
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <left> `` | Go to previous hunk | |
|
||||
| `` <right> `` | Go to next hunk | |
|
||||
| `` v `` | Toggle range select | |
|
||||
| `` a `` | Selecione o local | Ativa/desativa modo seleção de hunk |
|
||||
| `` <c-o> `` | Copy selected text to clipboard | |
|
||||
| `` <space> `` | Etapa | Ativar/desativar seleção em staged/unstaged |
|
||||
| `` d `` | Descartar | Quando a mudança não desejada for selecionada, descarte a mudança usando `git reset`. Quando a mudança em fase é selecionada, despare a mudança. |
|
||||
| `` o `` | Abrir arquivo | Abrir arquivo no aplicativo padrão. |
|
||||
| `` e `` | Editar arquivo | Abrir arquivo no editor externo. |
|
||||
| `` <esc> `` | Retornar ao painel de arquivos | |
|
||||
| `` <tab> `` | Mudar de visão | Alternar para outra visão (staged/não processadas alterações). |
|
||||
| `` E `` | Editar hunk | Editar o local selecionado no editor externo. |
|
||||
| `` c `` | Commit | Submeter mudanças em staging |
|
||||
| `` w `` | Commit changes without pre-commit hook | |
|
||||
| `` C `` | Enviar alteração usando um editor Git | |
|
||||
| `` <c-f> `` | Encontrar commit da base para consertar | Encontre o commit em que as suas mudanças atuais estão se baseando, para alterar/consertar o commit. Isso poupa-te você de ter que olhar pelos commits da sua branch um por um para ver qual commit deve ser alterado/consertado
|
||||
Veja a documentação:
|
||||
<https://github.com/jesseduffield/lazygit/tree/master/docs/Fixup_Commits.md> |
|
||||
| `` / `` | Search the current view by text | |
|
||||
|
||||
## Painel principal (mesclagem)
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | Escolha o local | |
|
||||
| `` b `` | Pegar todos os pedaços | |
|
||||
| `` <up> `` | Previous hunk | |
|
||||
| `` <down> `` | Next hunk | |
|
||||
| `` <left> `` | Previous conflict | |
|
||||
| `` <right> `` | Next conflict | |
|
||||
| `` z `` | Desfazer | Desfazer resolução de conflitos de última mesclagem. |
|
||||
| `` e `` | Editar arquivo | Abrir arquivo no editor externo. |
|
||||
| `` o `` | Abrir arquivo | Abrir arquivo no aplicativo padrão. |
|
||||
| `` M `` | Abrir ferramenta de merge externa | Execute `git mergetool`. |
|
||||
| `` <esc> `` | Retornar ao painel de arquivos | |
|
||||
|
||||
## Painel principal (patch build)
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <left> `` | Go to previous hunk | |
|
||||
| `` <right> `` | Go to next hunk | |
|
||||
| `` v `` | Toggle range select | |
|
||||
| `` a `` | Selecione o local | Ativa/desativa modo seleção de hunk |
|
||||
| `` <c-o> `` | Copy selected text to clipboard | |
|
||||
| `` o `` | Abrir arquivo | Abrir arquivo no aplicativo padrão. |
|
||||
| `` e `` | Editar arquivo | Abrir arquivo no editor externo. |
|
||||
| `` <space> `` | Alternar linhas no caminho | |
|
||||
| `` <esc> `` | Exit custom patch builder | |
|
||||
| `` / `` | Search the current view by text | |
|
||||
|
||||
## Reflog
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy commit hash to clipboard | |
|
||||
| `` <space> `` | Verificar | Checkout the selected commit as a detached HEAD. |
|
||||
| `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). |
|
||||
| `` o `` | Open commit in browser | |
|
||||
| `` n `` | Create new branch off of commit | |
|
||||
| `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Copiar (cherry-pick) | Marcar commit como copiado. Então, dentro da visualização local de commits, você pode pressionar `V` para colar (cherry-pick) o(s) commit(s) copiado(s) em seu branch de check-out. A qualquer momento você pode pressionar `<esc>` para cancelar a seleção. |
|
||||
| `` <c-r> `` | Reset copied (cherry-picked) commits selection | |
|
||||
| `` <c-t> `` | Abrir ferramenta de diff externa (git difftool) | |
|
||||
| `` <enter> `` | View commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Remotes
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <enter> `` | View branches | |
|
||||
| `` n `` | New remote | |
|
||||
| `` d `` | Remove | Remove the selected remote. Any local branches tracking a remote branch from the remote will be unaffected. |
|
||||
| `` e `` | Editar | Edit the selected remote's name or URL. |
|
||||
| `` f `` | Buscar | Fetch updates from the remote repository. This retrieves new commits and branches without merging them into your local branches. |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Stash
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | Aplicar | Aplique o stash no seu diretório de trabalho. |
|
||||
| `` g `` | Pop | Aplique a entrada de stash no seu diretório de trabalho e remova a entrada de stash. |
|
||||
| `` d `` | Descartar | Remova a entrada do stash da lista de armazenamento. |
|
||||
| `` n `` | Nova branch | Criar um novo ramo a partir da entrada de lixo selecionada. Isso funciona verificando o commit do qual a entrada de lixo foi criada, criar um novo branch a partir desse commit e, em seguida, aplicar a entrada de lixo ao novo branch como um commit adicional. |
|
||||
| `` r `` | Renomear o stasj | |
|
||||
| `` <enter> `` | View files | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Status
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` o `` | Abrir o ficheiro de config | Abrir arquivo no aplicativo padrão. |
|
||||
| `` e `` | Editar arquivo de configuração | Abrir arquivo no editor externo. |
|
||||
| `` u `` | Verificar atualização | |
|
||||
| `` <enter> `` | Mudar para um repositório recente | |
|
||||
| `` a `` | Mostrar todos os logs da branch | |
|
||||
|
||||
## Sub-commits
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy commit hash to clipboard | |
|
||||
| `` <space> `` | Verificar | Checkout the selected commit as a detached HEAD. |
|
||||
| `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). |
|
||||
| `` o `` | Open commit in browser | |
|
||||
| `` n `` | Create new branch off of commit | |
|
||||
| `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Copiar (cherry-pick) | Marcar commit como copiado. Então, dentro da visualização local de commits, você pode pressionar `V` para colar (cherry-pick) o(s) commit(s) copiado(s) em seu branch de check-out. A qualquer momento você pode pressionar `<esc>` para cancelar a seleção. |
|
||||
| `` <c-r> `` | Reset copied (cherry-picked) commits selection | |
|
||||
| `` <c-t> `` | Abrir ferramenta de diff externa (git difftool) | |
|
||||
| `` <enter> `` | View files | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Search the current view by text | |
|
||||
|
||||
## Submodules
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy submodule name to clipboard | |
|
||||
| `` <enter> `` | Enter | Enter submodule. After entering the submodule, you can press `<esc>` to escape back to the parent repo. |
|
||||
| `` d `` | Remove | Remove the selected submodule and its corresponding directory. |
|
||||
| `` u `` | Update | Update selected submodule. |
|
||||
| `` n `` | New submodule | |
|
||||
| `` e `` | Update submodule URL | |
|
||||
| `` i `` | Initialize | Initialize the selected submodule to prepare for fetching. You probably want to follow this up by invoking the 'update' action to fetch the submodule. |
|
||||
| `` b `` | View bulk submodule options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Sumário do commit
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <enter> `` | Confirmar | |
|
||||
| `` <esc> `` | Fechar | |
|
||||
|
||||
## Worktrees
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` n `` | New worktree | |
|
||||
| `` <space> `` | Switch | Switch to the selected worktree. |
|
||||
| `` o `` | Abrir no editor | |
|
||||
| `` d `` | Remove | Remove the selected worktree. This will both delete the worktree's directory, as well as metadata about the worktree in the .git directory. |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
@@ -261,6 +261,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Скопировать название файла в буфер обмена | |
|
||||
| `` y `` | Copy to clipboard | |
|
||||
| `` c `` | Переключить | Переключить файл |
|
||||
| `` d `` | Remove | Отменить изменения коммита в этом файле |
|
||||
| `` o `` | Открыть файл | Open file in default application. |
|
||||
@@ -288,6 +289,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy tag to clipboard | |
|
||||
| `` <space> `` | Переключить | Checkout the selected tag as a detached HEAD. |
|
||||
| `` n `` | Создать тег | Create new tag from current commit. You'll be prompted to enter a tag name and optional description. |
|
||||
| `` d `` | Delete | View delete options for local/remote tag. |
|
||||
|
||||
@@ -12,8 +12,8 @@ _图例:`<c-b>` 意味着ctrl+b, `<a-b>意味着Alt+b, `B` 意味着shift+b_
|
||||
| `` <pgup> (fn+up/shift+k) `` | 向上滚动主面板 | |
|
||||
| `` <pgdown> (fn+down/shift+j) `` | 向下滚动主面板 | |
|
||||
| `` @ `` | 打开命令日志菜单 | 查看命令日志的选项,例如显示/隐藏命令日志以及聚焦命令日志 |
|
||||
| `` P `` | 推送 | 推送当前分支到它的上游。如果上游为配置,你可以在弹窗中配置上游分支。 |
|
||||
| `` p `` | 拉取 | 从当前分支的远程分支获取改动。如果上游为配置,你可以在弹窗中配置上游分支。 |
|
||||
| `` P `` | 推送 | 推送当前分支到它的上游。如果上游未配置,你可以在弹窗中配置上游分支。 |
|
||||
| `` p `` | 拉取 | 从当前分支的远程分支获取改动。如果上游未配置,你可以在弹窗中配置上游分支。 |
|
||||
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
||||
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename. |
|
||||
| `` } `` | 扩大差异视图中显示的上下文范围 | 增加diff视图中围绕更改显示的上下文数量 |
|
||||
@@ -186,6 +186,7 @@ _图例:`<c-b>` 意味着ctrl+b, `<a-b>意味着Alt+b, `B` 意味着shift+b_
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | 将文件名复制到剪贴板 | |
|
||||
| `` y `` | 复制到剪贴板 | |
|
||||
| `` c `` | 检出 | 检出文件 |
|
||||
| `` d `` | 删除 | 放弃对此文件的提交变更 |
|
||||
| `` o `` | 打开文件 | 使用默认程序打开该文件 |
|
||||
@@ -250,6 +251,7 @@ _图例:`<c-b>` 意味着ctrl+b, `<a-b>意味着Alt+b, `B` 意味着shift+b_
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy tag to clipboard | |
|
||||
| `` <space> `` | 检出 | 检出选择的标签作为分离的HEAD |
|
||||
| `` n `` | 创建标签 | 基于当前提交创建一个新标签。你将在弹窗中输入标签名称和描述(可选)。 |
|
||||
| `` d `` | 删除 | 查看本地/远程标签的删除选项 |
|
||||
|
||||
@@ -210,6 +210,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | 複製檔案名稱到剪貼簿 | |
|
||||
| `` y `` | 複製到剪貼簿 | |
|
||||
| `` c `` | 檢出 | 檢出檔案 |
|
||||
| `` d `` | Remove | Discard this commit's changes to this file. This runs an interactive rebase in the background, so you may get a merge conflict if a later commit also changes this file. |
|
||||
| `` o `` | 開啟檔案 | 使用預設軟體開啟 |
|
||||
@@ -284,6 +285,7 @@ If you would instead like to start an interactive rebase from the selected commi
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <c-o> `` | Copy tag to clipboard | |
|
||||
| `` <space> `` | 檢出 | Checkout the selected tag as a detached HEAD. |
|
||||
| `` n `` | 建立標籤 | Create new tag from current commit. You'll be prompted to enter a tag name and optional description. |
|
||||
| `` d `` | 刪除 | View delete options for local/remote tag. |
|
||||
|
||||
@@ -16,7 +16,7 @@ require (
|
||||
github.com/integrii/flaggy v1.4.0
|
||||
github.com/jesseduffield/generics v0.0.0-20220320043834-727e535cbe68
|
||||
github.com/jesseduffield/go-git/v5 v5.1.2-0.20221018185014-fdd53fef665d
|
||||
github.com/jesseduffield/gocui v0.3.1-0.20250111205211-82d518436b5a
|
||||
github.com/jesseduffield/gocui v0.3.1-0.20250220081214-b376cb0857ac
|
||||
github.com/jesseduffield/kill v0.0.0-20250101124109-e216ddbe133a
|
||||
github.com/jesseduffield/lazycore v0.0.0-20221012050358-03d2e40243c5
|
||||
github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e
|
||||
@@ -30,7 +30,7 @@ require (
|
||||
github.com/sahilm/fuzzy v0.1.0
|
||||
github.com/samber/lo v1.31.0
|
||||
github.com/sanity-io/litter v1.5.2
|
||||
github.com/sasha-s/go-deadlock v0.3.1
|
||||
github.com/sasha-s/go-deadlock v0.3.5
|
||||
github.com/sirupsen/logrus v1.4.2
|
||||
github.com/spf13/afero v1.9.5
|
||||
github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad
|
||||
@@ -38,7 +38,7 @@ require (
|
||||
github.com/stretchr/testify v1.8.1
|
||||
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778
|
||||
golang.org/x/exp v0.0.0-20220318154914-8dddf5d87bd8
|
||||
golang.org/x/sync v0.10.0
|
||||
golang.org/x/sync v0.11.0
|
||||
gopkg.in/ozeidan/fuzzy-patricia.v3 v3.0.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
@@ -66,7 +66,7 @@ require (
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/onsi/ginkgo v1.10.3 // indirect
|
||||
github.com/onsi/gomega v1.7.1 // indirect
|
||||
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
|
||||
github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/sergi/go-diff v1.1.0 // indirect
|
||||
@@ -74,8 +74,8 @@ require (
|
||||
github.com/xanzy/ssh-agent v0.2.1 // indirect
|
||||
golang.org/x/crypto v0.31.0 // indirect
|
||||
golang.org/x/net v0.33.0 // indirect
|
||||
golang.org/x/sys v0.29.0 // indirect
|
||||
golang.org/x/term v0.28.0 // indirect
|
||||
golang.org/x/text v0.21.0 // indirect
|
||||
golang.org/x/sys v0.30.0 // indirect
|
||||
golang.org/x/term v0.29.0 // indirect
|
||||
golang.org/x/text v0.22.0 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
)
|
||||
|
||||
@@ -188,8 +188,8 @@ github.com/jesseduffield/generics v0.0.0-20220320043834-727e535cbe68 h1:EQP2Tv8T
|
||||
github.com/jesseduffield/generics v0.0.0-20220320043834-727e535cbe68/go.mod h1:+LLj9/WUPAP8LqCchs7P+7X0R98HiFujVFANdNaxhGk=
|
||||
github.com/jesseduffield/go-git/v5 v5.1.2-0.20221018185014-fdd53fef665d h1:bO+OmbreIv91rCe8NmscRwhFSqkDJtzWCPV4Y+SQuXE=
|
||||
github.com/jesseduffield/go-git/v5 v5.1.2-0.20221018185014-fdd53fef665d/go.mod h1:nGNEErzf+NRznT+N2SWqmHnDnF9aLgANB1CUNEan09o=
|
||||
github.com/jesseduffield/gocui v0.3.1-0.20250111205211-82d518436b5a h1:GLFWB8rESraTt2eIe2yssy4d4VEkCnmKbPeeZ5vCT2s=
|
||||
github.com/jesseduffield/gocui v0.3.1-0.20250111205211-82d518436b5a/go.mod h1:sLIyZ2J42R6idGdtemZzsiR3xY5EF0KsvYEGh3dQv3s=
|
||||
github.com/jesseduffield/gocui v0.3.1-0.20250220081214-b376cb0857ac h1:vUNTiVEB9Bz16pTJ5kNgb/1HhnWdSA1P0GfFLUJeITI=
|
||||
github.com/jesseduffield/gocui v0.3.1-0.20250220081214-b376cb0857ac/go.mod h1:sLIyZ2J42R6idGdtemZzsiR3xY5EF0KsvYEGh3dQv3s=
|
||||
github.com/jesseduffield/kill v0.0.0-20250101124109-e216ddbe133a h1:UDeJ3EBk04bXDLOPvuqM3on8HvyJfISw0+UMqW+0a4g=
|
||||
github.com/jesseduffield/kill v0.0.0-20250101124109-e216ddbe133a/go.mod h1:FSWDLKT0NQpntbDd1H3lbz51fhCVlMzy/J0S6nM727Q=
|
||||
github.com/jesseduffield/lazycore v0.0.0-20221012050358-03d2e40243c5 h1:CDuQmfOjAtb1Gms6a1p5L2P8RhbLUq5t8aL7PiQd2uY=
|
||||
@@ -250,8 +250,8 @@ github.com/onsi/ginkgo v1.10.3 h1:OoxbjfXVZyod1fmWYhI7SEyaD8B00ynP3T+D5GiyHOY=
|
||||
github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ=
|
||||
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o=
|
||||
github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 h1:Dx7Ovyv/SFnMFw3fD4oEoeorXc6saIiQ23LrGLth0Gw=
|
||||
github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
@@ -271,8 +271,8 @@ github.com/samber/lo v1.31.0 h1:Sfa+/064Tdo4SvlohQUQzBhgSer9v/coGvKQI/XLWAM=
|
||||
github.com/samber/lo v1.31.0/go.mod h1:HLeWcJRRyLKp3+/XBJvOrerCQn9mhdKMHyd7IRlgeQ8=
|
||||
github.com/sanity-io/litter v1.5.2 h1:AnC8s9BMORWH5a4atZ4D6FPVvKGzHcnc5/IVTa87myw=
|
||||
github.com/sanity-io/litter v1.5.2/go.mod h1:5Z71SvaYy5kcGtyglXOC9rrUi3c1E8CamFWjQsazTh0=
|
||||
github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0=
|
||||
github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM=
|
||||
github.com/sasha-s/go-deadlock v0.3.5 h1:tNCOEEDG6tBqrNDOX35j/7hL5FcFViG6awUGROb2NsU=
|
||||
github.com/sasha-s/go-deadlock v0.3.5/go.mod h1:bugP6EGbdGYObIlx7pUZtWqlvo8k9H6vCBBsiChJQ5U=
|
||||
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
||||
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
||||
@@ -437,8 +437,9 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
|
||||
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
|
||||
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20170407050850-f3918c30c5c2/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@@ -491,8 +492,9 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
|
||||
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
|
||||
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
@@ -501,8 +503,9 @@ golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
|
||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||
golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=
|
||||
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
|
||||
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
|
||||
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@@ -516,8 +519,9 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
||||
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
|
||||
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
|
||||
@@ -275,6 +275,7 @@ func (self *BranchCommands) IsBranchMerged(branch *models.Branch, mainBranches *
|
||||
Arg(lo.Map(branchesToCheckAgainst, func(branch string, _ int) string {
|
||||
return fmt.Sprintf("^%s", branch)
|
||||
})...).
|
||||
Arg("--").
|
||||
ToArgv()
|
||||
|
||||
stdout, _, err := self.cmd.New(cmdArgs).RunWithOutputs()
|
||||
|
||||
@@ -32,13 +32,17 @@ func NewFileLoader(gitCommon *GitCommon, cmd oscommands.ICmdObjBuilder, config F
|
||||
|
||||
type GetStatusFileOptions struct {
|
||||
NoRenames bool
|
||||
// If true, we'll show untracked files even if the user has set the config to hide them.
|
||||
// This is useful for users with bare repos for dotfiles who default to hiding untracked files,
|
||||
// but want to occasionally see them to `git add` a new file.
|
||||
ForceShowUntracked bool
|
||||
}
|
||||
|
||||
func (self *FileLoader) GetStatusFiles(opts GetStatusFileOptions) []*models.File {
|
||||
// check if config wants us ignoring untracked files
|
||||
untrackedFilesSetting := self.config.GetShowUntrackedFiles()
|
||||
|
||||
if untrackedFilesSetting == "" {
|
||||
if opts.ForceShowUntracked || untrackedFilesSetting == "" {
|
||||
untrackedFilesSetting = "all"
|
||||
}
|
||||
untrackedFilesArg := fmt.Sprintf("--untracked-files=%s", untrackedFilesSetting)
|
||||
|
||||
@@ -81,9 +81,11 @@ func (self *StashCommands) Hash(index int) (string, error) {
|
||||
}
|
||||
|
||||
func (self *StashCommands) ShowStashEntryCmdObj(index int) oscommands.ICmdObj {
|
||||
// "-u" is the same as "--include-untracked", but the latter fails in older git versions for some reason
|
||||
cmdArgs := NewGitCmd("stash").Arg("show").
|
||||
Arg("-p").
|
||||
Arg("--stat").
|
||||
Arg("-u").
|
||||
Arg(fmt.Sprintf("--color=%s", self.UserConfig().Git.Paging.ColorArg)).
|
||||
Arg(fmt.Sprintf("--unified=%d", self.AppState.DiffContextSize)).
|
||||
ArgIf(self.AppState.IgnoreWhitespaceInDiffView, "--ignore-all-space").
|
||||
|
||||
@@ -113,7 +113,7 @@ func TestStashStashEntryCmdObj(t *testing.T) {
|
||||
contextSize: 3,
|
||||
similarityThreshold: 50,
|
||||
ignoreWhitespace: false,
|
||||
expected: []string{"git", "-C", "/path/to/worktree", "stash", "show", "-p", "--stat", "--color=always", "--unified=3", "--find-renames=50%", "stash@{5}"},
|
||||
expected: []string{"git", "-C", "/path/to/worktree", "stash", "show", "-p", "--stat", "-u", "--color=always", "--unified=3", "--find-renames=50%", "stash@{5}"},
|
||||
},
|
||||
{
|
||||
testName: "Show diff with custom context size",
|
||||
@@ -121,7 +121,7 @@ func TestStashStashEntryCmdObj(t *testing.T) {
|
||||
contextSize: 77,
|
||||
similarityThreshold: 50,
|
||||
ignoreWhitespace: false,
|
||||
expected: []string{"git", "-C", "/path/to/worktree", "stash", "show", "-p", "--stat", "--color=always", "--unified=77", "--find-renames=50%", "stash@{5}"},
|
||||
expected: []string{"git", "-C", "/path/to/worktree", "stash", "show", "-p", "--stat", "-u", "--color=always", "--unified=77", "--find-renames=50%", "stash@{5}"},
|
||||
},
|
||||
{
|
||||
testName: "Show diff with custom similarity threshold",
|
||||
@@ -129,7 +129,7 @@ func TestStashStashEntryCmdObj(t *testing.T) {
|
||||
contextSize: 3,
|
||||
similarityThreshold: 33,
|
||||
ignoreWhitespace: false,
|
||||
expected: []string{"git", "-C", "/path/to/worktree", "stash", "show", "-p", "--stat", "--color=always", "--unified=3", "--find-renames=33%", "stash@{5}"},
|
||||
expected: []string{"git", "-C", "/path/to/worktree", "stash", "show", "-p", "--stat", "-u", "--color=always", "--unified=3", "--find-renames=33%", "stash@{5}"},
|
||||
},
|
||||
{
|
||||
testName: "Default case",
|
||||
@@ -137,7 +137,7 @@ func TestStashStashEntryCmdObj(t *testing.T) {
|
||||
contextSize: 3,
|
||||
similarityThreshold: 50,
|
||||
ignoreWhitespace: true,
|
||||
expected: []string{"git", "-C", "/path/to/worktree", "stash", "show", "-p", "--stat", "--color=always", "--unified=3", "--ignore-all-space", "--find-renames=50%", "stash@{5}"},
|
||||
expected: []string{"git", "-C", "/path/to/worktree", "stash", "show", "-p", "--stat", "-u", "--color=always", "--unified=3", "--ignore-all-space", "--find-renames=50%", "stash@{5}"},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package git_commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-errors/errors"
|
||||
"github.com/jesseduffield/gocui"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
||||
@@ -20,6 +22,7 @@ func NewSyncCommands(gitCommon *GitCommon) *SyncCommands {
|
||||
type PushOpts struct {
|
||||
Force bool
|
||||
ForceWithLease bool
|
||||
CurrentBranch string
|
||||
UpstreamRemote string
|
||||
UpstreamBranch string
|
||||
SetUpstream bool
|
||||
@@ -35,7 +38,7 @@ func (self *SyncCommands) PushCmdObj(task gocui.Task, opts PushOpts) (oscommands
|
||||
ArgIf(opts.ForceWithLease, "--force-with-lease").
|
||||
ArgIf(opts.SetUpstream, "--set-upstream").
|
||||
ArgIf(opts.UpstreamRemote != "", opts.UpstreamRemote).
|
||||
ArgIf(opts.UpstreamBranch != "", "HEAD:"+opts.UpstreamBranch).
|
||||
ArgIf(opts.UpstreamBranch != "", fmt.Sprintf("refs/heads/%s:%s", opts.CurrentBranch, opts.UpstreamBranch)).
|
||||
ToArgv()
|
||||
|
||||
cmdObj := self.cmd.New(cmdArgs).PromptOnCredentialRequest(task)
|
||||
|
||||
@@ -44,11 +44,12 @@ func TestSyncPush(t *testing.T) {
|
||||
testName: "Push with force disabled, upstream supplied",
|
||||
opts: PushOpts{
|
||||
ForceWithLease: false,
|
||||
CurrentBranch: "master",
|
||||
UpstreamRemote: "origin",
|
||||
UpstreamBranch: "master",
|
||||
},
|
||||
test: func(cmdObj oscommands.ICmdObj, err error) {
|
||||
assert.Equal(t, cmdObj.Args(), []string{"git", "push", "origin", "HEAD:master"})
|
||||
assert.Equal(t, cmdObj.Args(), []string{"git", "push", "origin", "refs/heads/master:master"})
|
||||
assert.NoError(t, err)
|
||||
},
|
||||
},
|
||||
@@ -56,12 +57,13 @@ func TestSyncPush(t *testing.T) {
|
||||
testName: "Push with force disabled, setting upstream",
|
||||
opts: PushOpts{
|
||||
ForceWithLease: false,
|
||||
CurrentBranch: "master-local",
|
||||
UpstreamRemote: "origin",
|
||||
UpstreamBranch: "master",
|
||||
SetUpstream: true,
|
||||
},
|
||||
test: func(cmdObj oscommands.ICmdObj, err error) {
|
||||
assert.Equal(t, cmdObj.Args(), []string{"git", "push", "--set-upstream", "origin", "HEAD:master"})
|
||||
assert.Equal(t, cmdObj.Args(), []string{"git", "push", "--set-upstream", "origin", "refs/heads/master-local:master"})
|
||||
assert.NoError(t, err)
|
||||
},
|
||||
},
|
||||
@@ -69,12 +71,13 @@ func TestSyncPush(t *testing.T) {
|
||||
testName: "Push with force-with-lease enabled, setting upstream",
|
||||
opts: PushOpts{
|
||||
ForceWithLease: true,
|
||||
CurrentBranch: "master",
|
||||
UpstreamRemote: "origin",
|
||||
UpstreamBranch: "master",
|
||||
SetUpstream: true,
|
||||
},
|
||||
test: func(cmdObj oscommands.ICmdObj, err error) {
|
||||
assert.Equal(t, cmdObj.Args(), []string{"git", "push", "--force-with-lease", "--set-upstream", "origin", "HEAD:master"})
|
||||
assert.Equal(t, cmdObj.Args(), []string{"git", "push", "--force-with-lease", "--set-upstream", "origin", "refs/heads/master:master"})
|
||||
assert.NoError(t, err)
|
||||
},
|
||||
},
|
||||
|
||||
@@ -217,6 +217,26 @@ func loadUserConfig(configFiles []*ConfigFile, base *UserConfig) (*UserConfig, e
|
||||
// from one container to another, or changing the type of a key (e.g. from bool
|
||||
// to an enum).
|
||||
func migrateUserConfig(path string, content []byte) ([]byte, error) {
|
||||
changedContent, err := computeMigratedConfig(path, content)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Write config back if changed
|
||||
if string(changedContent) != string(content) {
|
||||
fmt.Println("Provided user config is deprecated but auto-fixable. Attempting to write fixed version back to file...")
|
||||
if err := os.WriteFile(path, changedContent, 0o644); err != nil {
|
||||
return nil, fmt.Errorf("While attempting to write back fixed user config to %s, an error occurred: %s", path, err)
|
||||
}
|
||||
fmt.Printf("Success. New config written to %s\n", path)
|
||||
return changedContent, nil
|
||||
}
|
||||
|
||||
return content, nil
|
||||
}
|
||||
|
||||
// A pure function helper for testing purposes
|
||||
func computeMigratedConfig(path string, content []byte) ([]byte, error) {
|
||||
changedContent := content
|
||||
|
||||
pathsToReplace := []struct {
|
||||
@@ -241,17 +261,18 @@ func migrateUserConfig(path string, content []byte) ([]byte, error) {
|
||||
return nil, fmt.Errorf("Couldn't migrate config file at `%s`: %s", path, err)
|
||||
}
|
||||
|
||||
// Add more migrations here...
|
||||
|
||||
// Write config back if changed
|
||||
if string(changedContent) != string(content) {
|
||||
if err := os.WriteFile(path, changedContent, 0o644); err != nil {
|
||||
return nil, fmt.Errorf("Couldn't write migrated config back to `%s`: %s", path, err)
|
||||
}
|
||||
return changedContent, nil
|
||||
changedContent, err = changeElementToSequence(changedContent, []string{"git", "commitPrefix"})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Couldn't migrate config file at `%s`: %s", path, err)
|
||||
}
|
||||
|
||||
return content, nil
|
||||
changedContent, err = changeCommitPrefixesMap(changedContent)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Couldn't migrate config file at `%s`: %s", path, err)
|
||||
}
|
||||
// Add more migrations here...
|
||||
|
||||
return changedContent, nil
|
||||
}
|
||||
|
||||
func changeNullKeybindingsToDisabled(changedContent []byte) ([]byte, error) {
|
||||
@@ -265,6 +286,46 @@ func changeNullKeybindingsToDisabled(changedContent []byte) ([]byte, error) {
|
||||
})
|
||||
}
|
||||
|
||||
func changeElementToSequence(changedContent []byte, path []string) ([]byte, error) {
|
||||
return yaml_utils.TransformNode(changedContent, path, func(node *yaml.Node) (bool, error) {
|
||||
if node.Kind == yaml.MappingNode {
|
||||
nodeContentCopy := node.Content
|
||||
node.Kind = yaml.SequenceNode
|
||||
node.Value = ""
|
||||
node.Tag = "!!seq"
|
||||
node.Content = []*yaml.Node{{
|
||||
Kind: yaml.MappingNode,
|
||||
Content: nodeContentCopy,
|
||||
}}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
return false, nil
|
||||
})
|
||||
}
|
||||
|
||||
func changeCommitPrefixesMap(changedContent []byte) ([]byte, error) {
|
||||
return yaml_utils.TransformNode(changedContent, []string{"git", "commitPrefixes"}, func(prefixesNode *yaml.Node) (bool, error) {
|
||||
if prefixesNode.Kind == yaml.MappingNode {
|
||||
for _, contentNode := range prefixesNode.Content {
|
||||
if contentNode.Kind == yaml.MappingNode {
|
||||
nodeContentCopy := contentNode.Content
|
||||
contentNode.Kind = yaml.SequenceNode
|
||||
contentNode.Value = ""
|
||||
contentNode.Tag = "!!seq"
|
||||
contentNode.Content = []*yaml.Node{{
|
||||
Kind: yaml.MappingNode,
|
||||
Content: nodeContentCopy,
|
||||
}}
|
||||
|
||||
}
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
return false, nil
|
||||
})
|
||||
}
|
||||
|
||||
func (c *AppConfig) GetDebug() bool {
|
||||
return c.debug
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
func TestCommitPrefixMigrations(t *testing.T) {
|
||||
scenarios := []struct {
|
||||
name string
|
||||
input string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
"Empty String",
|
||||
"",
|
||||
"",
|
||||
}, {
|
||||
"Single CommitPrefix Rename",
|
||||
`
|
||||
git:
|
||||
commitPrefix:
|
||||
pattern: "^\\w+-\\w+.*"
|
||||
replace: '[JIRA $0] '`,
|
||||
`
|
||||
git:
|
||||
commitPrefix:
|
||||
- pattern: "^\\w+-\\w+.*"
|
||||
replace: '[JIRA $0] '`,
|
||||
}, {
|
||||
"Complicated CommitPrefixes Rename",
|
||||
`
|
||||
git:
|
||||
commitPrefixes:
|
||||
foo:
|
||||
pattern: "^\\w+-\\w+.*"
|
||||
replace: '[OTHER $0] '
|
||||
CrazyName!@#$^*&)_-)[[}{f{[]:
|
||||
pattern: "^foo.bar*"
|
||||
replace: '[FUN $0] '`,
|
||||
`
|
||||
git:
|
||||
commitPrefixes:
|
||||
foo:
|
||||
- pattern: "^\\w+-\\w+.*"
|
||||
replace: '[OTHER $0] '
|
||||
CrazyName!@#$^*&)_-)[[}{f{[]:
|
||||
- pattern: "^foo.bar*"
|
||||
replace: '[FUN $0] '`,
|
||||
}, {
|
||||
"Incomplete Configuration",
|
||||
"git:",
|
||||
"git:",
|
||||
},
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
t.Run(s.name, func(t *testing.T) {
|
||||
expectedConfig := GetDefaultConfig()
|
||||
err := yaml.Unmarshal([]byte(s.expected), expectedConfig)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
actual, err := computeMigratedConfig("path doesn't matter", []byte(s.input))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
actualConfig := GetDefaultConfig()
|
||||
err = yaml.Unmarshal(actual, actualConfig)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
assert.Equal(t, expectedConfig, actualConfig)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/jesseduffield/gocui"
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
|
||||
// NOTE: if you make changes to this table, be sure to update
|
||||
// docs/keybindings/Custom_Keybindings.md as well
|
||||
|
||||
var LabelByKey = map[gocui.Key]string{
|
||||
gocui.KeyF1: "<f1>",
|
||||
gocui.KeyF2: "<f2>",
|
||||
gocui.KeyF3: "<f3>",
|
||||
gocui.KeyF4: "<f4>",
|
||||
gocui.KeyF5: "<f5>",
|
||||
gocui.KeyF6: "<f6>",
|
||||
gocui.KeyF7: "<f7>",
|
||||
gocui.KeyF8: "<f8>",
|
||||
gocui.KeyF9: "<f9>",
|
||||
gocui.KeyF10: "<f10>",
|
||||
gocui.KeyF11: "<f11>",
|
||||
gocui.KeyF12: "<f12>",
|
||||
gocui.KeyInsert: "<insert>",
|
||||
gocui.KeyDelete: "<delete>",
|
||||
gocui.KeyHome: "<home>",
|
||||
gocui.KeyEnd: "<end>",
|
||||
gocui.KeyPgup: "<pgup>",
|
||||
gocui.KeyPgdn: "<pgdown>",
|
||||
gocui.KeyArrowUp: "<up>",
|
||||
gocui.KeyShiftArrowUp: "<s-up>",
|
||||
gocui.KeyArrowDown: "<down>",
|
||||
gocui.KeyShiftArrowDown: "<s-down>",
|
||||
gocui.KeyArrowLeft: "<left>",
|
||||
gocui.KeyArrowRight: "<right>",
|
||||
gocui.KeyTab: "<tab>", // <c-i>
|
||||
gocui.KeyBacktab: "<backtab>",
|
||||
gocui.KeyEnter: "<enter>", // <c-m>
|
||||
gocui.KeyAltEnter: "<a-enter>",
|
||||
gocui.KeyEsc: "<esc>", // <c-[>, <c-3>
|
||||
gocui.KeyBackspace: "<backspace>", // <c-h>
|
||||
gocui.KeyCtrlSpace: "<c-space>", // <c-~>, <c-2>
|
||||
gocui.KeyCtrlSlash: "<c-/>", // <c-_>
|
||||
gocui.KeySpace: "<space>",
|
||||
gocui.KeyCtrlA: "<c-a>",
|
||||
gocui.KeyCtrlB: "<c-b>",
|
||||
gocui.KeyCtrlC: "<c-c>",
|
||||
gocui.KeyCtrlD: "<c-d>",
|
||||
gocui.KeyCtrlE: "<c-e>",
|
||||
gocui.KeyCtrlF: "<c-f>",
|
||||
gocui.KeyCtrlG: "<c-g>",
|
||||
gocui.KeyCtrlJ: "<c-j>",
|
||||
gocui.KeyCtrlK: "<c-k>",
|
||||
gocui.KeyCtrlL: "<c-l>",
|
||||
gocui.KeyCtrlN: "<c-n>",
|
||||
gocui.KeyCtrlO: "<c-o>",
|
||||
gocui.KeyCtrlP: "<c-p>",
|
||||
gocui.KeyCtrlQ: "<c-q>",
|
||||
gocui.KeyCtrlR: "<c-r>",
|
||||
gocui.KeyCtrlS: "<c-s>",
|
||||
gocui.KeyCtrlT: "<c-t>",
|
||||
gocui.KeyCtrlU: "<c-u>",
|
||||
gocui.KeyCtrlV: "<c-v>",
|
||||
gocui.KeyCtrlW: "<c-w>",
|
||||
gocui.KeyCtrlX: "<c-x>",
|
||||
gocui.KeyCtrlY: "<c-y>",
|
||||
gocui.KeyCtrlZ: "<c-z>",
|
||||
gocui.KeyCtrl4: "<c-4>", // <c-\>
|
||||
gocui.KeyCtrl5: "<c-5>", // <c-]>
|
||||
gocui.KeyCtrl6: "<c-6>",
|
||||
gocui.KeyCtrl8: "<c-8>",
|
||||
gocui.MouseWheelUp: "mouse wheel up",
|
||||
gocui.MouseWheelDown: "mouse wheel down",
|
||||
}
|
||||
|
||||
var KeyByLabel = lo.Invert(LabelByKey)
|
||||
|
||||
func isValidKeybindingKey(key string) bool {
|
||||
runeCount := utf8.RuneCountInString(key)
|
||||
if key == "<disabled>" {
|
||||
return true
|
||||
}
|
||||
|
||||
if runeCount > 1 {
|
||||
_, ok := KeyByLabel[strings.ToLower(key)]
|
||||
return ok
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -64,6 +64,9 @@ type GuiConfig struct {
|
||||
ScrollOffMargin int `yaml:"scrollOffMargin"`
|
||||
// One of: 'margin' (default) | 'jump'
|
||||
ScrollOffBehavior string `yaml:"scrollOffBehavior"`
|
||||
// The number of spaces per tab; used for everything that's shown in the main view, but probably mostly relevant for diffs.
|
||||
// Note that when using a pager, the pager has its own tab width setting, so you need to pass it separately in the pager command.
|
||||
TabWidth int `yaml:"tabWidth" jsonschema:"minimum=1"`
|
||||
// If true, capture mouse events.
|
||||
// When mouse events are captured, it's a little harder to select text: e.g. requiring you to hold the option key when on macOS.
|
||||
MouseEvents bool `yaml:"mouseEvents"`
|
||||
@@ -114,7 +117,7 @@ type GuiConfig struct {
|
||||
// If true, show the '5 of 20' footer at the bottom of list views
|
||||
ShowListFooter bool `yaml:"showListFooter"`
|
||||
// If true, display the files in the file views as a tree. If false, display the files as a flat list.
|
||||
// This can be toggled from within Lazygit with the '~' key, but that will not change the default.
|
||||
// This can be toggled from within Lazygit with the '`' key, but that will not change the default.
|
||||
ShowFileTree bool `yaml:"showFileTree"`
|
||||
// If true, show the number of lines changed per file in the Files view
|
||||
ShowNumstatInFilesView bool `yaml:"showNumstatInFilesView"`
|
||||
@@ -256,9 +259,9 @@ type GitConfig struct {
|
||||
// If true, do not allow force pushes
|
||||
DisableForcePushing bool `yaml:"disableForcePushing"`
|
||||
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix
|
||||
CommitPrefix *CommitPrefixConfig `yaml:"commitPrefix"`
|
||||
CommitPrefix []CommitPrefixConfig `yaml:"commitPrefix"`
|
||||
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix
|
||||
CommitPrefixes map[string]CommitPrefixConfig `yaml:"commitPrefixes"`
|
||||
CommitPrefixes map[string][]CommitPrefixConfig `yaml:"commitPrefixes"`
|
||||
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-branch-name-prefix
|
||||
BranchPrefix string `yaml:"branchPrefix"`
|
||||
// If true, parse emoji strings in commit messages e.g. render :rocket: as 🚀
|
||||
@@ -611,8 +614,8 @@ type CustomCommandAfterHook struct {
|
||||
type CustomCommand struct {
|
||||
// The key to trigger the command. Use a single letter or one of the values from https://github.com/jesseduffield/lazygit/blob/master/docs/keybindings/Custom_Keybindings.md
|
||||
Key string `yaml:"key"`
|
||||
// The context in which to listen for the key
|
||||
Context string `yaml:"context" jsonschema:"enum=status,enum=files,enum=worktrees,enum=localBranches,enum=remotes,enum=remoteBranches,enum=tags,enum=commits,enum=reflogCommits,enum=subCommits,enum=commitFiles,enum=stash,enum=global"`
|
||||
// The context in which to listen for the key. Valid values are: status, files, worktrees, localBranches, remotes, remoteBranches, tags, commits, reflogCommits, subCommits, commitFiles, stash, and global. Multiple contexts separated by comma are allowed; most useful for "commits, subCommits" or "files, commitFiles".
|
||||
Context string `yaml:"context" jsonschema:"example=status,example=files,example=worktrees,example=localBranches,example=remotes,example=remoteBranches,example=tags,example=commits,example=reflogCommits,example=subCommits,example=commitFiles,example=stash,example=global"`
|
||||
// The command to run (using Go template syntax for placeholder values)
|
||||
Command string `yaml:"command" jsonschema:"example=git fetch {{.Form.Remote}} {{.Form.Branch}} && git checkout FETCH_HEAD"`
|
||||
// If true, run the command in a subprocess (e.g. if the command requires user input)
|
||||
@@ -693,6 +696,7 @@ func GetDefaultConfig() *UserConfig {
|
||||
ScrollPastBottom: true,
|
||||
ScrollOffMargin: 2,
|
||||
ScrollOffBehavior: "margin",
|
||||
TabWidth: 4,
|
||||
MouseEvents: true,
|
||||
SkipDiscardChangeWarning: false,
|
||||
SkipStashWarning: false,
|
||||
@@ -784,7 +788,7 @@ func GetDefaultConfig() *UserConfig {
|
||||
BranchLogCmd: "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --",
|
||||
AllBranchesLogCmd: "git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium",
|
||||
DisableForcePushing: false,
|
||||
CommitPrefixes: map[string]CommitPrefixConfig(nil),
|
||||
CommitPrefixes: map[string][]CommitPrefixConfig(nil),
|
||||
BranchPrefix: "",
|
||||
ParseEmoji: false,
|
||||
TruncateCopiedCommitHashesTo: 12,
|
||||
|
||||
@@ -2,8 +2,12 @@ package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/constants"
|
||||
)
|
||||
|
||||
func (config *UserConfig) Validate() error {
|
||||
@@ -15,6 +19,12 @@ func (config *UserConfig) Validate() error {
|
||||
[]string{"none", "onlyArrow", "arrowAndNumber"}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := validateKeybindings(config.Keybinding); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := validateCustomCommands(config.CustomCommands); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -25,3 +35,67 @@ func validateEnum(name string, value string, allowedValues []string) error {
|
||||
allowedValuesStr := strings.Join(allowedValues, ", ")
|
||||
return fmt.Errorf("Unexpected value '%s' for '%s'. Allowed values: %s", value, name, allowedValuesStr)
|
||||
}
|
||||
|
||||
func validateKeybindingsRecurse(path string, node any) error {
|
||||
value := reflect.ValueOf(node)
|
||||
if value.Kind() == reflect.Struct {
|
||||
for _, field := range reflect.VisibleFields(reflect.TypeOf(node)) {
|
||||
var newPath string
|
||||
if len(path) == 0 {
|
||||
newPath = field.Name
|
||||
} else {
|
||||
newPath = fmt.Sprintf("%s.%s", path, field.Name)
|
||||
}
|
||||
if err := validateKeybindingsRecurse(newPath,
|
||||
value.FieldByName(field.Name).Interface()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else if value.Kind() == reflect.Slice {
|
||||
for i := 0; i < value.Len(); i++ {
|
||||
if err := validateKeybindingsRecurse(
|
||||
fmt.Sprintf("%s[%d]", path, i), value.Index(i).Interface()); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
} else if value.Kind() == reflect.String {
|
||||
key := node.(string)
|
||||
if !isValidKeybindingKey(key) {
|
||||
return fmt.Errorf("Unrecognized key '%s' for keybinding '%s'. For permitted values see %s",
|
||||
key, path, constants.Links.Docs.CustomKeybindings)
|
||||
}
|
||||
} else {
|
||||
log.Fatalf("Unexpected type for property '%s': %s", path, value.Kind())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateKeybindings(keybindingConfig KeybindingConfig) error {
|
||||
if err := validateKeybindingsRecurse("", keybindingConfig); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(keybindingConfig.Universal.JumpToBlock) != 5 {
|
||||
return fmt.Errorf("keybinding.universal.jumpToBlock must have 5 elements; found %d.",
|
||||
len(keybindingConfig.Universal.JumpToBlock))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateCustomCommandKey(key string) error {
|
||||
if !isValidKeybindingKey(key) {
|
||||
return fmt.Errorf("Unrecognized key '%s' for custom command. For permitted values see %s",
|
||||
key, constants.Links.Docs.CustomKeybindings)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateCustomCommands(customCommands []CustomCommand) error {
|
||||
for _, customCommand := range customCommands {
|
||||
if err := validateCustomCommandKey(customCommand.Key); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -29,6 +30,50 @@ func TestUserConfigValidate_enums(t *testing.T) {
|
||||
{value: "invalid_value", valid: false},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Keybindings",
|
||||
setup: func(config *UserConfig, value string) {
|
||||
config.Keybinding.Universal.Quit = value
|
||||
},
|
||||
testCases: []testCase{
|
||||
{value: "", valid: true},
|
||||
{value: "<disabled>", valid: true},
|
||||
{value: "q", valid: true},
|
||||
{value: "<c-c>", valid: true},
|
||||
{value: "invalid_value", valid: false},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "JumpToBlock keybinding",
|
||||
setup: func(config *UserConfig, value string) {
|
||||
config.Keybinding.Universal.JumpToBlock = strings.Split(value, ",")
|
||||
},
|
||||
testCases: []testCase{
|
||||
{value: "", valid: false},
|
||||
{value: "1,2,3", valid: false},
|
||||
{value: "1,2,3,4,5", valid: true},
|
||||
{value: "1,2,3,4,invalid", valid: false},
|
||||
{value: "1,2,3,4,5,6", valid: false},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Custom command keybinding",
|
||||
setup: func(config *UserConfig, value string) {
|
||||
config.CustomCommands = []CustomCommand{
|
||||
{
|
||||
Key: value,
|
||||
Command: "echo 'hello'",
|
||||
},
|
||||
}
|
||||
},
|
||||
testCases: []testCase{
|
||||
{value: "", valid: true},
|
||||
{value: "<disabled>", valid: true},
|
||||
{value: "q", valid: true},
|
||||
{value: "<c-c>", valid: true},
|
||||
{value: "invalid_value", valid: false},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
|
||||
@@ -76,9 +76,9 @@ func (self *BackgroundRoutineMgr) startBackgroundFetch() {
|
||||
self.gui.waitForIntro.Wait()
|
||||
|
||||
fetch := func() error {
|
||||
err := self.backgroundFetch()
|
||||
self.gui.c.Render()
|
||||
return err
|
||||
return self.gui.helpers.AppStatus.WithWaitingStatusImpl(self.gui.Tr.FetchingStatus, func(gocui.Task) error {
|
||||
return self.backgroundFetch()
|
||||
}, nil)
|
||||
}
|
||||
|
||||
// We want an immediate fetch at startup, and since goEvery starts by
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package context
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@@ -8,8 +10,11 @@ import (
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/keybindings"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||
"github.com/spf13/afero"
|
||||
)
|
||||
|
||||
const PreservedCommitMessageFileName = "LAZYGIT_PENDING_COMMIT"
|
||||
|
||||
type CommitMessageContext struct {
|
||||
c *ContextCommon
|
||||
types.Context
|
||||
@@ -33,8 +38,6 @@ type CommitMessageViewModel struct {
|
||||
// we remember the initial message so that we can tell whether we should preserve
|
||||
// the message; if it's still identical to the initial message, we don't
|
||||
initialMessage string
|
||||
// the full preserved message (combined summary and description)
|
||||
preservedMessage string
|
||||
// invoked when pressing enter in the commit message panel
|
||||
onConfirm func(string, string) error
|
||||
// invoked when pressing the switch-to-editor key binding
|
||||
@@ -75,16 +78,51 @@ func (self *CommitMessageContext) GetSelectedIndex() int {
|
||||
return self.viewModel.selectedindex
|
||||
}
|
||||
|
||||
func (self *CommitMessageContext) GetPreservedMessagePath() string {
|
||||
return filepath.Join(self.c.Git().RepoPaths.WorktreeGitDirPath(), PreservedCommitMessageFileName)
|
||||
}
|
||||
|
||||
func (self *CommitMessageContext) GetPreserveMessage() bool {
|
||||
return self.viewModel.preserveMessage
|
||||
}
|
||||
|
||||
func (self *CommitMessageContext) GetPreservedMessage() string {
|
||||
return self.viewModel.preservedMessage
|
||||
func (self *CommitMessageContext) getPreservedMessage() (string, error) {
|
||||
buf, err := afero.ReadFile(self.c.Fs, self.GetPreservedMessagePath())
|
||||
if os.IsNotExist(err) {
|
||||
return "", nil
|
||||
}
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(buf), nil
|
||||
}
|
||||
|
||||
func (self *CommitMessageContext) SetPreservedMessage(message string) {
|
||||
self.viewModel.preservedMessage = message
|
||||
func (self *CommitMessageContext) GetPreservedMessageAndLogError() string {
|
||||
msg, err := self.getPreservedMessage()
|
||||
if err != nil {
|
||||
self.c.Log.Errorf("error when retrieving persisted commit message: %v", err)
|
||||
}
|
||||
return msg
|
||||
}
|
||||
|
||||
func (self *CommitMessageContext) setPreservedMessage(message string) error {
|
||||
preservedFilePath := self.GetPreservedMessagePath()
|
||||
|
||||
if len(message) == 0 {
|
||||
err := self.c.Fs.Remove(preservedFilePath)
|
||||
if os.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
return afero.WriteFile(self.c.Fs, preservedFilePath, []byte(message), 0o644)
|
||||
}
|
||||
|
||||
func (self *CommitMessageContext) SetPreservedMessageAndLogError(message string) {
|
||||
if err := self.setPreservedMessage(message); err != nil {
|
||||
self.c.Log.Errorf("error when persisting commit message: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func (self *CommitMessageContext) GetInitialMessage() string {
|
||||
|
||||
@@ -3,6 +3,7 @@ package controllers
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||
@@ -121,52 +122,93 @@ func (self *BasicCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
|
||||
return bindings
|
||||
}
|
||||
|
||||
func (self *BasicCommitsController) getCommitMessageBody(hash string) string {
|
||||
commitMessageBody, err := self.c.Git().Commit.GetCommitMessage(hash)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
_, body := self.c.Helpers().Commits.SplitCommitMessageAndDescription(commitMessageBody)
|
||||
return body
|
||||
}
|
||||
|
||||
func (self *BasicCommitsController) copyCommitAttribute(commit *models.Commit) error {
|
||||
return self.c.Menu(types.CreateMenuOptions{
|
||||
Title: self.c.Tr.Actions.CopyCommitAttributeToClipboard,
|
||||
Items: []*types.MenuItem{
|
||||
{
|
||||
Label: self.c.Tr.CommitHash,
|
||||
OnPress: func() error {
|
||||
return self.copyCommitHashToClipboard(commit)
|
||||
},
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.CommitSubject,
|
||||
OnPress: func() error {
|
||||
return self.copyCommitSubjectToClipboard(commit)
|
||||
},
|
||||
Key: 's',
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.CommitMessage,
|
||||
OnPress: func() error {
|
||||
return self.copyCommitMessageToClipboard(commit)
|
||||
},
|
||||
Key: 'm',
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.CommitURL,
|
||||
OnPress: func() error {
|
||||
return self.copyCommitURLToClipboard(commit)
|
||||
},
|
||||
Key: 'u',
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.CommitDiff,
|
||||
OnPress: func() error {
|
||||
return self.copyCommitDiffToClipboard(commit)
|
||||
},
|
||||
Key: 'd',
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.CommitAuthor,
|
||||
OnPress: func() error {
|
||||
return self.copyAuthorToClipboard(commit)
|
||||
},
|
||||
Key: 'a',
|
||||
commitMessageBody := self.getCommitMessageBody(commit.Hash)
|
||||
var commitMessageBodyDisabled *types.DisabledReason
|
||||
if commitMessageBody == "" {
|
||||
commitMessageBodyDisabled = &types.DisabledReason{
|
||||
Text: self.c.Tr.CommitHasNoMessageBody,
|
||||
}
|
||||
}
|
||||
|
||||
items := []*types.MenuItem{
|
||||
{
|
||||
Label: self.c.Tr.CommitHash,
|
||||
OnPress: func() error {
|
||||
return self.copyCommitHashToClipboard(commit)
|
||||
},
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.CommitSubject,
|
||||
OnPress: func() error {
|
||||
return self.copyCommitSubjectToClipboard(commit)
|
||||
},
|
||||
Key: 's',
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.CommitMessage,
|
||||
OnPress: func() error {
|
||||
return self.copyCommitMessageToClipboard(commit)
|
||||
},
|
||||
Key: 'm',
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.CommitMessageBody,
|
||||
DisabledReason: commitMessageBodyDisabled,
|
||||
OnPress: func() error {
|
||||
return self.copyCommitMessageBodyToClipboard(commitMessageBody)
|
||||
},
|
||||
Key: 'b',
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.CommitURL,
|
||||
OnPress: func() error {
|
||||
return self.copyCommitURLToClipboard(commit)
|
||||
},
|
||||
Key: 'u',
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.CommitDiff,
|
||||
OnPress: func() error {
|
||||
return self.copyCommitDiffToClipboard(commit)
|
||||
},
|
||||
Key: 'd',
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.CommitAuthor,
|
||||
OnPress: func() error {
|
||||
return self.copyAuthorToClipboard(commit)
|
||||
},
|
||||
Key: 'a',
|
||||
},
|
||||
}
|
||||
|
||||
commitTagsItem := types.MenuItem{
|
||||
Label: self.c.Tr.CommitTags,
|
||||
OnPress: func() error {
|
||||
return self.copyCommitTagsToClipboard(commit)
|
||||
},
|
||||
Key: 't',
|
||||
}
|
||||
|
||||
if len(commit.Tags) == 0 {
|
||||
commitTagsItem.DisabledReason = &types.DisabledReason{Text: self.c.Tr.CommitHasNoTags}
|
||||
}
|
||||
|
||||
items = append(items, &commitTagsItem)
|
||||
|
||||
return self.c.Menu(types.CreateMenuOptions{
|
||||
Title: self.c.Tr.Actions.CopyCommitAttributeToClipboard,
|
||||
Items: items,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -242,6 +284,16 @@ func (self *BasicCommitsController) copyCommitMessageToClipboard(commit *models.
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *BasicCommitsController) copyCommitMessageBodyToClipboard(commitMessageBody string) error {
|
||||
self.c.LogAction(self.c.Tr.Actions.CopyCommitMessageBodyToClipboard)
|
||||
if err := self.c.OS().CopyToClipboard(commitMessageBody); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
self.c.Toast(self.c.Tr.CommitMessageBodyCopiedToClipboard)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *BasicCommitsController) copyCommitSubjectToClipboard(commit *models.Commit) error {
|
||||
message, err := self.c.Git().Commit.GetCommitSubject(commit.Hash)
|
||||
if err != nil {
|
||||
@@ -257,6 +309,18 @@ func (self *BasicCommitsController) copyCommitSubjectToClipboard(commit *models.
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *BasicCommitsController) copyCommitTagsToClipboard(commit *models.Commit) error {
|
||||
message := strings.Join(commit.Tags, "\n")
|
||||
|
||||
self.c.LogAction(self.c.Tr.Actions.CopyCommitTagsToClipboard)
|
||||
if err := self.c.OS().CopyToClipboard(message); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
self.c.Toast(self.c.Tr.CommitTagsCopiedToClipboard)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *BasicCommitsController) openInBrowser(commit *models.Commit) error {
|
||||
url, err := self.c.Helpers().Host.GetCommitURL(commit.Hash)
|
||||
if err != nil {
|
||||
|
||||
@@ -28,7 +28,7 @@ func (self *CommitDescriptionController) GetKeybindings(opts types.KeybindingsOp
|
||||
bindings := []*types.Binding{
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
|
||||
Handler: self.switchToCommitMessage,
|
||||
Handler: self.handleTogglePanel,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Universal.Return),
|
||||
@@ -75,6 +75,32 @@ func (self *CommitDescriptionController) switchToCommitMessage() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CommitDescriptionController) handleTogglePanel() error {
|
||||
// The default keybinding for this action is "<tab>", which means that we
|
||||
// also get here when pasting multi-line text that contains tabs. In that
|
||||
// case we don't want to toggle the panel, but insert the tab as a character
|
||||
// (somehow, see below).
|
||||
//
|
||||
// Only do this if the TogglePanel command is actually mapped to "<tab>"
|
||||
// (the default). If it's not, we can only hope that it's mapped to some
|
||||
// ctrl key or fn key, which is unlikely to occur in pasted text. And if
|
||||
// they mapped some *other* command to "<tab>", then we're totally out of
|
||||
// luck.
|
||||
if self.c.GocuiGui().IsPasting && self.c.UserConfig().Keybinding.Universal.TogglePanel == "<tab>" {
|
||||
// Handling tabs in pasted commit messages is not optimal, but hopefully
|
||||
// good enough for now. We simply insert 4 spaces without worrying about
|
||||
// column alignment. This works well enough for leading indentation,
|
||||
// which is common in pasted code snippets.
|
||||
view := self.Context().GetView()
|
||||
for range 4 {
|
||||
view.Editor.Edit(view, gocui.KeySpace, ' ', 0)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
return self.switchToCommitMessage()
|
||||
}
|
||||
|
||||
func (self *CommitDescriptionController) close() error {
|
||||
self.c.Helpers().Commits.CloseCommitMessagePanel()
|
||||
return nil
|
||||
|
||||
@@ -48,7 +48,7 @@ func (self *CommitMessageController) GetKeybindings(opts types.KeybindingsOpts)
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Universal.TogglePanel),
|
||||
Handler: self.switchToCommitDescription,
|
||||
Handler: self.handleTogglePanel,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.CommitMessage.CommitMenu),
|
||||
@@ -105,6 +105,32 @@ func (self *CommitMessageController) switchToCommitDescription() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CommitMessageController) handleTogglePanel() error {
|
||||
// The default keybinding for this action is "<tab>", which means that we
|
||||
// also get here when pasting multi-line text that contains tabs. In that
|
||||
// case we don't want to toggle the panel, but insert the tab as a character
|
||||
// (somehow, see below).
|
||||
//
|
||||
// Only do this if the TogglePanel command is actually mapped to "<tab>"
|
||||
// (the default). If it's not, we can only hope that it's mapped to some
|
||||
// ctrl key or fn key, which is unlikely to occur in pasted text. And if
|
||||
// they mapped some *other* command to "<tab>", then we're totally out of
|
||||
// luck.
|
||||
if self.c.GocuiGui().IsPasting && self.c.UserConfig().Keybinding.Universal.TogglePanel == "<tab>" {
|
||||
// It is unlikely that a pasted commit message contains a tab in the
|
||||
// subject line, so it shouldn't matter too much how we handle it.
|
||||
// Simply insert 4 spaces instead; all that matters is that we don't
|
||||
// switch to the description panel.
|
||||
view := self.context().GetView()
|
||||
for range 4 {
|
||||
view.Editor.Edit(view, gocui.KeySpace, ' ', 0)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
return self.switchToCommitDescription()
|
||||
}
|
||||
|
||||
func (self *CommitMessageController) handleCommitIndexChange(value int) error {
|
||||
currentIndex := self.context().GetSelectedIndex()
|
||||
newIndex := currentIndex + value
|
||||
@@ -140,6 +166,20 @@ func (self *CommitMessageController) setCommitMessageAtIndex(index int) (bool, e
|
||||
}
|
||||
|
||||
func (self *CommitMessageController) confirm() error {
|
||||
// The default keybinding for this action is "<enter>", which means that we
|
||||
// also get here when pasting multi-line text that contains newlines. In
|
||||
// that case we don't want to confirm the commit, but switch to the
|
||||
// description panel instead so that the rest of the pasted text goes there.
|
||||
//
|
||||
// Only do this if the SubmitEditorText command is actually mapped to
|
||||
// "<enter>" (the default). If it's not, we can only hope that it's mapped
|
||||
// to some ctrl key or fn key, which is unlikely to occur in pasted text.
|
||||
// And if they mapped some *other* command to "<enter>", then we're totally
|
||||
// out of luck.
|
||||
if self.c.GocuiGui().IsPasting && self.c.UserConfig().Keybinding.Universal.SubmitEditorText == "<enter>" {
|
||||
return self.switchToCommitDescription()
|
||||
}
|
||||
|
||||
return self.c.Helpers().Commits.HandleCommitConfirm()
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,12 @@ func NewCommitFilesController(
|
||||
|
||||
func (self *CommitFilesController) GetKeybindings(opts types.KeybindingsOpts) []*types.Binding {
|
||||
bindings := []*types.Binding{
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Files.CopyFileInfoToClipboard),
|
||||
Handler: self.openCopyMenu,
|
||||
Description: self.c.Tr.CopyToClipboardMenu,
|
||||
OpensMenu: true,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.CommitFiles.CheckoutCommitFile),
|
||||
Handler: self.withItem(self.checkout),
|
||||
@@ -181,6 +187,77 @@ func (self *CommitFilesController) onClickMain(opts gocui.ViewMouseBindingOpts)
|
||||
return self.enterCommitFile(node, types.OnFocusOpts{ClickedWindowName: "main", ClickedViewLineIdx: opts.Y})
|
||||
}
|
||||
|
||||
func (self *CommitFilesController) copyDiffToClipboard(path string, toastMessage string) error {
|
||||
from, to := self.context().GetFromAndToForDiff()
|
||||
from, reverse := self.c.Modes().Diffing.GetFromAndReverseArgsForDiff(from)
|
||||
|
||||
cmdObj := self.c.Git().WorkingTree.ShowFileDiffCmdObj(from, to, reverse, path, true)
|
||||
diff, err := cmdObj.RunWithOutput()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := self.c.OS().CopyToClipboard(diff); err != nil {
|
||||
return err
|
||||
}
|
||||
self.c.Toast(toastMessage)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CommitFilesController) openCopyMenu() error {
|
||||
node := self.context().GetSelected()
|
||||
|
||||
copyNameItem := &types.MenuItem{
|
||||
Label: self.c.Tr.CopyFileName,
|
||||
OnPress: func() error {
|
||||
if err := self.c.OS().CopyToClipboard(node.Name()); err != nil {
|
||||
return err
|
||||
}
|
||||
self.c.Toast(self.c.Tr.FileNameCopiedToast)
|
||||
return nil
|
||||
},
|
||||
DisabledReason: self.require(self.singleItemSelected())(),
|
||||
Key: 'n',
|
||||
}
|
||||
copyPathItem := &types.MenuItem{
|
||||
Label: self.c.Tr.CopyFilePath,
|
||||
OnPress: func() error {
|
||||
if err := self.c.OS().CopyToClipboard(node.Path); err != nil {
|
||||
return err
|
||||
}
|
||||
self.c.Toast(self.c.Tr.FilePathCopiedToast)
|
||||
return nil
|
||||
},
|
||||
DisabledReason: self.require(self.singleItemSelected())(),
|
||||
Key: 'p',
|
||||
}
|
||||
copyFileDiffItem := &types.MenuItem{
|
||||
Label: self.c.Tr.CopySelectedDiff,
|
||||
OnPress: func() error {
|
||||
return self.copyDiffToClipboard(node.GetPath(), self.c.Tr.FileDiffCopiedToast)
|
||||
},
|
||||
DisabledReason: self.require(self.singleItemSelected())(),
|
||||
Key: 's',
|
||||
}
|
||||
copyAllDiff := &types.MenuItem{
|
||||
Label: self.c.Tr.CopyAllFilesDiff,
|
||||
OnPress: func() error {
|
||||
return self.copyDiffToClipboard(".", self.c.Tr.AllFilesDiffCopiedToast)
|
||||
},
|
||||
DisabledReason: self.require(self.itemsSelected())(),
|
||||
Key: 'a',
|
||||
}
|
||||
|
||||
return self.c.Menu(types.CreateMenuOptions{
|
||||
Title: self.c.Tr.CopyToClipboardMenu,
|
||||
Items: []*types.MenuItem{
|
||||
copyNameItem,
|
||||
copyPathItem,
|
||||
copyFileDiffItem,
|
||||
copyAllDiff,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func (self *CommitFilesController) checkout(node *filetree.CommitFileNode) error {
|
||||
self.c.LogAction(self.c.Tr.Actions.CheckoutFile)
|
||||
if err := self.c.Git().WorkingTree.CheckoutFile(self.context().GetRef().RefName(), node.GetPath()); err != nil {
|
||||
|
||||
@@ -2,6 +2,7 @@ package controllers
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/jesseduffield/gocui"
|
||||
@@ -690,24 +691,70 @@ func (self *FilesController) refresh() error {
|
||||
}
|
||||
|
||||
func (self *FilesController) handleAmendCommitPress() error {
|
||||
self.c.Confirm(types.ConfirmOpts{
|
||||
Title: self.c.Tr.AmendLastCommitTitle,
|
||||
Prompt: self.c.Tr.SureToAmend,
|
||||
HandleConfirm: func() error {
|
||||
return self.c.Helpers().WorkingTree.WithEnsureCommittableFiles(func() error {
|
||||
if len(self.c.Model().Commits) == 0 {
|
||||
return errors.New(self.c.Tr.NoCommitToAmend)
|
||||
}
|
||||
doAmend := func() error {
|
||||
return self.c.Helpers().WorkingTree.WithEnsureCommittableFiles(func() error {
|
||||
if len(self.c.Model().Commits) == 0 {
|
||||
return errors.New(self.c.Tr.NoCommitToAmend)
|
||||
}
|
||||
|
||||
return self.c.Helpers().AmendHelper.AmendHead()
|
||||
})
|
||||
},
|
||||
})
|
||||
return self.c.Helpers().AmendHelper.AmendHead()
|
||||
})
|
||||
}
|
||||
|
||||
if self.isResolvingConflicts() {
|
||||
return self.c.Menu(types.CreateMenuOptions{
|
||||
Title: self.c.Tr.AmendCommitTitle,
|
||||
Prompt: self.c.Tr.AmendCommitWithConflictsMenuPrompt,
|
||||
HideCancel: true, // We want the cancel item first, so we add one manually
|
||||
Items: []*types.MenuItem{
|
||||
{
|
||||
Label: self.c.Tr.Cancel,
|
||||
OnPress: func() error {
|
||||
return nil
|
||||
},
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.AmendCommitWithConflictsContinue,
|
||||
OnPress: func() error {
|
||||
return self.c.Helpers().MergeAndRebase.ContinueRebase()
|
||||
},
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.AmendCommitWithConflictsAmend,
|
||||
OnPress: func() error {
|
||||
return doAmend()
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
} else {
|
||||
self.c.Confirm(types.ConfirmOpts{
|
||||
Title: self.c.Tr.AmendLastCommitTitle,
|
||||
Prompt: self.c.Tr.SureToAmend,
|
||||
HandleConfirm: func() error {
|
||||
return doAmend()
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *FilesController) isResolvingConflicts() bool {
|
||||
commits := self.c.Model().Commits
|
||||
for _, c := range commits {
|
||||
if c.Status != models.StatusRebasing {
|
||||
break
|
||||
}
|
||||
if c.Action == models.ActionConflict {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (self *FilesController) handleStatusFilterPressed() error {
|
||||
currentFilter := self.context().GetFilter()
|
||||
return self.c.Menu(types.CreateMenuOptions{
|
||||
Title: self.c.Tr.FilteringMenuTitle,
|
||||
Items: []*types.MenuItem{
|
||||
@@ -716,37 +763,79 @@ func (self *FilesController) handleStatusFilterPressed() error {
|
||||
OnPress: func() error {
|
||||
return self.setStatusFiltering(filetree.DisplayStaged)
|
||||
},
|
||||
Key: 's',
|
||||
Key: 's',
|
||||
Widget: types.MakeMenuRadioButton(currentFilter == filetree.DisplayStaged),
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.FilterUnstagedFiles,
|
||||
OnPress: func() error {
|
||||
return self.setStatusFiltering(filetree.DisplayUnstaged)
|
||||
},
|
||||
Key: 'u',
|
||||
Key: 'u',
|
||||
Widget: types.MakeMenuRadioButton(currentFilter == filetree.DisplayUnstaged),
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.FilterTrackedFiles,
|
||||
OnPress: func() error {
|
||||
return self.setStatusFiltering(filetree.DisplayTracked)
|
||||
},
|
||||
Key: 't',
|
||||
Key: 't',
|
||||
Widget: types.MakeMenuRadioButton(currentFilter == filetree.DisplayTracked),
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.ResetFilter,
|
||||
Label: self.c.Tr.FilterUntrackedFiles,
|
||||
OnPress: func() error {
|
||||
return self.setStatusFiltering(filetree.DisplayUntracked)
|
||||
},
|
||||
Key: 'T',
|
||||
Widget: types.MakeMenuRadioButton(currentFilter == filetree.DisplayUntracked),
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.NoFilter,
|
||||
OnPress: func() error {
|
||||
return self.setStatusFiltering(filetree.DisplayAll)
|
||||
},
|
||||
Key: 'r',
|
||||
Key: 'r',
|
||||
Widget: types.MakeMenuRadioButton(currentFilter == filetree.DisplayAll),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func (self *FilesController) filteringLabel(filter filetree.FileTreeDisplayFilter) string {
|
||||
switch filter {
|
||||
case filetree.DisplayAll:
|
||||
return ""
|
||||
case filetree.DisplayStaged:
|
||||
return self.c.Tr.FilterLabelStagedFiles
|
||||
case filetree.DisplayUnstaged:
|
||||
return self.c.Tr.FilterLabelUnstagedFiles
|
||||
case filetree.DisplayTracked:
|
||||
return self.c.Tr.FilterLabelTrackedFiles
|
||||
case filetree.DisplayUntracked:
|
||||
return self.c.Tr.FilterLabelUntrackedFiles
|
||||
case filetree.DisplayConflicted:
|
||||
return self.c.Tr.FilterLabelConflictingFiles
|
||||
}
|
||||
|
||||
panic(fmt.Sprintf("Unexpected files display filter: %d", filter))
|
||||
}
|
||||
|
||||
func (self *FilesController) setStatusFiltering(filter filetree.FileTreeDisplayFilter) error {
|
||||
previousFilter := self.context().GetFilter()
|
||||
|
||||
self.context().FileTreeViewModel.SetStatusFilter(filter)
|
||||
self.c.PostRefreshUpdate(self.context())
|
||||
return nil
|
||||
self.c.Contexts().Files.GetView().Subtitle = self.filteringLabel(filter)
|
||||
|
||||
// Whenever we switch between untracked and other filters, we need to refresh the files view
|
||||
// because the untracked files filter applies when running `git status`.
|
||||
if previousFilter != filter && (previousFilter == filetree.DisplayUntracked || filter == filetree.DisplayUntracked) {
|
||||
return self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.FILES}, Mode: types.ASYNC})
|
||||
} else {
|
||||
self.c.PostRefreshUpdate(self.context())
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func (self *FilesController) edit(nodes []*filetree.FileNode) error {
|
||||
|
||||
@@ -60,9 +60,13 @@ func (self appStatusHelperTask) Continue() {
|
||||
// withWaitingStatus wraps a function and shows a waiting status while the function is still executing
|
||||
func (self *AppStatusHelper) WithWaitingStatus(message string, f func(gocui.Task) error) {
|
||||
self.c.OnWorker(func(task gocui.Task) error {
|
||||
return self.statusMgr().WithWaitingStatus(message, self.renderAppStatus, func(waitingStatusHandle *status.WaitingStatusHandle) error {
|
||||
return f(appStatusHelperTask{task, waitingStatusHandle})
|
||||
})
|
||||
return self.WithWaitingStatusImpl(message, f, task)
|
||||
})
|
||||
}
|
||||
|
||||
func (self *AppStatusHelper) WithWaitingStatusImpl(message string, f func(gocui.Task) error, task gocui.Task) error {
|
||||
return self.statusMgr().WithWaitingStatus(message, self.renderAppStatus, func(waitingStatusHandle *status.WaitingStatusHandle) error {
|
||||
return f(appStatusHelperTask{task, waitingStatusHandle})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ func (self *CommitsHelper) UpdateCommitPanelView(message string) {
|
||||
}
|
||||
|
||||
if self.c.Contexts().CommitMessage.GetPreserveMessage() {
|
||||
preservedMessage := self.c.Contexts().CommitMessage.GetPreservedMessage()
|
||||
preservedMessage := self.c.Contexts().CommitMessage.GetPreservedMessageAndLogError()
|
||||
self.SetMessageAndDescriptionInView(preservedMessage)
|
||||
return
|
||||
}
|
||||
@@ -156,7 +156,7 @@ func (self *CommitsHelper) OpenCommitMessagePanel(opts *OpenCommitMessagePanelOp
|
||||
func (self *CommitsHelper) OnCommitSuccess() {
|
||||
// if we have a preserved message we want to clear it on success
|
||||
if self.c.Contexts().CommitMessage.GetPreserveMessage() {
|
||||
self.c.Contexts().CommitMessage.SetPreservedMessage("")
|
||||
self.c.Contexts().CommitMessage.SetPreservedMessageAndLogError("")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ func (self *CommitsHelper) CloseCommitMessagePanel() {
|
||||
if self.c.Contexts().CommitMessage.GetPreserveMessage() {
|
||||
message := self.JoinCommitMessageAndUnwrappedDescription()
|
||||
if message != self.c.Contexts().CommitMessage.GetInitialMessage() {
|
||||
self.c.Contexts().CommitMessage.SetPreservedMessage(message)
|
||||
self.c.Contexts().CommitMessage.SetPreservedMessageAndLogError(message)
|
||||
}
|
||||
} else {
|
||||
self.SetMessageAndDescriptionInView("")
|
||||
|
||||
@@ -56,8 +56,8 @@ func (self *ConfirmationHelper) DeactivateConfirmationPrompt() {
|
||||
self.clearConfirmationViewKeyBindings()
|
||||
}
|
||||
|
||||
func getMessageHeight(wrap bool, message string, width int) int {
|
||||
wrappedLines, _, _ := utils.WrapViewLinesToWidth(wrap, message, width)
|
||||
func getMessageHeight(wrap bool, editable bool, message string, width int, tabWidth int) int {
|
||||
wrappedLines, _, _ := utils.WrapViewLinesToWidth(wrap, editable, message, width, tabWidth)
|
||||
return len(wrappedLines)
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ func (self *ConfirmationHelper) resizeMenu(parentPopupContext types.Context) {
|
||||
if selectedItem != nil {
|
||||
tooltip = self.TooltipForMenuItem(selectedItem)
|
||||
}
|
||||
tooltipHeight := getMessageHeight(true, tooltip, contentWidth) + 2 // plus 2 for the frame
|
||||
tooltipHeight := getMessageHeight(true, false, tooltip, contentWidth, self.c.Views().Menu.TabWidth) + 2 // plus 2 for the frame
|
||||
_, _ = self.c.GocuiGui().SetView(self.c.Views().Tooltip.Name(), x0, tooltipTop, x1, tooltipTop+tooltipHeight-1, 0)
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ func (self *ConfirmationHelper) layoutMenuPrompt(contentWidth int) int {
|
||||
var promptLines []string
|
||||
prompt := self.c.Contexts().Menu.GetPrompt()
|
||||
if len(prompt) > 0 {
|
||||
promptLines, _, _ = utils.WrapViewLinesToWidth(true, prompt, contentWidth)
|
||||
promptLines, _, _ = utils.WrapViewLinesToWidth(true, false, prompt, contentWidth, self.c.Views().Menu.TabWidth)
|
||||
promptLines = append(promptLines, "")
|
||||
}
|
||||
self.c.Contexts().Menu.SetPromptLines(promptLines)
|
||||
@@ -305,16 +305,18 @@ func (self *ConfirmationHelper) resizeConfirmationPanel(parentPopupContext types
|
||||
}
|
||||
panelWidth := self.getPopupPanelWidth()
|
||||
contentWidth := panelWidth - 2 // minus 2 for the frame
|
||||
prompt := self.c.Views().Confirmation.Buffer()
|
||||
confirmationView := self.c.Views().Confirmation
|
||||
prompt := confirmationView.Buffer()
|
||||
wrap := true
|
||||
if self.c.Views().Confirmation.Editable {
|
||||
prompt = self.c.Views().Confirmation.TextArea.GetContent()
|
||||
editable := confirmationView.Editable
|
||||
if editable {
|
||||
prompt = confirmationView.TextArea.GetContent()
|
||||
wrap = false
|
||||
}
|
||||
panelHeight := getMessageHeight(wrap, prompt, contentWidth) + suggestionsViewHeight
|
||||
panelHeight := getMessageHeight(wrap, editable, prompt, contentWidth, confirmationView.TabWidth) + suggestionsViewHeight
|
||||
x0, y0, x1, y1 := self.getPopupPanelDimensionsAux(panelWidth, panelHeight, parentPopupContext)
|
||||
confirmationViewBottom := y1 - suggestionsViewHeight
|
||||
_, _ = self.c.GocuiGui().SetView(self.c.Views().Confirmation.Name(), x0, y0, x1, confirmationViewBottom, 0)
|
||||
_, _ = self.c.GocuiGui().SetView(confirmationView.Name(), x0, y0, x1, confirmationViewBottom, 0)
|
||||
|
||||
suggestionsViewTop := confirmationViewBottom + 1
|
||||
_, _ = self.c.GocuiGui().SetView(self.c.Views().Suggestions.Name(), x0, suggestionsViewTop, x1, suggestionsViewTop+suggestionsViewHeight, 0)
|
||||
@@ -324,7 +326,7 @@ func (self *ConfirmationHelper) ResizeCommitMessagePanels(parentPopupContext typ
|
||||
panelWidth := self.getPopupPanelWidth()
|
||||
content := self.c.Views().CommitDescription.TextArea.GetContent()
|
||||
summaryViewHeight := 3
|
||||
panelHeight := getMessageHeight(false, content, panelWidth)
|
||||
panelHeight := getMessageHeight(false, true, content, panelWidth, self.c.Views().CommitDescription.TabWidth)
|
||||
minHeight := 7
|
||||
if panelHeight < minHeight {
|
||||
panelHeight = minHeight
|
||||
|
||||
@@ -77,6 +77,10 @@ func (self *MergeAndRebaseHelper) CreateRebaseOptionsMenu() error {
|
||||
return self.c.Menu(types.CreateMenuOptions{Title: title, Items: menuItems})
|
||||
}
|
||||
|
||||
func (self *MergeAndRebaseHelper) ContinueRebase() error {
|
||||
return self.genericMergeCommand(REBASE_OPTION_CONTINUE)
|
||||
}
|
||||
|
||||
func (self *MergeAndRebaseHelper) genericMergeCommand(command string) error {
|
||||
status := self.c.Git().Status.WorkingTreeState()
|
||||
|
||||
|
||||
@@ -490,6 +490,8 @@ func (self *RefreshHelper) refreshBranches(refreshWorktrees bool, keepBranchSele
|
||||
self.refreshView(self.c.Contexts().Worktrees)
|
||||
}
|
||||
|
||||
self.refreshView(self.c.Contexts().Branches)
|
||||
|
||||
if !keepBranchSelectionIndex && prevSelectedBranch != nil {
|
||||
_, idx, found := lo.FindIndexOf(self.c.Contexts().Branches.GetItems(),
|
||||
func(b *models.Branch) bool { return b.Name == prevSelectedBranch.Name })
|
||||
@@ -498,8 +500,6 @@ func (self *RefreshHelper) refreshBranches(refreshWorktrees bool, keepBranchSele
|
||||
}
|
||||
}
|
||||
|
||||
self.refreshView(self.c.Contexts().Branches)
|
||||
|
||||
// Need to re-render the commits view because the visualization of local
|
||||
// branch heads might have changed
|
||||
self.c.Mutexes().LocalCommitsMutex.Lock()
|
||||
@@ -570,7 +570,9 @@ func (self *RefreshHelper) refreshStateFiles() error {
|
||||
}
|
||||
|
||||
files := self.c.Git().Loaders.FileLoader.
|
||||
GetStatusFiles(git_commands.GetStatusFileOptions{})
|
||||
GetStatusFiles(git_commands.GetStatusFileOptions{
|
||||
ForceShowUntracked: self.c.Contexts().Files.ForceShowUntracked(),
|
||||
})
|
||||
|
||||
conflictFileCount := 0
|
||||
for _, file := range files {
|
||||
@@ -586,16 +588,14 @@ func (self *RefreshHelper) refreshStateFiles() error {
|
||||
fileTreeViewModel.RWMutex.Lock()
|
||||
|
||||
// only taking over the filter if it hasn't already been set by the user.
|
||||
// Though this does make it impossible for the user to actually say they want to display all if
|
||||
// conflicts are currently being shown. Hmm. Worth it I reckon. If we need to add some
|
||||
// extra state here to see if the user's set the filter themselves we can do that, but
|
||||
// I'd prefer to maintain as little state as possible.
|
||||
if conflictFileCount > 0 {
|
||||
if conflictFileCount > 0 && prevConflictFileCount == 0 {
|
||||
if fileTreeViewModel.GetFilter() == filetree.DisplayAll {
|
||||
fileTreeViewModel.SetStatusFilter(filetree.DisplayConflicted)
|
||||
self.c.Contexts().Files.GetView().Subtitle = self.c.Tr.FilterLabelConflictingFiles
|
||||
}
|
||||
} else if fileTreeViewModel.GetFilter() == filetree.DisplayConflicted {
|
||||
} else if conflictFileCount == 0 && fileTreeViewModel.GetFilter() == filetree.DisplayConflicted {
|
||||
fileTreeViewModel.SetStatusFilter(filetree.DisplayAll)
|
||||
self.c.Contexts().Files.GetView().Subtitle = ""
|
||||
}
|
||||
|
||||
self.c.Model().Files = files
|
||||
|
||||
@@ -278,7 +278,17 @@ func (self *RefsHelper) CreateCheckoutMenu(commit *models.Commit) error {
|
||||
})
|
||||
|
||||
hash := commit.Hash
|
||||
var menuItems []*types.MenuItem
|
||||
|
||||
menuItems := []*types.MenuItem{
|
||||
{
|
||||
LabelColumns: []string{fmt.Sprintf(self.c.Tr.Actions.CheckoutCommitAsDetachedHead, utils.ShortHash(hash))},
|
||||
OnPress: func() error {
|
||||
self.c.LogAction(self.c.Tr.Actions.CheckoutCommit)
|
||||
return self.CheckoutRef(hash, types.CheckoutRefOptions{})
|
||||
},
|
||||
Key: 'd',
|
||||
},
|
||||
}
|
||||
|
||||
if len(branches) > 0 {
|
||||
menuItems = append(menuItems, lo.Map(branches, func(branch *models.Branch, index int) *types.MenuItem {
|
||||
@@ -304,15 +314,6 @@ func (self *RefsHelper) CreateCheckoutMenu(commit *models.Commit) error {
|
||||
})
|
||||
}
|
||||
|
||||
menuItems = append(menuItems, &types.MenuItem{
|
||||
LabelColumns: []string{fmt.Sprintf(self.c.Tr.Actions.CheckoutCommitAsDetachedHead, utils.ShortHash(hash))},
|
||||
OnPress: func() error {
|
||||
self.c.LogAction(self.c.Tr.Actions.CheckoutCommit)
|
||||
return self.CheckoutRef(hash, types.CheckoutRefOptions{})
|
||||
},
|
||||
Key: 'd',
|
||||
})
|
||||
|
||||
return self.c.Menu(types.CreateMenuOptions{
|
||||
Title: self.c.Tr.Actions.CheckoutBranchOrCommit,
|
||||
Items: menuItems,
|
||||
|
||||
@@ -149,11 +149,11 @@ func (self *WorkingTreeHelper) HandleWIPCommitPress() error {
|
||||
}
|
||||
|
||||
func (self *WorkingTreeHelper) HandleCommitPress() error {
|
||||
message := self.c.Contexts().CommitMessage.GetPreservedMessage()
|
||||
message := self.c.Contexts().CommitMessage.GetPreservedMessageAndLogError()
|
||||
|
||||
if message == "" {
|
||||
commitPrefixConfig := self.commitPrefixConfigForRepo()
|
||||
if commitPrefixConfig != nil {
|
||||
commitPrefixConfigs := self.commitPrefixConfigsForRepo()
|
||||
for _, commitPrefixConfig := range commitPrefixConfigs {
|
||||
prefixPattern := commitPrefixConfig.Pattern
|
||||
prefixReplace := commitPrefixConfig.Replace
|
||||
branchName := self.refHelper.GetCheckedOutRef().Name
|
||||
@@ -165,6 +165,7 @@ func (self *WorkingTreeHelper) HandleCommitPress() error {
|
||||
if rgx.MatchString(branchName) {
|
||||
prefix := rgx.ReplaceAllString(branchName, prefixReplace)
|
||||
message = prefix
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -228,11 +229,11 @@ func (self *WorkingTreeHelper) prepareFilesForCommit() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *WorkingTreeHelper) commitPrefixConfigForRepo() *config.CommitPrefixConfig {
|
||||
func (self *WorkingTreeHelper) commitPrefixConfigsForRepo() []config.CommitPrefixConfig {
|
||||
cfg, ok := self.c.UserConfig().Git.CommitPrefixes[self.c.Git().RepoPaths.RepoName()]
|
||||
if ok {
|
||||
return &cfg
|
||||
return append(cfg, self.c.UserConfig().Git.CommitPrefix...)
|
||||
} else {
|
||||
return self.c.UserConfig().Git.CommitPrefix
|
||||
}
|
||||
|
||||
return self.c.UserConfig().Git.CommitPrefix
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/jesseduffield/gocui"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/patch"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/keybindings"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||
)
|
||||
|
||||
@@ -185,10 +187,20 @@ func (self *StagingController) TogglePanel() error {
|
||||
}
|
||||
|
||||
func (self *StagingController) ToggleStaged() error {
|
||||
if self.c.AppState.DiffContextSize == 0 {
|
||||
return fmt.Errorf(self.c.Tr.Actions.NotEnoughContextToStage,
|
||||
keybindings.Label(self.c.UserConfig().Keybinding.Universal.IncreaseContextInDiffView))
|
||||
}
|
||||
|
||||
return self.applySelectionAndRefresh(self.staged)
|
||||
}
|
||||
|
||||
func (self *StagingController) DiscardSelection() error {
|
||||
if self.c.AppState.DiffContextSize == 0 {
|
||||
return fmt.Errorf(self.c.Tr.Actions.NotEnoughContextToDiscard,
|
||||
keybindings.Label(self.c.UserConfig().Keybinding.Universal.IncreaseContextInDiffView))
|
||||
}
|
||||
|
||||
reset := func() error { return self.applySelectionAndRefresh(true) }
|
||||
|
||||
if !self.staged && !self.c.UserConfig().Gui.SkipDiscardChangeWarning {
|
||||
|
||||
@@ -201,13 +201,13 @@ func (self *StashController) handleRenameStashEntry(stashEntry *models.StashEntr
|
||||
HandleConfirm: func(response string) error {
|
||||
self.c.LogAction(self.c.Tr.Actions.RenameStash)
|
||||
err := self.c.Git().Stash.Rename(stashEntry.Index, response)
|
||||
_ = self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.STASH}})
|
||||
if err != nil {
|
||||
_ = self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.STASH}})
|
||||
return err
|
||||
}
|
||||
self.context().SetSelection(0) // Select the renamed stash
|
||||
self.context().FocusLine()
|
||||
return nil
|
||||
return self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.STASH}})
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -200,6 +200,7 @@ func (self *SyncController) pushAux(currentBranch *models.Branch, opts pushOpts)
|
||||
git_commands.PushOpts{
|
||||
Force: opts.force,
|
||||
ForceWithLease: opts.forceWithLease,
|
||||
CurrentBranch: currentBranch.Name,
|
||||
UpstreamRemote: opts.upstreamRemote,
|
||||
UpstreamBranch: opts.upstreamBranch,
|
||||
SetUpstream: opts.setUpstream,
|
||||
|
||||
@@ -177,6 +177,59 @@ func (self *TagsController) remoteDelete(tag *models.Tag) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *TagsController) localAndRemoteDelete(tag *models.Tag) error {
|
||||
title := utils.ResolvePlaceholderString(
|
||||
self.c.Tr.SelectRemoteTagUpstream,
|
||||
map[string]string{
|
||||
"tagName": tag.Name,
|
||||
},
|
||||
)
|
||||
|
||||
self.c.Prompt(types.PromptOpts{
|
||||
Title: title,
|
||||
InitialContent: "origin",
|
||||
FindSuggestionsFunc: self.c.Helpers().Suggestions.GetRemoteSuggestionsFunc(),
|
||||
HandleConfirm: func(upstream string) error {
|
||||
confirmTitle := utils.ResolvePlaceholderString(
|
||||
self.c.Tr.DeleteTagTitle,
|
||||
map[string]string{
|
||||
"tagName": tag.Name,
|
||||
},
|
||||
)
|
||||
confirmPrompt := utils.ResolvePlaceholderString(
|
||||
self.c.Tr.DeleteLocalAndRemoteTagPrompt,
|
||||
map[string]string{
|
||||
"tagName": tag.Name,
|
||||
"upstream": upstream,
|
||||
},
|
||||
)
|
||||
|
||||
self.c.Confirm(types.ConfirmOpts{
|
||||
Title: confirmTitle,
|
||||
Prompt: confirmPrompt,
|
||||
HandleConfirm: func() error {
|
||||
return self.c.WithInlineStatus(tag, types.ItemOperationDeleting, context.TAGS_CONTEXT_KEY, func(task gocui.Task) error {
|
||||
self.c.LogAction(self.c.Tr.Actions.DeleteRemoteTag)
|
||||
if err := self.c.Git().Remote.DeleteRemoteTag(task, upstream, tag.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
self.c.LogAction(self.c.Tr.Actions.DeleteLocalTag)
|
||||
if err := self.c.Git().Tag.LocalDelete(tag.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
return self.c.Refresh(types.RefreshOptions{Mode: types.ASYNC, Scope: []types.RefreshableView{types.COMMITS, types.TAGS}})
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
return nil
|
||||
},
|
||||
})
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *TagsController) delete(tag *models.Tag) error {
|
||||
menuTitle := utils.ResolvePlaceholderString(
|
||||
self.c.Tr.DeleteTagTitle,
|
||||
@@ -201,6 +254,14 @@ func (self *TagsController) delete(tag *models.Tag) error {
|
||||
return self.remoteDelete(tag)
|
||||
},
|
||||
},
|
||||
{
|
||||
Label: self.c.Tr.DeleteLocalAndRemoteTag,
|
||||
Key: 'b',
|
||||
OpensMenu: true,
|
||||
OnPress: func() error {
|
||||
return self.localAndRemoteDelete(tag)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return self.c.Menu(types.CreateMenuOptions{
|
||||
|
||||
@@ -16,6 +16,7 @@ const (
|
||||
DisplayStaged
|
||||
DisplayUnstaged
|
||||
DisplayTracked
|
||||
DisplayUntracked
|
||||
// this shows files with merge conflicts
|
||||
DisplayConflicted
|
||||
)
|
||||
@@ -40,6 +41,7 @@ type IFileTree interface {
|
||||
|
||||
FilterFiles(test func(*models.File) bool) []*models.File
|
||||
SetStatusFilter(filter FileTreeDisplayFilter)
|
||||
ForceShowUntracked() bool
|
||||
Get(index int) *FileNode
|
||||
GetFile(path string) *models.File
|
||||
GetAllItems() []*FileNode
|
||||
@@ -87,6 +89,8 @@ func (self *FileTree) getFilesForDisplay() []*models.File {
|
||||
return self.FilterFiles(func(file *models.File) bool { return file.HasUnstagedChanges })
|
||||
case DisplayTracked:
|
||||
return self.FilterFiles(func(file *models.File) bool { return file.Tracked })
|
||||
case DisplayUntracked:
|
||||
return self.FilterFiles(func(file *models.File) bool { return !file.Tracked })
|
||||
case DisplayConflicted:
|
||||
return self.FilterFiles(func(file *models.File) bool { return file.HasMergeConflicts })
|
||||
default:
|
||||
@@ -94,6 +98,10 @@ func (self *FileTree) getFilesForDisplay() []*models.File {
|
||||
}
|
||||
}
|
||||
|
||||
func (self *FileTree) ForceShowUntracked() bool {
|
||||
return self.filter == DisplayUntracked
|
||||
}
|
||||
|
||||
func (self *FileTree) FilterFiles(test func(*models.File) bool) []*models.File {
|
||||
return lo.Filter(self.getFiles(), func(file *models.File, _ int) bool { return test(file) })
|
||||
}
|
||||
|
||||
@@ -145,6 +145,13 @@ func (self *Gui) GetInitialKeybindings() ([]*types.Binding, []*gocui.ViewMouseBi
|
||||
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: self.c.Tr.CopyBranchNameToClipboard,
|
||||
},
|
||||
{
|
||||
ViewName: "tags",
|
||||
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
||||
Handler: self.handleCopySelectedSideContextItemToClipboard,
|
||||
GetDisabledReason: self.getCopySelectedSideContextItemToClipboardDisabledReason,
|
||||
Description: self.c.Tr.CopyTagToClipboard,
|
||||
},
|
||||
{
|
||||
ViewName: "commits",
|
||||
Key: opts.GetKey(opts.Config.Universal.CopyToClipboard),
|
||||
|
||||
@@ -7,78 +7,11 @@ import (
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/jesseduffield/gocui"
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
"github.com/jesseduffield/lazygit/pkg/constants"
|
||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
|
||||
var labelByKey = map[gocui.Key]string{
|
||||
gocui.KeyF1: "<f1>",
|
||||
gocui.KeyF2: "<f2>",
|
||||
gocui.KeyF3: "<f3>",
|
||||
gocui.KeyF4: "<f4>",
|
||||
gocui.KeyF5: "<f5>",
|
||||
gocui.KeyF6: "<f6>",
|
||||
gocui.KeyF7: "<f7>",
|
||||
gocui.KeyF8: "<f8>",
|
||||
gocui.KeyF9: "<f9>",
|
||||
gocui.KeyF10: "<f10>",
|
||||
gocui.KeyF11: "<f11>",
|
||||
gocui.KeyF12: "<f12>",
|
||||
gocui.KeyInsert: "<insert>",
|
||||
gocui.KeyDelete: "<delete>",
|
||||
gocui.KeyHome: "<home>",
|
||||
gocui.KeyEnd: "<end>",
|
||||
gocui.KeyPgup: "<pgup>",
|
||||
gocui.KeyPgdn: "<pgdown>",
|
||||
gocui.KeyArrowUp: "<up>",
|
||||
gocui.KeyShiftArrowUp: "<s-up>",
|
||||
gocui.KeyArrowDown: "<down>",
|
||||
gocui.KeyShiftArrowDown: "<s-down>",
|
||||
gocui.KeyArrowLeft: "<left>",
|
||||
gocui.KeyArrowRight: "<right>",
|
||||
gocui.KeyTab: "<tab>", // <c-i>
|
||||
gocui.KeyBacktab: "<backtab>",
|
||||
gocui.KeyEnter: "<enter>", // <c-m>
|
||||
gocui.KeyAltEnter: "<a-enter>",
|
||||
gocui.KeyEsc: "<esc>", // <c-[>, <c-3>
|
||||
gocui.KeyBackspace: "<backspace>", // <c-h>
|
||||
gocui.KeyCtrlSpace: "<c-space>", // <c-~>, <c-2>
|
||||
gocui.KeyCtrlSlash: "<c-/>", // <c-_>
|
||||
gocui.KeySpace: "<space>",
|
||||
gocui.KeyCtrlA: "<c-a>",
|
||||
gocui.KeyCtrlB: "<c-b>",
|
||||
gocui.KeyCtrlC: "<c-c>",
|
||||
gocui.KeyCtrlD: "<c-d>",
|
||||
gocui.KeyCtrlE: "<c-e>",
|
||||
gocui.KeyCtrlF: "<c-f>",
|
||||
gocui.KeyCtrlG: "<c-g>",
|
||||
gocui.KeyCtrlJ: "<c-j>",
|
||||
gocui.KeyCtrlK: "<c-k>",
|
||||
gocui.KeyCtrlL: "<c-l>",
|
||||
gocui.KeyCtrlN: "<c-n>",
|
||||
gocui.KeyCtrlO: "<c-o>",
|
||||
gocui.KeyCtrlP: "<c-p>",
|
||||
gocui.KeyCtrlQ: "<c-q>",
|
||||
gocui.KeyCtrlR: "<c-r>",
|
||||
gocui.KeyCtrlS: "<c-s>",
|
||||
gocui.KeyCtrlT: "<c-t>",
|
||||
gocui.KeyCtrlU: "<c-u>",
|
||||
gocui.KeyCtrlV: "<c-v>",
|
||||
gocui.KeyCtrlW: "<c-w>",
|
||||
gocui.KeyCtrlX: "<c-x>",
|
||||
gocui.KeyCtrlY: "<c-y>",
|
||||
gocui.KeyCtrlZ: "<c-z>",
|
||||
gocui.KeyCtrl4: "<c-4>", // <c-\>
|
||||
gocui.KeyCtrl5: "<c-5>", // <c-]>
|
||||
gocui.KeyCtrl6: "<c-6>",
|
||||
gocui.KeyCtrl8: "<c-8>",
|
||||
gocui.MouseWheelUp: "mouse wheel up",
|
||||
gocui.MouseWheelDown: "mouse wheel down",
|
||||
}
|
||||
|
||||
var keyByLabel = lo.Invert(labelByKey)
|
||||
|
||||
func Label(name string) string {
|
||||
return LabelFromKey(GetKey(name))
|
||||
}
|
||||
@@ -90,7 +23,7 @@ func LabelFromKey(key types.Key) string {
|
||||
case rune:
|
||||
keyInt = int(key)
|
||||
case gocui.Key:
|
||||
value, ok := labelByKey[key]
|
||||
value, ok := config.LabelByKey[key]
|
||||
if ok {
|
||||
return value
|
||||
}
|
||||
@@ -105,7 +38,7 @@ func GetKey(key string) types.Key {
|
||||
if key == "<disabled>" {
|
||||
return nil
|
||||
} else if runeCount > 1 {
|
||||
binding, ok := keyByLabel[strings.ToLower(key)]
|
||||
binding, ok := config.KeyByLabel[strings.ToLower(key)]
|
||||
if !ok {
|
||||
log.Fatalf("Unrecognized key %s for keybinding. For permitted values see %s", strings.ToLower(key), constants.Links.Docs.CustomKeybindings)
|
||||
} else {
|
||||
|
||||
@@ -323,6 +323,6 @@ func (s *State) CalculateOrigin(currentOrigin int, bufferHeight int, numLines in
|
||||
|
||||
func wrapPatchLines(diff string, view *gocui.View) ([]int, []int) {
|
||||
_, viewLineIndices, patchLineIndices := utils.WrapViewLinesToWidth(
|
||||
view.Wrap, strings.TrimSuffix(diff, "\n"), view.InnerWidth())
|
||||
view.Wrap, view.Editable, strings.TrimSuffix(diff, "\n"), view.InnerWidth(), view.TabWidth)
|
||||
return viewLineIndices, patchLineIndices
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ var nameIconMap = map[string]IconProperties{
|
||||
"bin": {Icon: "\U000f12a7", Color: "#25A79A"}, //
|
||||
"brewfile": {Icon: "\ue791", Color: "#701516"}, //
|
||||
"bspwmrc": {Icon: "\uf355", Color: "#2F2F2F"}, //
|
||||
"build": {Icon: "\ue63a", Color: "#89E051"}, //
|
||||
"BUILD": {Icon: "\ue63a", Color: "#89E051"}, //
|
||||
"build.gradle": {Icon: "\ue660", Color: "#005F87"}, //
|
||||
"build.zig.zon": {Icon: "\ue6a9", Color: "#F69A1B"}, //
|
||||
"bun.lockb": {Icon: "\ue76f", Color: "#EADCD1"}, //
|
||||
@@ -207,7 +207,8 @@ var nameIconMap = map[string]IconProperties{
|
||||
"vlcrc": {Icon: "\U000f057c", Color: "#E85E00"}, //
|
||||
"webpack": {Icon: "\U000f072b", Color: "#519ABA"}, //
|
||||
"weston.ini": {Icon: "\uf367", Color: "#FFBB01"}, //
|
||||
"workspace": {Icon: "\ue63a", Color: "#89E051"}, //
|
||||
"WORKSPACE": {Icon: "\ue63a", Color: "#89E051"}, //
|
||||
"WORKSPACE.bzlmod": {Icon: "\ue63a", Color: "#89E051"}, //
|
||||
"xmobarrc": {Icon: "\uf35e", Color: "#FD4D5D"}, //
|
||||
"xmobarrc.hs": {Icon: "\uf35e", Color: "#FD4D5D"}, //
|
||||
"xmonad.hs": {Icon: "\uf35e", Color: "#FD4D5D"}, //
|
||||
|
||||
@@ -162,12 +162,29 @@ func worktreeShimFromModelRemote(worktree *models.Worktree) *Worktree {
|
||||
}
|
||||
}
|
||||
|
||||
type CommitRange struct {
|
||||
From string
|
||||
To string
|
||||
}
|
||||
|
||||
func makeCommitRange(commits []*models.Commit, _ int, _ int) *CommitRange {
|
||||
if len(commits) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return &CommitRange{
|
||||
From: commits[len(commits)-1].Hash,
|
||||
To: commits[0].Hash,
|
||||
}
|
||||
}
|
||||
|
||||
// SessionState captures the current state of the application for use in custom commands
|
||||
type SessionState struct {
|
||||
SelectedLocalCommit *Commit // deprecated, use SelectedCommit
|
||||
SelectedReflogCommit *Commit // deprecated, use SelectedCommit
|
||||
SelectedSubCommit *Commit // deprecated, use SelectedCommit
|
||||
SelectedCommit *Commit
|
||||
SelectedCommitRange *CommitRange
|
||||
SelectedFile *File
|
||||
SelectedPath string
|
||||
SelectedLocalBranch *Branch
|
||||
@@ -183,14 +200,20 @@ type SessionState struct {
|
||||
|
||||
func (self *SessionStateLoader) call() *SessionState {
|
||||
selectedLocalCommit := commitShimFromModelCommit(self.c.Contexts().LocalCommits.GetSelected())
|
||||
selectedLocalCommitRange := makeCommitRange(self.c.Contexts().LocalCommits.GetSelectedItems())
|
||||
selectedReflogCommit := commitShimFromModelCommit(self.c.Contexts().ReflogCommits.GetSelected())
|
||||
selectedReflogCommitRange := makeCommitRange(self.c.Contexts().ReflogCommits.GetSelectedItems())
|
||||
selectedSubCommit := commitShimFromModelCommit(self.c.Contexts().SubCommits.GetSelected())
|
||||
selectedSubCommitRange := makeCommitRange(self.c.Contexts().SubCommits.GetSelectedItems())
|
||||
|
||||
selectedCommit := selectedLocalCommit
|
||||
selectedCommitRange := selectedLocalCommitRange
|
||||
if self.c.Context().IsCurrentOrParent(self.c.Contexts().ReflogCommits) {
|
||||
selectedCommit = selectedReflogCommit
|
||||
selectedCommitRange = selectedReflogCommitRange
|
||||
} else if self.c.Context().IsCurrentOrParent(self.c.Contexts().SubCommits) {
|
||||
selectedCommit = selectedSubCommit
|
||||
selectedCommitRange = selectedSubCommitRange
|
||||
}
|
||||
|
||||
selectedPath := self.c.Contexts().Files.GetSelectedPath()
|
||||
@@ -207,6 +230,7 @@ func (self *SessionStateLoader) call() *SessionState {
|
||||
SelectedReflogCommit: selectedReflogCommit,
|
||||
SelectedSubCommit: selectedSubCommit,
|
||||
SelectedCommit: selectedCommit,
|
||||
SelectedCommitRange: selectedCommitRange,
|
||||
SelectedLocalBranch: branchShimFromModelBranch(self.c.Contexts().Branches.GetSelected()),
|
||||
SelectedRemoteBranch: remoteBranchShimFromModelRemoteBranch(self.c.Contexts().RemoteBranches.GetSelected()),
|
||||
SelectedRemote: remoteShimFromModelRemote(self.c.Contexts().Remotes.GetSelected()),
|
||||
|
||||
@@ -203,6 +203,7 @@ func (gui *Gui) configureViewProperties() {
|
||||
|
||||
for _, view := range []*gocui.View{gui.Views.Main, gui.Views.Secondary, gui.Views.Staging, gui.Views.StagingSecondary, gui.Views.PatchBuilding, gui.Views.PatchBuildingSecondary, gui.Views.MergeConflicts} {
|
||||
view.CanScrollPastBottom = gui.c.UserConfig().Gui.ScrollPastBottom
|
||||
view.TabWidth = gui.c.UserConfig().Gui.TabWidth
|
||||
}
|
||||
|
||||
gui.Views.CommitDescription.FgColor = theme.GocuiDefaultTextColor
|
||||
|
||||
+88
-44
@@ -88,7 +88,13 @@ type TranslationSet struct {
|
||||
FilterStagedFiles string
|
||||
FilterUnstagedFiles string
|
||||
FilterTrackedFiles string
|
||||
ResetFilter string
|
||||
FilterUntrackedFiles string
|
||||
NoFilter string
|
||||
FilterLabelStagedFiles string
|
||||
FilterLabelUnstagedFiles string
|
||||
FilterLabelTrackedFiles string
|
||||
FilterLabelUntrackedFiles string
|
||||
FilterLabelConflictingFiles string
|
||||
MergeConflictsTitle string
|
||||
Checkout string
|
||||
CheckoutTooltip string
|
||||
@@ -353,6 +359,9 @@ type TranslationSet struct {
|
||||
ScrollDownMainWindow string
|
||||
AmendCommitTitle string
|
||||
AmendCommitPrompt string
|
||||
AmendCommitWithConflictsMenuPrompt string
|
||||
AmendCommitWithConflictsContinue string
|
||||
AmendCommitWithConflictsAmend string
|
||||
DropCommitTitle string
|
||||
DropCommitPrompt string
|
||||
DropUpdateRefPrompt string
|
||||
@@ -518,8 +527,10 @@ type TranslationSet struct {
|
||||
DeleteTagTitle string
|
||||
DeleteLocalTag string
|
||||
DeleteRemoteTag string
|
||||
DeleteLocalAndRemoteTag string
|
||||
SelectRemoteTagUpstream string
|
||||
DeleteRemoteTagPrompt string
|
||||
DeleteLocalAndRemoteTagPrompt string
|
||||
RemoteTagDeletedMessage string
|
||||
PushTagTitle string
|
||||
PushTag string
|
||||
@@ -610,11 +621,14 @@ type TranslationSet struct {
|
||||
PasteCommitMessageFromClipboard string
|
||||
SurePasteCommitMessage string
|
||||
CommitMessage string
|
||||
CommitMessageBody string
|
||||
CommitSubject string
|
||||
CommitAuthor string
|
||||
CommitTags string
|
||||
CopyCommitAttributeToClipboard string
|
||||
CopyCommitAttributeToClipboardTooltip string
|
||||
CopyBranchNameToClipboard string
|
||||
CopyTagToClipboard string
|
||||
CopyPathToClipboard string
|
||||
CommitPrefixPatternError string
|
||||
CopySelectedTextToClipboard string
|
||||
@@ -672,8 +686,12 @@ type TranslationSet struct {
|
||||
CommitDiffCopiedToClipboard string
|
||||
CommitURLCopiedToClipboard string
|
||||
CommitMessageCopiedToClipboard string
|
||||
CommitMessageBodyCopiedToClipboard string
|
||||
CommitSubjectCopiedToClipboard string
|
||||
CommitAuthorCopiedToClipboard string
|
||||
CommitTagsCopiedToClipboard string
|
||||
CommitHasNoTags string
|
||||
CommitHasNoMessageBody string
|
||||
PatchCopiedToClipboard string
|
||||
CopiedToClipboard string
|
||||
ErrCannotEditDirectory string
|
||||
@@ -899,12 +917,14 @@ type Actions struct {
|
||||
MoveCommitUp string
|
||||
MoveCommitDown string
|
||||
CopyCommitMessageToClipboard string
|
||||
CopyCommitMessageBodyToClipboard string
|
||||
CopyCommitSubjectToClipboard string
|
||||
CopyCommitDiffToClipboard string
|
||||
CopyCommitHashToClipboard string
|
||||
CopyCommitURLToClipboard string
|
||||
CopyCommitAuthorToClipboard string
|
||||
CopyCommitAttributeToClipboard string
|
||||
CopyCommitTagsToClipboard string
|
||||
CopyPatchToClipboard string
|
||||
CustomCommand string
|
||||
DiscardAllChangesInDirectory string
|
||||
@@ -916,6 +936,8 @@ type Actions struct {
|
||||
UnstageFile string
|
||||
UnstageAllFiles string
|
||||
StageAllFiles string
|
||||
NotEnoughContextToStage string
|
||||
NotEnoughContextToDiscard string
|
||||
IgnoreExcludeFile string
|
||||
IgnoreFileErr string
|
||||
ExcludeFile string
|
||||
@@ -1101,7 +1123,13 @@ func EnglishTranslationSet() *TranslationSet {
|
||||
FilterStagedFiles: "Show only staged files",
|
||||
FilterUnstagedFiles: "Show only unstaged files",
|
||||
FilterTrackedFiles: "Show only tracked files",
|
||||
ResetFilter: "Reset filter",
|
||||
FilterUntrackedFiles: "Show only untracked files",
|
||||
NoFilter: "No filter",
|
||||
FilterLabelStagedFiles: "(only staged)",
|
||||
FilterLabelUnstagedFiles: "(only unstaged)",
|
||||
FilterLabelTrackedFiles: "(only tracked)",
|
||||
FilterLabelUntrackedFiles: "(only untracked)",
|
||||
FilterLabelConflictingFiles: "(only conflicting)",
|
||||
NoChangedFiles: "No changed files",
|
||||
SoftReset: "Soft reset",
|
||||
AlreadyCheckedOutBranch: "You have already checked out this branch",
|
||||
@@ -1368,6 +1396,9 @@ func EnglishTranslationSet() *TranslationSet {
|
||||
ScrollDownMainWindow: "Scroll down main window",
|
||||
AmendCommitTitle: "Amend commit",
|
||||
AmendCommitPrompt: "Are you sure you want to amend this commit with your staged files?",
|
||||
AmendCommitWithConflictsMenuPrompt: "WARNING: you are about to amend the last finished commit with your resolved conflicts. This is very unlikely to be what you want at this point. More likely, you simply want to continue the rebase instead.\n\nDo you still want to amend the previous commit?",
|
||||
AmendCommitWithConflictsContinue: "No, continue rebase",
|
||||
AmendCommitWithConflictsAmend: "Yes, amend previous commit",
|
||||
DropCommitTitle: "Drop commit",
|
||||
DropCommitPrompt: "Are you sure you want to drop the selected commit(s)?",
|
||||
DropMergeCommitPrompt: "Are you sure you want to drop the selected merge commit? Note that it will also drop all the commits that were merged in by it.",
|
||||
@@ -1534,9 +1565,11 @@ func EnglishTranslationSet() *TranslationSet {
|
||||
DeleteTagTitle: "Delete tag '{{.tagName}}'?",
|
||||
DeleteLocalTag: "Delete local tag",
|
||||
DeleteRemoteTag: "Delete remote tag",
|
||||
DeleteLocalAndRemoteTag: "Delete local and remote tag",
|
||||
RemoteTagDeletedMessage: "Remote tag deleted",
|
||||
SelectRemoteTagUpstream: "Remote from which to remove tag '{{.tagName}}':",
|
||||
DeleteRemoteTagPrompt: "Are you sure you want to delete the remote tag '{{.tagName}}' from '{{.upstream}}'?",
|
||||
DeleteLocalAndRemoteTagPrompt: "Are you sure you want to delete '{{.tagName}}' from both your machine and from '{{.upstream}}'?",
|
||||
PushTagTitle: "Remote to push tag '{{.tagName}}' to:",
|
||||
// Using 'push tag' rather than just 'push' to disambiguate from a global push
|
||||
PushTag: "Push tag",
|
||||
@@ -1624,12 +1657,15 @@ func EnglishTranslationSet() *TranslationSet {
|
||||
CopyCommitMessageToClipboard: "Copy commit message to clipboard",
|
||||
PasteCommitMessageFromClipboard: "Paste commit message from clipboard",
|
||||
SurePasteCommitMessage: "Pasting will overwrite the current commit message, continue?",
|
||||
CommitMessage: "Commit message",
|
||||
CommitMessage: "Commit message (subject and body)",
|
||||
CommitMessageBody: "Commit message body",
|
||||
CommitSubject: "Commit subject",
|
||||
CommitAuthor: "Commit author",
|
||||
CommitTags: "Commit tags",
|
||||
CopyCommitAttributeToClipboard: "Copy commit attribute to clipboard",
|
||||
CopyCommitAttributeToClipboardTooltip: "Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author).",
|
||||
CopyBranchNameToClipboard: "Copy branch name to clipboard",
|
||||
CopyTagToClipboard: "Copy tag to clipboard",
|
||||
CopyPathToClipboard: "Copy path to clipboard",
|
||||
CopySelectedTextToClipboard: "Copy selected text to clipboard",
|
||||
CommitPrefixPatternError: "Error in commitPrefix pattern",
|
||||
@@ -1686,8 +1722,12 @@ func EnglishTranslationSet() *TranslationSet {
|
||||
CommitDiffCopiedToClipboard: "Commit diff copied to clipboard",
|
||||
CommitURLCopiedToClipboard: "Commit URL copied to clipboard",
|
||||
CommitMessageCopiedToClipboard: "Commit message copied to clipboard",
|
||||
CommitMessageBodyCopiedToClipboard: "Commit message body copied to clipboard",
|
||||
CommitSubjectCopiedToClipboard: "Commit subject copied to clipboard",
|
||||
CommitAuthorCopiedToClipboard: "Commit author copied to clipboard",
|
||||
CommitTagsCopiedToClipboard: "Commit tags copied to clipboard",
|
||||
CommitHasNoTags: "Commit has no tags",
|
||||
CommitHasNoMessageBody: "Commit has no message body",
|
||||
PatchCopiedToClipboard: "Patch copied to clipboard",
|
||||
CopiedToClipboard: "copied to clipboard",
|
||||
ErrCannotEditDirectory: "Cannot edit directories: you can only edit individual files",
|
||||
@@ -1840,47 +1880,49 @@ func EnglishTranslationSet() *TranslationSet {
|
||||
|
||||
Actions: Actions{
|
||||
// TODO: combine this with the original keybinding descriptions (those are all in lowercase atm)
|
||||
CheckoutCommit: "Checkout commit",
|
||||
CheckoutBranchAtCommit: "Checkout branch '%s'",
|
||||
CheckoutCommitAsDetachedHead: "Checkout commit %s as detached head",
|
||||
CheckoutTag: "Checkout tag",
|
||||
CheckoutBranch: "Checkout branch",
|
||||
ForceCheckoutBranch: "Force checkout branch",
|
||||
CheckoutBranchOrCommit: "Checkout branch or commit",
|
||||
DeleteLocalBranch: "Delete local branch",
|
||||
Merge: "Merge",
|
||||
SquashMerge: "Squash merge",
|
||||
RebaseBranch: "Rebase branch",
|
||||
RenameBranch: "Rename branch",
|
||||
CreateBranch: "Create branch",
|
||||
CherryPick: "(Cherry-pick) paste commits",
|
||||
CheckoutFile: "Checkout file",
|
||||
DiscardOldFileChange: "Discard old file change",
|
||||
SquashCommitDown: "Squash commit down",
|
||||
FixupCommit: "Fixup commit",
|
||||
RewordCommit: "Reword commit",
|
||||
DropCommit: "Drop commit",
|
||||
EditCommit: "Edit commit",
|
||||
AmendCommit: "Amend commit",
|
||||
ResetCommitAuthor: "Reset commit author",
|
||||
SetCommitAuthor: "Set commit author",
|
||||
AddCommitCoAuthor: "Add commit co-author",
|
||||
RevertCommit: "Revert commit",
|
||||
CreateFixupCommit: "Create fixup commit",
|
||||
SquashAllAboveFixupCommits: "Squash all above fixup commits",
|
||||
CreateLightweightTag: "Create lightweight tag",
|
||||
CreateAnnotatedTag: "Create annotated tag",
|
||||
CopyCommitMessageToClipboard: "Copy commit message to clipboard",
|
||||
CopyCommitSubjectToClipboard: "Copy commit subject to clipboard",
|
||||
CopyCommitDiffToClipboard: "Copy commit diff to clipboard",
|
||||
CopyCommitHashToClipboard: "Copy full commit hash to clipboard",
|
||||
CopyCommitURLToClipboard: "Copy commit URL to clipboard",
|
||||
CopyCommitAuthorToClipboard: "Copy commit author to clipboard",
|
||||
CopyCommitAttributeToClipboard: "Copy to clipboard",
|
||||
CopyPatchToClipboard: "Copy patch to clipboard",
|
||||
MoveCommitUp: "Move commit up",
|
||||
MoveCommitDown: "Move commit down",
|
||||
CustomCommand: "Custom command",
|
||||
CheckoutCommit: "Checkout commit",
|
||||
CheckoutBranchAtCommit: "Checkout branch '%s'",
|
||||
CheckoutCommitAsDetachedHead: "Checkout commit %s as detached head",
|
||||
CheckoutTag: "Checkout tag",
|
||||
CheckoutBranch: "Checkout branch",
|
||||
ForceCheckoutBranch: "Force checkout branch",
|
||||
CheckoutBranchOrCommit: "Checkout branch or commit",
|
||||
DeleteLocalBranch: "Delete local branch",
|
||||
Merge: "Merge",
|
||||
SquashMerge: "Squash merge",
|
||||
RebaseBranch: "Rebase branch",
|
||||
RenameBranch: "Rename branch",
|
||||
CreateBranch: "Create branch",
|
||||
CherryPick: "(Cherry-pick) paste commits",
|
||||
CheckoutFile: "Checkout file",
|
||||
DiscardOldFileChange: "Discard old file change",
|
||||
SquashCommitDown: "Squash commit down",
|
||||
FixupCommit: "Fixup commit",
|
||||
RewordCommit: "Reword commit",
|
||||
DropCommit: "Drop commit",
|
||||
EditCommit: "Edit commit",
|
||||
AmendCommit: "Amend commit",
|
||||
ResetCommitAuthor: "Reset commit author",
|
||||
SetCommitAuthor: "Set commit author",
|
||||
AddCommitCoAuthor: "Add commit co-author",
|
||||
RevertCommit: "Revert commit",
|
||||
CreateFixupCommit: "Create fixup commit",
|
||||
SquashAllAboveFixupCommits: "Squash all above fixup commits",
|
||||
CreateLightweightTag: "Create lightweight tag",
|
||||
CreateAnnotatedTag: "Create annotated tag",
|
||||
CopyCommitMessageToClipboard: "Copy commit message to clipboard",
|
||||
CopyCommitMessageBodyToClipboard: "Copy commit message body to clipboard",
|
||||
CopyCommitSubjectToClipboard: "Copy commit subject to clipboard",
|
||||
CopyCommitTagsToClipboard: "Copy commit tags to clipboard",
|
||||
CopyCommitDiffToClipboard: "Copy commit diff to clipboard",
|
||||
CopyCommitHashToClipboard: "Copy full commit hash to clipboard",
|
||||
CopyCommitURLToClipboard: "Copy commit URL to clipboard",
|
||||
CopyCommitAuthorToClipboard: "Copy commit author to clipboard",
|
||||
CopyCommitAttributeToClipboard: "Copy to clipboard",
|
||||
CopyPatchToClipboard: "Copy patch to clipboard",
|
||||
MoveCommitUp: "Move commit up",
|
||||
MoveCommitDown: "Move commit down",
|
||||
CustomCommand: "Custom command",
|
||||
|
||||
// TODO: remove
|
||||
DiscardAllChangesInDirectory: "Discard all changes in directory",
|
||||
@@ -1893,6 +1935,8 @@ func EnglishTranslationSet() *TranslationSet {
|
||||
UnstageFile: "Unstage file",
|
||||
UnstageAllFiles: "Unstage all files",
|
||||
StageAllFiles: "Stage all files",
|
||||
NotEnoughContextToStage: "Staging or unstaging changes is not possible with a diff context size of 0. Increase the context using '%s'.",
|
||||
NotEnoughContextToDiscard: "Discarding changes is not possible with a diff context size of 0. Increase the context using '%s'.",
|
||||
IgnoreExcludeFile: "Ignore or exclude file",
|
||||
IgnoreFileErr: "Cannot ignore .gitignore",
|
||||
ExcludeFile: "Exclude file",
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
The JSON files in this directory are machine-generated; please do not edit.
|
||||
|
||||
Translating lazygit happens at https://crowdin.com/project/lazygit/.
|
||||
|
||||
# Updating translations from Crowdin
|
||||
|
||||
We regularly need to pull changes from Crowdin and integrate them here. This is
|
||||
done by downloading a zip file of the translations from Crowdin, unzipping it,
|
||||
and calling `scripts/update_language_files.sh` with the unzipped directory as an
|
||||
argument.
|
||||
|
||||
# Uploading the English file to Crowdin
|
||||
|
||||
The English version of all the texts is still maintained in
|
||||
`pkg/i18n/english.go`; it needs to be uploaded to Crowdin regularly. To do this,
|
||||
call `go run cmd/i18n/main.go`; this will create an unversioned file `en.json`
|
||||
in the root of the repository. Upload this to
|
||||
`https://crowdin.com/project/lazygit/sources/files` and delete it from the
|
||||
working copy again.
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
{
|
||||
"NotEnoughSpace": "패널을 렌더링 할 공간이 부족합니다.",
|
||||
"DiffTitle": "변경점",
|
||||
"FilesTitle": "파일",
|
||||
"BranchesTitle": "브랜치",
|
||||
"CommitsTitle": "커밋",
|
||||
"EasterEgg": "이스터 에그",
|
||||
"UnstagedChanges": "Staged되지 않은 변경 내용",
|
||||
"StagedChanges": "Staged된 변경 내용",
|
||||
"MainTitle": "메인",
|
||||
"StagingTitle": "메인 패널 (Staging)",
|
||||
"MergingTitle": "메인 패널 (Merging)",
|
||||
"SquashMergeCommittedTitle": "스쿼시 병합 및 커밋",
|
||||
"NormalTitle": "메인 패널 (Normal)",
|
||||
"LogTitle": "로그",
|
||||
"CommitSummary": "커밋 메시지",
|
||||
"CredentialsUsername": "사용자 이름",
|
||||
"CredentialsPassword": "패스워드",
|
||||
"CredentialsPassphrase": "SSH키의 passphrase 입력",
|
||||
"CredentialsPIN": "SSH키\u001d의 PIN\u001d을 입력",
|
||||
"PassUnameWrong": "패스워드, passphrase 또는 사용자 이름이 잘못되었습니다.",
|
||||
"Commit": "커밋 변경내용",
|
||||
"AmendLastCommit": "마지맛 커밋 수정",
|
||||
@@ -34,6 +38,16 @@
|
||||
"Pull": "업데이트",
|
||||
"Scroll": "스크롤",
|
||||
"FileFilter": "파일을 필터하기 (Staged/unstaged)",
|
||||
"CopyToClipboardMenu": "클립보드에 복사",
|
||||
"CopyFileName": "파일명",
|
||||
"CopyFilePath": "경로",
|
||||
"CopySelectedDiff": "선택한 파일의 변경점",
|
||||
"CopyAllFilesDiff": "모든 파일의 변경점",
|
||||
"NoContentToCopyError": "복사 대상이 없습니다",
|
||||
"FileNameCopiedToast": "파일명을 클립보드에 복사했습니다.",
|
||||
"FilePathCopiedToast": "파일경로를 클립보드에 복사했습니다.",
|
||||
"FileDiffCopiedToast": "파일의 변경점을 클립보드에 복사했습니다.",
|
||||
"AllFilesDiffCopiedToast": "모든 파일의 변경점을 클립보드에 복사했습니다.",
|
||||
"FilterStagedFiles": "Staged된 파일만 표시",
|
||||
"FilterUnstagedFiles": "Stage되지 않은 파일만 표시",
|
||||
"ResetFilter": "필터 리셋",
|
||||
@@ -47,6 +61,10 @@
|
||||
"BranchName": "브랜치 이름",
|
||||
"NewBranchNameBranchOff": "새 브랜치 이름 (branch is off of '{{.branchName}}')",
|
||||
"CantDeleteCheckOutBranch": "체크아웃하는 브랜치는 삭제할 수 없습니다!",
|
||||
"DeleteBranchTitle": "'{{.selectedBranchName}}' 브랜치를 삭제하시겠습니까?",
|
||||
"DeleteLocalBranch": "로컬 브랜치를 삭제",
|
||||
"DeleteRemoteBranchOption": "원격 브랜치를 삭제",
|
||||
"ForceDeleteBranchTitle": "브랜치를 강제 삭제",
|
||||
"ForceDeleteBranchMessage": "'{{.selectedBranchName}}'는 완전히 병합되지 않았습니다. 정말 삭제하시겠습니까?",
|
||||
"RebaseBranch": "체크아웃된 브랜치를 이 브랜치에 리베이스",
|
||||
"CantRebaseOntoSelf": "브랜치를 자기 자신에게 리베이스할 수는 없습니다.",
|
||||
@@ -62,6 +80,8 @@
|
||||
"Quit": "종료",
|
||||
"SureFixupThisCommit": "Are you sure you want to 'fixup' this commit? It will be merged into the commit below",
|
||||
"SureSquashThisCommit": "Are you sure you want to squash this commit into the commit below?",
|
||||
"Squash": "스쿼시",
|
||||
"SquashMerge": "스쿼시 병합",
|
||||
"PickCommitTooltip": "Pick commit (when mid-rebase)",
|
||||
"RevertCommit": "커밋 되돌리기",
|
||||
"Reword": "커밋메시지 변경",
|
||||
@@ -181,6 +201,8 @@
|
||||
"Discard": "View 'discard changes' options",
|
||||
"Cancel": "취소",
|
||||
"DiscardAllChanges": "모든 변경사항 버리기",
|
||||
"Delete": "삭제",
|
||||
"Reset": "초기화",
|
||||
"ViewResetOptions": "View reset options",
|
||||
"CreateFixupCommitTooltip": "Create fixup commit for this commit",
|
||||
"SquashAboveCommitsTooltip": "Squash all 'fixup!' commits above selected commit (autosquash)",
|
||||
|
||||
@@ -0,0 +1,316 @@
|
||||
{
|
||||
"NotEnoughSpace": "Espaço insuficiente para renderizar painéis",
|
||||
"DiffTitle": "Diff",
|
||||
"FilesTitle": "Arquivos",
|
||||
"BranchesTitle": "Branches",
|
||||
"CommitsTitle": "Commits",
|
||||
"StashTitle": "Stash",
|
||||
"SnakeTitle": "Snake",
|
||||
"EasterEgg": "Easter Egg",
|
||||
"UnstagedChanges": "Alterações não preparadas",
|
||||
"StagedChanges": "Alterações preparadas",
|
||||
"MainTitle": "Main",
|
||||
"StagingTitle": "Painel Principal (preparação)",
|
||||
"MergingTitle": "Painel principal (mesclagem)",
|
||||
"SquashMergeUncommittedTitle": "Mesclar Squash e sair sem commit",
|
||||
"SquashMergeCommittedTitle": "Mesclar Squash e commit",
|
||||
"SquashMergeUncommitted": "Mesclar Squash '{{.selectedBranch}}' na árvore de trabalho",
|
||||
"SquashMergeCommitted": "Mesclar Squash '{{.selectedBranch}}' em '{{.checkedOutBranch}}' como um único commit.",
|
||||
"RegularMergeTooltip": "Mesclar '{{.selectedBranch}}' em '{{.checkedOutBranch}}'.",
|
||||
"NormalTitle": "Painel Principal (Normal)",
|
||||
"LogTitle": "Log",
|
||||
"CommitSummary": "Sumário do commit",
|
||||
"CredentialsUsername": "Nome de usuário",
|
||||
"CredentialsPassword": "Senha",
|
||||
"CredentialsPassphrase": "Digite a senha para a chave SSH",
|
||||
"CredentialsPIN": "Digite o PIN para a chave SSH",
|
||||
"PassUnameWrong": "Senha, palavra-chave e/ou nome de usuário incorreto",
|
||||
"Commit": "Commit",
|
||||
"CommitTooltip": "Submeter mudanças em staging",
|
||||
"AmendLastCommit": "Alterar último commit",
|
||||
"AmendLastCommitTitle": "Alterar último commit",
|
||||
"SureToAmend": "Está certo de querer alterar o último commit? Posteriormente, pode alterar a mensagem do commit do painel de commits",
|
||||
"NoCommitToAmend": "Não há commit para alterar.",
|
||||
"CommitChangesWithEditor": "Enviar alteração usando um editor Git",
|
||||
"FindBaseCommitForFixup": "Encontrar commit da base para consertar",
|
||||
"FindBaseCommitForFixupTooltip": "Encontre o commit em que as suas mudanças atuais estão se baseando, para alterar/consertar o commit. Isso poupa-te você de ter que olhar pelos commits da sua branch um por um para ver qual commit deve ser alterado/consertado\nVeja a documentação:\n<https://github.com/jesseduffield/lazygit/tree/master/docs/Fixup_Commits.md>",
|
||||
"NoBaseCommitsFound": "Nenhum commit base encontrado",
|
||||
"MultipleBaseCommitsFoundStaged": "Múltiplos commits da base encontrados.",
|
||||
"MultipleBaseCommitsFoundUnstaged": "Múltiplos commits da base encontrados. (Tente preparar alguma dessas mudanças)",
|
||||
"BaseCommitIsAlreadyOnMainBranch": "O commit da base para está mudança já está na branch main",
|
||||
"BaseCommitIsNotInCurrentView": "O commit da base não está na visão atual",
|
||||
"HunksWithOnlyAddedLinesWarning": "Existem intervalos apenas de linhas adicionadas no diff; tenha cuidado para verificar se elas pertencem ao commit base encontrado.\n\nProceder?",
|
||||
"StatusTitle": "Status",
|
||||
"GlobalTitle": "Combinações globais de teclas",
|
||||
"Menu": "Menu",
|
||||
"Execute": "Executar",
|
||||
"Stage": "Etapa",
|
||||
"StageTooltip": "Alternar para staging para o arquivo selecionado.",
|
||||
"ToggleStagedAll": "Stage completo",
|
||||
"ToggleStagedAllTooltip": "Alternar para todos os arquivos na árvore de trabalho",
|
||||
"ToggleTreeView": "Alternar exibição de árvore de arquivo",
|
||||
"ToggleTreeViewTooltip": "Alternar a visualização de arquivo entre layout plano e layout de árvore. Layout plano mostra todos os caminhos de arquivo em uma única lista, layout de árvore agrupa arquivos por diretório.",
|
||||
"OpenDiffTool": "Abrir ferramenta de diff externa (git difftool)",
|
||||
"OpenMergeTool": "Abrir ferramenta de merge externa",
|
||||
"OpenMergeToolTooltip": "Execute `git mergetool`.",
|
||||
"Refresh": "Atualizar",
|
||||
"RefreshTooltip": "Atualize o estado do git (ou seja, execute `git status`, `git branch`, etc em segundo plano para atualizar o conteúdo de painéis). Isso não executa `git fetch`.",
|
||||
"Push": "Empurre (Push)",
|
||||
"Pull": "Puxar (Pull)",
|
||||
"PushTooltip": "Faça push do branch atual para o seu branch upstream. Se nenhum upstream estiver configurado, você será solicitado a configurar um branch a montante.",
|
||||
"PullTooltip": "Puxe alterações do controle remoto para o ramo atual. Se nenhum upstream estiver configurado, será solicitado configurar um ramo a montante.",
|
||||
"Scroll": "Navegar",
|
||||
"FileFilter": "Filtrar arquivos por status",
|
||||
"CopyFileName": "Nome do arquivo",
|
||||
"CopyFilePath": "Caminho",
|
||||
"CopyFileDiffTooltip": "Se existirem itens preparados, este comando considera apenas eles",
|
||||
"CopySelectedDiff": "Diferença do arquivo selecionado",
|
||||
"CopyAllFilesDiff": "Diferença de todos os arquivos",
|
||||
"NoContentToCopyError": "Nada para copiar",
|
||||
"FileNameCopiedToast": "No do arquivo copiado para a área de transferência",
|
||||
"FilePathCopiedToast": "Caminho do arquivo copiado para a área de transferência",
|
||||
"FileDiffCopiedToast": "Diferença do arquivo copiado para a área de transferência ",
|
||||
"AllFilesDiffCopiedToast": "Todos os arquivos diferentes foram copiados para a área de transferência",
|
||||
"FilterStagedFiles": "Mostrar somente os arquivos em staging",
|
||||
"FilterUnstagedFiles": "Mostrar somente arquivos que não estão em staging",
|
||||
"ResetFilter": "Resetar filtro",
|
||||
"MergeConflictsTitle": "Mesclar conflitos",
|
||||
"Checkout": "Verificar",
|
||||
"CheckoutTooltip": "Checar item selecionado",
|
||||
"CantCheckoutBranchWhilePulling": "Você não pode hecar outra branch enquanto puxa a branch atual",
|
||||
"TagCheckoutTooltip": "Checar a tag selecionada como um HEAD, desanexado",
|
||||
"RemoteBranchCheckoutTooltip": "Checar a nova branch baseada na brach remota selecionada, ou a branch remota como HEAD, desanexado",
|
||||
"CantPullOrPushSameBranchTwice": "Você não pode empurar ou puxar uma branch enquanto ele já está a ser puxado ou empurrado",
|
||||
"NoChangedFiles": "Arquivos não alterados",
|
||||
"SoftReset": "Reiniciar suave",
|
||||
"AlreadyCheckedOutBranch": "Você já tem uma checagem dessa branch",
|
||||
"SureForceCheckout": "Você está certo de que quer forçar uma checagem? Você perdera todos as mudanças locais",
|
||||
"ForceCheckoutBranch": "Forçar checagem de branch",
|
||||
"BranchName": "Nome da Branch",
|
||||
"NewBranchNameBranchOff": "Novo nome da branch (branch está fora de '{{.branchName}}')",
|
||||
"CantDeleteCheckOutBranch": "Você não pode excluir a branch checada",
|
||||
"DeleteBranchTitle": "Deletar branch '{{.selectedBranchName}}'?",
|
||||
"DeleteLocalBranch": "Deletar branch local",
|
||||
"DeleteRemoteBranchOption": "Deletar branch remota",
|
||||
"DeleteRemoteBranchPrompt": "Você está certo de que quer deletar a branch remota '{{.selectedBranchName}}' de '{{.upstream}}'?",
|
||||
"ForceDeleteBranchTitle": "Forçar deleção de branch",
|
||||
"ForceDeleteBranchMessage": "{{.selectedBranchName}} não está completamente mesclada. Você está certo que quer deletar ela?",
|
||||
"RebaseBranch": "Refazer",
|
||||
"RebaseBranchTooltip": "Refazer a branch checada na branch selecionada",
|
||||
"CantRebaseOntoSelf": "Você não pode refazer a branch nela mesma",
|
||||
"CantMergeBranchIntoItself": "Você não pode mesclar a branch em si mesmo",
|
||||
"ForceCheckout": "Forçar checagem",
|
||||
"ForceCheckoutTooltip": "Forçar checagem da branch selecionada. Isso irá descartar todas as mudanças no seu diretório de trabalho antes cheque a branch selecionada ",
|
||||
"CheckoutByName": "Checar por nome",
|
||||
"CheckoutByNameTooltip": "Checar por nome. Na caixa de entrada você pode inserir '-' para trocar para a última branch ",
|
||||
"RemoteBranchCheckoutTitle": "Checar {{.branchName}}",
|
||||
"RemoteBranchCheckoutPrompt": "Como você gostaria de checar essa branch?",
|
||||
"CheckoutTypeNewBranch": "Nova branch local",
|
||||
"CheckoutTypeNewBranchTooltip": "Checar a branch remota como a branch local, rastreando a branch remota",
|
||||
"CheckoutTypeDetachedHead": "HEAD desanexado",
|
||||
"CheckoutTypeDetachedHeadTooltip": "Checar a branch remota como um HEAD desanexado, que pode ser útil se você apenas quer para testar a branch, mas não trabalha nela você mesmo. Você ainda pode criar um branch remoto a partir dela depois",
|
||||
"NewBranch": "Nova branch",
|
||||
"NewBranchFromStashTooltip": "Criar um novo ramo a partir da entrada de lixo selecionada. Isso funciona verificando o commit do qual a entrada de lixo foi criada, criar um novo branch a partir desse commit e, em seguida, aplicar a entrada de lixo ao novo branch como um commit adicional.",
|
||||
"NoBranchesThisRepo": "Nenhuma branch para esse repositório",
|
||||
"CommitWithoutMessageErr": "Você não pode dar commit sem uma mensagem de commit",
|
||||
"Close": "Fechar",
|
||||
"CloseCancel": "Fechar/Cancelar",
|
||||
"Confirm": "Confirmar",
|
||||
"Quit": "Sair",
|
||||
"SquashTooltip": "Squash o commit selecionado no commit abaixo dele. A mensagem do commit selecionado será anexada ao commit abaixo dele.",
|
||||
"CannotSquashOrFixupFirstCommit": "Não há commit abaixo para squash em",
|
||||
"Fixup": "Fixup",
|
||||
"FixupTooltip": "Faça o commit selecionado no commit abaixo dele. Semelhante para o squash, mas a mensagem do commit selecionado será descartada.",
|
||||
"SureFixupThisCommit": "Tem certeza que deseja 'corrigir' o(s) commit(s) selecionado(s) no commit abaixo?",
|
||||
"SureSquashThisCommit": "Tem certeza que deseja esmagar o(s) commit(s) selecionado(s) no commit abaixo?",
|
||||
"Squash": "Squash",
|
||||
"SquashMerge": "Mesclar Squash",
|
||||
"PickCommitTooltip": "Marque o commit selecionado para ser escolhido (quando meados da base). Isso significa que o commit será mantido ao continuar o rebase.",
|
||||
"Pick": "Escolher",
|
||||
"CantPickDisabledReason": "Não é possível escolher um commit quando não estiver no centro da rebase",
|
||||
"Edit": "Editar",
|
||||
"RevertCommit": "Reverter commit",
|
||||
"Revert": "Reverter",
|
||||
"RevertCommitTooltip": "Crie um commit reverter para o commit selecionado, que aplica as alterações do commit selecionado em reverso.",
|
||||
"Reword": "Reword",
|
||||
"CommitRewordTooltip": "Repetir a mensagem de submissão selecionada.",
|
||||
"DropCommit": "Descartar",
|
||||
"DropCommitTooltip": "Solte o commit selecionado. Isso irá remover o commit do branch através de uma rebase. Se o commit faz com que as alterações em commits posteriores dependem, você pode precisar resolver conflitos de merge.",
|
||||
"MoveDownCommit": "Mover commit um para baixo",
|
||||
"MoveUpCommit": "Mover o commit um para cima",
|
||||
"CannotMoveAnyFurther": "Não é possível mover mais",
|
||||
"EditCommit": "Editar (iniciar rebase interativa)",
|
||||
"EditCommitTooltip": "Editar o commit selecionado. Use isto para iniciar uma rebase interativa a partir do commit selecionado. Quando já estiver no meio da reconstrução, isto irá marcar o commit selecionado para edição, o que significa que ao continuar com a reformulação. a rebase irá pausar no commit selecionado para permitir que você faça alterações.",
|
||||
"AmendCommitTooltip": "Alterar o commit com mudanças em sted. Se o commit selecionado for o commit HEAD, ele executará o `git commit --amend`. Caso contrário, o compromisso será alterado por meio de uma base de apoio.",
|
||||
"Amend": "Modificar",
|
||||
"ResetAuthor": "Redefinir autor",
|
||||
"ResetAuthorTooltip": "Redefinir o autor do commit para o usuário atualmente configurado. Isto também irá renovar o timestamp do autor",
|
||||
"SetAuthor": "Definir autor",
|
||||
"SetAuthorTooltip": "Definir o autor baseado em um prompt",
|
||||
"AddCoAuthor": "Adicionar co-autor",
|
||||
"AmendCommitAttribute": "Alterar atributo de commit",
|
||||
"AmendCommitAttributeTooltip": "Definir/Redefinir autor de submissão ou co-autor definido.",
|
||||
"SetAuthorPromptTitle": "Configura autor (deve se parecer com 'Nome <Email>')",
|
||||
"AddCoAuthorPromptTitle": "Adicionar co-autor (deve se parecer com 'Nome <Email>')",
|
||||
"AddCoAuthorTooltip": "Adicione um coautor usando o Github/Gitlab metadata co-produzido por.",
|
||||
"SureResetCommitAuthor": "O campo autor deste commit será atualizado para corresponder ao usuário configurado. Isso também renova o timestamp do autor. Continuar?",
|
||||
"RewordCommitEditor": "Republicar com o editor",
|
||||
"NoCommitsThisBranch": "Não há commits para este branch",
|
||||
"UpdateRefHere": "Atualizar branch '{{.ref}}' aqui",
|
||||
"ExecCommandHere": "Execute o seguinte comando aqui:",
|
||||
"Error": "Erro",
|
||||
"Undo": "Desfazer",
|
||||
"UndoReflog": "Desfazer",
|
||||
"RedoReflog": "Refazer",
|
||||
"UndoTooltip": "O reflog será usado para determinar qual comando git para executar para desfazer o último comando git. Isto não inclui mudanças na árvore de trabalho; apenas compromissos são tidos em consideração.",
|
||||
"RedoTooltip": "O reflog será usado para determinar qual comando git para executar para refazer o último comando git. Isto não inclui mudanças na árvore de trabalho; apenas compromissos são tidos em consideração.",
|
||||
"UndoMergeResolveTooltip": "Desfazer resolução de conflitos de última mesclagem.",
|
||||
"DiscardAllTooltip": "Descartar mudanças agendadas e não preparadas em '{{.path}}'.",
|
||||
"DiscardUnstagedTooltip": "Descartar mudanças não preparadas em '{{.path}}'.",
|
||||
"DiscardUnstagedDisabled": "Os itens selecionados não possuem mudanças staging e não preparados.",
|
||||
"Pop": "Pop",
|
||||
"StashPopTooltip": "Aplique a entrada de stash no seu diretório de trabalho e remova a entrada de stash.",
|
||||
"Drop": "Descartar",
|
||||
"StashDropTooltip": "Remova a entrada do stash da lista de armazenamento.",
|
||||
"Apply": "Aplicar",
|
||||
"StashApplyTooltip": "Aplique o stash no seu diretório de trabalho.",
|
||||
"NoStashEntries": "Sem itens no stash",
|
||||
"StashDrop": "Remover stash",
|
||||
"SureDropStashEntry": "Tem certeza de que deseja remover esta entrada de stash?",
|
||||
"StashPop": "Remover Stash ",
|
||||
"SurePopStashEntry": "Tem certeza de que deseja exibir esta entrada de stash?",
|
||||
"StashApply": "Aplica o Stash",
|
||||
"SureApplyStashEntry": "Tem certeza que deseja aplicar esta entrada de stash?",
|
||||
"NoTrackedStagedFilesStash": "Você não tem arquivos rastreados/staging para armazenar",
|
||||
"NoFilesToStash": "Você não tem arquivos para armazenar",
|
||||
"StashChanges": "Alterações preparadas",
|
||||
"RenameStash": "Renomear o stasj",
|
||||
"RenameStashPrompt": "Renomear o estoque: {{.stashName}}",
|
||||
"OpenConfig": "Abrir o ficheiro de config",
|
||||
"EditConfig": "Editar arquivo de configuração",
|
||||
"ForcePush": "Forçar push",
|
||||
"ForcePushPrompt": "Seu branch divergiu do branch remoto. Pressione {{.cancelKey}} para cancelar, ou {{.confirmKey}} para forçar a push.",
|
||||
"ForcePushDisabled": "Seu branch divergiu do branch remoto e você desabilitou o push forçado forçado",
|
||||
"UpdatesRejected": "Atualizações foram rejeitadas. Por favor, busque e examine as alterações remotas antes de enviar novamente.",
|
||||
"UpdatesRejectedAndForcePushDisabled": "Atualizações foram rejeitadas e você desativou o push de força",
|
||||
"CheckForUpdate": "Verificar atualização",
|
||||
"CheckingForUpdates": "A verificar por actualização…",
|
||||
"UpdateAvailableTitle": "Atualização disponível!",
|
||||
"UpdateAvailable": "Baixar e instalar a versão {{.newVersion}}?",
|
||||
"UpdateInProgressWaitingStatus": "Atualizando",
|
||||
"UpdateCompletedTitle": "Atualização concluída!",
|
||||
"UpdateCompleted": "A atualização foi instalada com sucesso. Reinicie o lazygit para que tenha efeito.",
|
||||
"FailedToRetrieveLatestVersionErr": "Falha ao recuperar informações da versão",
|
||||
"OnLatestVersionErr": "Você já tem a versão mais recente!",
|
||||
"MajorVersionErr": "Nova versão ({{.newVersion}}) tem mudanças não compatíveis com as versões anteriores comparadas com a versão atual ({{.currentVersion}})",
|
||||
"CouldNotFindBinaryErr": "Não foi possível encontrar nenhum binário em {{.url}}",
|
||||
"UpdateFailedErr": "Falha na atualização: {{.errMessage}}",
|
||||
"ConfirmQuitDuringUpdateTitle": "Atualmente atualizando",
|
||||
"ConfirmQuitDuringUpdate": "Uma atualização está em andamento. Tem certeza que deseja sair?",
|
||||
"MergeToolTitle": "Ferramenta de mesclagem",
|
||||
"MergeToolPrompt": "Tem certeza de que deseja abrir o `git mergetool`?",
|
||||
"IntroPopupMessage": "\nObrigado por usar lazygit! Sério, você rock. Três coisas para compartilhar com você:\n\n 1) Se quiser aprender sobre os recursos do lazygit, assista a este vid:\n https://youtu. e/CPLdltN7wgE\n\n 2) Não deixe de ler as últimas notas de lançamento em:\n https://github. um/jesseduffield/lazygit/releases\n\n 3) Se você estiver usando um git, isso o torna um programador! Com a sua ajuda, podemos fazer\n lazygit melhor, então considere se tornar um colaborador e se junte à diversão no\n https://github. om/jesseduffield/lazygit\n Você também pode me patrocinar e me dizer no que trabalhar clicando no botão\n de doar na parte inferior direita.\n Ou até mesmo apenas adicionar estrela no repositório para compartilhar o amor!\n",
|
||||
"DeprecatedEditConfigWarning": "\n### Aviso de configuração obsoleto ###\n\nAs seguintes configurações são descontinuadas e serão removidas em uma futura versão\ndo A:\n{{configs}}\n\nPor favor, consulte\n\n https://github. om/jesseduffield/lazygit/blob/master/docs/Config.md#configuring-file-editor\n\npara informações atualizadas como configurar seu editor.\n\n",
|
||||
"GitconfigParseErr": "Gogit falhou ao analisar seu arquivo gitconfig devido à presença de caracteres '\\' não citados. Removendo-os deve corrigir o problema.",
|
||||
"EditFile": "Editar arquivo",
|
||||
"EditFileTooltip": "Abrir arquivo no editor externo.",
|
||||
"OpenFile": "Abrir arquivo",
|
||||
"OpenFileTooltip": "Abrir arquivo no aplicativo padrão.",
|
||||
"OpenInEditor": "Abrir no editor",
|
||||
"IgnoreFile": "Adicionar ao .gitignore",
|
||||
"ExcludeFile": "Adicionar ao .git/info/exclui",
|
||||
"RefreshFiles": "Atualizar arquivos",
|
||||
"Merge": "Mesclar",
|
||||
"RegularMerge": "Mesclagem regular",
|
||||
"MergeBranchTooltip": "Ver opções para mesclar o item selecionado no branch atual (mesclar regularmente, mesclar squash)",
|
||||
"ConfirmQuit": "Tem a certeza de que pretende sair?",
|
||||
"SwitchRepo": "Mudar para um repositório recente",
|
||||
"AllBranchesLogGraph": "Mostrar todos os logs da branch",
|
||||
"UnsupportedGitService": "Serviço git não suportado",
|
||||
"CopyPullRequestURL": "Copiar URL do pull request para área de transferência",
|
||||
"NoBranchOnRemote": "Este branch não existe no remoto. Primeiro, você precisa fazer push para o remoto.",
|
||||
"Fetch": "Buscar",
|
||||
"FetchTooltip": "Buscar alterações do controle remoto.",
|
||||
"NoAutomaticGitFetchTitle": "Sem busca automática no git",
|
||||
"NoAutomaticGitFetchBody": "Lazygit não pode usar \"git fetch\" em um repositório privado; use 'f' no painel de arquivos para executar \"git fetch\" manualmente",
|
||||
"FileEnter": "Stage lines / Colapso diretório",
|
||||
"FileEnterTooltip": "Se o item selecionado for um arquivo, o foco na exibição de preparo para o estágio de cenas/linhas individuais. Se o item selecionado for um diretório, recolher/expandi-lo.",
|
||||
"FileStagingRequirements": "Só pode stage linhas individuais para arquivos rastreados",
|
||||
"StageSelectionTooltip": "Ativar/desativar seleção em staged/unstaged",
|
||||
"DiscardSelection": "Descartar",
|
||||
"DiscardSelectionTooltip": "Quando a mudança não desejada for selecionada, descarte a mudança usando `git reset`. Quando a mudança em fase é selecionada, despare a mudança.",
|
||||
"ToggleSelectHunk": "Selecione o local",
|
||||
"ToggleSelectHunkTooltip": "Ativa/desativa modo seleção de hunk ",
|
||||
"ToggleSelectionForPatch": "Alternar linhas no caminho",
|
||||
"EditHunk": "Editar hunk",
|
||||
"EditHunkTooltip": "Editar o local selecionado no editor externo.",
|
||||
"ToggleStagingView": "Mudar de visão",
|
||||
"ToggleStagingViewTooltip": "Alternar para outra visão (staged/não processadas alterações).",
|
||||
"ReturnToFilesPanel": "Retornar ao painel de arquivos",
|
||||
"FastForward": "Avanço rápido",
|
||||
"FastForwardTooltip": "Encaminhamento rápido de branch selecionada a partir do upstream.",
|
||||
"FastForwarding": "Encaminhamento rápido",
|
||||
"FoundConflictsTitle": "Conflitos!",
|
||||
"ViewConflictsMenuItem": "Visualizar conflitos",
|
||||
"AbortMenuItem": "Abortar %s",
|
||||
"PickHunk": "Escolha o local",
|
||||
"PickAllHunks": "Pegar todos os pedaços",
|
||||
"ViewMergeRebaseOptions": "Ver opções de mesclar/rebase",
|
||||
"ViewMergeRebaseOptionsTooltip": "Ver opções para abortar/continuar/pular o merge/rebase atual.",
|
||||
"ViewMergeOptions": "Visualizar opções de merge",
|
||||
"ViewRebaseOptions": "Ver opções de rebase",
|
||||
"NotMergingOrRebasing": "Você não está atualmente nem rebasing nem mesclando",
|
||||
"AlreadyRebasing": "Não é possível executar esta ação durante uma rebase",
|
||||
"RecentRepos": "Repositórios recentes",
|
||||
"MergeOptionsTitle": "Opções de mesclagem",
|
||||
"RebaseOptionsTitle": "Opções de rebase",
|
||||
"CommitSummaryTitle": "Sumário do commit",
|
||||
"CommitDescriptionTitle": "Descrição de Commit",
|
||||
"CommitDescriptionSubTitle": "Pressione {{.togglePanelKeyBinding}} para alternar o foco, {{.commitMenuKeybinding}} para abrir o menu",
|
||||
"LocalBranchesTitle": "Branches locais",
|
||||
"SearchTitle": "Procurar",
|
||||
"TagsTitle": "Etiquetas",
|
||||
"MenuTitle": "Menu",
|
||||
"CommitMenuTitle": "Menu de Commit",
|
||||
"RemotesTitle": "Remotes",
|
||||
"RemoteBranchesTitle": "Branches remotos",
|
||||
"PatchBuildingTitle": "Painel principal (patch build)",
|
||||
"InformationTitle": "Informações",
|
||||
"SecondaryTitle": "Secundário",
|
||||
"ReflogCommitsTitle": "Reflog",
|
||||
"ConflictsResolved": "Todos os conflitos de merge resolvidos. Continuar?",
|
||||
"Continue": "Continuar",
|
||||
"RebasingTitle": "Rebase '{{.checkedOutBranch}}'",
|
||||
"RebasingFromBaseCommitTitle": "Rebase '{{.checkedOutBranch}}' de uma base marcada",
|
||||
"SimpleRebase": "Rebase simples para '{{.ref}}'",
|
||||
"InteractiveRebase": "Rebase interativa em '{{.ref}}'",
|
||||
"RebaseOntoBaseBranch": "Rebase no ramo base ({{.baseBranch}})",
|
||||
"InteractiveRebaseTooltip": "Comece uma rebase interativa com uma pausa no início, então você pode atualizar os commits TODO antes de continuar.",
|
||||
"RebaseOntoBaseBranchTooltip": "Rebase o branch check-out em seu ramo base (ou seja, o ramo principal mais próximo).",
|
||||
"MustSelectTodoCommits": "Ao rebaste, esta ação só funciona numa seleção de commits do TODO.",
|
||||
"FwdNoUpstream": "Não é possível encaminhar rapidamente um branch sem upstream",
|
||||
"FwdNoLocalUpstream": "Não é possível encaminhar rapidamente um branch cujo controle remoto não está registrado localmente",
|
||||
"FwdCommitsToPush": "Não é possível encaminhar um branch com commits para fazer push",
|
||||
"PullRequestNoUpstream": "Não é possível abrir uma pull request para um branch sem upstream",
|
||||
"ErrorOccurred": "Ocorreu um erro! Por favor, crie um problema em",
|
||||
"NoRoom": "Sala insuficiente",
|
||||
"YouAreHere": "VOCÊ ESTÁ AQUI",
|
||||
"YouDied": "VOCÊ MORREU!",
|
||||
"RewordNotSupported": "Reredacção de commits enquanto rebasing interativamente não é suportado atualmente",
|
||||
"ChangingThisActionIsNotAllowed": "Não é permitido alterar este tipo de rebase de tarefas",
|
||||
"CherryPickCopy": "Copiar (cherry-pick)",
|
||||
"CherryPickCopyTooltip": "Marcar commit como copiado. Então, dentro da visualização local de commits, você pode pressionar `{{.paste}}` para colar (cherry-pick) o(s) commit(s) copiado(s) em seu branch de check-out. A qualquer momento você pode pressionar `{{.escape}}` para cancelar a seleção.",
|
||||
"CherryPickCopyRangeTooltip": "Marcar commits como copiados do último commit copiado para o commit selecionado.",
|
||||
"PasteCommits": "Colar (cherry-pick)",
|
||||
"SureCherryPick": "Tem certeza que deseja escolher os commits copiados nesse branch?",
|
||||
"CherryPick": "cherry-pick",
|
||||
"CannotCherryPickNonCommit": "Não é possível escolher este tipo de item de tarefa",
|
||||
"CannotCherryPickMergeCommit": "Commits de merge Cherry-picking não são suportados",
|
||||
"Donate": "Doar",
|
||||
"AskQuestion": "Faça perguntas",
|
||||
"PrevLine": "Selecione a linha anterior",
|
||||
"Actions": {},
|
||||
"Bisect": {},
|
||||
"Log": {},
|
||||
"BreakingChangesByVersion": {}
|
||||
}
|
||||
@@ -57,8 +57,8 @@
|
||||
"RefreshTooltip": "刷新git状态(即在后台上运行`git status`,`git branch`等命令以更新面板内容) 不会运行`git fetch`",
|
||||
"Push": "推送",
|
||||
"Pull": "拉取",
|
||||
"PushTooltip": "推送当前分支到它的上游。如果上游为配置,你可以在弹窗中配置上游分支。",
|
||||
"PullTooltip": "从当前分支的远程分支获取改动。如果上游为配置,你可以在弹窗中配置上游分支。",
|
||||
"PushTooltip": "推送当前分支到它的上游。如果上游未配置,你可以在弹窗中配置上游分支。",
|
||||
"PullTooltip": "从当前分支的远程分支获取改动。如果上游未配置,你可以在弹窗中配置上游分支。",
|
||||
"Scroll": "滚动",
|
||||
"FileFilter": "通过状态过滤文件",
|
||||
"CopyToClipboardMenu": "复制到剪贴板",
|
||||
@@ -253,7 +253,7 @@
|
||||
"FastForwarding": "抓取并快进",
|
||||
"FoundConflictsTitle": "自动合并失败",
|
||||
"ViewConflictsMenuItem": "查看冲突",
|
||||
"AbortMenuItem": "关于 %s",
|
||||
"AbortMenuItem": "中止 %s",
|
||||
"PickHunk": "选中区块",
|
||||
"PickAllHunks": "选中所有区块",
|
||||
"ViewMergeRebaseOptions": "查看 合并/变基 选项",
|
||||
|
||||
@@ -199,7 +199,7 @@
|
||||
"FastForwarding": "的擷取和快進中",
|
||||
"FoundConflictsTitle": "自動合併失敗",
|
||||
"ViewConflictsMenuItem": "檢視衝突",
|
||||
"AbortMenuItem": "關於%s",
|
||||
"AbortMenuItem": "中止%s",
|
||||
"PickHunk": "挑選程式碼片段",
|
||||
"PickAllHunks": "挑選所有程式碼片段",
|
||||
"ViewMergeRebaseOptions": "查看合併/變基選項",
|
||||
|
||||
@@ -52,6 +52,11 @@ func (self *CommitDescriptionPanelDriver) AddCoAuthor(author string) *CommitDesc
|
||||
return self
|
||||
}
|
||||
|
||||
func (self *CommitDescriptionPanelDriver) Clear() *CommitDescriptionPanelDriver {
|
||||
self.getViewDriver().Clear()
|
||||
return self
|
||||
}
|
||||
|
||||
func (self *CommitDescriptionPanelDriver) Title(expected *TextMatcher) *CommitDescriptionPanelDriver {
|
||||
self.getViewDriver().Title(expected)
|
||||
|
||||
|
||||
@@ -39,20 +39,7 @@ func (self *CommitMessagePanelDriver) SwitchToDescription() *CommitDescriptionPa
|
||||
}
|
||||
|
||||
func (self *CommitMessagePanelDriver) Clear() *CommitMessagePanelDriver {
|
||||
// clearing multiple times in case there's multiple lines
|
||||
// (the clear button only clears a single line at a time)
|
||||
maxAttempts := 100
|
||||
for i := 0; i < maxAttempts+1; i++ {
|
||||
if self.getViewDriver().getView().Buffer() == "" {
|
||||
break
|
||||
}
|
||||
|
||||
self.t.press(ClearKey)
|
||||
if i == maxAttempts {
|
||||
panic("failed to clear commit message panel")
|
||||
}
|
||||
}
|
||||
|
||||
self.getViewDriver().Clear()
|
||||
return self
|
||||
}
|
||||
|
||||
|
||||
@@ -174,6 +174,10 @@ func (self *Shell) EmptyCommit(message string) *Shell {
|
||||
return self.RunCommand([]string{"git", "commit", "--allow-empty", "-m", message})
|
||||
}
|
||||
|
||||
func (self *Shell) EmptyCommitWithBody(subject string, body string) *Shell {
|
||||
return self.RunCommand([]string{"git", "commit", "--allow-empty", "-m", subject, "-m", body})
|
||||
}
|
||||
|
||||
func (self *Shell) EmptyCommitDaysAgo(message string, daysAgo int) *Shell {
|
||||
return self.RunCommand([]string{"git", "commit", "--allow-empty", "--date", fmt.Sprintf("%d days ago", daysAgo), "-m", message})
|
||||
}
|
||||
@@ -190,6 +194,10 @@ func (self *Shell) Revert(ref string) *Shell {
|
||||
return self.RunCommand([]string{"git", "revert", ref})
|
||||
}
|
||||
|
||||
func (self *Shell) AssertRemoteTagNotFound(upstream, name string) *Shell {
|
||||
return self.RunCommandExpectError([]string{"git", "ls-remote", "--exit-code", upstream, fmt.Sprintf("refs/tags/%s", name)})
|
||||
}
|
||||
|
||||
func (self *Shell) CreateLightweightTag(name string, ref string) *Shell {
|
||||
return self.RunCommand([]string{"git", "tag", name, ref})
|
||||
}
|
||||
|
||||
@@ -40,6 +40,24 @@ func (self *ViewDriver) Title(expected *TextMatcher) *ViewDriver {
|
||||
return self
|
||||
}
|
||||
|
||||
func (self *ViewDriver) Clear() *ViewDriver {
|
||||
// clearing multiple times in case there's multiple lines
|
||||
// (the clear button only clears a single line at a time)
|
||||
maxAttempts := 100
|
||||
for i := 0; i < maxAttempts+1; i++ {
|
||||
if self.getView().Buffer() == "" {
|
||||
break
|
||||
}
|
||||
|
||||
self.t.press(ClearKey)
|
||||
if i == maxAttempts {
|
||||
panic("failed to clear view buffer")
|
||||
}
|
||||
}
|
||||
|
||||
return self
|
||||
}
|
||||
|
||||
// asserts that the view has lines matching the given matchers. One matcher must be passed for each line.
|
||||
// If you only care about the top n lines, use the TopLines method instead.
|
||||
// If you only care about a subset of lines, use the ContainsLines method instead.
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package branch
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
// Regression test for deleting the last branch in the unfiltered list while
|
||||
// filtering is on. This used to cause a segfault.
|
||||
var DeleteWhileFiltering = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Delete a local branch while there's a filter in the branches panel",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.GetAppState().LocalBranchSortOrder = "alphabetic"
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("one")
|
||||
shell.NewBranch("branch1")
|
||||
shell.NewBranch("branch2")
|
||||
shell.Checkout("master")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Branches().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("master").IsSelected(),
|
||||
Contains("branch1"),
|
||||
Contains("branch2"),
|
||||
).
|
||||
FilterOrSearch("branch").
|
||||
Lines(
|
||||
Contains("branch1").IsSelected(),
|
||||
Contains("branch2"),
|
||||
).
|
||||
SelectNextItem().
|
||||
Press(keys.Universal.Remove).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().
|
||||
Menu().
|
||||
Title(Equals("Delete branch 'branch2'?")).
|
||||
Select(Contains("Delete local branch")).
|
||||
Confirm()
|
||||
}).
|
||||
Lines(
|
||||
Contains("branch1").IsSelected(),
|
||||
)
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,41 @@
|
||||
package commit
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var AmendWhenThereAreConflictsAndAmend = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Amends the last commit from the files panel while a rebase is stopped due to conflicts, and amends the commit",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
setupForAmendTests(shell)
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
doTheRebaseForAmendTests(t, keys)
|
||||
|
||||
t.Views().Files().
|
||||
Press(keys.Commits.AmendToCommit)
|
||||
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Amend commit")).
|
||||
Select(Equals("Yes, amend previous commit")).
|
||||
Confirm()
|
||||
|
||||
t.Views().Files().IsEmpty()
|
||||
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("pick").Contains("commit three"),
|
||||
Contains("conflict").Contains("<-- YOU ARE HERE --- file1 changed in branch"),
|
||||
Contains("commit two"),
|
||||
Contains("file1 changed in master"),
|
||||
Contains("base commit"),
|
||||
)
|
||||
|
||||
checkCommitContainsChange(t, "commit two", "+branch")
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,43 @@
|
||||
package commit
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var AmendWhenThereAreConflictsAndCancel = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Amends the last commit from the files panel while a rebase is stopped due to conflicts, and cancels the confirmation",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
setupForAmendTests(shell)
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
doTheRebaseForAmendTests(t, keys)
|
||||
|
||||
t.Views().Files().
|
||||
Press(keys.Commits.AmendToCommit)
|
||||
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Amend commit")).
|
||||
Select(Equals("Cancel")).
|
||||
Confirm()
|
||||
|
||||
// Check that nothing happened:
|
||||
t.Views().Files().
|
||||
Lines(
|
||||
Contains("M file1"),
|
||||
)
|
||||
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("pick").Contains("commit three"),
|
||||
Contains("conflict").Contains("<-- YOU ARE HERE --- file1 changed in branch"),
|
||||
Contains("commit two"),
|
||||
Contains("file1 changed in master"),
|
||||
Contains("base commit"),
|
||||
)
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,41 @@
|
||||
package commit
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var AmendWhenThereAreConflictsAndContinue = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Amends the last commit from the files panel while a rebase is stopped due to conflicts, and continues the rebase",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
setupForAmendTests(shell)
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
doTheRebaseForAmendTests(t, keys)
|
||||
|
||||
t.Views().Files().
|
||||
Press(keys.Commits.AmendToCommit)
|
||||
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Amend commit")).
|
||||
Select(Equals("No, continue rebase")).
|
||||
Confirm()
|
||||
|
||||
t.Views().Files().IsEmpty()
|
||||
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("commit three"),
|
||||
Contains("file1 changed in branch"),
|
||||
Contains("commit two"),
|
||||
Contains("file1 changed in master"),
|
||||
Contains("base commit"),
|
||||
)
|
||||
|
||||
checkCommitContainsChange(t, "file1 changed in branch", "+branch")
|
||||
},
|
||||
})
|
||||
@@ -32,10 +32,11 @@ var Checkout = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Contains("Checkout branch or commit")).
|
||||
Lines(
|
||||
Contains("Checkout branch").IsSelected(),
|
||||
MatchesRegexp("Checkout commit [a-f0-9]+ as detached head"),
|
||||
MatchesRegexp("Checkout commit [a-f0-9]+ as detached head").IsSelected(),
|
||||
Contains("Checkout branch"),
|
||||
Contains("Cancel"),
|
||||
).
|
||||
Select(Contains("Checkout branch")).
|
||||
Tooltip(Contains("Disabled: No branches found at selected commit.")).
|
||||
Select(MatchesRegexp("Checkout commit [a-f0-9]+ as detached head")).
|
||||
Confirm()
|
||||
@@ -53,9 +54,9 @@ var Checkout = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Contains("Checkout branch or commit")).
|
||||
Lines(
|
||||
Contains("Checkout branch 'branch1'").IsSelected(),
|
||||
MatchesRegexp("Checkout commit [a-f0-9]+ as detached head").IsSelected(),
|
||||
Contains("Checkout branch 'branch1'"),
|
||||
Contains("Checkout branch 'master'"),
|
||||
MatchesRegexp("Checkout commit [a-f0-9]+ as detached head"),
|
||||
Contains("Cancel"),
|
||||
).
|
||||
Select(Contains("Checkout branch 'master'")).
|
||||
|
||||
@@ -10,7 +10,7 @@ var CommitWipWithPrefix = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(cfg *config.AppConfig) {
|
||||
cfg.GetUserConfig().Git.CommitPrefixes = map[string]config.CommitPrefixConfig{"repo": {Pattern: "^\\w+\\/(\\w+-\\w+).*", Replace: "[$1]: "}}
|
||||
cfg.GetUserConfig().Git.CommitPrefixes = map[string][]config.CommitPrefixConfig{"repo": {{Pattern: "^\\w+\\/(\\w+-\\w+).*", Replace: "[$1]: "}}}
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.NewBranch("feature/TEST-002")
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package commit
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var CommitWithFallthroughPrefix = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Commit with multiple CommitPrefixConfig",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(cfg *config.AppConfig) {
|
||||
cfg.GetUserConfig().Git.CommitPrefix = []config.CommitPrefixConfig{
|
||||
{Pattern: "^doesntmatch-(\\w+).*", Replace: "[BAD $1]: "},
|
||||
{Pattern: "^\\w+\\/(\\w+-\\w+).*", Replace: "[GOOD $1]: "},
|
||||
}
|
||||
cfg.GetUserConfig().Git.CommitPrefixes = map[string][]config.CommitPrefixConfig{
|
||||
"DifferentProject": {{Pattern: "^otherthatdoesn'tmatch-(\\w+).*", Replace: "[BAD $1]: "}},
|
||||
}
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.NewBranch("feature/TEST-001")
|
||||
shell.CreateFile("test-commit-prefix", "This is foo bar")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().
|
||||
IsEmpty()
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
PressPrimaryAction().
|
||||
Press(keys.Files.CommitChanges)
|
||||
|
||||
t.ExpectPopup().CommitMessagePanel().
|
||||
Title(Equals("Commit summary")).
|
||||
InitialText(Equals("[GOOD TEST-001]: ")).
|
||||
Type("my commit message").
|
||||
Cancel()
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
Press(keys.Files.CommitChanges)
|
||||
|
||||
t.ExpectPopup().CommitMessagePanel().
|
||||
Title(Equals("Commit summary")).
|
||||
InitialText(Equals("[GOOD TEST-001]: my commit message")).
|
||||
Type(". Added something else").
|
||||
Confirm()
|
||||
|
||||
t.Views().Commits().Focus()
|
||||
t.Views().Main().Content(Contains("[GOOD TEST-001]: my commit message. Added something else"))
|
||||
},
|
||||
})
|
||||
@@ -10,7 +10,7 @@ var CommitWithGlobalPrefix = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(cfg *config.AppConfig) {
|
||||
cfg.GetUserConfig().Git.CommitPrefix = &config.CommitPrefixConfig{Pattern: "^\\w+\\/(\\w+-\\w+).*", Replace: "[$1]: "}
|
||||
cfg.GetUserConfig().Git.CommitPrefix = []config.CommitPrefixConfig{{Pattern: "^\\w+\\/(\\w+-\\w+).*", Replace: "[$1]: "}}
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.NewBranch("feature/TEST-001")
|
||||
|
||||
@@ -10,10 +10,10 @@ var CommitWithNonMatchingBranchName = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(cfg *config.AppConfig) {
|
||||
cfg.GetUserConfig().Git.CommitPrefix = &config.CommitPrefixConfig{
|
||||
cfg.GetUserConfig().Git.CommitPrefix = []config.CommitPrefixConfig{{
|
||||
Pattern: "^\\w+\\/(\\w+-\\w+).*",
|
||||
Replace: "[$1]: ",
|
||||
}
|
||||
}}
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.NewBranch("branchnomatch")
|
||||
|
||||
@@ -10,11 +10,11 @@ var CommitWithPrefix = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(cfg *config.AppConfig) {
|
||||
cfg.GetUserConfig().Git.CommitPrefixes = map[string]config.CommitPrefixConfig{
|
||||
"repo": {
|
||||
cfg.GetUserConfig().Git.CommitPrefixes = map[string][]config.CommitPrefixConfig{
|
||||
"repo": {{
|
||||
Pattern: `^\w+/(\w+-\w+).*`,
|
||||
Replace: "[$1]: ",
|
||||
},
|
||||
}},
|
||||
}
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
|
||||
@@ -12,8 +12,7 @@ var CopyAuthorToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
// Include delimiters around the text so that we can assert on the entire content
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "echo /{{text}}/ > clipboard"
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > clipboard"
|
||||
},
|
||||
|
||||
SetupRepo: func(shell *Shell) {
|
||||
@@ -36,13 +35,6 @@ var CopyAuthorToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
t.ExpectToast(Equals("Commit author copied to clipboard"))
|
||||
|
||||
t.Views().Files().
|
||||
Focus().
|
||||
Press(keys.Files.RefreshFiles).
|
||||
Lines(
|
||||
Contains("clipboard").IsSelected(),
|
||||
)
|
||||
|
||||
t.Views().Main().Content(Contains("/John Doe <john@doe.com>/"))
|
||||
t.FileSystem().FileContent("clipboard", Equals("John Doe <john@doe.com>"))
|
||||
},
|
||||
})
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package commit
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
// We're emulating the clipboard by writing to a file called clipboard
|
||||
|
||||
var CopyMessageBodyToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Copy a commit message body to the clipboard",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > clipboard"
|
||||
},
|
||||
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommitWithBody("My Subject", "My awesome commit message body")
|
||||
},
|
||||
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("My Subject").IsSelected(),
|
||||
).
|
||||
Press(keys.Commits.CopyCommitAttributeToClipboard)
|
||||
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Copy to clipboard")).
|
||||
Select(Contains("Commit message body")).
|
||||
Confirm()
|
||||
|
||||
t.ExpectToast(Equals("Commit message body copied to clipboard"))
|
||||
|
||||
t.FileSystem().FileContent("clipboard", Equals("My awesome commit message body"))
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,42 @@
|
||||
package commit
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
// We're emulating the clipboard by writing to a file called clipboard
|
||||
|
||||
var CopyTagToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Copy a commit tag to the clipboard",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > clipboard"
|
||||
},
|
||||
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.SetAuthor("John Doe", "john@doe.com")
|
||||
shell.EmptyCommit("commit")
|
||||
shell.CreateLightweightTag("tag1", "HEAD")
|
||||
shell.CreateLightweightTag("tag2", "HEAD")
|
||||
},
|
||||
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("commit").IsSelected(),
|
||||
).
|
||||
Press(keys.Commits.CopyCommitAttributeToClipboard)
|
||||
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Copy to clipboard")).
|
||||
Select(Contains("Commit tags")).
|
||||
Confirm()
|
||||
|
||||
t.ExpectToast(Equals("Commit tags copied to clipboard"))
|
||||
|
||||
t.FileSystem().FileContent("clipboard", Equals("tag2\ntag1"))
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,33 @@
|
||||
package commit
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var DisableCopyCommitMessageBody = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Disables copy commit message body when there is no body",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("commit")
|
||||
},
|
||||
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("commit").IsSelected(),
|
||||
).
|
||||
Press(keys.Commits.CopyCommitAttributeToClipboard)
|
||||
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Copy to clipboard")).
|
||||
Select(Contains("Commit message body")).
|
||||
Confirm()
|
||||
|
||||
t.ExpectToast(Equals("Disabled: Commit has no message body"))
|
||||
},
|
||||
})
|
||||
@@ -10,7 +10,7 @@ var PasteCommitMessage = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "echo {{text}} > ../clipboard"
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > ../clipboard"
|
||||
config.GetUserConfig().OS.ReadFromClipboardCmd = "cat ../clipboard"
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
@@ -26,7 +26,7 @@ var PasteCommitMessage = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Press(keys.Commits.CopyCommitAttributeToClipboard)
|
||||
|
||||
t.ExpectPopup().Menu().Title(Equals("Copy to clipboard")).
|
||||
Select(Contains("Commit message")).Confirm()
|
||||
Select(Contains("Commit message (subject and body)")).Confirm()
|
||||
|
||||
t.ExpectToast(Equals("Commit message copied to clipboard"))
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ var PasteCommitMessageOverExisting = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "echo {{text}} > ../clipboard"
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > ../clipboard"
|
||||
config.GetUserConfig().OS.ReadFromClipboardCmd = "cat ../clipboard"
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
@@ -26,7 +26,7 @@ var PasteCommitMessageOverExisting = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Press(keys.Commits.CopyCommitAttributeToClipboard)
|
||||
|
||||
t.ExpectPopup().Menu().Title(Equals("Copy to clipboard")).
|
||||
Select(Contains("Commit message")).Confirm()
|
||||
Select(Contains("Commit message (subject and body)")).Confirm()
|
||||
|
||||
t.ExpectToast(Equals("Commit message copied to clipboard"))
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ var PreserveCommitMessage = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Type("second paragraph").
|
||||
Cancel()
|
||||
|
||||
t.FileSystem().PathPresent(".git/LAZYGIT_PENDING_COMMIT")
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
Press(keys.Files.CommitChanges)
|
||||
@@ -35,6 +37,22 @@ var PreserveCommitMessage = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
t.ExpectPopup().CommitMessagePanel().
|
||||
Content(Equals("my commit message")).
|
||||
SwitchToDescription().
|
||||
Content(Equals("first paragraph\n\nsecond paragraph"))
|
||||
Content(Equals("first paragraph\n\nsecond paragraph")).
|
||||
Clear().
|
||||
SwitchToSummary().
|
||||
Clear().
|
||||
Cancel()
|
||||
|
||||
t.FileSystem().PathNotPresent(".git/LAZYGIT_PENDING_COMMIT")
|
||||
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
Press(keys.Files.CommitChanges)
|
||||
|
||||
t.ExpectPopup().CommitMessagePanel().
|
||||
Type("my new commit message").
|
||||
Confirm()
|
||||
|
||||
t.FileSystem().PathNotPresent(".git/LAZYGIT_PENDING_COMMIT")
|
||||
},
|
||||
})
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package commit
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
func setupForAmendTests(shell *Shell) {
|
||||
shell.EmptyCommit("base commit")
|
||||
shell.NewBranch("branch")
|
||||
shell.Checkout("master")
|
||||
shell.CreateFileAndAdd("file1", "master")
|
||||
shell.Commit("file1 changed in master")
|
||||
shell.Checkout("branch")
|
||||
shell.UpdateFileAndAdd("file2", "two")
|
||||
shell.Commit("commit two")
|
||||
shell.CreateFileAndAdd("file1", "branch")
|
||||
shell.Commit("file1 changed in branch")
|
||||
shell.UpdateFileAndAdd("file3", "three")
|
||||
shell.Commit("commit three")
|
||||
}
|
||||
|
||||
func doTheRebaseForAmendTests(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("commit three").IsSelected(),
|
||||
Contains("file1 changed in branch"),
|
||||
Contains("commit two"),
|
||||
Contains("base commit"),
|
||||
)
|
||||
t.Views().Branches().
|
||||
Focus().
|
||||
NavigateToLine(Contains("master")).
|
||||
Press(keys.Branches.RebaseBranch).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Rebase 'branch'")).
|
||||
Select(Contains("Simple rebase")).
|
||||
Confirm()
|
||||
t.Common().AcknowledgeConflicts()
|
||||
})
|
||||
|
||||
t.Views().Commits().
|
||||
Lines(
|
||||
Contains("pick").Contains("commit three"),
|
||||
Contains("conflict").Contains("<-- YOU ARE HERE --- file1 changed in branch"),
|
||||
Contains("commit two"),
|
||||
Contains("file1 changed in master"),
|
||||
Contains("base commit"),
|
||||
)
|
||||
|
||||
t.Views().Files().
|
||||
Focus().
|
||||
PressEnter()
|
||||
|
||||
t.Views().MergeConflicts().
|
||||
IsFocused().
|
||||
SelectNextItem(). // choose "incoming"
|
||||
PressPrimaryAction()
|
||||
|
||||
t.ExpectPopup().Confirmation().
|
||||
Title(Equals("Continue")).
|
||||
Content(Contains("All merge conflicts resolved. Continue?")).
|
||||
Cancel()
|
||||
}
|
||||
|
||||
func checkCommitContainsChange(t *TestDriver, commitSubject string, change string) {
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
NavigateToLine(Contains(commitSubject))
|
||||
t.Views().Main().
|
||||
Content(Contains(change))
|
||||
}
|
||||
@@ -25,7 +25,7 @@ var Filter = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Filtering")).
|
||||
Select(Contains("Reset filter")).
|
||||
Select(Contains("No filter")).
|
||||
Confirm()
|
||||
}).
|
||||
Lines(
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package custom_commands
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var SelectedCommitRange = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Use the {{ .SelectedCommitRange }} template variable",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateNCommits(3)
|
||||
},
|
||||
SetupConfig: func(cfg *config.AppConfig) {
|
||||
cfg.GetUserConfig().CustomCommands = []config.CustomCommand{
|
||||
{
|
||||
Key: "X",
|
||||
Context: "global",
|
||||
Command: `git log --format="%s" {{.SelectedCommitRange.From}}^..{{.SelectedCommitRange.To}} > file.txt`,
|
||||
},
|
||||
}
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().Focus().
|
||||
Lines(
|
||||
Contains("commit 03").IsSelected(),
|
||||
Contains("commit 02"),
|
||||
Contains("commit 01"),
|
||||
)
|
||||
|
||||
t.GlobalPress("X")
|
||||
t.FileSystem().FileContent("file.txt", Equals("commit 03\n"))
|
||||
|
||||
t.Views().Commits().Focus().
|
||||
Press(keys.Universal.RangeSelectDown)
|
||||
|
||||
t.GlobalPress("X")
|
||||
t.FileSystem().FileContent("file.txt", Equals("commit 03\ncommit 02\n"))
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,123 @@
|
||||
package diff
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
// note: this is required to simulate the clipboard during CI
|
||||
func expectClipboard(t *TestDriver, matcher *TextMatcher) {
|
||||
defer t.Shell().DeleteFile("clipboard")
|
||||
|
||||
t.FileSystem().FileContent("clipboard", matcher)
|
||||
}
|
||||
|
||||
var CopyToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "The copy menu allows to copy name and diff of selected/all files",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > clipboard"
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.CreateDir("dir")
|
||||
shell.CreateFileAndAdd("dir/file1", "1st line\n")
|
||||
shell.Commit("1")
|
||||
shell.CreateFileAndAdd("dir/file1", "1st line\n2nd line\n")
|
||||
shell.CreateFileAndAdd("dir/file2", "file2\n")
|
||||
shell.Commit("2")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("2").IsSelected(),
|
||||
Contains("1"),
|
||||
).
|
||||
PressEnter()
|
||||
|
||||
t.Views().CommitFiles().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("dir").IsSelected(),
|
||||
Contains("file1"),
|
||||
Contains("file2"),
|
||||
).
|
||||
NavigateToLine(Contains("file1")).
|
||||
Press(keys.Files.CopyFileInfoToClipboard).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Copy to clipboard")).
|
||||
Select(Contains("File name")).
|
||||
Confirm().
|
||||
Tap(func() {
|
||||
t.ExpectToast(Equals("File name copied to clipboard"))
|
||||
expectClipboard(t, Equals("file1"))
|
||||
})
|
||||
}).
|
||||
Press(keys.Files.CopyFileInfoToClipboard).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Copy to clipboard")).
|
||||
Select(Contains("Path")).
|
||||
Confirm().
|
||||
Tap(func() {
|
||||
t.ExpectToast(Equals("File path copied to clipboard"))
|
||||
expectClipboard(t, Equals("dir/file1"))
|
||||
})
|
||||
}).
|
||||
Press(keys.Files.CopyFileInfoToClipboard).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Copy to clipboard")).
|
||||
Select(Contains("Diff of selected file")).
|
||||
Confirm().
|
||||
Tap(func() {
|
||||
t.ExpectToast(Equals("File diff copied to clipboard"))
|
||||
expectClipboard(t,
|
||||
Contains("diff --git a/dir/file1 b/dir/file1").Contains("+2nd line").DoesNotContain("+1st line").
|
||||
DoesNotContain("diff --git a/dir/file2 b/dir/file2").DoesNotContain("+file2"))
|
||||
})
|
||||
}).
|
||||
Press(keys.Files.CopyFileInfoToClipboard).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Copy to clipboard")).
|
||||
Select(Contains("Diff of all files")).
|
||||
Confirm().
|
||||
Tap(func() {
|
||||
t.ExpectToast(Equals("All files diff copied to clipboard"))
|
||||
expectClipboard(t,
|
||||
Contains("diff --git a/dir/file1 b/dir/file1").Contains("+2nd line").DoesNotContain("+1st line").
|
||||
Contains("diff --git a/dir/file2 b/dir/file2").Contains("+file2"))
|
||||
})
|
||||
})
|
||||
|
||||
t.Views().Commits().
|
||||
Focus().
|
||||
// Select both commits
|
||||
Press(keys.Universal.RangeSelectDown).
|
||||
PressEnter()
|
||||
|
||||
t.Views().CommitFiles().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("dir").IsSelected(),
|
||||
Contains("file1"),
|
||||
Contains("file2"),
|
||||
).
|
||||
NavigateToLine(Contains("file1")).
|
||||
Press(keys.Files.CopyFileInfoToClipboard).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Copy to clipboard")).
|
||||
Select(Contains("Diff of selected file")).
|
||||
Confirm().
|
||||
Tap(func() {
|
||||
t.ExpectToast(Equals("File diff copied to clipboard"))
|
||||
expectClipboard(t,
|
||||
Contains("diff --git a/dir/file1 b/dir/file1").Contains("+1st line").Contains("+2nd line"))
|
||||
})
|
||||
})
|
||||
},
|
||||
})
|
||||
@@ -17,7 +17,7 @@ var CopyMenu = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "echo {{text}} > clipboard"
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > clipboard"
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
@@ -100,7 +100,7 @@ var CopyMenu = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
t.ExpectToast(Equals("File name copied to clipboard"))
|
||||
|
||||
expectClipboard(t, Contains("unstaged_file"))
|
||||
expectClipboard(t, Equals("1-unstaged_file"))
|
||||
})
|
||||
|
||||
// Copy file path
|
||||
@@ -114,7 +114,7 @@ var CopyMenu = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
t.ExpectToast(Equals("File path copied to clipboard"))
|
||||
|
||||
expectClipboard(t, Contains("dir/1-unstaged_file"))
|
||||
expectClipboard(t, Equals("dir/1-unstaged_file"))
|
||||
})
|
||||
|
||||
// Selected path diff on a single (unstaged) file
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package filter_and_search
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var FilterByFileStatus = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Filtering to show untracked files in repo that hides them by default",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
// need to set untracked files to not be displayed in git config
|
||||
shell.SetConfig("status.showUntrackedFiles", "no")
|
||||
|
||||
shell.CreateFileAndAdd("file-tracked", "foo")
|
||||
|
||||
shell.Commit("first commit")
|
||||
|
||||
shell.CreateFile("file-untracked", "bar")
|
||||
shell.UpdateFile("file-tracked", "baz")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Files().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains(`file-tracked`).IsSelected(),
|
||||
).
|
||||
Press(keys.Files.OpenStatusFilter).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Filtering")).
|
||||
Select(Contains("Show only untracked files")).
|
||||
Confirm()
|
||||
}).
|
||||
Lines(
|
||||
Contains(`file-untracked`).IsSelected(),
|
||||
).
|
||||
Press(keys.Files.OpenStatusFilter).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Filtering")).
|
||||
Select(Contains("Show only tracked files")).
|
||||
Confirm()
|
||||
}).
|
||||
Lines(
|
||||
Contains(`file-tracked`).IsSelected(),
|
||||
).
|
||||
Press(keys.Files.OpenStatusFilter).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Menu().
|
||||
Title(Equals("Filtering")).
|
||||
Select(Contains("No filter")).
|
||||
Confirm()
|
||||
}).
|
||||
Lines(
|
||||
Contains(`file-tracked`).IsSelected(),
|
||||
)
|
||||
},
|
||||
})
|
||||
@@ -12,7 +12,7 @@ var CopyToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "echo {{text}} > clipboard"
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > clipboard"
|
||||
},
|
||||
|
||||
SetupRepo: func(shell *Shell) {
|
||||
@@ -34,13 +34,6 @@ var CopyToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
|
||||
t.GlobalPress(keys.Files.RefreshFiles)
|
||||
|
||||
// Expect to see the clipboard file with contents
|
||||
t.Views().Files().
|
||||
IsFocused().
|
||||
Lines(
|
||||
Contains("clipboard").IsSelected(),
|
||||
)
|
||||
|
||||
t.Views().Main().Content(Contains("branch-a"))
|
||||
t.FileSystem().FileContent("clipboard", Equals("branch-a"))
|
||||
},
|
||||
})
|
||||
|
||||
@@ -31,5 +31,7 @@ var Rename = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
t.ExpectPopup().Prompt().Title(Equals("Rename stash: stash@{1}")).Type(" baz").Confirm()
|
||||
}).
|
||||
SelectedLine(Contains("On master: foo baz"))
|
||||
|
||||
t.Views().Main().Content(Contains("file-1"))
|
||||
},
|
||||
})
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package tag
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var CopyToClipboard = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Copy the tag to the clipboard",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {
|
||||
config.GetUserConfig().OS.CopyToClipboardCmd = "printf '%s' {{text}} > clipboard"
|
||||
},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("one")
|
||||
shell.CreateLightweightTag("super.l000ongtag", "HEAD")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Tags().
|
||||
Focus().
|
||||
Lines(
|
||||
Contains("tag").IsSelected(),
|
||||
).
|
||||
Press(keys.Universal.CopyToClipboard)
|
||||
|
||||
t.ExpectToast(Equals("'super.l000ongtag' copied to clipboard"))
|
||||
|
||||
t.FileSystem().FileContent("clipboard", Equals("super.l000ongtag"))
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,75 @@
|
||||
package tag
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/config"
|
||||
. "github.com/jesseduffield/lazygit/pkg/integration/components"
|
||||
)
|
||||
|
||||
var DeleteLocalAndRemote = NewIntegrationTest(NewIntegrationTestArgs{
|
||||
Description: "Create and delete both local and remote annotated tag",
|
||||
ExtraCmdArgs: []string{},
|
||||
Skip: false,
|
||||
SetupConfig: func(config *config.AppConfig) {},
|
||||
SetupRepo: func(shell *Shell) {
|
||||
shell.EmptyCommit("initial commit")
|
||||
shell.CloneIntoRemote("origin")
|
||||
},
|
||||
Run: func(t *TestDriver, keys config.KeybindingConfig) {
|
||||
t.Views().Tags().
|
||||
Focus().
|
||||
IsEmpty().
|
||||
Press(keys.Universal.New).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().CommitMessagePanel().
|
||||
Title(Equals("Tag name")).
|
||||
Type("new-tag").
|
||||
SwitchToDescription().
|
||||
Title(Equals("Tag description")).
|
||||
Type("message").
|
||||
SwitchToSummary().
|
||||
Confirm()
|
||||
}).
|
||||
Lines(
|
||||
MatchesRegexp(`new-tag.*message`).IsSelected(),
|
||||
).
|
||||
Press(keys.Universal.Push).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Prompt().
|
||||
Title(Equals("Remote to push tag 'new-tag' to:")).
|
||||
InitialText(Equals("origin")).
|
||||
SuggestionLines(
|
||||
Contains("origin"),
|
||||
).
|
||||
Confirm()
|
||||
}).
|
||||
Press(keys.Universal.Remove).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().
|
||||
Menu().
|
||||
Title(Equals("Delete tag 'new-tag'?")).
|
||||
Select(Contains("Delete local and remote tag")).
|
||||
Confirm()
|
||||
}).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().Prompt().
|
||||
Title(Equals("Remote from which to remove tag 'new-tag':")).
|
||||
InitialText(Equals("origin")).
|
||||
SuggestionLines(
|
||||
Contains("origin"),
|
||||
).
|
||||
Confirm()
|
||||
}).
|
||||
Tap(func() {
|
||||
t.ExpectPopup().
|
||||
Confirmation().
|
||||
Title(Equals("Delete tag 'new-tag'?")).
|
||||
Content(Equals("Are you sure you want to delete 'new-tag' from both your machine and from 'origin'?")).
|
||||
Confirm()
|
||||
}).
|
||||
IsEmpty().
|
||||
Press(keys.Universal.New).
|
||||
Tap(func() {
|
||||
t.Shell().AssertRemoteTagNotFound("origin", "new-tag")
|
||||
})
|
||||
},
|
||||
})
|
||||
@@ -45,6 +45,7 @@ var tests = []*components.IntegrationTest{
|
||||
branch.DeleteMultiple,
|
||||
branch.DeleteRemoteBranchWithCredentialPrompt,
|
||||
branch.DeleteRemoteBranchWithDifferentName,
|
||||
branch.DeleteWhileFiltering,
|
||||
branch.DetachedHead,
|
||||
branch.NewBranchAutostash,
|
||||
branch.NewBranchFromRemoteTrackingDifferentName,
|
||||
@@ -83,19 +84,26 @@ var tests = []*components.IntegrationTest{
|
||||
commit.AddCoAuthorRange,
|
||||
commit.AddCoAuthorWhileCommitting,
|
||||
commit.Amend,
|
||||
commit.AmendWhenThereAreConflictsAndAmend,
|
||||
commit.AmendWhenThereAreConflictsAndCancel,
|
||||
commit.AmendWhenThereAreConflictsAndContinue,
|
||||
commit.AutoWrapMessage,
|
||||
commit.Checkout,
|
||||
commit.Commit,
|
||||
commit.CommitMultiline,
|
||||
commit.CommitSwitchToEditor,
|
||||
commit.CommitWipWithPrefix,
|
||||
commit.CommitWithFallthroughPrefix,
|
||||
commit.CommitWithGlobalPrefix,
|
||||
commit.CommitWithNonMatchingBranchName,
|
||||
commit.CommitWithPrefix,
|
||||
commit.CopyAuthorToClipboard,
|
||||
commit.CopyMessageBodyToClipboard,
|
||||
commit.CopyTagToClipboard,
|
||||
commit.CreateAmendCommit,
|
||||
commit.CreateFixupCommitInBranchStack,
|
||||
commit.CreateTag,
|
||||
commit.DisableCopyCommitMessageBody,
|
||||
commit.DiscardOldFileChanges,
|
||||
commit.FindBaseCommitForFixup,
|
||||
commit.FindBaseCommitForFixupDisregardMainBranch,
|
||||
@@ -139,6 +147,7 @@ var tests = []*components.IntegrationTest{
|
||||
custom_commands.MultipleContexts,
|
||||
custom_commands.MultiplePrompts,
|
||||
custom_commands.SelectedCommit,
|
||||
custom_commands.SelectedCommitRange,
|
||||
custom_commands.SelectedPath,
|
||||
custom_commands.ShowOutputInPanel,
|
||||
custom_commands.SuggestionsCommand,
|
||||
@@ -158,6 +167,7 @@ var tests = []*components.IntegrationTest{
|
||||
demo.StageLines,
|
||||
demo.Undo,
|
||||
demo.WorktreeCreateFromBranches,
|
||||
diff.CopyToClipboard,
|
||||
diff.Diff,
|
||||
diff.DiffAndApplyPatch,
|
||||
diff.DiffCommits,
|
||||
@@ -181,6 +191,7 @@ var tests = []*components.IntegrationTest{
|
||||
file.StageChildrenRangeSelect,
|
||||
file.StageDeletedRangeSelect,
|
||||
file.StageRangeSelect,
|
||||
filter_and_search.FilterByFileStatus,
|
||||
filter_and_search.FilterCommitFiles,
|
||||
filter_and_search.FilterFiles,
|
||||
filter_and_search.FilterFuzzy,
|
||||
@@ -350,9 +361,11 @@ var tests = []*components.IntegrationTest{
|
||||
sync.RenameBranchAndPull,
|
||||
tag.Checkout,
|
||||
tag.CheckoutWhenBranchWithSameNameExists,
|
||||
tag.CopyToClipboard,
|
||||
tag.CreateWhileCommitting,
|
||||
tag.CrudAnnotated,
|
||||
tag.CrudLightweight,
|
||||
tag.DeleteLocalAndRemote,
|
||||
tag.ForceTagAnnotated,
|
||||
tag.ForceTagLightweight,
|
||||
tag.Reset,
|
||||
|
||||
+28
-18
@@ -137,21 +137,31 @@ func (self *ViewBufferManager) NewCmdTask(start func() (*exec.Cmd, io.Reader), p
|
||||
cmd, r := start()
|
||||
timeToStart := time.Since(startTime)
|
||||
|
||||
go utils.Safe(func() {
|
||||
<-opts.Stop
|
||||
// we use the time it took to start the program as a way of checking if things
|
||||
// are running slow at the moment. This is admittedly a crude estimate, but
|
||||
// the point is that we only want to throttle when things are running slow
|
||||
// and the user is flicking through a bunch of items.
|
||||
self.throttle = time.Since(startTime) < THROTTLE_TIME && timeToStart > COMMAND_START_THRESHOLD
|
||||
if err := oscommands.Kill(cmd); err != nil {
|
||||
if !strings.Contains(err.Error(), "process already finished") {
|
||||
self.Log.Errorf("error when running cmd task: %v", err)
|
||||
}
|
||||
}
|
||||
done := make(chan struct{})
|
||||
|
||||
// for pty's we need to call onDone here so that cmd.Wait() doesn't block forever
|
||||
onDone()
|
||||
go utils.Safe(func() {
|
||||
select {
|
||||
case <-done:
|
||||
// The command finished and did not have to be preemptively stopped before the next command.
|
||||
// No need to throttle.
|
||||
self.throttle = false
|
||||
case <-opts.Stop:
|
||||
// we use the time it took to start the program as a way of checking if things
|
||||
// are running slow at the moment. This is admittedly a crude estimate, but
|
||||
// the point is that we only want to throttle when things are running slow
|
||||
// and the user is flicking through a bunch of items.
|
||||
self.throttle = time.Since(startTime) < THROTTLE_TIME && timeToStart > COMMAND_START_THRESHOLD
|
||||
|
||||
// Kill the still-running command.
|
||||
if err := oscommands.Kill(cmd); err != nil {
|
||||
if !strings.Contains(err.Error(), "process already finished") {
|
||||
self.Log.Errorf("error when trying to kill cmd task: %v; Command: %v %v", err, cmd.Path, cmd.Args)
|
||||
}
|
||||
}
|
||||
|
||||
// for pty's we need to call onDone here so that cmd.Wait() doesn't block forever
|
||||
onDone()
|
||||
}
|
||||
})
|
||||
|
||||
loadingMutex := deadlock.Mutex{}
|
||||
@@ -159,8 +169,6 @@ func (self *ViewBufferManager) NewCmdTask(start func() (*exec.Cmd, io.Reader), p
|
||||
// not sure if it's the right move to redefine this or not
|
||||
self.readLines = make(chan LinesToRead, 1024)
|
||||
|
||||
done := make(chan struct{})
|
||||
|
||||
scanner := bufio.NewScanner(r)
|
||||
scanner.Split(utils.ScanLinesAndTruncateWhenLongerThanBuffer(bufio.MaxScanTokenSize))
|
||||
|
||||
@@ -269,8 +277,10 @@ func (self *ViewBufferManager) NewCmdTask(start func() (*exec.Cmd, io.Reader), p
|
||||
refreshViewIfStale()
|
||||
|
||||
if err := cmd.Wait(); err != nil {
|
||||
// it's fine if we've killed this program ourselves
|
||||
if !strings.Contains(err.Error(), "signal: killed") {
|
||||
select {
|
||||
case <-opts.Stop:
|
||||
// it's fine if we've killed this program ourselves
|
||||
default:
|
||||
self.Log.Errorf("Unexpected error when running cmd task: %v; Failed command: %v %v", err, cmd.Path, cmd.Args)
|
||||
}
|
||||
}
|
||||
|
||||
+10
-4
@@ -109,8 +109,10 @@ func ScanLinesAndTruncateWhenLongerThanBuffer(maxBufferSize int) func(data []byt
|
||||
// - the line indices of the original lines, indexed by the wrapped line indices
|
||||
// If wrap is false, the text is returned as is.
|
||||
// This code needs to behave the same as `gocui.lineWrap` does.
|
||||
func WrapViewLinesToWidth(wrap bool, text string, width int) ([]string, []int, []int) {
|
||||
text = strings.TrimSuffix(text, "\n")
|
||||
func WrapViewLinesToWidth(wrap bool, editable bool, text string, width int, tabWidth int) ([]string, []int, []int) {
|
||||
if !editable {
|
||||
text = strings.TrimSuffix(text, "\n")
|
||||
}
|
||||
lines := strings.Split(text, "\n")
|
||||
if !wrap {
|
||||
indices := make([]int, len(lines))
|
||||
@@ -124,14 +126,18 @@ func WrapViewLinesToWidth(wrap bool, text string, width int) ([]string, []int, [
|
||||
wrappedLineIndices := make([]int, 0, len(lines))
|
||||
originalLineIndices := make([]int, 0, len(lines))
|
||||
|
||||
if tabWidth < 1 {
|
||||
tabWidth = 4
|
||||
}
|
||||
|
||||
for originalLineIdx, line := range lines {
|
||||
wrappedLineIndices = append(wrappedLineIndices, len(wrappedLines))
|
||||
|
||||
// convert tabs to spaces
|
||||
for i := 0; i < len(line); i++ {
|
||||
if line[i] == '\t' {
|
||||
numSpaces := 4 - (i % 4)
|
||||
line = line[:i] + " "[:numSpaces] + line[i+1:]
|
||||
numSpaces := tabWidth - (i % tabWidth)
|
||||
line = line[:i] + strings.Repeat(" ", numSpaces) + line[i+1:]
|
||||
i += numSpaces - 1
|
||||
}
|
||||
}
|
||||
|
||||
+67
-5
@@ -170,8 +170,10 @@ func TestWrapViewLinesToWidth(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
wrap bool
|
||||
editable bool
|
||||
text string
|
||||
width int
|
||||
tabWidth int
|
||||
expectedWrappedLines []string
|
||||
expectedWrappedLinesIndices []int
|
||||
expectedOriginalLinesIndices []int
|
||||
@@ -352,14 +354,25 @@ func TestWrapViewLinesToWidth(t *testing.T) {
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Tabs",
|
||||
wrap: true,
|
||||
text: "\ta\tbb\tccc\tdddd\teeeee",
|
||||
width: 50,
|
||||
name: "Tabs, width 4",
|
||||
wrap: true,
|
||||
text: "\ta\tbb\tccc\tdddd\teeeee",
|
||||
width: 50,
|
||||
tabWidth: 4,
|
||||
expectedWrappedLines: []string{
|
||||
" a bb ccc dddd eeeee",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Tabs, width 8",
|
||||
wrap: true,
|
||||
text: "\ta\tbb\tccc\tdddddddd\teeeee",
|
||||
width: 100,
|
||||
tabWidth: 8,
|
||||
expectedWrappedLines: []string{
|
||||
" a bb ccc dddddddd eeeee",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Multiple lines",
|
||||
wrap: true,
|
||||
@@ -378,10 +391,57 @@ func TestWrapViewLinesToWidth(t *testing.T) {
|
||||
expectedWrappedLinesIndices: []int{0, 2, 6},
|
||||
expectedOriginalLinesIndices: []int{0, 0, 1, 1, 1, 1, 2, 2},
|
||||
},
|
||||
{
|
||||
name: "Avoid blank line at end if not editable",
|
||||
wrap: true,
|
||||
editable: false,
|
||||
text: "First\nSecond\nThird\n",
|
||||
width: 10,
|
||||
expectedWrappedLines: []string{
|
||||
"First",
|
||||
"Second",
|
||||
"Third",
|
||||
},
|
||||
expectedWrappedLinesIndices: []int{0, 1, 2},
|
||||
expectedOriginalLinesIndices: []int{0, 1, 2},
|
||||
},
|
||||
{
|
||||
name: "Avoid blank line at end if not editable",
|
||||
wrap: true,
|
||||
editable: false,
|
||||
text: "First\nSecond\nThird\n",
|
||||
width: 10,
|
||||
expectedWrappedLines: []string{
|
||||
"First",
|
||||
"Second",
|
||||
"Third",
|
||||
},
|
||||
expectedWrappedLinesIndices: []int{0, 1, 2},
|
||||
expectedOriginalLinesIndices: []int{0, 1, 2},
|
||||
},
|
||||
{
|
||||
name: "Keep blank line at end if editable",
|
||||
wrap: true,
|
||||
editable: true,
|
||||
text: "First\nSecond\nThird\n",
|
||||
width: 10,
|
||||
expectedWrappedLines: []string{
|
||||
"First",
|
||||
"Second",
|
||||
"Third",
|
||||
"",
|
||||
},
|
||||
expectedWrappedLinesIndices: []int{0, 1, 2, 3},
|
||||
expectedOriginalLinesIndices: []int{0, 1, 2, 3},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
wrappedLines, wrappedLinesIndices, originalLinesIndices := WrapViewLinesToWidth(tt.wrap, tt.text, tt.width)
|
||||
tabWidth := tt.tabWidth
|
||||
if tabWidth == 0 {
|
||||
tabWidth = 4
|
||||
}
|
||||
wrappedLines, wrappedLinesIndices, originalLinesIndices := WrapViewLinesToWidth(tt.wrap, tt.editable, tt.text, tt.width, tabWidth)
|
||||
assert.Equal(t, tt.expectedWrappedLines, wrappedLines)
|
||||
if tt.expectedWrappedLinesIndices != nil {
|
||||
assert.Equal(t, tt.expectedWrappedLinesIndices, wrappedLinesIndices)
|
||||
@@ -392,8 +452,10 @@ func TestWrapViewLinesToWidth(t *testing.T) {
|
||||
|
||||
// As a sanity check, also test that gocui's line wrapping behaves the same way
|
||||
view := gocui.NewView("", 0, 0, tt.width+1, 1000, gocui.OutputNormal)
|
||||
view.TabWidth = tabWidth
|
||||
assert.Equal(t, tt.width, view.InnerWidth())
|
||||
view.Wrap = tt.wrap
|
||||
view.Editable = tt.editable
|
||||
view.SetContent(tt.text)
|
||||
assert.Equal(t, wrappedLines, view.ViewBufferLines())
|
||||
})
|
||||
|
||||
@@ -99,6 +99,55 @@ func lookupKey(node *yaml.Node, key string) (*yaml.Node, *yaml.Node) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Walks a yaml document to the specified path, and then applies the transformation to that node.
|
||||
//
|
||||
// The transform must return true if it made changes to the node.
|
||||
// If the requested path is not defined in the document, no changes are made to the document.
|
||||
//
|
||||
// If no changes are made, the original document is returned.
|
||||
// If changes are made, a newly marshalled document is returned. (This may result in different indentation for all nodes)
|
||||
func TransformNode(yamlBytes []byte, path []string, transform func(node *yaml.Node) (bool, error)) ([]byte, error) {
|
||||
// Parse the YAML file.
|
||||
var node yaml.Node
|
||||
err := yaml.Unmarshal(yamlBytes, &node)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse YAML: %w", err)
|
||||
}
|
||||
|
||||
// Empty document: nothing to do.
|
||||
if len(node.Content) == 0 {
|
||||
return yamlBytes, nil
|
||||
}
|
||||
|
||||
body := node.Content[0]
|
||||
|
||||
if didTransform, err := transformNode(body, path, transform); err != nil || !didTransform {
|
||||
return yamlBytes, err
|
||||
}
|
||||
|
||||
// Convert the updated YAML node back to YAML bytes.
|
||||
updatedYAMLBytes, err := yaml.Marshal(body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to convert YAML node to bytes: %w", err)
|
||||
}
|
||||
|
||||
return updatedYAMLBytes, nil
|
||||
}
|
||||
|
||||
// A recursive function to walk down the tree. See TransformNode for more details.
|
||||
func transformNode(node *yaml.Node, path []string, transform func(node *yaml.Node) (bool, error)) (bool, error) {
|
||||
if len(path) == 0 {
|
||||
return transform(node)
|
||||
}
|
||||
|
||||
keyNode, valueNode := lookupKey(node, path[0])
|
||||
if keyNode == nil {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
return transformNode(valueNode, path[1:], transform)
|
||||
}
|
||||
|
||||
// takes a yaml document in bytes, a path to a key, and a new name for the key.
|
||||
// Will rename the key to the new name if it exists, and do nothing otherwise.
|
||||
func RenameYamlKey(yamlBytes []byte, path []string, newKey string) ([]byte, error) {
|
||||
@@ -106,7 +155,7 @@ func RenameYamlKey(yamlBytes []byte, path []string, newKey string) ([]byte, erro
|
||||
var node yaml.Node
|
||||
err := yaml.Unmarshal(yamlBytes, &node)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse YAML: %w", err)
|
||||
return nil, fmt.Errorf("failed to parse YAML: %w for bytes %s", err, string(yamlBytes))
|
||||
}
|
||||
|
||||
// Empty document: nothing to do.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package yaml_utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -314,3 +315,80 @@ func TestWalk_inPlaceChanges(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestTransformNode(t *testing.T) {
|
||||
transformIntValueToString := func(node *yaml.Node) (bool, error) {
|
||||
if node.Kind == yaml.ScalarNode {
|
||||
if node.ShortTag() == "!!int" {
|
||||
node.Tag = "!!str"
|
||||
return true, nil
|
||||
} else if node.ShortTag() == "!!str" {
|
||||
// We have already transformed it,
|
||||
return false, nil
|
||||
} else {
|
||||
return false, fmt.Errorf("Node was of bad type")
|
||||
}
|
||||
} else {
|
||||
return false, fmt.Errorf("Node was not a scalar")
|
||||
}
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
in string
|
||||
path []string
|
||||
transform func(node *yaml.Node) (bool, error)
|
||||
expectedOut string
|
||||
}{
|
||||
{
|
||||
name: "Path not present",
|
||||
in: "foo: 1",
|
||||
path: []string{"bar"},
|
||||
transform: transformIntValueToString,
|
||||
expectedOut: "foo: 1",
|
||||
},
|
||||
{
|
||||
name: "Part of path present",
|
||||
in: `
|
||||
foo:
|
||||
bar: 2`,
|
||||
path: []string{"foo", "baz"},
|
||||
transform: transformIntValueToString,
|
||||
expectedOut: `
|
||||
foo:
|
||||
bar: 2`,
|
||||
},
|
||||
{
|
||||
name: "Successfully Transforms to string",
|
||||
in: `
|
||||
foo:
|
||||
bar: 2`,
|
||||
path: []string{"foo", "bar"},
|
||||
transform: transformIntValueToString,
|
||||
expectedOut: `foo:
|
||||
bar: "2"
|
||||
`, // Note the indentiation change and newlines because of how it re-marshalls
|
||||
},
|
||||
{
|
||||
name: "Does nothing when already transformed",
|
||||
in: `
|
||||
foo:
|
||||
bar: "2"`,
|
||||
path: []string{"foo", "bar"},
|
||||
transform: transformIntValueToString,
|
||||
expectedOut: `
|
||||
foo:
|
||||
bar: "2"`,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
result, err := TransformNode([]byte(test.in), test.path, test.transform)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assert.Equal(t, test.expectedOut, string(result))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
+38
-26
@@ -46,6 +46,12 @@
|
||||
"description": "One of: 'margin' (default) | 'jump'",
|
||||
"default": "margin"
|
||||
},
|
||||
"tabWidth": {
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"description": "The number of spaces per tab; used for everything that's shown in the main view, but probably mostly relevant for diffs.\nNote that when using a pager, the pager has its own tab width setting, so you need to pass it separately in the pager command.",
|
||||
"default": 4
|
||||
},
|
||||
"mouseEvents": {
|
||||
"type": "boolean",
|
||||
"description": "If true, capture mouse events.\nWhen mouse events are captured, it's a little harder to select text: e.g. requiring you to hold the option key when on macOS.",
|
||||
@@ -302,7 +308,7 @@
|
||||
},
|
||||
"showFileTree": {
|
||||
"type": "boolean",
|
||||
"description": "If true, display the files in the file views as a tree. If false, display the files as a flat list.\nThis can be toggled from within Lazygit with the '~' key, but that will not change the default.",
|
||||
"description": "If true, display the files in the file views as a tree. If false, display the files as a flat list.\nThis can be toggled from within Lazygit with the '`' key, but that will not change the default.",
|
||||
"default": true
|
||||
},
|
||||
"showNumstatInFilesView": {
|
||||
@@ -638,28 +644,7 @@
|
||||
"default": false
|
||||
},
|
||||
"commitPrefix": {
|
||||
"properties": {
|
||||
"pattern": {
|
||||
"type": "string",
|
||||
"description": "pattern to match on. E.g. for 'feature/AB-123' to match on the AB-123 use \"^\\\\w+\\\\/(\\\\w+-\\\\w+).*\"",
|
||||
"examples": [
|
||||
"^\\w+\\/(\\w+-\\w+).*"
|
||||
]
|
||||
},
|
||||
"replace": {
|
||||
"type": "string",
|
||||
"description": "Replace directive. E.g. for 'feature/AB-123' to start the commit message with 'AB-123 ' use \"[$1] \"",
|
||||
"examples": [
|
||||
"[$1]"
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object",
|
||||
"description": "See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix"
|
||||
},
|
||||
"commitPrefixes": {
|
||||
"additionalProperties": {
|
||||
"items": {
|
||||
"properties": {
|
||||
"pattern": {
|
||||
"type": "string",
|
||||
@@ -679,6 +664,33 @@
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"type": "array",
|
||||
"description": "See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix"
|
||||
},
|
||||
"commitPrefixes": {
|
||||
"additionalProperties": {
|
||||
"items": {
|
||||
"properties": {
|
||||
"pattern": {
|
||||
"type": "string",
|
||||
"description": "pattern to match on. E.g. for 'feature/AB-123' to match on the AB-123 use \"^\\\\w+\\\\/(\\\\w+-\\\\w+).*\"",
|
||||
"examples": [
|
||||
"^\\w+\\/(\\w+-\\w+).*"
|
||||
]
|
||||
},
|
||||
"replace": {
|
||||
"type": "string",
|
||||
"description": "Replace directive. E.g. for 'feature/AB-123' to start the commit message with 'AB-123 ' use \"[$1] \"",
|
||||
"examples": [
|
||||
"[$1]"
|
||||
]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"type": "object",
|
||||
"description": "See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix"
|
||||
},
|
||||
@@ -875,7 +887,8 @@
|
||||
},
|
||||
"context": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"description": "The context in which to listen for the key. Valid values are: status, files, worktrees, localBranches, remotes, remoteBranches, tags, commits, reflogCommits, subCommits, commitFiles, stash, and global. Multiple contexts separated by comma are allowed; most useful for \"commits, subCommits\" or \"files, commitFiles\".",
|
||||
"examples": [
|
||||
"status",
|
||||
"files",
|
||||
"worktrees",
|
||||
@@ -889,8 +902,7 @@
|
||||
"commitFiles",
|
||||
"stash",
|
||||
"global"
|
||||
],
|
||||
"description": "The context in which to listen for the key"
|
||||
]
|
||||
},
|
||||
"command": {
|
||||
"type": "string",
|
||||
|
||||
@@ -18,6 +18,11 @@ fi
|
||||
|
||||
download_dir="$1"
|
||||
|
||||
# The Portuguese translation is named pt-PT, but we want to use pt instead (it
|
||||
# is used both for Brasilian and European Portuguese). I couldn't figure out how
|
||||
# to change this in Crowdin, so we'll do it here.
|
||||
[ -d "$download_dir/pt-PT" ] && mv "$download_dir/pt-PT" "$download_dir/pt"
|
||||
|
||||
for d in "$download_dir"/*
|
||||
do
|
||||
# We need to remove empty strings from the JSON files; those are the ones
|
||||
|
||||
+24
@@ -157,6 +157,8 @@ type Gui struct {
|
||||
// If Mouse is true then mouse events will be enabled.
|
||||
Mouse bool
|
||||
|
||||
IsPasting bool
|
||||
|
||||
// If InputEsc is true, when ESC sequence is in the buffer and it doesn't
|
||||
// match any known sequence, ESC means KeyEsc.
|
||||
InputEsc bool
|
||||
@@ -759,6 +761,7 @@ func (g *Gui) MainLoop() error {
|
||||
}()
|
||||
|
||||
Screen.EnableFocus()
|
||||
Screen.EnablePaste()
|
||||
|
||||
previousEnableMouse := false
|
||||
for {
|
||||
@@ -847,6 +850,9 @@ func (g *Gui) handleEvent(ev *GocuiEvent) error {
|
||||
return nil
|
||||
case eventFocus:
|
||||
return g.onFocus(ev)
|
||||
case eventPaste:
|
||||
g.IsPasting = ev.Start
|
||||
return nil
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
@@ -1305,6 +1311,20 @@ func (g *Gui) onKey(ev *GocuiEvent) error {
|
||||
switch ev.Type {
|
||||
case eventKey:
|
||||
|
||||
// When pasting text in Ghostty, it sends us '\r' instead of '\n' for
|
||||
// newlines. I actually don't quite understand why, because from reading
|
||||
// Ghostty's source code (e.g.
|
||||
// https://github.com/ghostty-org/ghostty/commit/010338354a0) it does
|
||||
// this conversion only for non-bracketed paste mode, but I'm seeing it
|
||||
// in bracketed paste mode. Whatever I'm missing here, converting '\r'
|
||||
// back to '\n' fixes pasting multi-line text from Ghostty, and doesn't
|
||||
// seem harmful for other terminal emulators.
|
||||
//
|
||||
// KeyCtrlJ (int value 10) is '\r', and KeyCtrlM (int value 13) is '\n'.
|
||||
if g.IsPasting && ev.Key == KeyCtrlJ {
|
||||
ev.Key = KeyCtrlM
|
||||
}
|
||||
|
||||
err := g.execKeybindings(g.currentView, ev)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -1469,6 +1489,10 @@ func (g *Gui) execKeybindings(v *View, ev *GocuiEvent) error {
|
||||
var globalKb *keybinding
|
||||
var matchingParentViewKb *keybinding
|
||||
|
||||
if g.IsPasting && v != nil && !v.Editable {
|
||||
return nil
|
||||
}
|
||||
|
||||
// if we're searching, and we've hit n/N/Esc, we ignore the default keybinding
|
||||
if v != nil && v.IsSearching() && ev.Mod == ModNone {
|
||||
if eventMatchesKey(ev, g.NextSearchMatchKey) {
|
||||
|
||||
+9
@@ -155,6 +155,8 @@ type gocuiEventType uint8
|
||||
// The 'MouseX' and 'MouseY' fields are valid if 'Type' is 'eventMouse'.
|
||||
// The 'Width' and 'Height' fields are valid if 'Type' is 'eventResize'.
|
||||
// The 'Focused' field is valid if 'Type' is 'eventFocus'.
|
||||
// The 'Start' field is valid if 'Type' is 'eventPaste'. It is true for the
|
||||
// beginning of a paste operation, false for the end.
|
||||
// The 'Err' field is valid if 'Type' is 'eventError'.
|
||||
type GocuiEvent struct {
|
||||
Type gocuiEventType
|
||||
@@ -167,6 +169,7 @@ type GocuiEvent struct {
|
||||
MouseX int
|
||||
MouseY int
|
||||
Focused bool
|
||||
Start bool
|
||||
N int
|
||||
}
|
||||
|
||||
@@ -178,6 +181,7 @@ const (
|
||||
eventMouse
|
||||
eventMouseMove // only used when no button is down, otherwise it's eventMouse
|
||||
eventFocus
|
||||
eventPaste
|
||||
eventInterrupt
|
||||
eventError
|
||||
eventRaw
|
||||
@@ -417,6 +421,11 @@ func (g *Gui) pollEvent() GocuiEvent {
|
||||
Type: eventFocus,
|
||||
Focused: tev.Focused,
|
||||
}
|
||||
case *tcell.EventPaste:
|
||||
return GocuiEvent{
|
||||
Type: eventPaste,
|
||||
Start: tev.Start(),
|
||||
}
|
||||
default:
|
||||
return GocuiEvent{Type: eventNone}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user