mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-09-28 10:16:22 -04:00
Compare commits
275
Commits
+1
-1
@@ -1,3 +1,3 @@
|
||||
*.go text
|
||||
*.go text eol=lf
|
||||
*.md text eol=lf
|
||||
*.json text eol=lf
|
||||
|
||||
+15
-13
@@ -28,7 +28,7 @@ jobs:
|
||||
GOFLAGS: -mod=vendor
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
@@ -59,11 +59,11 @@ jobs:
|
||||
GOFLAGS: -mod=vendor
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
- name: Restore Git cache
|
||||
if: matrix.git-version != 'latest'
|
||||
id: cache-git-restore
|
||||
uses: actions/cache/restore@v5
|
||||
uses: actions/cache/restore@v6
|
||||
with:
|
||||
path: ~/git-${{matrix.git-version}}
|
||||
key: ${{runner.os}}-git-${{matrix.git-version}}
|
||||
@@ -80,7 +80,7 @@ jobs:
|
||||
run: sudo make -C "$HOME/git-${{matrix.git-version}}" -j install
|
||||
- name: Save Git cache
|
||||
if: steps.cache-git-restore.outputs.cache-hit != 'true' && matrix.git-version != 'latest'
|
||||
uses: actions/cache/save@v5
|
||||
uses: actions/cache/save@v6
|
||||
with:
|
||||
path: ~/git-${{matrix.git-version}}
|
||||
key: ${{runner.os}}-git-${{matrix.git-version}}
|
||||
@@ -109,7 +109,7 @@ jobs:
|
||||
GOARCH: amd64
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
@@ -136,7 +136,7 @@ jobs:
|
||||
GOARCH: amd64
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
@@ -162,19 +162,21 @@ jobs:
|
||||
GOFLAGS: -mod=vendor
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: 1.25.x
|
||||
- name: Check formatting
|
||||
run: ./scripts/gofumpt-check.sh
|
||||
- name: Lint
|
||||
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9
|
||||
# Run even if the formatting check failed, so that both sets of
|
||||
# problems are reported in a single CI run.
|
||||
if: ${{ !cancelled() }}
|
||||
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9
|
||||
with:
|
||||
# If you change this, make sure to also update scripts/golangci-lint-shim.sh
|
||||
version: v2.4.0
|
||||
- name: errors
|
||||
run: golangci-lint run
|
||||
if: ${{ failure() }}
|
||||
upload-coverage:
|
||||
# List all jobs that produce coverage files
|
||||
needs: [unit-tests, integration-tests]
|
||||
@@ -182,7 +184,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v6
|
||||
@@ -221,7 +223,7 @@ jobs:
|
||||
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} ))" >> "${GITHUB_ENV}"
|
||||
|
||||
- name: "Checkout PR branch and all PR commits"
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
- name: Annotate locations with typos
|
||||
uses: codespell-project/codespell-problem-matcher@9ba2c57125d4908eade4308f32c4ff814c184633 # v1.2.0
|
||||
- name: Codespell
|
||||
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
repository: jesseduffield/lazygit
|
||||
token: ${{ secrets.LAZYGIT_RELEASE_PAT }}
|
||||
@@ -159,7 +159,7 @@ jobs:
|
||||
go-version: 1.25.x
|
||||
|
||||
- name: Run goreleaser
|
||||
uses: goreleaser/goreleaser-action@5daf1e915a5f0af01ddbcd89a43b8061ff4f1a89 # v7.2.2
|
||||
uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: v2
|
||||
|
||||
@@ -10,7 +10,7 @@ jobs:
|
||||
if: ${{ github.repository == 'jesseduffield/lazygit' }}
|
||||
steps:
|
||||
- name: Checkout 🛎️
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Generate Sponsors 💖
|
||||
uses: JamesIves/github-sponsors-readme-action@2fd9142e765f755780202122261dc85e78459405 # v1.6.0
|
||||
|
||||
+7
-1
@@ -1,6 +1,10 @@
|
||||
version: "2"
|
||||
run:
|
||||
go: "1.25"
|
||||
issues:
|
||||
max-issues-per-linter: 0
|
||||
max-same-issues: 0
|
||||
uniq-by-line: false
|
||||
linters:
|
||||
enable:
|
||||
- copyloopvar
|
||||
@@ -102,7 +106,9 @@ linters:
|
||||
- vendor/
|
||||
formatters:
|
||||
enable:
|
||||
- gofumpt
|
||||
# gofumpt is intentionally not listed here: golangci-lint bundles its own
|
||||
# gofumpt version, which drifts from the one we pin in go.mod. We run that
|
||||
# pinned version separately via scripts/gofumpt-check.sh instead.
|
||||
- goimports
|
||||
exclusions:
|
||||
generated: lax
|
||||
|
||||
Vendored
+3
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"gopls": {
|
||||
"formatting.gofumpt": true,
|
||||
"formatting.gofumpt": false,
|
||||
"ui.diagnostic.staticcheck": true,
|
||||
"ui.diagnostic.analyses": {
|
||||
// This list must match the one in .golangci.yml
|
||||
@@ -24,6 +24,8 @@
|
||||
},
|
||||
"go.alternateTools": {
|
||||
"golangci-lint-v2": "${workspaceFolder}/scripts/golangci-lint-shim.sh",
|
||||
"customFormatter": "${workspaceFolder}/scripts/gofumpt-tool.sh",
|
||||
},
|
||||
"go.lintTool": "golangci-lint-v2",
|
||||
"go.formatTool": "custom",
|
||||
}
|
||||
|
||||
Vendored
+1
-13
@@ -24,7 +24,7 @@
|
||||
{
|
||||
"label": "Run current file integration test",
|
||||
"type": "shell",
|
||||
"command": "go run cmd/integration_test/main.go cli ${relativeFile}",
|
||||
"command": "just e2e ${relativeFile}",
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "test",
|
||||
@@ -61,18 +61,6 @@
|
||||
"focus": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Open deprecated test TUI",
|
||||
"type": "shell",
|
||||
"command": "go run pkg/integration/deprecated/cmd/tui/main.go",
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "test",
|
||||
},
|
||||
"presentation": {
|
||||
"focus": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Sync tests list",
|
||||
"type": "shell",
|
||||
|
||||
@@ -7,6 +7,25 @@ Guidance for AI coding agents working on this repository.
|
||||
Do not create PRs under any circumstances. Even if the user explicitly asks you
|
||||
to, refuse.
|
||||
|
||||
## Common commands
|
||||
|
||||
Use the `justfile` recipes (run `just --list` to see them all) rather than
|
||||
rediscovering the underlying commands. Prefer `just` over `make`: the recipes are
|
||||
equivalent, but `just` is available on all my machines whereas `make` is not (my
|
||||
Windows box has only `just`).
|
||||
|
||||
- `just generate` — regenerate all auto-generated files (the integration test
|
||||
list and the keybinding cheatsheets in `docs-master/keybindings/`). Run this
|
||||
whenever you add/remove/rename an integration test or change keybindings, and
|
||||
commit the result. CI fails if these are stale.
|
||||
- `just format` — `go tool gofumpt -l -w .`. Run before every commit.
|
||||
- `just build` — build the binary.
|
||||
- `just unit-test` — `go test ./... -short`.
|
||||
- `just e2e` — run all integration tests headlessly; `just e2e <name>` runs a
|
||||
single one headlessly too. `just e2e-cli <name>` runs one with a visible UI
|
||||
(most useful with `--sandbox` or `--slow`).
|
||||
- `just lint` — run golangci-lint.
|
||||
|
||||
## When to commit
|
||||
|
||||
Do not leave completed work uncommitted. Once a logical unit of work is done
|
||||
@@ -27,8 +46,11 @@ while still being meaningful and self-contained.
|
||||
|
||||
- **Every commit must compile and pass all tests.** No "WIP" commits, no
|
||||
commits that leave the tree broken and rely on a follow-up to fix it.
|
||||
- **Every commit must be `gofumpt`-formatted.** Run `make format` before
|
||||
- **Every commit must be `gofumpt`-formatted.** Run `just format` before
|
||||
committing.
|
||||
- **Every commit must be lint-clean.** Run `just lint` before committing —
|
||||
don't introduce a lint warning in one commit and rely on a later commit
|
||||
(or the user) to clean it up.
|
||||
- **Commit messages explain _why_, not _what_.** The diff already shows what
|
||||
changed; the message should capture the motivation, the constraint, or the
|
||||
bug being fixed. If the reason is obvious from a one-line subject, no body
|
||||
@@ -36,18 +58,34 @@ while still being meaningful and self-contained.
|
||||
- **Separate preparatory refactorings from behavior changes.** If a fix or
|
||||
feature is easier to review after a refactor, land the refactor in its own
|
||||
commit first. Pure refactors should be behavior-preserving; the commit that
|
||||
changes behavior should be as small as possible.
|
||||
changes behavior should be as small as possible. This applies even when the
|
||||
refactor only becomes apparent _while_ writing the behavior change — e.g. you
|
||||
extract a helper to avoid duplication. Don't let "I discovered it mid-change"
|
||||
excuse bundling it in. Before committing, review your diff and split out any
|
||||
hunk that is behavior-preserving (an extraction, a rename, a move) into a
|
||||
preceding commit, by staging hunks or resetting and recommitting in order.
|
||||
- **Do not use conventional commits** (no `feat:`/`fix:`/`chore:` prefixes).
|
||||
Match the plain English imperative style of the existing history.
|
||||
- **Wrap message body to 72 characters**. The subject is allowed to go up to 80
|
||||
characters, or even a little more if needed to convey a good single-line
|
||||
summary; the body should be wrapped at 72 exactly, no more, no less.
|
||||
|
||||
## Iterate with `fixup!` commits
|
||||
|
||||
When refining work that's already committed — adjusting an approach,
|
||||
incorporating an idea from elsewhere, fixing something that belongs to the
|
||||
same logical unit — create a fixup against the target commit
|
||||
(`git commit --fixup=<sha>`) so the history collapses cleanly under
|
||||
`git rebase --autosquash`. Don't pile follow-up commits on top with the
|
||||
intent of squashing them later.
|
||||
(`git commit --fixup=<sha>`) so it sits alongside its target, ready for the
|
||||
user to fold in later with `git rebase --autosquash`. Don't pile follow-up
|
||||
commits on top with the intent of squashing them later.
|
||||
|
||||
This holds **even when the target is the most recent commit (HEAD)**: use
|
||||
`git commit --fixup`, not `git commit --amend`. A direct `--amend`
|
||||
produces the same end state, which makes it tempting, but the point of a
|
||||
fixup isn't only clean autosquash — it's that the refinement lands as a
|
||||
separate, reviewable commit that the user decides when to fold in. A bare
|
||||
`--amend` rewrites the commit on the spot and skips that checkpoint. Don't
|
||||
treat "I'm only touching the tip commit" as an exception.
|
||||
|
||||
If the changes don't map cleanly onto existing commits — say they cut
|
||||
across several of them, or restructure something at a different layer
|
||||
@@ -57,10 +95,80 @@ call, but it's the user's call to make.
|
||||
|
||||
After writing a fixup, re-read the target commit's message. If anything in
|
||||
that message has become inaccurate or misleading because of the fixup, use
|
||||
an `amend!` commit instead (its subject is `amend! <original subject>` and
|
||||
its body becomes the target's new full message after autosquash). A plain
|
||||
`fixup!` keeps the original message verbatim, so message drift stays in
|
||||
unless you explicitly correct it.
|
||||
an `amend!` commit instead. The safest way to create one is
|
||||
`git commit --fixup=amend:<sha>`, which opens the editor prefilled with the
|
||||
target's existing message for you to revise.
|
||||
|
||||
An `amend!` commit's message has this exact shape:
|
||||
|
||||
```
|
||||
amend! <original subject>
|
||||
|
||||
<new subject>
|
||||
|
||||
<new body>
|
||||
```
|
||||
|
||||
The first line (`amend! <original subject>`) is **only the matcher** that
|
||||
ties the commit to its target — it must equal the target's current subject.
|
||||
Everything after the blank line is the **complete replacement message**, so
|
||||
it must begin with a subject line of its own. Even when you only mean to
|
||||
change the body, you still repeat the (unchanged) subject as that first line.
|
||||
|
||||
This is the trap when writing the message by hand with `-m` instead of using
|
||||
the prefilled editor: if you pass only the body, there is no replacement
|
||||
subject line, so after autosquash the target loses its subject and the first
|
||||
body paragraph silently gets promoted to the subject. By hand it must be
|
||||
`-m "amend! <subject>" -m "<subject>" -m "<body>"` — note the subject appears
|
||||
twice, once in the matcher and once as the start of the replacement message.
|
||||
|
||||
A plain `fixup!` keeps the original message verbatim, so message drift stays
|
||||
in unless you explicitly correct it.
|
||||
|
||||
**Never squash the fixups yourself.** Leave them in the history as separate
|
||||
commits. Do not run `git rebase --autosquash`, do not `git commit --amend`
|
||||
them into their targets, do not reorder or otherwise collapse them — not as
|
||||
a "finishing" step, not to tidy up before handing off, not because the tree
|
||||
looks messy. The whole point of a fixup is that the iteration stays
|
||||
**visible and reviewable**; squashing it away yourself destroys exactly the
|
||||
artifact it exists to create. Collapsing fixups into their targets is the
|
||||
user's action, taken once they've reviewed the iterations. Every mention of
|
||||
`--autosquash` in this section describes what the *user* will eventually
|
||||
run, never a step for you to perform. If you think the history is ready to
|
||||
collapse, say so and leave it to them.
|
||||
|
||||
The same commit-structure rules apply to `fixup!` and `amend!` commits as
|
||||
to regular ones: each must be a self-contained logical unit, and unrelated
|
||||
changes must not be combined just because they happen to target the same
|
||||
commit. If you have two independent refinements for the same target, make
|
||||
two separate fixups. Reviewability of the intermediate state matters even
|
||||
when the end state after autosquash would be identical.
|
||||
|
||||
## Surface mid-implementation decisions; decide them together
|
||||
|
||||
Planning can't anticipate everything. When a decision surfaces while you're
|
||||
implementing — a design choice, a tradeoff, a scope cut, a "this turned out
|
||||
harder than expected, so maybe X" — don't quietly make the call and keep
|
||||
going, even if you have a clear recommendation and even if the call seems
|
||||
small. Stop, lay out the options and your recommendation, and let me weigh in.
|
||||
I want to make these calls _with_ you, not discover them after the fact in the
|
||||
diff.
|
||||
|
||||
This isn't a request to stop and ask about every trivial detail; obvious
|
||||
mechanical choices with one sensible answer don't need a checkpoint. It's about
|
||||
genuine forks — the ones where a reasonable person might pick differently, or
|
||||
where you'd be trading away something the plan assumed (scope, UX, performance,
|
||||
reload behavior, …). When in doubt, surface it.
|
||||
|
||||
This applies with equal force to unforeseen _discoveries_, not just to
|
||||
decisions you set out to make. If you find something the plan didn't account
|
||||
for — a latent bug, a race, a wrong assumption, a case that turns out
|
||||
unhandled — stop and raise it before designing or writing a fix, even when the
|
||||
fix seems obvious and even when it's "just correctness." Finding the problem is
|
||||
itself the fork: whether to fix it here or in a separate change, how generally
|
||||
to solve it, and whether it reshapes the current work are all calls for me to
|
||||
make with you. Don't quietly fold a self-directed fix for a newly-found problem
|
||||
into the branch and let me discover it in the diff.
|
||||
|
||||
## Prefer the cleaner design over the smaller diff
|
||||
|
||||
@@ -131,6 +239,51 @@ and fix it instead of papering over it with a binding.
|
||||
|
||||
Use this pattern only where it makes sense; don't apply it by default.
|
||||
|
||||
## Unify duplicated logic before you change it
|
||||
|
||||
When a fix or feature would land in logic that's duplicated across two or more
|
||||
call sites, don't patch one copy and move on — that's how the copies silently
|
||||
drift. (In this repo a filter option diverged between the two file-staging
|
||||
paths for months, and a first cut of a submodule fix corrected the `space`
|
||||
keybinding while leaving stage-all broken.) Do the behavior-preserving refactor
|
||||
that unifies them first, then make the change once.
|
||||
|
||||
Keep that refactor at the foundation of the branch, before the change. Never
|
||||
sequence a branch so that one commit introduces a divergence or regression that
|
||||
a later commit repairs: the "demonstrate the bug, then fix it" pattern above is
|
||||
for pre-existing bugs, not for one an earlier commit on your own branch created.
|
||||
Follow this even when the need for the refactor is only discovered in the middle
|
||||
of working on the branch; suggest to the user to rewrite the history to move the
|
||||
refactor to an earlier commit (but don't do it without asking first).
|
||||
|
||||
## Don't read model state right after a `Refresh`
|
||||
|
||||
A `Refresh` (or `RefreshFromWorker`) does its git work on a worker and then
|
||||
*enqueues* the model update onto the UI thread. So when `Refresh` returns, the
|
||||
model is **not** updated yet — the write is still queued. Reading a field
|
||||
synchronously right after refreshing its scope reads the stale, pre-refresh
|
||||
value (and this is true even for SYNC refreshes):
|
||||
|
||||
```go
|
||||
self.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.FILES}})
|
||||
files := self.c.Model().Files // BUG: still the pre-refresh value
|
||||
```
|
||||
|
||||
Put the read in `RefreshOptions.Then` instead — it's queued after the scope's
|
||||
model writes, so it sees the fresh value:
|
||||
|
||||
```go
|
||||
self.c.Refresh(types.RefreshOptions{
|
||||
Scope: []types.RefreshableView{types.FILES},
|
||||
Then: func() error {
|
||||
files := self.c.Model().Files // fresh
|
||||
return nil
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
`Then` is a `func() error` and works with any non-`ASYNC` mode.
|
||||
|
||||
## Integration test conventions
|
||||
|
||||
Don't bind views to local variables. Always chain method calls directly from
|
||||
@@ -143,6 +296,74 @@ keep the call site fluent.
|
||||
Prefer `assert.Equal` (and friends) over hand-rolled `if` checks. The failure
|
||||
messages are more useful and the intent is clearer at a glance.
|
||||
|
||||
## Translatable strings use Go templates, not `%s`
|
||||
|
||||
Never put `fmt.Sprintf`-style placeholders (`%s`, `%d`, …) in translatable
|
||||
strings — the fields of `TranslationSet` and `Actions` in
|
||||
`pkg/i18n/english.go`. Use named Go-template placeholders and fill them in with
|
||||
`utils.ResolvePlaceholderString`:
|
||||
|
||||
```go
|
||||
// in english.go
|
||||
DeleteBranchTitle: "Delete branch '{{.selectedBranchName}}'?",
|
||||
|
||||
// at the call site
|
||||
utils.ResolvePlaceholderString(
|
||||
self.c.Tr.DeleteBranchTitle,
|
||||
map[string]string{"selectedBranchName": branchName},
|
||||
)
|
||||
```
|
||||
|
||||
Named placeholders tell localizers what each value is (a bare `%s` says
|
||||
nothing, and translators can't safely reorder positional verbs across
|
||||
languages), and the map form extends cleanly when a string later needs more
|
||||
than one placeholder. This holds for every user-facing string, including short
|
||||
ones like disabled-action reasons and toasts.
|
||||
|
||||
## Only edit the English translations
|
||||
|
||||
`pkg/i18n/english.go` is the one translation file you edit; add, change, and
|
||||
remove strings there. The other languages under `pkg/i18n/translations/` are
|
||||
maintained by Crowdin and synced automatically — never edit them by hand, not
|
||||
even to add a key you just introduced or to delete one you just removed. A
|
||||
removed English string simply leaves an orphan key in those files, which
|
||||
Crowdin cleans up on its own; an unknown key in a translation file is ignored
|
||||
at load time, so it does no harm in the meantime.
|
||||
|
||||
## Try to keep new english.go strings within the existing column alignment
|
||||
|
||||
`gofumpt` aligns the `TranslationSet` struct fields and the `EnglishTranslationSet`
|
||||
literal into columns, so a new field whose name is longer than the widest one in
|
||||
its alignment block re-indents every line in that block. When there are several
|
||||
feature branches in flight that all add strings, that reformatting churn turns
|
||||
english.go into a rebase-conflict magnet. So when it's cheap to do so, make an
|
||||
effort to keep a new field name within the current widest name in the block
|
||||
(measure it; it's around 40 characters today), shortening the Go field name to
|
||||
fit. This is a soft preference, not a rule: the usual "best name wins" still
|
||||
applies, so don't mangle a name past the point of readability just to save a
|
||||
column. Applies only to `pkg/i18n/english.go`.
|
||||
|
||||
## Code comments are for future readers, not development history
|
||||
|
||||
Comments in source code explain *why this code is shaped the way it is*. They
|
||||
are not the place to narrate the path we took during development — what was
|
||||
tried first, what didn't work, what's "more reliable" or "cleaner" than some
|
||||
alternative. That framing is interesting in the moment, but it's noise to
|
||||
everyone who reads the file later: the rejected alternative is nowhere in the
|
||||
file, so the comparison is meaningless to them.
|
||||
|
||||
Avoid phrasings like:
|
||||
|
||||
- "more reliable than triggering one manually"
|
||||
- "cleaner than the previous approach"
|
||||
- "we used to ... but ..."
|
||||
- "after trying X, we found Y"
|
||||
|
||||
The iteration story is sometimes worth preserving — but it belongs in the
|
||||
commit message, which is the durable record of *why this change was made*. The
|
||||
code comment should make sense to someone who has never seen any prior version
|
||||
and is just trying to understand the file as it currently exists.
|
||||
|
||||
## Don't present "live with the bug" as an option
|
||||
|
||||
When you're investigating a defect and laying out fix options for the user,
|
||||
@@ -154,6 +375,36 @@ present actual fixes. If a real fix is genuinely out of reach (e.g. it
|
||||
requires API changes you can't make), say so plainly; don't dress "no fix"
|
||||
up as a viable option in a numbered list alongside real ones.
|
||||
|
||||
## Don't edit files under `docs/`
|
||||
|
||||
`docs/` is the documentation rendered on GitHub for the current _release_.
|
||||
Users read it as the reference for the version they're running. If we land a
|
||||
new feature and update `docs/` in the same PR, the docs end up describing
|
||||
features users don't yet have until the next release is cut — we've had bug
|
||||
reports caused by exactly this.
|
||||
|
||||
So:
|
||||
|
||||
- Document new features in `docs-master/` only. The release process
|
||||
(`scripts/update_docs_for_release.sh`) copies `docs-master/` to `docs/` at
|
||||
release time.
|
||||
- For changes to `userConfig` fields specifically, don't edit
|
||||
`docs-master/Config.md` by hand either — the relevant section is
|
||||
auto-generated from the struct field doc comments. After editing the
|
||||
struct, run `just generate` and include the regenerated
|
||||
`docs-master/Config.md` (and `schema-master/config.json`) in your commit.
|
||||
- Don't hard-wrap the doc comments on `userConfig` fields. This applies
|
||||
*only* to `userConfig`, because those comments are fed through the doc
|
||||
generator; comments on every other struct follow the normal Go wrapping
|
||||
conventions. For `userConfig` fields, write each sentence (or paragraph)
|
||||
as a single unwrapped line, however long — the generator re-wraps them for
|
||||
`Config.md` (see `wrapLine` in `pkg/jsonschema/generate_config_docs.go`).
|
||||
Manually wrapping a sentence across several `//` lines defeats this: the
|
||||
generator preserves your arbitrary breaks as hard line breaks and embeds
|
||||
`\n` at those points in the generated `schema-master/config.json`
|
||||
description. (Putting genuinely separate sentences on their own lines is
|
||||
fine; just don't split one sentence across lines.)
|
||||
|
||||
## Don't search outside the working tree
|
||||
|
||||
Never run `find` (or similar) from `/` or other paths outside the project. All
|
||||
|
||||
@@ -36,10 +36,11 @@ generate:
|
||||
|
||||
.PHONY: format
|
||||
format:
|
||||
gofumpt -l -w .
|
||||
go tool gofumpt -l -w .
|
||||
|
||||
.PHONY: lint
|
||||
lint:
|
||||
./scripts/gofumpt-check.sh
|
||||
./scripts/golangci-lint-shim.sh run
|
||||
|
||||
# For more details about integration test, see https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md.
|
||||
@@ -69,4 +70,4 @@ record-demo:
|
||||
|
||||
.PHONY: vendor
|
||||
vendor:
|
||||
go mod vendor && go mod tidy
|
||||
go mod tidy && go mod vendor
|
||||
|
||||
+59
-2
@@ -73,6 +73,8 @@ gui:
|
||||
# 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.
|
||||
# Mouse capture can also be toggled at runtime with the 'toggleMouseCapture'
|
||||
# keybinding ('%' by default).
|
||||
mouseEvents: true
|
||||
|
||||
# If true, do not show a warning when amending a commit.
|
||||
@@ -110,6 +112,26 @@ gui:
|
||||
# is true.
|
||||
expandedSidePanelWeight: 2
|
||||
|
||||
# If true, don't give a side panel more height than it needs to show its
|
||||
# content; when all panels fit, the leftover height is shared among them so that
|
||||
# they still fill the screen.
|
||||
shrinkSidePanelsToContent: false
|
||||
|
||||
# The side panels, in the order they appear from top to bottom.
|
||||
# Each entry is a list of one or more names that share a single panel as tabs
|
||||
# (cycle through them with the next-tab/previous-tab keys).
|
||||
# Omit a name to hide it; give a name its own one-element list to promote a tab
|
||||
# to a top-level panel.
|
||||
# Valid names are: 'status', 'files', 'worktrees', 'submodules', 'branches',
|
||||
# 'remotes', 'tags', 'commits', 'reflog', 'stash'. 'files', 'branches', and
|
||||
# 'commits' must always be included; they can't be hidden.
|
||||
sidePanels:
|
||||
- [status]
|
||||
- [files, worktrees, submodules]
|
||||
- [branches, remotes, tags]
|
||||
- [commits, reflog]
|
||||
- [stash]
|
||||
|
||||
# Sometimes the main window is split in two (e.g. when the selected file has
|
||||
# both staged and unstaged changes). This setting controls how the two sections
|
||||
# are split.
|
||||
@@ -342,6 +364,11 @@ gui:
|
||||
git:
|
||||
# Array of pagers. Each entry has the following format:
|
||||
#
|
||||
# # A name for the pager, shown in the notification when cycling pagers.
|
||||
# # If not set, the name is derived from the first word of the pager
|
||||
# # command (or of the external diff command).
|
||||
# name: ""
|
||||
#
|
||||
# # Value of the --color arg in the git diff command. Some pagers want
|
||||
# # this to be set to 'always' and some want it set to 'never'
|
||||
# colorArg: "always"
|
||||
@@ -361,6 +388,9 @@ git:
|
||||
# # https://git-scm.com/docs/gitattributes#_defining_an_external_diff_driver.
|
||||
# useExternalDiffGitConfig: false
|
||||
#
|
||||
# 'pager', 'externalDiffCommand', and 'useExternalDiffGitConfig' are mutually
|
||||
# exclusive; set at most one per entry.
|
||||
#
|
||||
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md
|
||||
# for more information.
|
||||
pagers: []
|
||||
@@ -406,6 +436,11 @@ git:
|
||||
# If true, periodically refresh files and submodules
|
||||
autoRefresh: true
|
||||
|
||||
# If true, poll the repo periodically for external ref changes (commits, branch
|
||||
# updates, checkouts made outside lazygit) and refresh when one is detected.
|
||||
# Independent of autoRefresh, which only governs the files panel.
|
||||
autoDetectExternalChanges: true
|
||||
|
||||
# If not "none", lazygit will automatically fast-forward local branches to match
|
||||
# their upstream after fetching. Applies to branches that are not the currently
|
||||
# checked out branch, and only to those that are strictly behind their upstream
|
||||
@@ -499,6 +534,15 @@ git:
|
||||
# to 40 to disable truncation.
|
||||
truncateCopiedCommitHashesTo: 12
|
||||
|
||||
# Config relating to git worktrees
|
||||
worktree:
|
||||
# Default parent directory for new worktrees. It is offered as a candidate
|
||||
# location alongside the parent directories of any worktrees you already have.
|
||||
# A relative path is resolved against the repository's root directory, so
|
||||
# "../worktrees" sits beside the repo and ".worktrees" sits inside it.
|
||||
# A leading "~" is expanded to your home directory, so "~/worktrees" works.
|
||||
defaultPath: ""
|
||||
|
||||
# Periodic update checks
|
||||
update:
|
||||
# One of: 'prompt' (default) | 'background' | 'never'
|
||||
@@ -517,6 +561,11 @@ refresher:
|
||||
# Auto-fetch can be disabled via option 'git.autoFetch'.
|
||||
fetchInterval: 60
|
||||
|
||||
# Interval in seconds at which lazygit polls for external ref changes (commits,
|
||||
# branch updates, checkouts made outside lazygit).
|
||||
# Detection can be disabled via option 'git.autoDetectExternalChanges'.
|
||||
externalChangeCheckInterval: 2
|
||||
|
||||
# If true, show a confirmation popup before quitting Lazygit
|
||||
confirmOnQuit: false
|
||||
|
||||
@@ -648,6 +697,7 @@ keybinding:
|
||||
confirmInEditor: [<ctrl+enter>, <ctrl+s>]
|
||||
remove: d
|
||||
new: "n"
|
||||
newWorktree: w
|
||||
edit: e
|
||||
openFile: o
|
||||
scrollUpMain: [<pgup>, K, <ctrl+u>]
|
||||
@@ -667,6 +717,7 @@ keybinding:
|
||||
nextScreenMode: +
|
||||
prevScreenMode: _
|
||||
cyclePagers: '|'
|
||||
cyclePagersReverse: \
|
||||
undo: z
|
||||
redo: Z
|
||||
filteringMenu: <ctrl+s>
|
||||
@@ -676,11 +727,13 @@ keybinding:
|
||||
submitEditorText: <enter>
|
||||
extrasMenu: '@'
|
||||
toggleWhitespaceInDiffView: <ctrl+w>
|
||||
toggleMouseCapture: '%'
|
||||
increaseContextInDiffView: '}'
|
||||
decreaseContextInDiffView: '{'
|
||||
increaseRenameSimilarityThreshold: )
|
||||
decreaseRenameSimilarityThreshold: (
|
||||
openDiffTool: <ctrl+t>
|
||||
editConfig: <alt+shift+c>
|
||||
status:
|
||||
checkForUpdate: u
|
||||
recentRepos: <enter>
|
||||
@@ -726,8 +779,6 @@ keybinding:
|
||||
fetchRemote: f
|
||||
addForkRemote: F
|
||||
sortOrder: s
|
||||
worktrees:
|
||||
viewWorktreeOptions: w
|
||||
commits:
|
||||
squashDown: s
|
||||
renameCommit: r
|
||||
@@ -1059,6 +1110,12 @@ keybinding:
|
||||
edit: <disabled> # disable 'edit file'
|
||||
```
|
||||
|
||||
### Overriding the platform for default keybindings
|
||||
|
||||
A few keybindings have different defaults on macOS than on Linux and Windows (e.g. word-wise cursor movement in text inputs uses `alt` on macOS but `ctrl` elsewhere). Lazygit picks these based on the OS it's running on, but you can override that with the `LAZYGIT_KEYBINDING_PLATFORM` environment variable. Set it to `darwin`, `linux`, or `windows`; any other value is ignored and the actual OS is used.
|
||||
|
||||
This is useful when running lazygit in a Linux container that you access over ssh from a Mac, where you'd rather use the macOS keybindings.
|
||||
|
||||
### Example Keybindings For Colemak Users
|
||||
|
||||
```yaml
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
Lazygit supports custom pagers, [configured](/docs/Config.md) in the config.yml file (which can be opened by pressing `e` in the Status panel).
|
||||
|
||||
Support does not extend to Windows users, because we're making use of a package which doesn't have Windows support. However, see [below](#emulating-custom-pagers-on-windows) for a workaround.
|
||||
|
||||
Multiple pagers are supported; you can cycle through them with the `|` key. This can be useful if you usually prefer a particular pager, but want to use a different one for certain kinds of diffs.
|
||||
|
||||
Pagers are configured with the `pagers` array in the git section; here's an example for a multi-pager setup (use an empty object `{}` for the default builtin diff display that doesn't use a pager):
|
||||
@@ -71,7 +69,7 @@ git:
|
||||
- externalDiffCommand: difft --color=always
|
||||
```
|
||||
|
||||
The `colorArg` and `pager` options are not used in this case.
|
||||
The `colorArg` option is not used in this case.
|
||||
|
||||
You can add whatever extra arguments you prefer for your difftool; for instance
|
||||
|
||||
@@ -81,6 +79,22 @@ git:
|
||||
- externalDiffCommand: difft --color=always --display=inline --syntax-highlight=off
|
||||
```
|
||||
|
||||
This can also be used for normal git diffs with custom parameters, such as `--color-words` or `--word-diff` which some people find useful. To do that, save a script like this to, say, `~/bin/color-words.sh`:
|
||||
|
||||
```sh
|
||||
#!/bin/sh
|
||||
|
||||
git diff --color-words --no-index --color=always --no-ext-diff "$2" "$5"
|
||||
```
|
||||
|
||||
And then use it in your git config like so:
|
||||
|
||||
```yaml
|
||||
git:
|
||||
pagers:
|
||||
- externalDiffCommand: ~/bin/color-words.sh
|
||||
```
|
||||
|
||||
Instead of setting this command in lazygit's `externalDiffCommand` config, you can also tell lazygit to use the external diff command that is configured in git itself (`diff.external`), by using
|
||||
|
||||
```yaml
|
||||
@@ -91,29 +105,4 @@ git:
|
||||
|
||||
This can be useful if you also want to use it for diffs on the command line, and it also has the advantage that you can configure it per file type in `.gitattributes`; see https://git-scm.com/docs/gitattributes#_defining_an_external_diff_driver.
|
||||
|
||||
## Emulating custom pagers on Windows
|
||||
|
||||
There is a trick to emulate custom pagers on Windows using a Powershell script configured as an external diff command. It's not perfect, but certainly better than nothing. To do this, save the following script as `lazygit-pager.ps1` at a convenient place on your disk:
|
||||
|
||||
```pwsh
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
$old = $args[1].Replace('\', '/')
|
||||
$new = $args[4].Replace('\', '/')
|
||||
$path = $args[0]
|
||||
git diff --no-index --no-ext-diff $old $new
|
||||
| %{ $_.Replace($old, $path).Replace($new, $path) }
|
||||
| delta --width=$env:LAZYGIT_COLUMNS
|
||||
```
|
||||
|
||||
Use the pager of your choice with the arguments you like in the last line of the script. Personally I wouldn't want to use lazygit anymore without delta's `--hyperlinks --hyperlinks-file-link-format="lazygit-edit://{path}:{line}"` args, see [above](#delta).
|
||||
|
||||
In your lazygit config, use
|
||||
|
||||
```yml
|
||||
git:
|
||||
pagers:
|
||||
- externalDiffCommand: "C:/wherever/lazygit-pager.ps1"
|
||||
```
|
||||
|
||||
The main limitation of this approach compared to a "real" pager is that renames are not displayed correctly; they are shown as if they were modifications of the old file. (This affects only the hunk headers; the diff itself is always correct.)
|
||||
`pager`, `externalDiffCommand`, and `useExternalDiffGitConfig` are alternative ways of producing the diff, so a pager entry may use at most one of them.
|
||||
|
||||
@@ -22,7 +22,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` R `` | Refresh | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||
| `` + `` | Next screen mode (normal/half/fullscreen) | |
|
||||
| `` _ `` | Prev screen mode | |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers. |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | Cancel | |
|
||||
| `` ? `` | Open keybindings menu | |
|
||||
| `` <ctrl+s> `` | View filter options | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
@@ -30,6 +31,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` q, <ctrl+c> `` | Quit | |
|
||||
| `` <ctrl+z> `` | Suspend the application | |
|
||||
| `` <ctrl+w> `` | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` % `` | Toggle mouse capture | Toggle whether lazygit captures mouse events. When mouse capture is off, the terminal handles the mouse, so you can select text with it; this is useful in terminals that don't have a modifier key to bypass the capture.<br><br>The default can be changed in the config file with the key 'gui.mouseEvents'. |
|
||||
| `` <alt+shift+c> `` | Edit config file | Open file in external editor. |
|
||||
| `` z `` | Undo | The reflog will be used to determine what git command to run to undo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
| `` Z `` | Redo | The reflog will be used to determine what git command to run to redo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
|
||||
@@ -110,13 +113,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Open commit in browser | |
|
||||
| `` n `` | Create new branch off of commit | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Copy (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View files | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Search the current view by text | |
|
||||
|
||||
## Confirmation panel
|
||||
@@ -176,6 +179,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <space> `` | Checkout | Checkout selected item. |
|
||||
| `` n `` | New branch | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` o `` | Create pull request | |
|
||||
| `` O `` | View create pull request options | |
|
||||
| `` G `` | Open pull request in browser | |
|
||||
@@ -195,7 +199,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Main panel (merging)
|
||||
@@ -203,7 +206,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | Pick hunk | |
|
||||
| `` b `` | Pick all hunks | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | Previous hunk | |
|
||||
| `` <down>, j `` | Next hunk | |
|
||||
| `` <left>, h `` | Previous conflict | |
|
||||
@@ -280,6 +283,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Open commit in browser | |
|
||||
| `` n `` | Create new branch off of commit | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Copy (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | Reset copied (cherry-picked) commits selection | |
|
||||
@@ -287,7 +291,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Remote branches
|
||||
@@ -297,6 +300,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | Copy branch name to clipboard | |
|
||||
| `` <space> `` | Checkout | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
|
||||
| `` n `` | New branch | |
|
||||
| `` w `` | New worktree | |
|
||||
| `` M `` | Merge | View options for merging the selected item into the current branch (regular merge, squash merge) |
|
||||
| `` r `` | Rebase | Rebase the checked-out branch onto the selected branch. |
|
||||
| `` d `` | Delete | Delete the remote branch from the remote. |
|
||||
@@ -306,7 +310,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Remotes
|
||||
@@ -337,17 +340,16 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | Pop | Apply the stash entry to your working directory and remove the stash entry. |
|
||||
| `` d `` | Drop | Remove the stash entry from the stash list. |
|
||||
| `` n `` | New branch | Create a new branch from the selected stash entry. This works by git checking out the commit that the stash entry was created from, creating a new branch from that commit, then applying the stash entry to the new branch as an additional commit. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` r `` | Rename stash | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View files | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Status
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` o `` | Open config file | Open file in default application. |
|
||||
| `` e `` | Edit config file | Open file in external editor. |
|
||||
| `` u `` | Check for update | |
|
||||
| `` <enter> `` | Switch to a recent repo | |
|
||||
@@ -365,6 +367,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Open commit in browser | |
|
||||
| `` n `` | Create new branch off of commit | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Copy (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | Reset copied (cherry-picked) commits selection | |
|
||||
@@ -372,7 +375,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View files | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Search the current view by text | |
|
||||
|
||||
## Submodules
|
||||
@@ -396,13 +398,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+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. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` 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. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Worktrees
|
||||
|
||||
@@ -22,7 +22,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` R `` | 更新 | Gitの状態を更新します(`git status`、`git branch`などをバックグラウンドで実行してパネルの内容を更新します)。これは`git fetch`を実行しません。 |
|
||||
| `` + `` | 次の画面モード(通常/半分/全画面) | |
|
||||
| `` _ `` | 前の画面モード | |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers. |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | キャンセル | |
|
||||
| `` ? `` | キーバインディングメニューを開く | |
|
||||
| `` <ctrl+s> `` | フィルターオプションを表示 | コミットログのフィルタリングオプションを表示し、フィルタに一致するコミットのみを表示します。 |
|
||||
@@ -30,6 +31,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` q, <ctrl+c> `` | 終了 | |
|
||||
| `` <ctrl+z> `` | Suspend the application | |
|
||||
| `` <ctrl+w> `` | 空白表示の切り替え | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` % `` | Toggle mouse capture | Toggle whether lazygit captures mouse events. When mouse capture is off, the terminal handles the mouse, so you can select text with it; this is useful in terminals that don't have a modifier key to bypass the capture.<br><br>The default can be changed in the config file with the key 'gui.mouseEvents'. |
|
||||
| `` <alt+shift+c> `` | 設定ファイルを編集 | 外部エディタでファイルを開きます。 |
|
||||
| `` z `` | 元に戻す | 最後のgitコマンドを元に戻すために実行するgitコマンドを決定するためにreflogが使用されます。これにはワーキングツリーへの変更は含まれません。コミットのみが考慮されます。 |
|
||||
| `` Z `` | やり直す | 最後のgitコマンドをやり直すために実行するgitコマンドを決定するためにreflogが使用されます。これにはワーキングツリーへの変更は含まれません。コミットのみが考慮されます。 |
|
||||
|
||||
@@ -90,13 +93,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | ブラウザでコミットを開く | |
|
||||
| `` n `` | コミットから新しいブランチを作成 | |
|
||||
| `` N `` | コミットを新しいブランチに移動 | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | 新しいワークツリー | |
|
||||
| `` g `` | リセット | 選択した項目へのリセットオプション(ソフト/ミックス/ハード)を表示します。各リセットタイプの詳細は次の通りです:<br>- ソフトリセット:変更を保持し、ステージされた状態にします<br>- ミックスリセット:変更を保持し、ステージされていない状態にします<br>- ハードリセット:すべての変更を破棄します |
|
||||
| `` C `` | コピー(チェリーピック) | コミットをコピーとしてマークします。ローカルコミットビューで `V` を押すと、コピーしたコミットをチェックアウトしたブランチにペースト(チェリーピック)できます。いつでも `<esc>` を押して選択をキャンセルできます。 |
|
||||
| `` <ctrl+t> `` | 外部差分ツールを開く(git difftool) | |
|
||||
| `` * `` | 現在のブランチのコミットを選択 | |
|
||||
| `` 0 `` | メインビューにフォーカス | |
|
||||
| `` <enter> `` | ファイルを表示 | |
|
||||
| `` w `` | ワークツリーオプションを表示 | |
|
||||
| `` / `` | 現在のビューをテキストで検索 | |
|
||||
|
||||
## コミットファイル
|
||||
@@ -136,6 +139,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | ブラウザでコミットを開く | |
|
||||
| `` n `` | コミットから新しいブランチを作成 | |
|
||||
| `` N `` | コミットを新しいブランチに移動 | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | 新しいワークツリー | |
|
||||
| `` g `` | リセット | 選択した項目へのリセットオプション(ソフト/ミックス/ハード)を表示します。各リセットタイプの詳細は次の通りです:<br>- ソフトリセット:変更を保持し、ステージされた状態にします<br>- ミックスリセット:変更を保持し、ステージされていない状態にします<br>- ハードリセット:すべての変更を破棄します |
|
||||
| `` C `` | コピー(チェリーピック) | コミットをコピーとしてマークします。ローカルコミットビューで `V` を押すと、コピーしたコミットをチェックアウトしたブランチにペースト(チェリーピック)できます。いつでも `<esc>` を押して選択をキャンセルできます。 |
|
||||
| `` <ctrl+r> `` | コピーされた(チェリーピックされた)コミットの選択をリセット | |
|
||||
@@ -143,7 +147,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | 現在のブランチのコミットを選択 | |
|
||||
| `` 0 `` | メインビューにフォーカス | |
|
||||
| `` <enter> `` | ファイルを表示 | |
|
||||
| `` w `` | ワークツリーオプションを表示 | |
|
||||
| `` / `` | 現在のビューをテキストで検索 | |
|
||||
|
||||
## サブモジュール
|
||||
@@ -168,17 +171,16 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | ポップ | スタッシュエントリをワーキングディレクトリに適用し、スタッシュエントリを削除します。 |
|
||||
| `` d `` | 削除 | スタッシュリストからスタッシュエントリを削除します。 |
|
||||
| `` n `` | 新しいブランチ | 選択したスタッシュエントリから新しいブランチを作成します。これは、スタッシュエントリが作成されたコミットをgitがチェックアウトし、そのコミットから新しいブランチを作成した後、スタッシュエントリを追加のコミットとして新しいブランチに適用することで機能します。 |
|
||||
| `` w `` | 新しいワークツリー | |
|
||||
| `` r `` | スタッシュの名前を変更 | |
|
||||
| `` 0 `` | メインビューにフォーカス | |
|
||||
| `` <enter> `` | ファイルを表示 | |
|
||||
| `` w `` | ワークツリーオプションを表示 | |
|
||||
| `` / `` | 現在のビューをテキストでフィルタリング | |
|
||||
|
||||
## ステータス
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` o `` | 設定ファイルを開く | デフォルトのアプリケーションでファイルを開きます。 |
|
||||
| `` e `` | 設定ファイルを編集 | 外部エディタでファイルを開きます。 |
|
||||
| `` u `` | 更新を確認 | |
|
||||
| `` <enter> `` | 最近のリポジトリをチェックアウト | |
|
||||
@@ -201,13 +203,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | タグをクリップボードにコピー | |
|
||||
| `` <space> `` | チェックアウト(ブランチの切り替え) | 選択したタグをデタッチドHEADとしてチェックアウトします。 |
|
||||
| `` n `` | 新しいタグを作成 | 現在のコミットから新しいタグを作成します。タグ名とオプションの説明を入力するよう促されます。 |
|
||||
| `` w `` | 新しいワークツリー | |
|
||||
| `` d `` | 削除 | ローカル/リモートタグの削除オプションを表示します。 |
|
||||
| `` P `` | タグをプッシュ | 選択したタグをリモートにプッシュします。リモートを選択するよう促されます。 |
|
||||
| `` g `` | リセット | 選択した項目へのリセットオプション(ソフト/ミックス/ハード)を表示します。各リセットタイプの詳細は次の通りです:<br>- ソフトリセット:変更を保持し、ステージされた状態にします<br>- ミックスリセット:変更を保持し、ステージされていない状態にします<br>- ハードリセット:すべての変更を破棄します |
|
||||
| `` <ctrl+t> `` | 外部差分ツールを開く(git difftool) | |
|
||||
| `` 0 `` | メインビューにフォーカス | |
|
||||
| `` <enter> `` | コミットを表示 | |
|
||||
| `` w `` | ワークツリーオプションを表示 | |
|
||||
| `` / `` | 現在のビューをテキストでフィルタリング | |
|
||||
|
||||
## ファイル
|
||||
@@ -286,7 +288,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | ハンクを選択 | |
|
||||
| `` b `` | すべてのハンクを選択 | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | 前のハンク | |
|
||||
| `` <down>, j `` | 次のハンク | |
|
||||
| `` <left>, h `` | 前のコンフリクト | |
|
||||
@@ -325,6 +327,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | ブラウザでコミットを開く | |
|
||||
| `` n `` | コミットから新しいブランチを作成 | |
|
||||
| `` N `` | コミットを新しいブランチに移動 | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | 新しいワークツリー | |
|
||||
| `` g `` | リセット | 選択した項目へのリセットオプション(ソフト/ミックス/ハード)を表示します。各リセットタイプの詳細は次の通りです:<br>- ソフトリセット:変更を保持し、ステージされた状態にします<br>- ミックスリセット:変更を保持し、ステージされていない状態にします<br>- ハードリセット:すべての変更を破棄します |
|
||||
| `` C `` | コピー(チェリーピック) | コミットをコピーとしてマークします。ローカルコミットビューで `V` を押すと、コピーしたコミットをチェックアウトしたブランチにペースト(チェリーピック)できます。いつでも `<esc>` を押して選択をキャンセルできます。 |
|
||||
| `` <ctrl+r> `` | コピーされた(チェリーピックされた)コミットの選択をリセット | |
|
||||
@@ -332,7 +335,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | 現在のブランチのコミットを選択 | |
|
||||
| `` 0 `` | メインビューにフォーカス | |
|
||||
| `` <enter> `` | コミットを表示 | |
|
||||
| `` w `` | ワークツリーオプションを表示 | |
|
||||
| `` / `` | 現在のビューをテキストでフィルタリング | |
|
||||
|
||||
## リモート
|
||||
@@ -354,6 +356,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | ブランチ名をクリップボードにコピー | |
|
||||
| `` <space> `` | チェックアウト(ブランチの切り替え) | 選択したリモートブランチに基づいて新しいローカルブランチをチェックアウトするか、リモートブランチをデタッチドヘッドとしてチェックアウトします。 |
|
||||
| `` n `` | 新しいブランチ | |
|
||||
| `` w `` | 新しいワークツリー | |
|
||||
| `` M `` | マージ | 選択した項目を現在のブランチにマージするためのオプションを表示します(通常のマージ、スカッシュマージ) |
|
||||
| `` r `` | リベース | チェックアウトしたブランチを選択したブランチ上にリベースします。 |
|
||||
| `` d `` | 削除 | リモートからリモートブランチを削除します。 |
|
||||
@@ -363,7 +366,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | 外部差分ツールを開く(git difftool) | |
|
||||
| `` 0 `` | メインビューにフォーカス | |
|
||||
| `` <enter> `` | コミットを表示 | |
|
||||
| `` w `` | ワークツリーオプションを表示 | |
|
||||
| `` / `` | 現在のビューをテキストでフィルタリング | |
|
||||
|
||||
## ローカルブランチ
|
||||
@@ -375,6 +377,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <space> `` | チェックアウト(ブランチの切り替え) | 選択した項目をチェックアウトします。 |
|
||||
| `` n `` | 新しいブランチ | |
|
||||
| `` N `` | コミットを新しいブランチに移動 | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | 新しいワークツリー | |
|
||||
| `` o `` | プルリクエストを作成 | |
|
||||
| `` O `` | プルリクエスト作成オプションを表示 | |
|
||||
| `` G `` | Open pull request in browser | |
|
||||
@@ -394,7 +397,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | 外部差分ツールを開く(git difftool) | |
|
||||
| `` 0 `` | メインビューにフォーカス | |
|
||||
| `` <enter> `` | コミットを表示 | |
|
||||
| `` w `` | ワークツリーオプションを表示 | |
|
||||
| `` / `` | 現在のビューをテキストでフィルタリング | |
|
||||
|
||||
## ワークツリー
|
||||
|
||||
@@ -22,7 +22,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` R `` | 새로고침 | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||
| `` + `` | 다음 스크린 모드 (normal/half/fullscreen) | |
|
||||
| `` _ `` | 이전 스크린 모드 | |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers. |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | 취소 | |
|
||||
| `` ? `` | 매뉴 열기 | |
|
||||
| `` <ctrl+s> `` | View filter-by-path options | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
@@ -30,6 +31,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` q, <ctrl+c> `` | 종료 | |
|
||||
| `` <ctrl+z> `` | Suspend the application | |
|
||||
| `` <ctrl+w> `` | 공백문자를 Diff 뷰에서 표시 여부 전환 | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` % `` | Toggle mouse capture | Toggle whether lazygit captures mouse events. When mouse capture is off, the terminal handles the mouse, so you can select text with it; this is useful in terminals that don't have a modifier key to bypass the capture.<br><br>The default can be changed in the config file with the key 'gui.mouseEvents'. |
|
||||
| `` <alt+shift+c> `` | 설정 파일 수정 | Open file in external editor. |
|
||||
| `` z `` | 되돌리기 (reflog) (실험적) | The reflog will be used to determine what git command to run to undo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
| `` Z `` | 다시 실행 (reflog) (실험적) | The reflog will be used to determine what git command to run to redo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
|
||||
@@ -67,6 +70,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 브라우저에서 커밋 열기 | |
|
||||
| `` n `` | 커밋에서 새 브랜치를 만듭니다. | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | View reset options | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | 커밋을 복사 (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | Reset cherry-picked (copied) commits selection | |
|
||||
@@ -74,7 +78,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 커밋 보기 | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Secondary
|
||||
@@ -93,10 +96,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | Pop | Apply the stash entry to your working directory and remove the stash entry. |
|
||||
| `` d `` | Drop | Remove the stash entry from the stash list. |
|
||||
| `` n `` | 새 브랜치 생성 | Create a new branch from the selected stash entry. This works by git checking out the commit that the stash entry was created from, creating a new branch from that commit, then applying the stash entry to the new branch as an additional commit. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` r `` | Rename stash | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View selected item's files | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Sub-commits
|
||||
@@ -109,6 +112,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 브라우저에서 커밋 열기 | |
|
||||
| `` n `` | 커밋에서 새 브랜치를 만듭니다. | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | View reset options | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | 커밋을 복사 (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | Reset cherry-picked (copied) commits selection | |
|
||||
@@ -116,7 +120,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View selected item's files | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | 검색 시작 | |
|
||||
|
||||
## Worktrees
|
||||
@@ -142,7 +145,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | Pick hunk | |
|
||||
| `` b `` | Pick all hunks | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | 이전 hunk를 선택 | |
|
||||
| `` <down>, j `` | 다음 hunk를 선택 | |
|
||||
| `` <left>, h `` | 이전 충돌을 선택 | |
|
||||
@@ -210,6 +213,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <space> `` | 체크아웃 | Checkout selected item. |
|
||||
| `` n `` | 새 브랜치 생성 | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` o `` | 풀 리퀘스트 생성 | |
|
||||
| `` O `` | 풀 리퀘스트 생성 옵션 | |
|
||||
| `` G `` | Open pull request in browser | |
|
||||
@@ -229,14 +233,12 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 커밋 보기 | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## 상태
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` o `` | 설정 파일 열기 | Open file in default application. |
|
||||
| `` e `` | 설정 파일 수정 | Open file in external editor. |
|
||||
| `` u `` | 업데이트 확인 | |
|
||||
| `` <enter> `` | 최근에 사용한 저장소로 전환 | |
|
||||
@@ -277,6 +279,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | 브랜치명을 클립보드에 복사 | |
|
||||
| `` <space> `` | 체크아웃 | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
|
||||
| `` n `` | 새 브랜치 생성 | |
|
||||
| `` w `` | New worktree | |
|
||||
| `` 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 the remote branch from the remote. |
|
||||
@@ -286,7 +289,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 커밋 보기 | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## 커밋
|
||||
@@ -322,13 +324,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 브라우저에서 커밋 열기 | |
|
||||
| `` n `` | 커밋에서 새 브랜치를 만듭니다. | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | View reset options | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | 커밋을 복사 (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View selected item's files | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | 검색 시작 | |
|
||||
|
||||
## 커밋 파일
|
||||
@@ -365,13 +367,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+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. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` 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 `` | 초기화 | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 커밋 보기 | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## 파일
|
||||
|
||||
@@ -10,26 +10,29 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <pgup>, K, <ctrl+u> (fn+up/shift+k) `` | Scroll naar beneden vanaf hoofdpaneel | |
|
||||
| `` <pgdown>, J, <ctrl+d> (fn+down/shift+j) `` | Scroll naar beneden vanaf hoofdpaneel | |
|
||||
| `` @ `` | View command log options | View options for the command log e.g. show/hide the command log and focus the command log. |
|
||||
| `` P `` | Push | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
|
||||
| `` p `` | Pull | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
|
||||
| `` P `` | Push | Push de huidige branch naar de bijbehorende upstream-branch. Als er geen upstream is geconfigureerd wordt er gevraagd om een upstream-branch te configureren. |
|
||||
| `` p `` | Pull | Pull wijzigingen van de remote voor de huidige branch. Als er geen upstream is geconfigureerd wordt er gevraagd om een upstream-branch te configureren. |
|
||||
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename.<br><br>The default can be changed in the config file with the key 'git.renameSimilarityThreshold'. |
|
||||
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename.<br><br>The default can be changed in the config file with the key 'git.renameSimilarityThreshold'. |
|
||||
| `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view.<br><br>The default can be changed in the config file with the key 'git.diffContextSize'. |
|
||||
| `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view.<br><br>The default can be changed in the config file with the key 'git.diffContextSize'. |
|
||||
| `` : `` | Execute shell command | Bring up a prompt where you can enter a shell command to execute. |
|
||||
| `` <ctrl+p> `` | Bekijk aangepaste patch opties | |
|
||||
| `` m `` | Bekijk merge/rebase opties | View options to abort/continue/skip the current merge/rebase. |
|
||||
| `` m `` | Bekijk merge/rebase opties | Toon abort/continue/skip opties voor huidige merge/rebase. |
|
||||
| `` R `` | Verversen | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||
| `` + `` | Volgende scherm modus (normaal/half/groot) | |
|
||||
| `` _ `` | Vorige scherm modus | |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers. |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | Annuleren | |
|
||||
| `` ? `` | Open menu | |
|
||||
| `` <ctrl+s> `` | Bekijk scoping opties | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
| `` W, <ctrl+e> `` | Open diff menu | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
|
||||
| `` q, <ctrl+c> `` | Quit | |
|
||||
| `` <ctrl+z> `` | Suspend the application | |
|
||||
| `` q, <ctrl+c> `` | Afsluiten | |
|
||||
| `` <ctrl+z> `` | Pauzeer de applicatie | |
|
||||
| `` <ctrl+w> `` | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` % `` | Toggle mouse capture | Toggle whether lazygit captures mouse events. When mouse capture is off, the terminal handles the mouse, so you can select text with it; this is useful in terminals that don't have a modifier key to bypass the capture.<br><br>The default can be changed in the config file with the key 'gui.mouseEvents'. |
|
||||
| `` <alt+shift+c> `` | Verander config bestand | Open bestand in externe editor. |
|
||||
| `` z `` | Ongedaan maken (via reflog) (experimenteel) | The reflog will be used to determine what git command to run to undo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
| `` Z `` | Redo (via reflog) (experimenteel) | The reflog will be used to determine what git command to run to redo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
|
||||
@@ -45,8 +48,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <shift+down> `` | Range select down | |
|
||||
| `` <shift+up> `` | Range select up | |
|
||||
| `` / `` | Start met zoeken | |
|
||||
| `` H `` | Scroll left | |
|
||||
| `` L `` | Scroll right | |
|
||||
| `` H `` | Scroll naar links | |
|
||||
| `` L `` | Scroll naar rechts | |
|
||||
| `` ] `` | Volgende tabblad | |
|
||||
| `` [ `` | Vorige tabblad | |
|
||||
|
||||
@@ -56,15 +59,15 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
|-----|--------|-------------|
|
||||
| `` <ctrl+o> `` | Kopieer de bestandsnaam naar het klembord | |
|
||||
| `` <space> `` | Toggle staged | Toggle staged for selected file. |
|
||||
| `` <ctrl+b> `` | Filter files by status | |
|
||||
| `` y `` | Copy to clipboard | |
|
||||
| `` c `` | Commit veranderingen | Commit staged changes. |
|
||||
| `` <ctrl+b> `` | Filter bestanden op status | |
|
||||
| `` y `` | Kopieer naar klembord | |
|
||||
| `` c `` | Commit veranderingen | Commit gestagede wijzigingen. |
|
||||
| `` w `` | Commit veranderingen zonder pre-commit hook | |
|
||||
| `` A `` | Wijzig laatste commit | |
|
||||
| `` C `` | Commit veranderingen met de git editor | |
|
||||
| `` <ctrl+f> `` | Find base commit for fixup | Find the commit that your current changes are building upon, for the sake of amending/fixing up the commit. This spares you from having to look through your branch's commits one-by-one to see which commit should be amended/fixed up. See docs: <https://github.com/jesseduffield/lazygit/tree/master/docs/Fixup_Commits.md> |
|
||||
| `` e `` | Edit | Open file in external editor. |
|
||||
| `` o `` | Open bestand | Open file in default application. |
|
||||
| `` <ctrl+f> `` | Find base commit for fixup | Vind de commit waar je huidige wijzigingen bovenop zijn gebouwd met als doel die commit te amenden/fixen. Hierdoor hoef je dit niet met de hand te doen. Zie: <https://github.com/jesseduffield/lazygit/tree/master/docs/Fixup_Commits.md> |
|
||||
| `` e `` | Edit | Open bestand in externe editor. |
|
||||
| `` o `` | Open bestand | Open bestand in standaardapplicatie. |
|
||||
| `` i `` | Ignore or exclude file | |
|
||||
| `` r `` | Refresh bestanden | |
|
||||
| `` s `` | Stash | Stash all changes. For other variations of stashing, use the view stash options keybinding. |
|
||||
@@ -73,13 +76,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <enter> `` | Stage individuele hunks/lijnen | 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 `` | Bekijk 'veranderingen ongedaan maken' opties | View options for discarding changes to the selected file. |
|
||||
| `` g `` | Bekijk upstream reset opties | |
|
||||
| `` D `` | Reset | View reset options for working tree (e.g. nuking the working tree). |
|
||||
| `` D `` | Resetten | View reset options for working tree (e.g. nuking the working tree). |
|
||||
| `` ` `` | Toggle bestandsboom weergave | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory.<br><br>The default can be changed in the config file with the key 'gui.showFileTree'. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` M `` | View merge conflict options | View options for resolving merge conflicts. |
|
||||
| `` <ctrl+t> `` | Open externe diff applicatie (git difftool) | |
|
||||
| `` M `` | Bekijk merge conflict opties | Bekijk opties voor het oplossen van mergeconflicten. |
|
||||
| `` f `` | Fetch | Fetch changes from remote. |
|
||||
| `` - `` | Collapse all files | Collapse all directories in the files tree |
|
||||
| `` = `` | Expand all files | Expand all directories in the file tree |
|
||||
| `` = `` | Vouw alle bestanden uit | Vouw alle mappen in de bestandsstructuur uit |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
@@ -89,7 +92,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
|-----|--------|-------------|
|
||||
| `` <enter> `` | Bevestig | |
|
||||
| `` <esc> `` | Sluiten | |
|
||||
| `` <ctrl+o> `` | Copy to clipboard | |
|
||||
| `` <ctrl+o> `` | Kopieer naar klembord | |
|
||||
|
||||
## Branches
|
||||
|
||||
@@ -97,18 +100,19 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
|-----|--------|-------------|
|
||||
| `` <ctrl+o> `` | Kopieer branch name naar klembord | |
|
||||
| `` i `` | Laat git-flow opties zien | |
|
||||
| `` <space> `` | Uitchecken | Checkout selected item. |
|
||||
| `` <space> `` | Uitchecken | Geselecteerd item uitchecken. |
|
||||
| `` n `` | Nieuwe branch | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` N `` | Verplaats commits naar nieuwe branch | Maak een nieuwe branch en verplaats niet-gepushte commits van de huidige branch hier naar toe. Gebruik dit in het geval dat je deze commits eigenlijk op een nieuwe branch had willen maken.<br><br>Let op dat de selectie genegeerd wordt. De nieuwe branch komt ofwel bovenop de main branch, of bovenop de huidige branch (je kan kiezen). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` o `` | Maak een pull-request | |
|
||||
| `` O `` | Bekijk opties voor pull-aanvraag | |
|
||||
| `` G `` | Open pull request in browser | |
|
||||
| `` <ctrl+y> `` | Kopieer de URL van het pull-verzoek naar het klembord | |
|
||||
| `` c `` | Uitchecken bij naam | Checkout by name. In the input box you can enter '-' to switch to the previous branch. |
|
||||
| `` - `` | Checkout previous branch | |
|
||||
| `` - `` | Vorige branch uitchecken | |
|
||||
| `` F `` | Forceer checkout | 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. |
|
||||
| `` r `` | Rebase branch | Rebase the checked-out branch onto the selected branch. |
|
||||
| `` d `` | Verwijderen | View delete options for local/remote branch. |
|
||||
| `` r `` | Rebase branch | Rebase de uitgecheckte branch bovenop de geselecteerde branch. |
|
||||
| `` M `` | Merge in met huidige checked out branch | View options for merging the selected item into the current branch (regular merge, squash merge) |
|
||||
| `` f `` | Fast-forward deze branch vanaf zijn upstream | Fast-forward selected branch from its upstream. |
|
||||
| `` T `` | Creëer tag | |
|
||||
@@ -116,10 +120,9 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | Bekijk reset opties | |
|
||||
| `` R `` | Hernoem branch | |
|
||||
| `` u `` | View upstream options | View options relating to the branch's upstream e.g. setting/unsetting the upstream and resetting to the upstream. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` <ctrl+t> `` | Open externe diff applicatie (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Bekijk commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Commit bericht
|
||||
@@ -134,18 +137,18 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <ctrl+o> `` | Kopieer de bestandsnaam naar het klembord | |
|
||||
| `` y `` | Copy to clipboard | |
|
||||
| `` y `` | Kopieer naar klembord | |
|
||||
| `` c `` | Uitchecken | Bestand uitchecken |
|
||||
| `` d `` | Bekijk 'veranderingen ongedaan maken' opties | Uitsluit deze commit zijn veranderingen aan dit bestand |
|
||||
| `` o `` | Open bestand | Open file in default application. |
|
||||
| `` e `` | Edit | Open file in external editor. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` o `` | Open bestand | Open bestand in standaardapplicatie. |
|
||||
| `` e `` | Edit | Open bestand in externe editor. |
|
||||
| `` <ctrl+t> `` | Open externe diff applicatie (git difftool) | |
|
||||
| `` <space> `` | Toggle bestand inbegrepen 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 bestand om geselecteerde regels toe te voegen aan de patch | 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. |
|
||||
| `` ` `` | Toggle bestandsboom weergave | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory.<br><br>The default can be changed in the config file with the key 'gui.showFileTree'. |
|
||||
| `` - `` | Collapse all files | Collapse all directories in the files tree |
|
||||
| `` = `` | Expand all files | Expand all directories in the file tree |
|
||||
| `` = `` | Vouw alle bestanden uit | Vouw alle mappen in de bestandsstructuur uit |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
@@ -181,14 +184,14 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). |
|
||||
| `` o `` | Open commit in browser | |
|
||||
| `` n `` | Creëer nieuwe branch van commit | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` N `` | Verplaats commits naar nieuwe branch | Maak een nieuwe branch en verplaats niet-gepushte commits van de huidige branch hier naar toe. Gebruik dit in het geval dat je deze commits eigenlijk op een nieuwe branch had willen maken.<br><br>Let op dat de selectie genegeerd wordt. De nieuwe branch komt ofwel bovenop de main branch, of bovenop de huidige branch (je kan kiezen). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Bekijk reset opties | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Kopieer commit (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` <ctrl+t> `` | Open externe diff applicatie (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Bekijk gecommite bestanden | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Start met zoeken | |
|
||||
|
||||
## Input prompt
|
||||
@@ -211,15 +214,15 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | Kies stuk | |
|
||||
| `` b `` | Kies beide stukken | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | Selecteer bovenste hunk | |
|
||||
| `` <down>, j `` | Selecteer onderste hunk | |
|
||||
| `` <left>, h `` | Selecteer voorgaand conflict | |
|
||||
| `` <right>, l `` | Selecteer volgende conflict | |
|
||||
| `` z `` | Ongedaan maken | Undo last merge conflict resolution. |
|
||||
| `` e `` | Verander bestand | Open file in external editor. |
|
||||
| `` o `` | Open bestand | Open file in default application. |
|
||||
| `` M `` | View merge conflict options | View options for resolving merge conflicts. |
|
||||
| `` e `` | Verander bestand | Open bestand in externe editor. |
|
||||
| `` o `` | Open bestand | Open bestand in standaardapplicatie. |
|
||||
| `` M `` | Bekijk merge conflict opties | Bekijk opties voor het oplossen van mergeconflicten. |
|
||||
| `` <esc> `` | Ga terug naar het bestanden paneel | |
|
||||
|
||||
## Normaal
|
||||
@@ -241,8 +244,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` v `` | Toggle drag selecteer | |
|
||||
| `` a `` | Toggle hunk selection | Toggle line-by-line vs. hunk selection mode. |
|
||||
| `` <ctrl+o> `` | Copy selected text to clipboard | |
|
||||
| `` o `` | Open bestand | Open file in default application. |
|
||||
| `` e `` | Verander bestand | Open file in external editor. |
|
||||
| `` o `` | Open bestand | Open bestand in standaardapplicatie. |
|
||||
| `` e `` | Verander bestand | Open bestand in externe editor. |
|
||||
| `` <space> `` | Voeg toe/verwijder lijn(en) in patch | |
|
||||
| `` d `` | Remove lines from commit | Remove the selected lines from this commit. This runs an interactive rebase in the background, so you may get a merge conflict if a later commit also changes these lines. |
|
||||
| `` <esc> `` | Sluit lijn-bij-lijn modus | |
|
||||
@@ -257,15 +260,15 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). |
|
||||
| `` o `` | Open commit in browser | |
|
||||
| `` n `` | Creëer nieuwe branch van commit | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` N `` | Verplaats commits naar nieuwe branch | Maak een nieuwe branch en verplaats niet-gepushte commits van de huidige branch hier naar toe. Gebruik dit in het geval dat je deze commits eigenlijk op een nieuwe branch had willen maken.<br><br>Let op dat de selectie genegeerd wordt. De nieuwe branch komt ofwel bovenop de main branch, of bovenop de huidige branch (je kan kiezen). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Bekijk reset opties | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Kopieer commit (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | Reset cherry-picked (gekopieerde) commits selectie | |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` <ctrl+t> `` | Open externe diff applicatie (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Bekijk commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Remote branches
|
||||
@@ -273,27 +276,27 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <ctrl+o> `` | Kopieer branch name naar klembord | |
|
||||
| `` <space> `` | Uitchecken | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
|
||||
| `` <space> `` | Uitchecken | Geselecteerde remote branch uitchecken als nieuwe locale branch of als detached head. |
|
||||
| `` n `` | Nieuwe branch | |
|
||||
| `` w `` | New worktree | |
|
||||
| `` M `` | Merge in met huidige checked out branch | View options for merging the selected item into the current branch (regular merge, squash merge) |
|
||||
| `` r `` | Rebase branch | Rebase the checked-out branch onto the selected branch. |
|
||||
| `` d `` | Delete | Delete the remote branch from the remote. |
|
||||
| `` u `` | Set as upstream | Stel in als upstream van uitgecheckte branch |
|
||||
| `` r `` | Rebase branch | Rebase de uitgecheckte branch bovenop de geselecteerde branch. |
|
||||
| `` d `` | Verwijderen | Delete the remote branch from the remote. |
|
||||
| `` u `` | Instellen als upstream | Stel in als upstream van uitgecheckte branch |
|
||||
| `` s `` | Sort order | |
|
||||
| `` g `` | Bekijk reset opties | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` <ctrl+t> `` | Open externe diff applicatie (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Bekijk commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Remotes
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <enter> `` | View branches | |
|
||||
| `` <enter> `` | Bekijk branches | |
|
||||
| `` n `` | Voeg een nieuwe remote toe | |
|
||||
| `` d `` | Remove | Remove the selected remote. Any local branches tracking a remote branch from the remote will be unaffected. |
|
||||
| `` d `` | Verwijderen | Remove the selected remote. Any local branches tracking a remote branch from the remote will be unaffected. |
|
||||
| `` e `` | Edit | Wijzig remote |
|
||||
| `` f `` | Fetch | Fetch remote |
|
||||
| `` F `` | Add fork remote | Quickly add a fork remote by replacing the owner in the origin URL and optionally check out a branch from new remote. |
|
||||
@@ -318,15 +321,15 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | Copy selected text to clipboard | |
|
||||
| `` <space> `` | Toggle staged | Toggle lijnen staged / unstaged |
|
||||
| `` d `` | Verwijdert change (git reset) | When unstaged change is selected, discard the change using `git reset`. When staged change is selected, unstage the change. |
|
||||
| `` o `` | Open bestand | Open file in default application. |
|
||||
| `` e `` | Verander bestand | Open file in external editor. |
|
||||
| `` o `` | Open bestand | Open bestand in standaardapplicatie. |
|
||||
| `` e `` | Verander bestand | Open bestand in externe editor. |
|
||||
| `` <esc> `` | Ga terug naar het bestanden paneel | |
|
||||
| `` <tab> `` | Ga naar een ander paneel | Switch to other view (staged/unstaged changes). |
|
||||
| `` E `` | Edit hunk | Edit selected hunk in external editor. |
|
||||
| `` c `` | Commit veranderingen | Commit staged changes. |
|
||||
| `` c `` | Commit veranderingen | Commit gestagede wijzigingen. |
|
||||
| `` w `` | Commit veranderingen zonder pre-commit hook | |
|
||||
| `` C `` | Commit veranderingen met de git editor | |
|
||||
| `` <ctrl+f> `` | Find base commit for fixup | Find the commit that your current changes are building upon, for the sake of amending/fixing up the commit. This spares you from having to look through your branch's commits one-by-one to see which commit should be amended/fixed up. See docs: <https://github.com/jesseduffield/lazygit/tree/master/docs/Fixup_Commits.md> |
|
||||
| `` <ctrl+f> `` | Find base commit for fixup | Vind de commit waar je huidige wijzigingen bovenop zijn gebouwd met als doel die commit te amenden/fixen. Hierdoor hoef je dit niet met de hand te doen. Zie: <https://github.com/jesseduffield/lazygit/tree/master/docs/Fixup_Commits.md> |
|
||||
| `` / `` | Start met zoeken | |
|
||||
|
||||
## Stash
|
||||
@@ -337,18 +340,17 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | Pop | Apply the stash entry to your working directory and remove the stash entry. |
|
||||
| `` d `` | Laten vallen | Remove the stash entry from the stash list. |
|
||||
| `` n `` | Nieuwe branch | Create a new branch from the selected stash entry. This works by git checking out the commit that the stash entry was created from, creating a new branch from that commit, then applying the stash entry to the new branch as an additional commit. |
|
||||
| `` r `` | Rename stash | |
|
||||
| `` w `` | New worktree | |
|
||||
| `` r `` | Hernoem stash | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Bekijk gecommite bestanden | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Status
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` o `` | Open config bestand | Open file in default application. |
|
||||
| `` e `` | Verander config bestand | Open file in external editor. |
|
||||
| `` e `` | Verander config bestand | Open bestand in externe editor. |
|
||||
| `` u `` | Check voor updates | |
|
||||
| `` <enter> `` | Wissel naar een recente repo | |
|
||||
| `` a `` | Show/cycle all branch logs | |
|
||||
@@ -364,15 +366,15 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). |
|
||||
| `` o `` | Open commit in browser | |
|
||||
| `` n `` | Creëer nieuwe branch van commit | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` N `` | Verplaats commits naar nieuwe branch | Maak een nieuwe branch en verplaats niet-gepushte commits van de huidige branch hier naar toe. Gebruik dit in het geval dat je deze commits eigenlijk op een nieuwe branch had willen maken.<br><br>Let op dat de selectie genegeerd wordt. De nieuwe branch komt ofwel bovenop de main branch, of bovenop de huidige branch (je kan kiezen). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Bekijk reset opties | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Kopieer commit (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | Reset cherry-picked (gekopieerde) commits selectie | |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` <ctrl+t> `` | Open externe diff applicatie (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Bekijk gecommite bestanden | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Start met zoeken | |
|
||||
|
||||
## Submodules
|
||||
@@ -381,7 +383,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
|-----|--------|-------------|
|
||||
| `` <ctrl+o> `` | Kopieer submodule naam naar klembord | |
|
||||
| `` <enter> `` | Enter | Enter submodule |
|
||||
| `` d `` | Remove | Remove the selected submodule and its corresponding directory. |
|
||||
| `` d `` | Verwijderen | Remove the selected submodule and its corresponding directory. |
|
||||
| `` u `` | Update | Update selected submodule. |
|
||||
| `` n `` | Voeg nieuwe submodule toe | |
|
||||
| `` e `` | Update submodule URL | |
|
||||
@@ -394,15 +396,15 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <ctrl+o> `` | Copy tag to clipboard | |
|
||||
| `` <space> `` | Uitchecken | Checkout the selected tag as a detached HEAD. |
|
||||
| `` <space> `` | Uitchecken | Geselecteerde tag uitchecken als 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. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` d `` | Verwijderen | 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. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` g `` | Resetten | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` <ctrl+t> `` | Open externe diff applicatie (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Bekijk commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Worktrees
|
||||
@@ -411,6 +413,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
|-----|--------|-------------|
|
||||
| `` n `` | New worktree | |
|
||||
| `` <space> `` | Switch | Switch to the selected worktree. |
|
||||
| `` o `` | Open in 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. |
|
||||
| `` o `` | Openen in editor | |
|
||||
| `` d `` | Verwijderen | 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 | |
|
||||
|
||||
@@ -22,7 +22,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` R `` | Odśwież | Odśwież stan git (tj. uruchom `git status`, `git branch`, itp. w tle, aby zaktualizować zawartość paneli). To nie uruchamia `git fetch`. |
|
||||
| `` + `` | Następny tryb ekranu (normalny/półpełny/pełnoekranowy) | |
|
||||
| `` _ `` | Poprzedni tryb ekranu | |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers. |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | Anuluj | |
|
||||
| `` ? `` | Otwórz menu przypisań klawiszy | |
|
||||
| `` <ctrl+s> `` | Pokaż opcje filtrowania | Pokaż opcje filtrowania dziennika commitów, tak aby pokazywane były tylko commity pasujące do filtra. |
|
||||
@@ -30,6 +31,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` q, <ctrl+c> `` | Wyjdź | |
|
||||
| `` <ctrl+z> `` | Suspend the application | |
|
||||
| `` <ctrl+w> `` | Przełącz białe znaki | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` % `` | Toggle mouse capture | Toggle whether lazygit captures mouse events. When mouse capture is off, the terminal handles the mouse, so you can select text with it; this is useful in terminals that don't have a modifier key to bypass the capture.<br><br>The default can be changed in the config file with the key 'gui.mouseEvents'. |
|
||||
| `` <alt+shift+c> `` | Edytuj plik konfiguracyjny | Otwórz plik w zewnętrznym edytorze. |
|
||||
| `` z `` | Cofnij | Dziennik reflog zostanie użyty do określenia, jakie polecenie git należy uruchomić, aby cofnąć ostatnie polecenie git. Nie obejmuje to zmian w drzewie roboczym; brane są pod uwagę tylko commity. |
|
||||
| `` Z `` | Ponów | Dziennik reflog zostanie użyty do określenia, jakie polecenie git należy uruchomić, aby ponowić ostatnie polecenie git. Nie obejmuje to zmian w drzewie roboczym; brane są pod uwagę tylko commity. |
|
||||
|
||||
@@ -83,13 +86,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Otwórz commit w przeglądarce | |
|
||||
| `` n `` | Utwórz nową gałąź z commita | |
|
||||
| `` N `` | Przenieś commity do nowej gałęzi | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | Nowe drzewo pracy | |
|
||||
| `` g `` | Reset | Wyświetl opcje resetu (miękki/mieszany/twardy) do wybranego elementu. |
|
||||
| `` C `` | Kopiuj (cherry-pick) | Oznacz commit jako skopiowany. Następnie, w widoku lokalnych commitów, możesz nacisnąć `V`, aby wkleić (cherry-pick) skopiowane commity do sprawdzonej gałęzi. W dowolnym momencie możesz nacisnąć `<esc>`, aby anulować zaznaczenie. |
|
||||
| `` <ctrl+t> `` | Otwórz zewnętrzne narzędzie różnic (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Wyświetl pliki | |
|
||||
| `` w `` | Zobacz opcje drzewa pracy | |
|
||||
| `` / `` | Szukaj w bieżącym widoku po tekście | |
|
||||
|
||||
## Dodatkowy
|
||||
@@ -120,6 +123,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Otwórz commit w przeglądarce | |
|
||||
| `` n `` | Utwórz nową gałąź z commita | |
|
||||
| `` N `` | Przenieś commity do nowej gałęzi | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | Nowe drzewo pracy | |
|
||||
| `` g `` | Reset | Wyświetl opcje resetu (miękki/mieszany/twardy) do wybranego elementu. |
|
||||
| `` C `` | Kopiuj (cherry-pick) | Oznacz commit jako skopiowany. Następnie, w widoku lokalnych commitów, możesz nacisnąć `V`, aby wkleić (cherry-pick) skopiowane commity do sprawdzonej gałęzi. W dowolnym momencie możesz nacisnąć `<esc>`, aby anulować zaznaczenie. |
|
||||
| `` <ctrl+r> `` | Resetuj wybrane (cherry-picked) commity | |
|
||||
@@ -127,7 +131,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Pokaż commity | |
|
||||
| `` w `` | Zobacz opcje drzewa pracy | |
|
||||
| `` / `` | Filtruj bieżący widok po tekście | |
|
||||
|
||||
## Główny panel (budowanie łatki)
|
||||
@@ -162,6 +165,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <space> `` | Przełącz | Przełącz wybrany element. |
|
||||
| `` n `` | Nowa gałąź | |
|
||||
| `` N `` | Przenieś commity do nowej gałęzi | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | Nowe drzewo pracy | |
|
||||
| `` o `` | Utwórz żądanie ściągnięcia | |
|
||||
| `` O `` | Zobacz opcje tworzenia pull requesta | |
|
||||
| `` G `` | Otwórz żądanie ściągnięcia w przeglądarce | |
|
||||
@@ -181,7 +185,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Otwórz zewnętrzne narzędzie różnic (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Pokaż commity | |
|
||||
| `` w `` | Zobacz opcje drzewa pracy | |
|
||||
| `` / `` | Filtruj bieżący widok po tekście | |
|
||||
|
||||
## Menu
|
||||
@@ -207,7 +210,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | Wybierz fragment | |
|
||||
| `` b `` | Wybierz wszystkie fragmenty | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | Poprzedni fragment | |
|
||||
| `` <down>, j `` | Następny fragment | |
|
||||
| `` <left>, h `` | Poprzedni konflikt | |
|
||||
@@ -316,17 +319,16 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | Wyciągnij | Zastosuj wpis schowka do katalogu roboczego i usuń wpis schowka. |
|
||||
| `` d `` | Usuń | Usuń wpis schowka z listy schowka. |
|
||||
| `` n `` | Nowa gałąź | Utwórz nową gałąź z wybranego wpisu schowka. Działa poprzez przełączenie git na commit, na którym wpis schowka został utworzony, tworzenie nowej gałęzi z tego commita, a następnie zastosowanie wpisu schowka do nowej gałęzi jako dodatkowego commita. |
|
||||
| `` w `` | Nowe drzewo pracy | |
|
||||
| `` r `` | Zmień nazwę schowka | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Wyświetl pliki | |
|
||||
| `` w `` | Zobacz opcje drzewa pracy | |
|
||||
| `` / `` | Filtruj bieżący widok po tekście | |
|
||||
|
||||
## Status
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` o `` | Otwórz plik konfiguracyjny | Otwórz plik w domyślnej aplikacji. |
|
||||
| `` e `` | Edytuj plik konfiguracyjny | Otwórz plik w zewnętrznym edytorze. |
|
||||
| `` u `` | Sprawdź aktualizacje | |
|
||||
| `` <enter> `` | Przełącz na ostatnie repozytorium | |
|
||||
@@ -344,6 +346,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Otwórz commit w przeglądarce | |
|
||||
| `` n `` | Utwórz nową gałąź z commita | |
|
||||
| `` N `` | Przenieś commity do nowej gałęzi | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | Nowe drzewo pracy | |
|
||||
| `` g `` | Reset | Wyświetl opcje resetu (miękki/mieszany/twardy) do wybranego elementu. |
|
||||
| `` C `` | Kopiuj (cherry-pick) | Oznacz commit jako skopiowany. Następnie, w widoku lokalnych commitów, możesz nacisnąć `V`, aby wkleić (cherry-pick) skopiowane commity do sprawdzonej gałęzi. W dowolnym momencie możesz nacisnąć `<esc>`, aby anulować zaznaczenie. |
|
||||
| `` <ctrl+r> `` | Resetuj wybrane (cherry-picked) commity | |
|
||||
@@ -351,7 +354,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Wyświetl pliki | |
|
||||
| `` w `` | Zobacz opcje drzewa pracy | |
|
||||
| `` / `` | Szukaj w bieżącym widoku po tekście | |
|
||||
|
||||
## Submoduły
|
||||
@@ -375,13 +377,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | Skopiuj tag do schowka | |
|
||||
| `` <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. |
|
||||
| `` w `` | Nowe drzewo pracy | |
|
||||
| `` d `` | Usuń | Wyświetl opcje usuwania lokalnego/odległego tagu. |
|
||||
| `` P `` | Wyślij tag | Wyślij wybrany tag do zdalnego. Zostaniesz poproszony o wybranie zdalnego. |
|
||||
| `` g `` | Reset | Wyświetl opcje resetu (miękki/mieszany/twardy) do wybranego elementu. |
|
||||
| `` <ctrl+t> `` | Otwórz zewnętrzne narzędzie różnic (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Pokaż commity | |
|
||||
| `` w `` | Zobacz opcje drzewa pracy | |
|
||||
| `` / `` | Filtruj bieżący widok po tekście | |
|
||||
|
||||
## Zdalne
|
||||
@@ -403,6 +405,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | Kopiuj nazwę gałęzi do schowka | |
|
||||
| `` <space> `` | Przełącz | Przełącz na nową lokalną gałąź na podstawie wybranej gałęzi zdalnej. Nowa gałąź będzie śledzić gałąź zdalną. |
|
||||
| `` n `` | Nowa gałąź | |
|
||||
| `` w `` | Nowe drzewo pracy | |
|
||||
| `` M `` | Scal | Scal wybraną gałąź z aktualnie sprawdzoną gałęzią. |
|
||||
| `` r `` | Przebazuj | Przebazuj przełączoną gałąź na wybraną gałąź. |
|
||||
| `` d `` | Usuń | Usuń gałąź zdalną ze zdalnego. |
|
||||
@@ -412,5 +415,4 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Otwórz zewnętrzne narzędzie różnic (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Pokaż commity | |
|
||||
| `` w `` | Zobacz opcje drzewa pracy | |
|
||||
| `` / `` | Filtruj bieżący widok po tekście | |
|
||||
|
||||
@@ -22,7 +22,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` 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`. |
|
||||
| `` + `` | Modo de tela seguinte (normal/metade/tela cheia) | |
|
||||
| `` _ `` | Modo de tela anterior | |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers. |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | Cancelar | |
|
||||
| `` ? `` | Abrir o menu de atalhos do teclado | |
|
||||
| `` <ctrl+s> `` | Ver opções de filtro | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
@@ -30,6 +31,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` q, <ctrl+c> `` | Sair | |
|
||||
| `` <ctrl+z> `` | Suspender a aplicação | |
|
||||
| `` <ctrl+w> `` | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` % `` | Toggle mouse capture | Toggle whether lazygit captures mouse events. When mouse capture is off, the terminal handles the mouse, so you can select text with it; this is useful in terminals that don't have a modifier key to bypass the capture.<br><br>The default can be changed in the config file with the key 'gui.mouseEvents'. |
|
||||
| `` <alt+shift+c> `` | Editar arquivo de configuração | Abrir arquivo no editor externo. |
|
||||
| `` 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. |
|
||||
| `` 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. |
|
||||
|
||||
@@ -92,6 +95,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <space> `` | Verificar | Checar item selecionado |
|
||||
| `` n `` | Nova branch | |
|
||||
| `` N `` | Mover commits para uma nova branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | Nova árvore de trabalho | |
|
||||
| `` o `` | Criar solicitação de pull | |
|
||||
| `` O `` | View create pull request options | |
|
||||
| `` G `` | Open pull request in browser | |
|
||||
@@ -111,7 +115,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Abrir ferramenta de diff externa (git difftool) | |
|
||||
| `` 0 `` | Focar visualização principal | |
|
||||
| `` <enter> `` | Ver commits | |
|
||||
| `` w `` | Ver opções da árvore de trabalho | |
|
||||
| `` / `` | Filtrar a visualização atual por texto | |
|
||||
|
||||
## Branches remotos
|
||||
@@ -121,6 +124,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | Copiar nome da branch para área de transferência | |
|
||||
| `` <space> `` | Verificar | Checar a nova branch baseada na brach remota selecionada, ou a branch remota como HEAD, desanexado |
|
||||
| `` n `` | Nova branch | |
|
||||
| `` w `` | Nova árvore de trabalho | |
|
||||
| `` 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 `` | Apagar | Excluir o branch remoto do controle remoto. |
|
||||
@@ -130,7 +134,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Abrir ferramenta de diff externa (git difftool) | |
|
||||
| `` 0 `` | Focar visualização principal | |
|
||||
| `` <enter> `` | Ver commits | |
|
||||
| `` w `` | Ver opções da árvore de trabalho | |
|
||||
| `` / `` | Filtrar a visualização atual por texto | |
|
||||
|
||||
## Commit arquivos
|
||||
@@ -186,13 +189,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Abrir commit no navegador | |
|
||||
| `` n `` | Create new branch off of commit | |
|
||||
| `` N `` | Mover commits para uma nova branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | Nova árvore de trabalho | |
|
||||
| `` g `` | Restaurar | Ver opções de redefinição (soft/mixed/hard) para redefinir para o item selecionado. |
|
||||
| `` 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. |
|
||||
| `` <ctrl+t> `` | Abrir ferramenta de diff externa (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focar visualização principal | |
|
||||
| `` <enter> `` | Ver arquivos | |
|
||||
| `` w `` | Ver opções da árvore de trabalho | |
|
||||
| `` / `` | Pesquisar na visualização atual por texto | |
|
||||
|
||||
## Etiquetas
|
||||
@@ -202,13 +205,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | Copiar etiqueta para área de transferência | |
|
||||
| `` <space> `` | Verificar | Checar a tag selecionada como um HEAD, desanexado |
|
||||
| `` n `` | Nova etiqueta | Crie uma nova etiqueta a partir do commit atual. Você será solicitado a digitar um nome e uma descrição opcional. |
|
||||
| `` w `` | Nova árvore de trabalho | |
|
||||
| `` d `` | Apagar | Ver opções de exclusão para tag local/remoto. |
|
||||
| `` P `` | Empurrar etiqueta | Push the selected tag to a remote. You'll be prompted to select a remote. |
|
||||
| `` g `` | Restaurar | Ver opções de redefinição (soft/mixed/hard) para redefinir para o item selecionado. |
|
||||
| `` <ctrl+t> `` | Abrir ferramenta de diff externa (git difftool) | |
|
||||
| `` 0 `` | Focar visualização principal | |
|
||||
| `` <enter> `` | Ver commits | |
|
||||
| `` w `` | Ver opções da árvore de trabalho | |
|
||||
| `` / `` | Filtrar a visualização atual por texto | |
|
||||
|
||||
## Input prompt
|
||||
@@ -271,7 +274,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | Escolha o local | |
|
||||
| `` b `` | Pegar todos os pedaços | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | Trecho anterior | |
|
||||
| `` <down>, j `` | Próximo trecho | |
|
||||
| `` <left>, h `` | Conflito anterior | |
|
||||
@@ -308,6 +311,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Abrir commit no navegador | |
|
||||
| `` n `` | Create new branch off of commit | |
|
||||
| `` N `` | Mover commits para uma nova branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | Nova árvore de trabalho | |
|
||||
| `` g `` | Restaurar | Ver opções de redefinição (soft/mixed/hard) para redefinir para o item selecionado. |
|
||||
| `` 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. |
|
||||
| `` <ctrl+r> `` | Reset copied (cherry-picked) commits selection | |
|
||||
@@ -315,7 +319,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focar visualização principal | |
|
||||
| `` <enter> `` | Ver commits | |
|
||||
| `` w `` | Ver opções da árvore de trabalho | |
|
||||
| `` / `` | Filtrar a visualização atual por texto | |
|
||||
|
||||
## Remotes
|
||||
@@ -346,17 +349,16 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` 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. |
|
||||
| `` w `` | Nova árvore de trabalho | |
|
||||
| `` r `` | Renomear o stash | |
|
||||
| `` 0 `` | Focar visualização principal | |
|
||||
| `` <enter> `` | Ver arquivos | |
|
||||
| `` w `` | Ver opções da árvore de trabalho | |
|
||||
| `` / `` | Filtrar a visualização atual por texto | |
|
||||
|
||||
## 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 | |
|
||||
@@ -374,6 +376,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Abrir commit no navegador | |
|
||||
| `` n `` | Create new branch off of commit | |
|
||||
| `` N `` | Mover commits para uma nova branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | Nova árvore de trabalho | |
|
||||
| `` g `` | Restaurar | Ver opções de redefinição (soft/mixed/hard) para redefinir para o item selecionado. |
|
||||
| `` 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. |
|
||||
| `` <ctrl+r> `` | Reset copied (cherry-picked) commits selection | |
|
||||
@@ -381,7 +384,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focar visualização principal | |
|
||||
| `` <enter> `` | Ver arquivos | |
|
||||
| `` w `` | Ver opções da árvore de trabalho | |
|
||||
| `` / `` | Pesquisar na visualização atual por texto | |
|
||||
|
||||
## Submódulos
|
||||
|
||||
@@ -22,7 +22,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` R `` | Обновить | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||
| `` + `` | Следующий режим экрана (нормальный/полуэкранный/полноэкранный) | |
|
||||
| `` _ `` | Предыдущий режим экрана | |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers. |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | Отменить | |
|
||||
| `` ? `` | Открыть меню | |
|
||||
| `` <ctrl+s> `` | Просмотреть параметры фильтрации по пути | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
@@ -30,6 +31,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` q, <ctrl+c> `` | Выйти | |
|
||||
| `` <ctrl+z> `` | Suspend the application | |
|
||||
| `` <ctrl+w> `` | Переключить отображение изменении пробелов в просмотрщике сравнении | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` % `` | Toggle mouse capture | Toggle whether lazygit captures mouse events. When mouse capture is off, the terminal handles the mouse, so you can select text with it; this is useful in terminals that don't have a modifier key to bypass the capture.<br><br>The default can be changed in the config file with the key 'gui.mouseEvents'. |
|
||||
| `` <alt+shift+c> `` | Редактировать файл конфигурации | Open file in external editor. |
|
||||
| `` z `` | Отменить (через reflog) (экспериментальный) | Журнал ссылок (reflog) будет использоваться для определения того, какую команду git запустить, чтобы отменить последнюю команду git. Сюда не входят изменения в рабочем дереве; учитываются только коммиты. |
|
||||
| `` Z `` | Повторить (через reflog) (экспериментальный) | Журнал ссылок (reflog) будет использоваться для определения того, какую команду git нужно запустить, чтобы повторить последнюю команду git. Сюда не входят изменения в рабочем дереве; учитываются только коммиты. |
|
||||
|
||||
@@ -112,7 +115,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | Выбрать эту часть | |
|
||||
| `` b `` | Выбрать все части | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | Выбрать предыдущую часть | |
|
||||
| `` <down>, j `` | Выбрать следующую часть | |
|
||||
| `` <left>, h `` | Выбрать предыдущий конфликт | |
|
||||
@@ -149,6 +152,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Открыть коммит в браузере | |
|
||||
| `` n `` | Создать новую ветку с этого коммита | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Просмотреть параметры сброса | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Скопировать отобранные коммит (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | Сбросить отобранную (скопированную \| cherry-picked) выборку коммитов | |
|
||||
@@ -156,7 +160,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Просмотреть коммиты | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Коммиты
|
||||
@@ -192,13 +195,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Открыть коммит в браузере | |
|
||||
| `` n `` | Создать новую ветку с этого коммита | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Просмотреть параметры сброса | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Скопировать отобранные коммит (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Просмотреть файлы выбранного элемента | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Найти | |
|
||||
|
||||
## Локальные Ветки
|
||||
@@ -210,6 +213,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <space> `` | Переключить | Checkout selected item. |
|
||||
| `` n `` | Новая ветка | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` o `` | Создать запрос на принятие изменений | |
|
||||
| `` O `` | Создать параметры запроса принятие изменений | |
|
||||
| `` G `` | Open pull request in browser | |
|
||||
@@ -229,7 +233,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Просмотреть коммиты | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Меню
|
||||
@@ -258,6 +261,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Открыть коммит в браузере | |
|
||||
| `` n `` | Создать новую ветку с этого коммита | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Просмотреть параметры сброса | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Скопировать отобранные коммит (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | Сбросить отобранную (скопированную \| cherry-picked) выборку коммитов | |
|
||||
@@ -265,7 +269,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Просмотреть файлы выбранного элемента | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Найти | |
|
||||
|
||||
## Подмодули
|
||||
@@ -313,7 +316,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` o `` | Открыть файл конфигурации | Open file in default application. |
|
||||
| `` e `` | Редактировать файл конфигурации | Open file in external editor. |
|
||||
| `` u `` | Проверить обновления | |
|
||||
| `` <enter> `` | Переключиться на последний репозиторий | |
|
||||
@@ -328,13 +330,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+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. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` d `` | Delete | View delete options for local/remote tag. |
|
||||
| `` P `` | Отправить тег | 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. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Просмотреть коммиты | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Удалённые ветки
|
||||
@@ -344,6 +346,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | Скопировать название ветки в буфер обмена | |
|
||||
| `` <space> `` | Переключить | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
|
||||
| `` n `` | Новая ветка | |
|
||||
| `` w `` | New worktree | |
|
||||
| `` 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. |
|
||||
@@ -353,7 +356,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Просмотреть коммиты | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Удалённые репозитории
|
||||
@@ -409,8 +411,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | Применить припрятанные изменения и тут же удалить их из хранилища | Apply the stash entry to your working directory and remove the stash entry. |
|
||||
| `` d `` | Удалить припрятанные изменения из хранилища | Remove the stash entry from the stash list. |
|
||||
| `` n `` | Новая ветка | Create a new branch from the selected stash entry. This works by git checking out the commit that the stash entry was created from, creating a new branch from that commit, then applying the stash entry to the new branch as an additional commit. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` r `` | Переименовать хранилище | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Просмотреть файлы выбранного элемента | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
@@ -23,6 +23,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` + `` | 下一屏模式(正常/半屏/全屏) | |
|
||||
| `` _ `` | 上一屏模式 | |
|
||||
| `` \| `` | 切换分页器 | 从已配置的分页器列表中选择下一个分页器 |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | 取消 | |
|
||||
| `` ? `` | 打开菜单 | |
|
||||
| `` <ctrl+s> `` | 查看按路径过滤选项 | 查看用于过滤提交日志的选项,以便仅显示与过滤器匹配的提交。 |
|
||||
@@ -30,6 +31,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` q, <ctrl+c> `` | 退出 | |
|
||||
| `` <ctrl+z> `` | 挂起应用程序 | |
|
||||
| `` <ctrl+w> `` | 切换是否在差异视图中显示空白字符差异 | 切换是否在差异视图中显示空白字符更改。<br><br>默认值可在配置文件中通过键 'git.ignoreWhitespaceInDiffView' 更改。 |
|
||||
| `` % `` | Toggle mouse capture | Toggle whether lazygit captures mouse events. When mouse capture is off, the terminal handles the mouse, so you can select text with it; this is useful in terminals that don't have a modifier key to bypass the capture.<br><br>The default can be changed in the config file with the key 'gui.mouseEvents'. |
|
||||
| `` <alt+shift+c> `` | 编辑配置文件 | 使用外部编辑器打开文件 |
|
||||
| `` z `` | 撤销 | Reflog将用于确定运行哪个git命令来撤消最后一个git命令。这并不包括对工作树的更改,只考虑提交。 |
|
||||
| `` Z `` | 重做 | Reflog将用于确定运行哪个git命令来重做上一个git命令。这并不包括对工作树的更改,只考虑提交。 |
|
||||
|
||||
@@ -60,6 +63,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 在浏览器中打开提交 | |
|
||||
| `` n `` | 从提交创建新分支 | |
|
||||
| `` N `` | 移动提交至新分支 | 创建一个新分支,并将当前分支未推送的提交移动到该分支。如果您打算开始新工作但忘记先创建新分支,这会很有用。<br><br>请注意,此操作忽略选择,新分支总是从主分支创建或堆叠在当前分支之上(您可以选择哪种方式)。 |
|
||||
| `` w `` | 新建工作树 | |
|
||||
| `` g `` | 查看重置选项 | 查看重置选项 (soft/mixed/hard) 用于重置到选择项 |
|
||||
| `` C `` | 复制提交(拣选) | 标记提交为已复制。然后,在本地提交视图中,您可以按 `V` (Cherry-Pick) 将已复制的提交粘贴到已检出的分支中。任何时候都可以按 `<esc>` 来取消选择。 |
|
||||
| `` <ctrl+r> `` | 重置已拣选(复制)的提交 | |
|
||||
@@ -67,7 +71,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | 选择当前分支的提交 | |
|
||||
| `` 0 `` | 聚焦主视图 | |
|
||||
| `` <enter> `` | 查看提交的文件 | |
|
||||
| `` w `` | 查看工作区选项 | |
|
||||
| `` / `` | 开始搜索 | |
|
||||
|
||||
## 子模块
|
||||
@@ -104,6 +107,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 在浏览器中打开提交 | |
|
||||
| `` n `` | 从提交创建新分支 | |
|
||||
| `` N `` | 移动提交至新分支 | 创建一个新分支,并将当前分支未推送的提交移动到该分支。如果您打算开始新工作但忘记先创建新分支,这会很有用。<br><br>请注意,此操作忽略选择,新分支总是从主分支创建或堆叠在当前分支之上(您可以选择哪种方式)。 |
|
||||
| `` w `` | 新建工作树 | |
|
||||
| `` g `` | 查看重置选项 | 查看重置选项 (soft/mixed/hard) 用于重置到选择项 |
|
||||
| `` C `` | 复制提交(拣选) | 标记提交为已复制。然后,在本地提交视图中,您可以按 `V` (Cherry-Pick) 将已复制的提交粘贴到已检出的分支中。任何时候都可以按 `<esc>` 来取消选择。 |
|
||||
| `` <ctrl+r> `` | 重置已拣选(复制)的提交 | |
|
||||
@@ -111,7 +115,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | 选择当前分支的提交 | |
|
||||
| `` 0 `` | 聚焦主视图 | |
|
||||
| `` <enter> `` | 查看提交 | |
|
||||
| `` w `` | 查看工作区选项 | |
|
||||
| `` / `` | 通过文本过滤当前视图 | |
|
||||
|
||||
## 提交
|
||||
@@ -147,13 +150,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 在浏览器中打开提交 | |
|
||||
| `` n `` | 从提交创建新分支 | |
|
||||
| `` N `` | 移动提交至新分支 | 创建一个新分支,并将当前分支未推送的提交移动到该分支。如果您打算开始新工作但忘记先创建新分支,这会很有用。<br><br>请注意,此操作忽略选择,新分支总是从主分支创建或堆叠在当前分支之上(您可以选择哪种方式)。 |
|
||||
| `` w `` | 新建工作树 | |
|
||||
| `` g `` | 查看重置选项 | 查看重置选项 (soft/mixed/hard) 用于重置到选择项 |
|
||||
| `` C `` | 复制提交(拣选) | 标记提交为已复制。然后,在本地提交视图中,您可以按 `V` (Cherry-Pick) 将已复制的提交粘贴到已检出的分支中。任何时候都可以按 `<esc>` 来取消选择。 |
|
||||
| `` <ctrl+t> `` | 使用外部差异比较工具(git difftool) | |
|
||||
| `` * `` | 选择当前分支的提交 | |
|
||||
| `` 0 `` | 聚焦主视图 | |
|
||||
| `` <enter> `` | 查看提交的文件 | |
|
||||
| `` w `` | 查看工作区选项 | |
|
||||
| `` / `` | 开始搜索 | |
|
||||
|
||||
## 提交信息
|
||||
@@ -225,6 +228,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <space> `` | 检出 | 检出选中的项目 |
|
||||
| `` n `` | 新分支 | |
|
||||
| `` N `` | 移动提交至新分支 | 创建一个新分支,并将当前分支未推送的提交移动到该分支。如果您打算开始新工作但忘记先创建新分支,这会很有用。<br><br>请注意,此操作忽略选择,新分支总是从主分支创建或堆叠在当前分支之上(您可以选择哪种方式)。 |
|
||||
| `` w `` | 新建工作树 | |
|
||||
| `` o `` | 创建拉取请求 | |
|
||||
| `` O `` | 创建拉取请求选项 | |
|
||||
| `` G `` | 在浏览器中打开拉取请求 | |
|
||||
@@ -244,7 +248,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | 使用外部差异比较工具(git difftool) | |
|
||||
| `` 0 `` | 聚焦主视图 | |
|
||||
| `` <enter> `` | 查看提交 | |
|
||||
| `` w `` | 查看工作区选项 | |
|
||||
| `` / `` | 通过文本过滤当前视图 | |
|
||||
|
||||
## 构建补丁中
|
||||
@@ -270,13 +273,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | 复制标签到剪贴板 | |
|
||||
| `` <space> `` | 检出 | 检出选择的标签作为分离的HEAD |
|
||||
| `` n `` | 创建标签 | 基于当前提交创建一个新标签。您将在弹窗中输入标签名称和描述(可选)。 |
|
||||
| `` w `` | 新建工作树 | |
|
||||
| `` d `` | 删除 | 查看本地/远程标签的删除选项 |
|
||||
| `` P `` | 推送标签 | 推送选择的标签到远端。您将在弹窗中选择一个远端。 |
|
||||
| `` g `` | 重置 | 查看重置选项 (soft/mixed/hard) 用于重置到选择项 |
|
||||
| `` <ctrl+t> `` | 使用外部差异比较工具(git difftool) | |
|
||||
| `` 0 `` | 聚焦主视图 | |
|
||||
| `` <enter> `` | 查看提交 | |
|
||||
| `` w `` | 查看工作区选项 | |
|
||||
| `` / `` | 通过文本过滤当前视图 | |
|
||||
|
||||
## 次要
|
||||
@@ -292,7 +295,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | 选中区块 | |
|
||||
| `` b `` | 选中所有区块 | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | 选择顶部块 | |
|
||||
| `` <down>, j `` | 选择底部块 | |
|
||||
| `` <left>, h `` | 选择上一个冲突 | |
|
||||
@@ -339,7 +342,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` o `` | 打开配置文件 | 使用默认程序打开该文件 |
|
||||
| `` e `` | 编辑配置文件 | 使用外部编辑器打开文件 |
|
||||
| `` u `` | 检查更新 | |
|
||||
| `` <enter> `` | 切换到最近的仓库 | |
|
||||
@@ -371,10 +373,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | 应用并删除 | 将存储项应用到工作目录并删除存储项。 |
|
||||
| `` d `` | 删除 | 从贮藏列表中删除该贮藏项 |
|
||||
| `` n `` | 新分支 | 从选定的贮藏项创建一个新分支。这是通过 git 检查创建贮藏项的提交,从该提交创建一个新分支,然后将贮藏项作为附加提交应用到新分支来实现的。 |
|
||||
| `` w `` | 新建工作树 | |
|
||||
| `` r `` | 重命名贮藏 | |
|
||||
| `` 0 `` | 聚焦主视图 | |
|
||||
| `` <enter> `` | 查看提交的文件 | |
|
||||
| `` w `` | 查看工作区选项 | |
|
||||
| `` / `` | 通过文本过滤当前视图 | |
|
||||
|
||||
## 输入提示
|
||||
@@ -403,6 +405,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | 复制分支名称到剪贴板 | |
|
||||
| `` <space> `` | 检出 | 基于当前选中的远程分支检出一个新的本地分支,或者将远程分支作分离的HEAD。 |
|
||||
| `` n `` | 新分支 | |
|
||||
| `` w `` | 新建工作树 | |
|
||||
| `` M `` | 合并到当前检出的分支 | 查看将选中项合并到当前分支的选项(正常合并,压缩合并) |
|
||||
| `` r `` | 变基 | 将检出的分支变基到所选的分支上。 |
|
||||
| `` d `` | 删除 | 从远程删除远程分支。 |
|
||||
@@ -412,5 +415,4 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | 使用外部差异比较工具(git difftool) | |
|
||||
| `` 0 `` | 聚焦主视图 | |
|
||||
| `` <enter> `` | 查看提交 | |
|
||||
| `` w `` | 查看工作区选项 | |
|
||||
| `` / `` | 通过文本过滤当前视图 | |
|
||||
|
||||
@@ -22,7 +22,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` R `` | 重新整理 | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||
| `` + `` | 下一個螢幕模式(常規/半螢幕/全螢幕) | |
|
||||
| `` _ `` | 上一個螢幕模式 | |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers. |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | 取消 | |
|
||||
| `` ? `` | 開啟選單 | |
|
||||
| `` <ctrl+s> `` | 檢視篩選路徑選項 | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
@@ -30,6 +31,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` q, <ctrl+c> `` | 結束 | |
|
||||
| `` <ctrl+z> `` | Suspend the application | |
|
||||
| `` <ctrl+w> `` | 切換是否在差異檢視中顯示空格變更 | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` % `` | Toggle mouse capture | Toggle whether lazygit captures mouse events. When mouse capture is off, the terminal handles the mouse, so you can select text with it; this is useful in terminals that don't have a modifier key to bypass the capture.<br><br>The default can be changed in the config file with the key 'gui.mouseEvents'. |
|
||||
| `` <alt+shift+c> `` | 編輯設定檔案 | 使用外部編輯器開啟 |
|
||||
| `` z `` | 復原 | 將使用 reflog 確任 git 指令以復原。這不包括工作區更改;只考慮提交。 |
|
||||
| `` Z `` | 取消復原 | 將使用 reflog 確任 git 指令以重作。這不包括工作區更改;只考慮提交。 |
|
||||
|
||||
@@ -88,7 +91,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | 挑選程式碼片段 | |
|
||||
| `` b `` | 挑選所有程式碼片段 | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | 選擇上一段 | |
|
||||
| `` <down>, j `` | 選擇下一段 | |
|
||||
| `` <left>, h `` | 選擇上一個衝突 | |
|
||||
@@ -139,6 +142,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 在瀏覽器中開啟提交 | |
|
||||
| `` n `` | 從提交建立新分支 | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | 檢視重設選項 | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | 複製提交 (揀選) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | 重設選定的揀選 (複製) 提交 | |
|
||||
@@ -146,7 +150,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 檢視所選項目的檔案 | |
|
||||
| `` w `` | 檢視工作目錄選項 | |
|
||||
| `` / `` | 搜尋 | |
|
||||
|
||||
## 子模組
|
||||
@@ -206,13 +209,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 在瀏覽器中開啟提交 | |
|
||||
| `` n `` | 從提交建立新分支 | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | 檢視重設選項 | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | 複製提交 (揀選) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+t> `` | 開啟外部差異工具 (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 檢視所選項目的檔案 | |
|
||||
| `` w `` | 檢視工作目錄選項 | |
|
||||
| `` / `` | 搜尋 | |
|
||||
|
||||
## 提交摘要
|
||||
@@ -250,10 +253,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | 還原 | Apply the stash entry to your working directory and remove the stash entry. |
|
||||
| `` d `` | 捨棄 | Remove the stash entry from the stash list. |
|
||||
| `` n `` | 新分支 | Create a new branch from the selected stash entry. This works by git checking out the commit that the stash entry was created from, creating a new branch from that commit, then applying the stash entry to the new branch as an additional commit. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` r `` | 重新命名收藏 | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 檢視所選項目的檔案 | |
|
||||
| `` w `` | 檢視工作目錄選項 | |
|
||||
| `` / `` | 搜尋 | |
|
||||
|
||||
## 日誌
|
||||
@@ -266,6 +269,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 在瀏覽器中開啟提交 | |
|
||||
| `` n `` | 從提交建立新分支 | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | 檢視重設選項 | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | 複製提交 (揀選) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | 重設選定的揀選 (複製) 提交 | |
|
||||
@@ -273,7 +277,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 檢視提交 | |
|
||||
| `` w `` | 檢視工作目錄選項 | |
|
||||
| `` / `` | 搜尋 | |
|
||||
|
||||
## 本地分支
|
||||
@@ -285,6 +288,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <space> `` | 檢出 | 檢出選定的項目。 |
|
||||
| `` n `` | 新分支 | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` o `` | 建立拉取請求 | |
|
||||
| `` O `` | 建立拉取請求選項 | |
|
||||
| `` G `` | Open pull request in browser | |
|
||||
@@ -304,7 +308,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | 開啟外部差異工具 (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 檢視提交 | |
|
||||
| `` w `` | 檢視工作目錄選項 | |
|
||||
| `` / `` | 搜尋 | |
|
||||
|
||||
## 標籤
|
||||
@@ -314,13 +317,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+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. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` d `` | 刪除 | View delete options for local/remote tag. |
|
||||
| `` P `` | 推送標籤 | Push the selected tag to a remote. You'll be prompted to select a remote. |
|
||||
| `` g `` | 重設 | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` <ctrl+t> `` | 開啟外部差異工具 (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 檢視提交 | |
|
||||
| `` w `` | 檢視工作目錄選項 | |
|
||||
| `` / `` | 搜尋 | |
|
||||
|
||||
## 檔案
|
||||
@@ -368,7 +371,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` o `` | 開啟設定檔案 | 使用預設軟體開啟 |
|
||||
| `` e `` | 編輯設定檔案 | 使用外部編輯器開啟 |
|
||||
| `` u `` | 檢查更新 | |
|
||||
| `` <enter> `` | 切換到最近使用的版本庫 | |
|
||||
@@ -403,6 +405,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | 複製分支名稱到剪貼簿 | |
|
||||
| `` <space> `` | 檢出 | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
|
||||
| `` n `` | 新分支 | |
|
||||
| `` w `` | New worktree | |
|
||||
| `` 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 the remote branch from the remote. |
|
||||
@@ -412,5 +415,4 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | 開啟外部差異工具 (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 檢視提交 | |
|
||||
| `` w `` | 檢視工作目錄選項 | |
|
||||
| `` / `` | 搜尋 | |
|
||||
|
||||
+56
-2
@@ -110,6 +110,26 @@ gui:
|
||||
# is true.
|
||||
expandedSidePanelWeight: 2
|
||||
|
||||
# If true, don't give a side panel more height than it needs to show its
|
||||
# content; when all panels fit, the leftover height is shared among them so that
|
||||
# they still fill the screen.
|
||||
shrinkSidePanelsToContent: false
|
||||
|
||||
# The side panels, in the order they appear from top to bottom.
|
||||
# Each entry is a list of one or more names that share a single panel as tabs
|
||||
# (cycle through them with the next-tab/previous-tab keys).
|
||||
# Omit a name to hide it; give a name its own one-element list to promote a tab
|
||||
# to a top-level panel.
|
||||
# Valid names are: 'status', 'files', 'worktrees', 'submodules', 'branches',
|
||||
# 'remotes', 'tags', 'commits', 'reflog', 'stash'. 'files', 'branches', and
|
||||
# 'commits' must always be included; they can't be hidden.
|
||||
sidePanels:
|
||||
- [status]
|
||||
- [files, worktrees, submodules]
|
||||
- [branches, remotes, tags]
|
||||
- [commits, reflog]
|
||||
- [stash]
|
||||
|
||||
# Sometimes the main window is split in two (e.g. when the selected file has
|
||||
# both staged and unstaged changes). This setting controls how the two sections
|
||||
# are split.
|
||||
@@ -342,6 +362,11 @@ gui:
|
||||
git:
|
||||
# Array of pagers. Each entry has the following format:
|
||||
#
|
||||
# # A name for the pager, shown in the notification when cycling pagers.
|
||||
# # If not set, the name is derived from the first word of the pager
|
||||
# # command (or of the external diff command).
|
||||
# name: ""
|
||||
#
|
||||
# # Value of the --color arg in the git diff command. Some pagers want
|
||||
# # this to be set to 'always' and some want it set to 'never'
|
||||
# colorArg: "always"
|
||||
@@ -361,6 +386,9 @@ git:
|
||||
# # https://git-scm.com/docs/gitattributes#_defining_an_external_diff_driver.
|
||||
# useExternalDiffGitConfig: false
|
||||
#
|
||||
# 'pager', 'externalDiffCommand', and 'useExternalDiffGitConfig' are mutually
|
||||
# exclusive; set at most one per entry.
|
||||
#
|
||||
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md
|
||||
# for more information.
|
||||
pagers: []
|
||||
@@ -406,6 +434,11 @@ git:
|
||||
# If true, periodically refresh files and submodules
|
||||
autoRefresh: true
|
||||
|
||||
# If true, poll the repo periodically for external ref changes (commits, branch
|
||||
# updates, checkouts made outside lazygit) and refresh when one is detected.
|
||||
# Independent of autoRefresh, which only governs the files panel.
|
||||
autoDetectExternalChanges: true
|
||||
|
||||
# If not "none", lazygit will automatically fast-forward local branches to match
|
||||
# their upstream after fetching. Applies to branches that are not the currently
|
||||
# checked out branch, and only to those that are strictly behind their upstream
|
||||
@@ -499,6 +532,15 @@ git:
|
||||
# to 40 to disable truncation.
|
||||
truncateCopiedCommitHashesTo: 12
|
||||
|
||||
# Config relating to git worktrees
|
||||
worktree:
|
||||
# Default parent directory for new worktrees. It is offered as a candidate
|
||||
# location alongside the parent directories of any worktrees you already have.
|
||||
# A relative path is resolved against the repository's root directory, so
|
||||
# "../worktrees" sits beside the repo and ".worktrees" sits inside it.
|
||||
# A leading "~" is expanded to your home directory, so "~/worktrees" works.
|
||||
defaultPath: ""
|
||||
|
||||
# Periodic update checks
|
||||
update:
|
||||
# One of: 'prompt' (default) | 'background' | 'never'
|
||||
@@ -517,6 +559,11 @@ refresher:
|
||||
# Auto-fetch can be disabled via option 'git.autoFetch'.
|
||||
fetchInterval: 60
|
||||
|
||||
# Interval in seconds at which lazygit polls for external ref changes (commits,
|
||||
# branch updates, checkouts made outside lazygit).
|
||||
# Detection can be disabled via option 'git.autoDetectExternalChanges'.
|
||||
externalChangeCheckInterval: 2
|
||||
|
||||
# If true, show a confirmation popup before quitting Lazygit
|
||||
confirmOnQuit: false
|
||||
|
||||
@@ -648,6 +695,7 @@ keybinding:
|
||||
confirmInEditor: [<ctrl+enter>, <ctrl+s>]
|
||||
remove: d
|
||||
new: "n"
|
||||
newWorktree: w
|
||||
edit: e
|
||||
openFile: o
|
||||
scrollUpMain: [<pgup>, K, <ctrl+u>]
|
||||
@@ -667,6 +715,7 @@ keybinding:
|
||||
nextScreenMode: +
|
||||
prevScreenMode: _
|
||||
cyclePagers: '|'
|
||||
cyclePagersReverse: \
|
||||
undo: z
|
||||
redo: Z
|
||||
filteringMenu: <ctrl+s>
|
||||
@@ -681,6 +730,7 @@ keybinding:
|
||||
increaseRenameSimilarityThreshold: )
|
||||
decreaseRenameSimilarityThreshold: (
|
||||
openDiffTool: <ctrl+t>
|
||||
editConfig: <alt+shift+c>
|
||||
status:
|
||||
checkForUpdate: u
|
||||
recentRepos: <enter>
|
||||
@@ -726,8 +776,6 @@ keybinding:
|
||||
fetchRemote: f
|
||||
addForkRemote: F
|
||||
sortOrder: s
|
||||
worktrees:
|
||||
viewWorktreeOptions: w
|
||||
commits:
|
||||
squashDown: s
|
||||
renameCommit: r
|
||||
@@ -1059,6 +1107,12 @@ keybinding:
|
||||
edit: <disabled> # disable 'edit file'
|
||||
```
|
||||
|
||||
### Overriding the platform for default keybindings
|
||||
|
||||
A few keybindings have different defaults on macOS than on Linux and Windows (e.g. word-wise cursor movement in text inputs uses `alt` on macOS but `ctrl` elsewhere). Lazygit picks these based on the OS it's running on, but you can override that with the `LAZYGIT_KEYBINDING_PLATFORM` environment variable. Set it to `darwin`, `linux`, or `windows`; any other value is ignored and the actual OS is used.
|
||||
|
||||
This is useful when running lazygit in a Linux container that you access over ssh from a Mac, where you'd rather use the macOS keybindings.
|
||||
|
||||
### Example Keybindings For Colemak Users
|
||||
|
||||
```yaml
|
||||
|
||||
+18
-29
@@ -2,8 +2,6 @@
|
||||
|
||||
Lazygit supports custom pagers, [configured](/docs/Config.md) in the config.yml file (which can be opened by pressing `e` in the Status panel).
|
||||
|
||||
Support does not extend to Windows users, because we're making use of a package which doesn't have Windows support. However, see [below](#emulating-custom-pagers-on-windows) for a workaround.
|
||||
|
||||
Multiple pagers are supported; you can cycle through them with the `|` key. This can be useful if you usually prefer a particular pager, but want to use a different one for certain kinds of diffs.
|
||||
|
||||
Pagers are configured with the `pagers` array in the git section; here's an example for a multi-pager setup (use an empty object `{}` for the default builtin diff display that doesn't use a pager):
|
||||
@@ -71,7 +69,7 @@ git:
|
||||
- externalDiffCommand: difft --color=always
|
||||
```
|
||||
|
||||
The `colorArg` and `pager` options are not used in this case.
|
||||
The `colorArg` option is not used in this case.
|
||||
|
||||
You can add whatever extra arguments you prefer for your difftool; for instance
|
||||
|
||||
@@ -81,6 +79,22 @@ git:
|
||||
- externalDiffCommand: difft --color=always --display=inline --syntax-highlight=off
|
||||
```
|
||||
|
||||
This can also be used for normal git diffs with custom parameters, such as `--color-words` or `--word-diff` which some people find useful. To do that, save a script like this to, say, `~/bin/color-words.sh`:
|
||||
|
||||
```sh
|
||||
#!/bin/sh
|
||||
|
||||
git diff --color-words --no-index --color=always --no-ext-diff "$2" "$5"
|
||||
```
|
||||
|
||||
And then use it in your git config like so:
|
||||
|
||||
```yaml
|
||||
git:
|
||||
pagers:
|
||||
- externalDiffCommand: ~/bin/color-words.sh
|
||||
```
|
||||
|
||||
Instead of setting this command in lazygit's `externalDiffCommand` config, you can also tell lazygit to use the external diff command that is configured in git itself (`diff.external`), by using
|
||||
|
||||
```yaml
|
||||
@@ -91,29 +105,4 @@ git:
|
||||
|
||||
This can be useful if you also want to use it for diffs on the command line, and it also has the advantage that you can configure it per file type in `.gitattributes`; see https://git-scm.com/docs/gitattributes#_defining_an_external_diff_driver.
|
||||
|
||||
## Emulating custom pagers on Windows
|
||||
|
||||
There is a trick to emulate custom pagers on Windows using a Powershell script configured as an external diff command. It's not perfect, but certainly better than nothing. To do this, save the following script as `lazygit-pager.ps1` at a convenient place on your disk:
|
||||
|
||||
```pwsh
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
$old = $args[1].Replace('\', '/')
|
||||
$new = $args[4].Replace('\', '/')
|
||||
$path = $args[0]
|
||||
git diff --no-index --no-ext-diff $old $new
|
||||
| %{ $_.Replace($old, $path).Replace($new, $path) }
|
||||
| delta --width=$env:LAZYGIT_COLUMNS
|
||||
```
|
||||
|
||||
Use the pager of your choice with the arguments you like in the last line of the script. Personally I wouldn't want to use lazygit anymore without delta's `--hyperlinks --hyperlinks-file-link-format="lazygit-edit://{path}:{line}"` args, see [above](#delta).
|
||||
|
||||
In your lazygit config, use
|
||||
|
||||
```yml
|
||||
git:
|
||||
pagers:
|
||||
- externalDiffCommand: "C:/wherever/lazygit-pager.ps1"
|
||||
```
|
||||
|
||||
The main limitation of this approach compared to a "real" pager is that renames are not displayed correctly; they are shown as if they were modifications of the old file. (This affects only the hunk headers; the diff itself is always correct.)
|
||||
`pager`, `externalDiffCommand`, and `useExternalDiffGitConfig` are alternative ways of producing the diff, so a pager entry may use at most one of them.
|
||||
|
||||
@@ -22,7 +22,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` R `` | Refresh | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||
| `` + `` | Next screen mode (normal/half/fullscreen) | |
|
||||
| `` _ `` | Prev screen mode | |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers. |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | Cancel | |
|
||||
| `` ? `` | Open keybindings menu | |
|
||||
| `` <ctrl+s> `` | View filter options | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
@@ -30,6 +31,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` q, <ctrl+c> `` | Quit | |
|
||||
| `` <ctrl+z> `` | Suspend the application | |
|
||||
| `` <ctrl+w> `` | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` <alt+shift+c> `` | Edit config file | Open file in external editor. |
|
||||
| `` z `` | Undo | The reflog will be used to determine what git command to run to undo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
| `` Z `` | Redo | The reflog will be used to determine what git command to run to redo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
|
||||
@@ -110,13 +112,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Open commit in browser | |
|
||||
| `` n `` | Create new branch off of commit | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Copy (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View files | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Search the current view by text | |
|
||||
|
||||
## Confirmation panel
|
||||
@@ -176,6 +178,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <space> `` | Checkout | Checkout selected item. |
|
||||
| `` n `` | New branch | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` o `` | Create pull request | |
|
||||
| `` O `` | View create pull request options | |
|
||||
| `` G `` | Open pull request in browser | |
|
||||
@@ -195,7 +198,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Main panel (merging)
|
||||
@@ -203,7 +205,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | Pick hunk | |
|
||||
| `` b `` | Pick all hunks | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | Previous hunk | |
|
||||
| `` <down>, j `` | Next hunk | |
|
||||
| `` <left>, h `` | Previous conflict | |
|
||||
@@ -280,6 +282,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Open commit in browser | |
|
||||
| `` n `` | Create new branch off of commit | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Copy (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | Reset copied (cherry-picked) commits selection | |
|
||||
@@ -287,7 +290,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Remote branches
|
||||
@@ -297,6 +299,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | Copy branch name to clipboard | |
|
||||
| `` <space> `` | Checkout | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
|
||||
| `` n `` | New branch | |
|
||||
| `` w `` | New worktree | |
|
||||
| `` M `` | Merge | View options for merging the selected item into the current branch (regular merge, squash merge) |
|
||||
| `` r `` | Rebase | Rebase the checked-out branch onto the selected branch. |
|
||||
| `` d `` | Delete | Delete the remote branch from the remote. |
|
||||
@@ -306,7 +309,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Remotes
|
||||
@@ -337,17 +339,16 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | Pop | Apply the stash entry to your working directory and remove the stash entry. |
|
||||
| `` d `` | Drop | Remove the stash entry from the stash list. |
|
||||
| `` n `` | New branch | Create a new branch from the selected stash entry. This works by git checking out the commit that the stash entry was created from, creating a new branch from that commit, then applying the stash entry to the new branch as an additional commit. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` r `` | Rename stash | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View files | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Status
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` o `` | Open config file | Open file in default application. |
|
||||
| `` e `` | Edit config file | Open file in external editor. |
|
||||
| `` u `` | Check for update | |
|
||||
| `` <enter> `` | Switch to a recent repo | |
|
||||
@@ -365,6 +366,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Open commit in browser | |
|
||||
| `` n `` | Create new branch off of commit | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Reset | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Copy (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | Reset copied (cherry-picked) commits selection | |
|
||||
@@ -372,7 +374,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View files | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Search the current view by text | |
|
||||
|
||||
## Submodules
|
||||
@@ -396,13 +397,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+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. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` 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. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Worktrees
|
||||
|
||||
@@ -22,7 +22,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` R `` | 更新 | Gitの状態を更新します(`git status`、`git branch`などをバックグラウンドで実行してパネルの内容を更新します)。これは`git fetch`を実行しません。 |
|
||||
| `` + `` | 次の画面モード(通常/半分/全画面) | |
|
||||
| `` _ `` | 前の画面モード | |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers. |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | キャンセル | |
|
||||
| `` ? `` | キーバインディングメニューを開く | |
|
||||
| `` <ctrl+s> `` | フィルターオプションを表示 | コミットログのフィルタリングオプションを表示し、フィルタに一致するコミットのみを表示します。 |
|
||||
@@ -30,6 +31,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` q, <ctrl+c> `` | 終了 | |
|
||||
| `` <ctrl+z> `` | Suspend the application | |
|
||||
| `` <ctrl+w> `` | 空白表示の切り替え | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` <alt+shift+c> `` | 設定ファイルを編集 | 外部エディタでファイルを開きます。 |
|
||||
| `` z `` | 元に戻す | 最後のgitコマンドを元に戻すために実行するgitコマンドを決定するためにreflogが使用されます。これにはワーキングツリーへの変更は含まれません。コミットのみが考慮されます。 |
|
||||
| `` Z `` | やり直す | 最後のgitコマンドをやり直すために実行するgitコマンドを決定するためにreflogが使用されます。これにはワーキングツリーへの変更は含まれません。コミットのみが考慮されます。 |
|
||||
|
||||
@@ -90,13 +92,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | ブラウザでコミットを開く | |
|
||||
| `` n `` | コミットから新しいブランチを作成 | |
|
||||
| `` N `` | コミットを新しいブランチに移動 | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | 新しいワークツリー | |
|
||||
| `` g `` | リセット | 選択した項目へのリセットオプション(ソフト/ミックス/ハード)を表示します。各リセットタイプの詳細は次の通りです:<br>- ソフトリセット:変更を保持し、ステージされた状態にします<br>- ミックスリセット:変更を保持し、ステージされていない状態にします<br>- ハードリセット:すべての変更を破棄します |
|
||||
| `` C `` | コピー(チェリーピック) | コミットをコピーとしてマークします。ローカルコミットビューで `V` を押すと、コピーしたコミットをチェックアウトしたブランチにペースト(チェリーピック)できます。いつでも `<esc>` を押して選択をキャンセルできます。 |
|
||||
| `` <ctrl+t> `` | 外部差分ツールを開く(git difftool) | |
|
||||
| `` * `` | 現在のブランチのコミットを選択 | |
|
||||
| `` 0 `` | メインビューにフォーカス | |
|
||||
| `` <enter> `` | ファイルを表示 | |
|
||||
| `` w `` | ワークツリーオプションを表示 | |
|
||||
| `` / `` | 現在のビューをテキストで検索 | |
|
||||
|
||||
## コミットファイル
|
||||
@@ -136,6 +138,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | ブラウザでコミットを開く | |
|
||||
| `` n `` | コミットから新しいブランチを作成 | |
|
||||
| `` N `` | コミットを新しいブランチに移動 | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | 新しいワークツリー | |
|
||||
| `` g `` | リセット | 選択した項目へのリセットオプション(ソフト/ミックス/ハード)を表示します。各リセットタイプの詳細は次の通りです:<br>- ソフトリセット:変更を保持し、ステージされた状態にします<br>- ミックスリセット:変更を保持し、ステージされていない状態にします<br>- ハードリセット:すべての変更を破棄します |
|
||||
| `` C `` | コピー(チェリーピック) | コミットをコピーとしてマークします。ローカルコミットビューで `V` を押すと、コピーしたコミットをチェックアウトしたブランチにペースト(チェリーピック)できます。いつでも `<esc>` を押して選択をキャンセルできます。 |
|
||||
| `` <ctrl+r> `` | コピーされた(チェリーピックされた)コミットの選択をリセット | |
|
||||
@@ -143,7 +146,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | 現在のブランチのコミットを選択 | |
|
||||
| `` 0 `` | メインビューにフォーカス | |
|
||||
| `` <enter> `` | ファイルを表示 | |
|
||||
| `` w `` | ワークツリーオプションを表示 | |
|
||||
| `` / `` | 現在のビューをテキストで検索 | |
|
||||
|
||||
## サブモジュール
|
||||
@@ -168,17 +170,16 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | ポップ | スタッシュエントリをワーキングディレクトリに適用し、スタッシュエントリを削除します。 |
|
||||
| `` d `` | 削除 | スタッシュリストからスタッシュエントリを削除します。 |
|
||||
| `` n `` | 新しいブランチ | 選択したスタッシュエントリから新しいブランチを作成します。これは、スタッシュエントリが作成されたコミットをgitがチェックアウトし、そのコミットから新しいブランチを作成した後、スタッシュエントリを追加のコミットとして新しいブランチに適用することで機能します。 |
|
||||
| `` w `` | 新しいワークツリー | |
|
||||
| `` r `` | スタッシュの名前を変更 | |
|
||||
| `` 0 `` | メインビューにフォーカス | |
|
||||
| `` <enter> `` | ファイルを表示 | |
|
||||
| `` w `` | ワークツリーオプションを表示 | |
|
||||
| `` / `` | 現在のビューをテキストでフィルタリング | |
|
||||
|
||||
## ステータス
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` o `` | 設定ファイルを開く | デフォルトのアプリケーションでファイルを開きます。 |
|
||||
| `` e `` | 設定ファイルを編集 | 外部エディタでファイルを開きます。 |
|
||||
| `` u `` | 更新を確認 | |
|
||||
| `` <enter> `` | 最近のリポジトリをチェックアウト | |
|
||||
@@ -201,13 +202,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | タグをクリップボードにコピー | |
|
||||
| `` <space> `` | チェックアウト(ブランチの切り替え) | 選択したタグをデタッチドHEADとしてチェックアウトします。 |
|
||||
| `` n `` | 新しいタグを作成 | 現在のコミットから新しいタグを作成します。タグ名とオプションの説明を入力するよう促されます。 |
|
||||
| `` w `` | 新しいワークツリー | |
|
||||
| `` d `` | 削除 | ローカル/リモートタグの削除オプションを表示します。 |
|
||||
| `` P `` | タグをプッシュ | 選択したタグをリモートにプッシュします。リモートを選択するよう促されます。 |
|
||||
| `` g `` | リセット | 選択した項目へのリセットオプション(ソフト/ミックス/ハード)を表示します。各リセットタイプの詳細は次の通りです:<br>- ソフトリセット:変更を保持し、ステージされた状態にします<br>- ミックスリセット:変更を保持し、ステージされていない状態にします<br>- ハードリセット:すべての変更を破棄します |
|
||||
| `` <ctrl+t> `` | 外部差分ツールを開く(git difftool) | |
|
||||
| `` 0 `` | メインビューにフォーカス | |
|
||||
| `` <enter> `` | コミットを表示 | |
|
||||
| `` w `` | ワークツリーオプションを表示 | |
|
||||
| `` / `` | 現在のビューをテキストでフィルタリング | |
|
||||
|
||||
## ファイル
|
||||
@@ -286,7 +287,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | ハンクを選択 | |
|
||||
| `` b `` | すべてのハンクを選択 | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | 前のハンク | |
|
||||
| `` <down>, j `` | 次のハンク | |
|
||||
| `` <left>, h `` | 前のコンフリクト | |
|
||||
@@ -325,6 +326,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | ブラウザでコミットを開く | |
|
||||
| `` n `` | コミットから新しいブランチを作成 | |
|
||||
| `` N `` | コミットを新しいブランチに移動 | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | 新しいワークツリー | |
|
||||
| `` g `` | リセット | 選択した項目へのリセットオプション(ソフト/ミックス/ハード)を表示します。各リセットタイプの詳細は次の通りです:<br>- ソフトリセット:変更を保持し、ステージされた状態にします<br>- ミックスリセット:変更を保持し、ステージされていない状態にします<br>- ハードリセット:すべての変更を破棄します |
|
||||
| `` C `` | コピー(チェリーピック) | コミットをコピーとしてマークします。ローカルコミットビューで `V` を押すと、コピーしたコミットをチェックアウトしたブランチにペースト(チェリーピック)できます。いつでも `<esc>` を押して選択をキャンセルできます。 |
|
||||
| `` <ctrl+r> `` | コピーされた(チェリーピックされた)コミットの選択をリセット | |
|
||||
@@ -332,7 +334,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | 現在のブランチのコミットを選択 | |
|
||||
| `` 0 `` | メインビューにフォーカス | |
|
||||
| `` <enter> `` | コミットを表示 | |
|
||||
| `` w `` | ワークツリーオプションを表示 | |
|
||||
| `` / `` | 現在のビューをテキストでフィルタリング | |
|
||||
|
||||
## リモート
|
||||
@@ -354,6 +355,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | ブランチ名をクリップボードにコピー | |
|
||||
| `` <space> `` | チェックアウト(ブランチの切り替え) | 選択したリモートブランチに基づいて新しいローカルブランチをチェックアウトするか、リモートブランチをデタッチドヘッドとしてチェックアウトします。 |
|
||||
| `` n `` | 新しいブランチ | |
|
||||
| `` w `` | 新しいワークツリー | |
|
||||
| `` M `` | マージ | 選択した項目を現在のブランチにマージするためのオプションを表示します(通常のマージ、スカッシュマージ) |
|
||||
| `` r `` | リベース | チェックアウトしたブランチを選択したブランチ上にリベースします。 |
|
||||
| `` d `` | 削除 | リモートからリモートブランチを削除します。 |
|
||||
@@ -363,7 +365,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | 外部差分ツールを開く(git difftool) | |
|
||||
| `` 0 `` | メインビューにフォーカス | |
|
||||
| `` <enter> `` | コミットを表示 | |
|
||||
| `` w `` | ワークツリーオプションを表示 | |
|
||||
| `` / `` | 現在のビューをテキストでフィルタリング | |
|
||||
|
||||
## ローカルブランチ
|
||||
@@ -375,6 +376,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <space> `` | チェックアウト(ブランチの切り替え) | 選択した項目をチェックアウトします。 |
|
||||
| `` n `` | 新しいブランチ | |
|
||||
| `` N `` | コミットを新しいブランチに移動 | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | 新しいワークツリー | |
|
||||
| `` o `` | プルリクエストを作成 | |
|
||||
| `` O `` | プルリクエスト作成オプションを表示 | |
|
||||
| `` G `` | Open pull request in browser | |
|
||||
@@ -394,7 +396,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | 外部差分ツールを開く(git difftool) | |
|
||||
| `` 0 `` | メインビューにフォーカス | |
|
||||
| `` <enter> `` | コミットを表示 | |
|
||||
| `` w `` | ワークツリーオプションを表示 | |
|
||||
| `` / `` | 現在のビューをテキストでフィルタリング | |
|
||||
|
||||
## ワークツリー
|
||||
|
||||
@@ -22,7 +22,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` R `` | 새로고침 | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||
| `` + `` | 다음 스크린 모드 (normal/half/fullscreen) | |
|
||||
| `` _ `` | 이전 스크린 모드 | |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers. |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | 취소 | |
|
||||
| `` ? `` | 매뉴 열기 | |
|
||||
| `` <ctrl+s> `` | View filter-by-path options | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
@@ -30,6 +31,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` q, <ctrl+c> `` | 종료 | |
|
||||
| `` <ctrl+z> `` | Suspend the application | |
|
||||
| `` <ctrl+w> `` | 공백문자를 Diff 뷰에서 표시 여부 전환 | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` <alt+shift+c> `` | 설정 파일 수정 | Open file in external editor. |
|
||||
| `` z `` | 되돌리기 (reflog) (실험적) | The reflog will be used to determine what git command to run to undo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
| `` Z `` | 다시 실행 (reflog) (실험적) | The reflog will be used to determine what git command to run to redo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
|
||||
@@ -67,6 +69,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 브라우저에서 커밋 열기 | |
|
||||
| `` n `` | 커밋에서 새 브랜치를 만듭니다. | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | View reset options | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | 커밋을 복사 (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | Reset cherry-picked (copied) commits selection | |
|
||||
@@ -74,7 +77,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 커밋 보기 | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Secondary
|
||||
@@ -93,10 +95,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | Pop | Apply the stash entry to your working directory and remove the stash entry. |
|
||||
| `` d `` | Drop | Remove the stash entry from the stash list. |
|
||||
| `` n `` | 새 브랜치 생성 | Create a new branch from the selected stash entry. This works by git checking out the commit that the stash entry was created from, creating a new branch from that commit, then applying the stash entry to the new branch as an additional commit. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` r `` | Rename stash | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View selected item's files | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Sub-commits
|
||||
@@ -109,6 +111,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 브라우저에서 커밋 열기 | |
|
||||
| `` n `` | 커밋에서 새 브랜치를 만듭니다. | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | View reset options | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | 커밋을 복사 (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | Reset cherry-picked (copied) commits selection | |
|
||||
@@ -116,7 +119,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View selected item's files | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | 검색 시작 | |
|
||||
|
||||
## Worktrees
|
||||
@@ -142,7 +144,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | Pick hunk | |
|
||||
| `` b `` | Pick all hunks | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | 이전 hunk를 선택 | |
|
||||
| `` <down>, j `` | 다음 hunk를 선택 | |
|
||||
| `` <left>, h `` | 이전 충돌을 선택 | |
|
||||
@@ -210,6 +212,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <space> `` | 체크아웃 | Checkout selected item. |
|
||||
| `` n `` | 새 브랜치 생성 | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` o `` | 풀 리퀘스트 생성 | |
|
||||
| `` O `` | 풀 리퀘스트 생성 옵션 | |
|
||||
| `` G `` | Open pull request in browser | |
|
||||
@@ -229,14 +232,12 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 커밋 보기 | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## 상태
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` o `` | 설정 파일 열기 | Open file in default application. |
|
||||
| `` e `` | 설정 파일 수정 | Open file in external editor. |
|
||||
| `` u `` | 업데이트 확인 | |
|
||||
| `` <enter> `` | 최근에 사용한 저장소로 전환 | |
|
||||
@@ -277,6 +278,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | 브랜치명을 클립보드에 복사 | |
|
||||
| `` <space> `` | 체크아웃 | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
|
||||
| `` n `` | 새 브랜치 생성 | |
|
||||
| `` w `` | New worktree | |
|
||||
| `` 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 the remote branch from the remote. |
|
||||
@@ -286,7 +288,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 커밋 보기 | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## 커밋
|
||||
@@ -322,13 +323,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 브라우저에서 커밋 열기 | |
|
||||
| `` n `` | 커밋에서 새 브랜치를 만듭니다. | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | View reset options | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | 커밋을 복사 (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | View selected item's files | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | 검색 시작 | |
|
||||
|
||||
## 커밋 파일
|
||||
@@ -365,13 +366,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+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. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` 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 `` | 초기화 | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 커밋 보기 | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## 파일
|
||||
|
||||
@@ -10,26 +10,28 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <pgup>, K, <ctrl+u> (fn+up/shift+k) `` | Scroll naar beneden vanaf hoofdpaneel | |
|
||||
| `` <pgdown>, J, <ctrl+d> (fn+down/shift+j) `` | Scroll naar beneden vanaf hoofdpaneel | |
|
||||
| `` @ `` | View command log options | View options for the command log e.g. show/hide the command log and focus the command log. |
|
||||
| `` P `` | Push | Push the current branch to its upstream branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
|
||||
| `` p `` | Pull | Pull changes from the remote for the current branch. If no upstream is configured, you will be prompted to configure an upstream branch. |
|
||||
| `` P `` | Push | Push de huidige branch naar de bijbehorende upstream-branch. Als er geen upstream is geconfigureerd wordt er gevraagd om een upstream-branch te configureren. |
|
||||
| `` p `` | Pull | Pull wijzigingen van de remote voor de huidige branch. Als er geen upstream is geconfigureerd wordt er gevraagd om een upstream-branch te configureren. |
|
||||
| `` ) `` | Increase rename similarity threshold | Increase the similarity threshold for a deletion and addition pair to be treated as a rename.<br><br>The default can be changed in the config file with the key 'git.renameSimilarityThreshold'. |
|
||||
| `` ( `` | Decrease rename similarity threshold | Decrease the similarity threshold for a deletion and addition pair to be treated as a rename.<br><br>The default can be changed in the config file with the key 'git.renameSimilarityThreshold'. |
|
||||
| `` } `` | Increase diff context size | Increase the amount of the context shown around changes in the diff view.<br><br>The default can be changed in the config file with the key 'git.diffContextSize'. |
|
||||
| `` { `` | Decrease diff context size | Decrease the amount of the context shown around changes in the diff view.<br><br>The default can be changed in the config file with the key 'git.diffContextSize'. |
|
||||
| `` : `` | Execute shell command | Bring up a prompt where you can enter a shell command to execute. |
|
||||
| `` <ctrl+p> `` | Bekijk aangepaste patch opties | |
|
||||
| `` m `` | Bekijk merge/rebase opties | View options to abort/continue/skip the current merge/rebase. |
|
||||
| `` m `` | Bekijk merge/rebase opties | Toon abort/continue/skip opties voor huidige merge/rebase. |
|
||||
| `` R `` | Verversen | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||
| `` + `` | Volgende scherm modus (normaal/half/groot) | |
|
||||
| `` _ `` | Vorige scherm modus | |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers. |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | Annuleren | |
|
||||
| `` ? `` | Open menu | |
|
||||
| `` <ctrl+s> `` | Bekijk scoping opties | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
| `` W, <ctrl+e> `` | Open diff menu | View options relating to diffing two refs e.g. diffing against selected ref, entering ref to diff against, and reversing the diff direction. |
|
||||
| `` q, <ctrl+c> `` | Quit | |
|
||||
| `` <ctrl+z> `` | Suspend the application | |
|
||||
| `` q, <ctrl+c> `` | Afsluiten | |
|
||||
| `` <ctrl+z> `` | Pauzeer de applicatie | |
|
||||
| `` <ctrl+w> `` | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` <alt+shift+c> `` | Verander config bestand | Open bestand in externe editor. |
|
||||
| `` z `` | Ongedaan maken (via reflog) (experimenteel) | The reflog will be used to determine what git command to run to undo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
| `` Z `` | Redo (via reflog) (experimenteel) | The reflog will be used to determine what git command to run to redo the last git command. This does not include changes to the working tree; only commits are taken into consideration. |
|
||||
|
||||
@@ -45,8 +47,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <shift+down> `` | Range select down | |
|
||||
| `` <shift+up> `` | Range select up | |
|
||||
| `` / `` | Start met zoeken | |
|
||||
| `` H `` | Scroll left | |
|
||||
| `` L `` | Scroll right | |
|
||||
| `` H `` | Scroll naar links | |
|
||||
| `` L `` | Scroll naar rechts | |
|
||||
| `` ] `` | Volgende tabblad | |
|
||||
| `` [ `` | Vorige tabblad | |
|
||||
|
||||
@@ -56,15 +58,15 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
|-----|--------|-------------|
|
||||
| `` <ctrl+o> `` | Kopieer de bestandsnaam naar het klembord | |
|
||||
| `` <space> `` | Toggle staged | Toggle staged for selected file. |
|
||||
| `` <ctrl+b> `` | Filter files by status | |
|
||||
| `` y `` | Copy to clipboard | |
|
||||
| `` c `` | Commit veranderingen | Commit staged changes. |
|
||||
| `` <ctrl+b> `` | Filter bestanden op status | |
|
||||
| `` y `` | Kopieer naar klembord | |
|
||||
| `` c `` | Commit veranderingen | Commit gestagede wijzigingen. |
|
||||
| `` w `` | Commit veranderingen zonder pre-commit hook | |
|
||||
| `` A `` | Wijzig laatste commit | |
|
||||
| `` C `` | Commit veranderingen met de git editor | |
|
||||
| `` <ctrl+f> `` | Find base commit for fixup | Find the commit that your current changes are building upon, for the sake of amending/fixing up the commit. This spares you from having to look through your branch's commits one-by-one to see which commit should be amended/fixed up. See docs: <https://github.com/jesseduffield/lazygit/tree/master/docs/Fixup_Commits.md> |
|
||||
| `` e `` | Edit | Open file in external editor. |
|
||||
| `` o `` | Open bestand | Open file in default application. |
|
||||
| `` <ctrl+f> `` | Find base commit for fixup | Vind de commit waar je huidige wijzigingen bovenop zijn gebouwd met als doel die commit te amenden/fixen. Hierdoor hoef je dit niet met de hand te doen. Zie: <https://github.com/jesseduffield/lazygit/tree/master/docs/Fixup_Commits.md> |
|
||||
| `` e `` | Edit | Open bestand in externe editor. |
|
||||
| `` o `` | Open bestand | Open bestand in standaardapplicatie. |
|
||||
| `` i `` | Ignore or exclude file | |
|
||||
| `` r `` | Refresh bestanden | |
|
||||
| `` s `` | Stash | Stash all changes. For other variations of stashing, use the view stash options keybinding. |
|
||||
@@ -73,13 +75,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <enter> `` | Stage individuele hunks/lijnen | 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 `` | Bekijk 'veranderingen ongedaan maken' opties | View options for discarding changes to the selected file. |
|
||||
| `` g `` | Bekijk upstream reset opties | |
|
||||
| `` D `` | Reset | View reset options for working tree (e.g. nuking the working tree). |
|
||||
| `` D `` | Resetten | View reset options for working tree (e.g. nuking the working tree). |
|
||||
| `` ` `` | Toggle bestandsboom weergave | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory.<br><br>The default can be changed in the config file with the key 'gui.showFileTree'. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` M `` | View merge conflict options | View options for resolving merge conflicts. |
|
||||
| `` <ctrl+t> `` | Open externe diff applicatie (git difftool) | |
|
||||
| `` M `` | Bekijk merge conflict opties | Bekijk opties voor het oplossen van mergeconflicten. |
|
||||
| `` f `` | Fetch | Fetch changes from remote. |
|
||||
| `` - `` | Collapse all files | Collapse all directories in the files tree |
|
||||
| `` = `` | Expand all files | Expand all directories in the file tree |
|
||||
| `` = `` | Vouw alle bestanden uit | Vouw alle mappen in de bestandsstructuur uit |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
@@ -89,7 +91,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
|-----|--------|-------------|
|
||||
| `` <enter> `` | Bevestig | |
|
||||
| `` <esc> `` | Sluiten | |
|
||||
| `` <ctrl+o> `` | Copy to clipboard | |
|
||||
| `` <ctrl+o> `` | Kopieer naar klembord | |
|
||||
|
||||
## Branches
|
||||
|
||||
@@ -97,18 +99,19 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
|-----|--------|-------------|
|
||||
| `` <ctrl+o> `` | Kopieer branch name naar klembord | |
|
||||
| `` i `` | Laat git-flow opties zien | |
|
||||
| `` <space> `` | Uitchecken | Checkout selected item. |
|
||||
| `` <space> `` | Uitchecken | Geselecteerd item uitchecken. |
|
||||
| `` n `` | Nieuwe branch | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` N `` | Verplaats commits naar nieuwe branch | Maak een nieuwe branch en verplaats niet-gepushte commits van de huidige branch hier naar toe. Gebruik dit in het geval dat je deze commits eigenlijk op een nieuwe branch had willen maken.<br><br>Let op dat de selectie genegeerd wordt. De nieuwe branch komt ofwel bovenop de main branch, of bovenop de huidige branch (je kan kiezen). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` o `` | Maak een pull-request | |
|
||||
| `` O `` | Bekijk opties voor pull-aanvraag | |
|
||||
| `` G `` | Open pull request in browser | |
|
||||
| `` <ctrl+y> `` | Kopieer de URL van het pull-verzoek naar het klembord | |
|
||||
| `` c `` | Uitchecken bij naam | Checkout by name. In the input box you can enter '-' to switch to the previous branch. |
|
||||
| `` - `` | Checkout previous branch | |
|
||||
| `` - `` | Vorige branch uitchecken | |
|
||||
| `` F `` | Forceer checkout | 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. |
|
||||
| `` r `` | Rebase branch | Rebase the checked-out branch onto the selected branch. |
|
||||
| `` d `` | Verwijderen | View delete options for local/remote branch. |
|
||||
| `` r `` | Rebase branch | Rebase de uitgecheckte branch bovenop de geselecteerde branch. |
|
||||
| `` M `` | Merge in met huidige checked out branch | View options for merging the selected item into the current branch (regular merge, squash merge) |
|
||||
| `` f `` | Fast-forward deze branch vanaf zijn upstream | Fast-forward selected branch from its upstream. |
|
||||
| `` T `` | Creëer tag | |
|
||||
@@ -116,10 +119,9 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | Bekijk reset opties | |
|
||||
| `` R `` | Hernoem branch | |
|
||||
| `` u `` | View upstream options | View options relating to the branch's upstream e.g. setting/unsetting the upstream and resetting to the upstream. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` <ctrl+t> `` | Open externe diff applicatie (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Bekijk commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Commit bericht
|
||||
@@ -134,18 +136,18 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <ctrl+o> `` | Kopieer de bestandsnaam naar het klembord | |
|
||||
| `` y `` | Copy to clipboard | |
|
||||
| `` y `` | Kopieer naar klembord | |
|
||||
| `` c `` | Uitchecken | Bestand uitchecken |
|
||||
| `` d `` | Bekijk 'veranderingen ongedaan maken' opties | Uitsluit deze commit zijn veranderingen aan dit bestand |
|
||||
| `` o `` | Open bestand | Open file in default application. |
|
||||
| `` e `` | Edit | Open file in external editor. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` o `` | Open bestand | Open bestand in standaardapplicatie. |
|
||||
| `` e `` | Edit | Open bestand in externe editor. |
|
||||
| `` <ctrl+t> `` | Open externe diff applicatie (git difftool) | |
|
||||
| `` <space> `` | Toggle bestand inbegrepen 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 bestand om geselecteerde regels toe te voegen aan de patch | 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. |
|
||||
| `` ` `` | Toggle bestandsboom weergave | Toggle file view between flat and tree layout. Flat layout shows all file paths in a single list, tree layout groups files by directory.<br><br>The default can be changed in the config file with the key 'gui.showFileTree'. |
|
||||
| `` - `` | Collapse all files | Collapse all directories in the files tree |
|
||||
| `` = `` | Expand all files | Expand all directories in the file tree |
|
||||
| `` = `` | Vouw alle bestanden uit | Vouw alle mappen in de bestandsstructuur uit |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
@@ -181,14 +183,14 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). |
|
||||
| `` o `` | Open commit in browser | |
|
||||
| `` n `` | Creëer nieuwe branch van commit | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` N `` | Verplaats commits naar nieuwe branch | Maak een nieuwe branch en verplaats niet-gepushte commits van de huidige branch hier naar toe. Gebruik dit in het geval dat je deze commits eigenlijk op een nieuwe branch had willen maken.<br><br>Let op dat de selectie genegeerd wordt. De nieuwe branch komt ofwel bovenop de main branch, of bovenop de huidige branch (je kan kiezen). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Bekijk reset opties | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Kopieer commit (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` <ctrl+t> `` | Open externe diff applicatie (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Bekijk gecommite bestanden | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Start met zoeken | |
|
||||
|
||||
## Input prompt
|
||||
@@ -211,15 +213,15 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | Kies stuk | |
|
||||
| `` b `` | Kies beide stukken | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | Selecteer bovenste hunk | |
|
||||
| `` <down>, j `` | Selecteer onderste hunk | |
|
||||
| `` <left>, h `` | Selecteer voorgaand conflict | |
|
||||
| `` <right>, l `` | Selecteer volgende conflict | |
|
||||
| `` z `` | Ongedaan maken | Undo last merge conflict resolution. |
|
||||
| `` e `` | Verander bestand | Open file in external editor. |
|
||||
| `` o `` | Open bestand | Open file in default application. |
|
||||
| `` M `` | View merge conflict options | View options for resolving merge conflicts. |
|
||||
| `` e `` | Verander bestand | Open bestand in externe editor. |
|
||||
| `` o `` | Open bestand | Open bestand in standaardapplicatie. |
|
||||
| `` M `` | Bekijk merge conflict opties | Bekijk opties voor het oplossen van mergeconflicten. |
|
||||
| `` <esc> `` | Ga terug naar het bestanden paneel | |
|
||||
|
||||
## Normaal
|
||||
@@ -241,8 +243,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` v `` | Toggle drag selecteer | |
|
||||
| `` a `` | Toggle hunk selection | Toggle line-by-line vs. hunk selection mode. |
|
||||
| `` <ctrl+o> `` | Copy selected text to clipboard | |
|
||||
| `` o `` | Open bestand | Open file in default application. |
|
||||
| `` e `` | Verander bestand | Open file in external editor. |
|
||||
| `` o `` | Open bestand | Open bestand in standaardapplicatie. |
|
||||
| `` e `` | Verander bestand | Open bestand in externe editor. |
|
||||
| `` <space> `` | Voeg toe/verwijder lijn(en) in patch | |
|
||||
| `` d `` | Remove lines from commit | Remove the selected lines from this commit. This runs an interactive rebase in the background, so you may get a merge conflict if a later commit also changes these lines. |
|
||||
| `` <esc> `` | Sluit lijn-bij-lijn modus | |
|
||||
@@ -257,15 +259,15 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). |
|
||||
| `` o `` | Open commit in browser | |
|
||||
| `` n `` | Creëer nieuwe branch van commit | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` N `` | Verplaats commits naar nieuwe branch | Maak een nieuwe branch en verplaats niet-gepushte commits van de huidige branch hier naar toe. Gebruik dit in het geval dat je deze commits eigenlijk op een nieuwe branch had willen maken.<br><br>Let op dat de selectie genegeerd wordt. De nieuwe branch komt ofwel bovenop de main branch, of bovenop de huidige branch (je kan kiezen). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Bekijk reset opties | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Kopieer commit (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | Reset cherry-picked (gekopieerde) commits selectie | |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` <ctrl+t> `` | Open externe diff applicatie (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Bekijk commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Remote branches
|
||||
@@ -273,27 +275,27 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <ctrl+o> `` | Kopieer branch name naar klembord | |
|
||||
| `` <space> `` | Uitchecken | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
|
||||
| `` <space> `` | Uitchecken | Geselecteerde remote branch uitchecken als nieuwe locale branch of als detached head. |
|
||||
| `` n `` | Nieuwe branch | |
|
||||
| `` w `` | New worktree | |
|
||||
| `` M `` | Merge in met huidige checked out branch | View options for merging the selected item into the current branch (regular merge, squash merge) |
|
||||
| `` r `` | Rebase branch | Rebase the checked-out branch onto the selected branch. |
|
||||
| `` d `` | Delete | Delete the remote branch from the remote. |
|
||||
| `` u `` | Set as upstream | Stel in als upstream van uitgecheckte branch |
|
||||
| `` r `` | Rebase branch | Rebase de uitgecheckte branch bovenop de geselecteerde branch. |
|
||||
| `` d `` | Verwijderen | Delete the remote branch from the remote. |
|
||||
| `` u `` | Instellen als upstream | Stel in als upstream van uitgecheckte branch |
|
||||
| `` s `` | Sort order | |
|
||||
| `` g `` | Bekijk reset opties | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` <ctrl+t> `` | Open externe diff applicatie (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Bekijk commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Remotes
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <enter> `` | View branches | |
|
||||
| `` <enter> `` | Bekijk branches | |
|
||||
| `` n `` | Voeg een nieuwe remote toe | |
|
||||
| `` d `` | Remove | Remove the selected remote. Any local branches tracking a remote branch from the remote will be unaffected. |
|
||||
| `` d `` | Verwijderen | Remove the selected remote. Any local branches tracking a remote branch from the remote will be unaffected. |
|
||||
| `` e `` | Edit | Wijzig remote |
|
||||
| `` f `` | Fetch | Fetch remote |
|
||||
| `` F `` | Add fork remote | Quickly add a fork remote by replacing the owner in the origin URL and optionally check out a branch from new remote. |
|
||||
@@ -318,15 +320,15 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | Copy selected text to clipboard | |
|
||||
| `` <space> `` | Toggle staged | Toggle lijnen staged / unstaged |
|
||||
| `` d `` | Verwijdert change (git reset) | When unstaged change is selected, discard the change using `git reset`. When staged change is selected, unstage the change. |
|
||||
| `` o `` | Open bestand | Open file in default application. |
|
||||
| `` e `` | Verander bestand | Open file in external editor. |
|
||||
| `` o `` | Open bestand | Open bestand in standaardapplicatie. |
|
||||
| `` e `` | Verander bestand | Open bestand in externe editor. |
|
||||
| `` <esc> `` | Ga terug naar het bestanden paneel | |
|
||||
| `` <tab> `` | Ga naar een ander paneel | Switch to other view (staged/unstaged changes). |
|
||||
| `` E `` | Edit hunk | Edit selected hunk in external editor. |
|
||||
| `` c `` | Commit veranderingen | Commit staged changes. |
|
||||
| `` c `` | Commit veranderingen | Commit gestagede wijzigingen. |
|
||||
| `` w `` | Commit veranderingen zonder pre-commit hook | |
|
||||
| `` C `` | Commit veranderingen met de git editor | |
|
||||
| `` <ctrl+f> `` | Find base commit for fixup | Find the commit that your current changes are building upon, for the sake of amending/fixing up the commit. This spares you from having to look through your branch's commits one-by-one to see which commit should be amended/fixed up. See docs: <https://github.com/jesseduffield/lazygit/tree/master/docs/Fixup_Commits.md> |
|
||||
| `` <ctrl+f> `` | Find base commit for fixup | Vind de commit waar je huidige wijzigingen bovenop zijn gebouwd met als doel die commit te amenden/fixen. Hierdoor hoef je dit niet met de hand te doen. Zie: <https://github.com/jesseduffield/lazygit/tree/master/docs/Fixup_Commits.md> |
|
||||
| `` / `` | Start met zoeken | |
|
||||
|
||||
## Stash
|
||||
@@ -337,18 +339,17 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | Pop | Apply the stash entry to your working directory and remove the stash entry. |
|
||||
| `` d `` | Laten vallen | Remove the stash entry from the stash list. |
|
||||
| `` n `` | Nieuwe branch | Create a new branch from the selected stash entry. This works by git checking out the commit that the stash entry was created from, creating a new branch from that commit, then applying the stash entry to the new branch as an additional commit. |
|
||||
| `` r `` | Rename stash | |
|
||||
| `` w `` | New worktree | |
|
||||
| `` r `` | Hernoem stash | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Bekijk gecommite bestanden | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Status
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` o `` | Open config bestand | Open file in default application. |
|
||||
| `` e `` | Verander config bestand | Open file in external editor. |
|
||||
| `` e `` | Verander config bestand | Open bestand in externe editor. |
|
||||
| `` u `` | Check voor updates | |
|
||||
| `` <enter> `` | Wissel naar een recente repo | |
|
||||
| `` a `` | Show/cycle all branch logs | |
|
||||
@@ -364,15 +365,15 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` y `` | Copy commit attribute to clipboard | Copy commit attribute to clipboard (e.g. hash, URL, diff, message, author). |
|
||||
| `` o `` | Open commit in browser | |
|
||||
| `` n `` | Creëer nieuwe branch van commit | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` N `` | Verplaats commits naar nieuwe branch | Maak een nieuwe branch en verplaats niet-gepushte commits van de huidige branch hier naar toe. Gebruik dit in het geval dat je deze commits eigenlijk op een nieuwe branch had willen maken.<br><br>Let op dat de selectie genegeerd wordt. De nieuwe branch komt ofwel bovenop de main branch, of bovenop de huidige branch (je kan kiezen). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Bekijk reset opties | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Kopieer commit (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | Reset cherry-picked (gekopieerde) commits selectie | |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` <ctrl+t> `` | Open externe diff applicatie (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Bekijk gecommite bestanden | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Start met zoeken | |
|
||||
|
||||
## Submodules
|
||||
@@ -381,7 +382,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
|-----|--------|-------------|
|
||||
| `` <ctrl+o> `` | Kopieer submodule naam naar klembord | |
|
||||
| `` <enter> `` | Enter | Enter submodule |
|
||||
| `` d `` | Remove | Remove the selected submodule and its corresponding directory. |
|
||||
| `` d `` | Verwijderen | Remove the selected submodule and its corresponding directory. |
|
||||
| `` u `` | Update | Update selected submodule. |
|
||||
| `` n `` | Voeg nieuwe submodule toe | |
|
||||
| `` e `` | Update submodule URL | |
|
||||
@@ -394,15 +395,15 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <ctrl+o> `` | Copy tag to clipboard | |
|
||||
| `` <space> `` | Uitchecken | Checkout the selected tag as a detached HEAD. |
|
||||
| `` <space> `` | Uitchecken | Geselecteerde tag uitchecken als 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. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` d `` | Verwijderen | 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. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` g `` | Resetten | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` <ctrl+t> `` | Open externe diff applicatie (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Bekijk commits | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Worktrees
|
||||
@@ -411,6 +412,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
|-----|--------|-------------|
|
||||
| `` n `` | New worktree | |
|
||||
| `` <space> `` | Switch | Switch to the selected worktree. |
|
||||
| `` o `` | Open in 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. |
|
||||
| `` o `` | Openen in editor | |
|
||||
| `` d `` | Verwijderen | 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 | |
|
||||
|
||||
@@ -22,7 +22,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` R `` | Odśwież | Odśwież stan git (tj. uruchom `git status`, `git branch`, itp. w tle, aby zaktualizować zawartość paneli). To nie uruchamia `git fetch`. |
|
||||
| `` + `` | Następny tryb ekranu (normalny/półpełny/pełnoekranowy) | |
|
||||
| `` _ `` | Poprzedni tryb ekranu | |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers. |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | Anuluj | |
|
||||
| `` ? `` | Otwórz menu przypisań klawiszy | |
|
||||
| `` <ctrl+s> `` | Pokaż opcje filtrowania | Pokaż opcje filtrowania dziennika commitów, tak aby pokazywane były tylko commity pasujące do filtra. |
|
||||
@@ -30,6 +31,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` q, <ctrl+c> `` | Wyjdź | |
|
||||
| `` <ctrl+z> `` | Suspend the application | |
|
||||
| `` <ctrl+w> `` | Przełącz białe znaki | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` <alt+shift+c> `` | Edytuj plik konfiguracyjny | Otwórz plik w zewnętrznym edytorze. |
|
||||
| `` z `` | Cofnij | Dziennik reflog zostanie użyty do określenia, jakie polecenie git należy uruchomić, aby cofnąć ostatnie polecenie git. Nie obejmuje to zmian w drzewie roboczym; brane są pod uwagę tylko commity. |
|
||||
| `` Z `` | Ponów | Dziennik reflog zostanie użyty do określenia, jakie polecenie git należy uruchomić, aby ponowić ostatnie polecenie git. Nie obejmuje to zmian w drzewie roboczym; brane są pod uwagę tylko commity. |
|
||||
|
||||
@@ -83,13 +85,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Otwórz commit w przeglądarce | |
|
||||
| `` n `` | Utwórz nową gałąź z commita | |
|
||||
| `` N `` | Przenieś commity do nowej gałęzi | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | Nowe drzewo pracy | |
|
||||
| `` g `` | Reset | Wyświetl opcje resetu (miękki/mieszany/twardy) do wybranego elementu. |
|
||||
| `` C `` | Kopiuj (cherry-pick) | Oznacz commit jako skopiowany. Następnie, w widoku lokalnych commitów, możesz nacisnąć `V`, aby wkleić (cherry-pick) skopiowane commity do sprawdzonej gałęzi. W dowolnym momencie możesz nacisnąć `<esc>`, aby anulować zaznaczenie. |
|
||||
| `` <ctrl+t> `` | Otwórz zewnętrzne narzędzie różnic (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Wyświetl pliki | |
|
||||
| `` w `` | Zobacz opcje drzewa pracy | |
|
||||
| `` / `` | Szukaj w bieżącym widoku po tekście | |
|
||||
|
||||
## Dodatkowy
|
||||
@@ -120,6 +122,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Otwórz commit w przeglądarce | |
|
||||
| `` n `` | Utwórz nową gałąź z commita | |
|
||||
| `` N `` | Przenieś commity do nowej gałęzi | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | Nowe drzewo pracy | |
|
||||
| `` g `` | Reset | Wyświetl opcje resetu (miękki/mieszany/twardy) do wybranego elementu. |
|
||||
| `` C `` | Kopiuj (cherry-pick) | Oznacz commit jako skopiowany. Następnie, w widoku lokalnych commitów, możesz nacisnąć `V`, aby wkleić (cherry-pick) skopiowane commity do sprawdzonej gałęzi. W dowolnym momencie możesz nacisnąć `<esc>`, aby anulować zaznaczenie. |
|
||||
| `` <ctrl+r> `` | Resetuj wybrane (cherry-picked) commity | |
|
||||
@@ -127,7 +130,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Pokaż commity | |
|
||||
| `` w `` | Zobacz opcje drzewa pracy | |
|
||||
| `` / `` | Filtruj bieżący widok po tekście | |
|
||||
|
||||
## Główny panel (budowanie łatki)
|
||||
@@ -162,6 +164,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <space> `` | Przełącz | Przełącz wybrany element. |
|
||||
| `` n `` | Nowa gałąź | |
|
||||
| `` N `` | Przenieś commity do nowej gałęzi | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | Nowe drzewo pracy | |
|
||||
| `` o `` | Utwórz żądanie ściągnięcia | |
|
||||
| `` O `` | Zobacz opcje tworzenia pull requesta | |
|
||||
| `` G `` | Otwórz żądanie ściągnięcia w przeglądarce | |
|
||||
@@ -181,7 +184,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Otwórz zewnętrzne narzędzie różnic (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Pokaż commity | |
|
||||
| `` w `` | Zobacz opcje drzewa pracy | |
|
||||
| `` / `` | Filtruj bieżący widok po tekście | |
|
||||
|
||||
## Menu
|
||||
@@ -207,7 +209,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | Wybierz fragment | |
|
||||
| `` b `` | Wybierz wszystkie fragmenty | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | Poprzedni fragment | |
|
||||
| `` <down>, j `` | Następny fragment | |
|
||||
| `` <left>, h `` | Poprzedni konflikt | |
|
||||
@@ -316,17 +318,16 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | Wyciągnij | Zastosuj wpis schowka do katalogu roboczego i usuń wpis schowka. |
|
||||
| `` d `` | Usuń | Usuń wpis schowka z listy schowka. |
|
||||
| `` n `` | Nowa gałąź | Utwórz nową gałąź z wybranego wpisu schowka. Działa poprzez przełączenie git na commit, na którym wpis schowka został utworzony, tworzenie nowej gałęzi z tego commita, a następnie zastosowanie wpisu schowka do nowej gałęzi jako dodatkowego commita. |
|
||||
| `` w `` | Nowe drzewo pracy | |
|
||||
| `` r `` | Zmień nazwę schowka | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Wyświetl pliki | |
|
||||
| `` w `` | Zobacz opcje drzewa pracy | |
|
||||
| `` / `` | Filtruj bieżący widok po tekście | |
|
||||
|
||||
## Status
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` o `` | Otwórz plik konfiguracyjny | Otwórz plik w domyślnej aplikacji. |
|
||||
| `` e `` | Edytuj plik konfiguracyjny | Otwórz plik w zewnętrznym edytorze. |
|
||||
| `` u `` | Sprawdź aktualizacje | |
|
||||
| `` <enter> `` | Przełącz na ostatnie repozytorium | |
|
||||
@@ -344,6 +345,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Otwórz commit w przeglądarce | |
|
||||
| `` n `` | Utwórz nową gałąź z commita | |
|
||||
| `` N `` | Przenieś commity do nowej gałęzi | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | Nowe drzewo pracy | |
|
||||
| `` g `` | Reset | Wyświetl opcje resetu (miękki/mieszany/twardy) do wybranego elementu. |
|
||||
| `` C `` | Kopiuj (cherry-pick) | Oznacz commit jako skopiowany. Następnie, w widoku lokalnych commitów, możesz nacisnąć `V`, aby wkleić (cherry-pick) skopiowane commity do sprawdzonej gałęzi. W dowolnym momencie możesz nacisnąć `<esc>`, aby anulować zaznaczenie. |
|
||||
| `` <ctrl+r> `` | Resetuj wybrane (cherry-picked) commity | |
|
||||
@@ -351,7 +353,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Wyświetl pliki | |
|
||||
| `` w `` | Zobacz opcje drzewa pracy | |
|
||||
| `` / `` | Szukaj w bieżącym widoku po tekście | |
|
||||
|
||||
## Submoduły
|
||||
@@ -375,13 +376,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | Skopiuj tag do schowka | |
|
||||
| `` <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. |
|
||||
| `` w `` | Nowe drzewo pracy | |
|
||||
| `` d `` | Usuń | Wyświetl opcje usuwania lokalnego/odległego tagu. |
|
||||
| `` P `` | Wyślij tag | Wyślij wybrany tag do zdalnego. Zostaniesz poproszony o wybranie zdalnego. |
|
||||
| `` g `` | Reset | Wyświetl opcje resetu (miękki/mieszany/twardy) do wybranego elementu. |
|
||||
| `` <ctrl+t> `` | Otwórz zewnętrzne narzędzie różnic (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Pokaż commity | |
|
||||
| `` w `` | Zobacz opcje drzewa pracy | |
|
||||
| `` / `` | Filtruj bieżący widok po tekście | |
|
||||
|
||||
## Zdalne
|
||||
@@ -403,6 +404,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | Kopiuj nazwę gałęzi do schowka | |
|
||||
| `` <space> `` | Przełącz | Przełącz na nową lokalną gałąź na podstawie wybranej gałęzi zdalnej. Nowa gałąź będzie śledzić gałąź zdalną. |
|
||||
| `` n `` | Nowa gałąź | |
|
||||
| `` w `` | Nowe drzewo pracy | |
|
||||
| `` M `` | Scal | Scal wybraną gałąź z aktualnie sprawdzoną gałęzią. |
|
||||
| `` r `` | Przebazuj | Przebazuj przełączoną gałąź na wybraną gałąź. |
|
||||
| `` d `` | Usuń | Usuń gałąź zdalną ze zdalnego. |
|
||||
@@ -412,5 +414,4 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Otwórz zewnętrzne narzędzie różnic (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Pokaż commity | |
|
||||
| `` w `` | Zobacz opcje drzewa pracy | |
|
||||
| `` / `` | Filtruj bieżący widok po tekście | |
|
||||
|
||||
@@ -22,7 +22,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` 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`. |
|
||||
| `` + `` | Modo de tela seguinte (normal/metade/tela cheia) | |
|
||||
| `` _ `` | Modo de tela anterior | |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers. |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | Cancelar | |
|
||||
| `` ? `` | Abrir o menu de atalhos do teclado | |
|
||||
| `` <ctrl+s> `` | Ver opções de filtro | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
@@ -30,6 +31,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` q, <ctrl+c> `` | Sair | |
|
||||
| `` <ctrl+z> `` | Suspender a aplicação | |
|
||||
| `` <ctrl+w> `` | Toggle whitespace | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` <alt+shift+c> `` | Editar arquivo de configuração | Abrir arquivo no editor externo. |
|
||||
| `` 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. |
|
||||
| `` 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. |
|
||||
|
||||
@@ -92,6 +94,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <space> `` | Verificar | Checar item selecionado |
|
||||
| `` n `` | Nova branch | |
|
||||
| `` N `` | Mover commits para uma nova branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | Nova árvore de trabalho | |
|
||||
| `` o `` | Criar solicitação de pull | |
|
||||
| `` O `` | View create pull request options | |
|
||||
| `` G `` | Open pull request in browser | |
|
||||
@@ -111,7 +114,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Abrir ferramenta de diff externa (git difftool) | |
|
||||
| `` 0 `` | Focar visualização principal | |
|
||||
| `` <enter> `` | Ver commits | |
|
||||
| `` w `` | Ver opções da árvore de trabalho | |
|
||||
| `` / `` | Filtrar a visualização atual por texto | |
|
||||
|
||||
## Branches remotos
|
||||
@@ -121,6 +123,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | Copiar nome da branch para área de transferência | |
|
||||
| `` <space> `` | Verificar | Checar a nova branch baseada na brach remota selecionada, ou a branch remota como HEAD, desanexado |
|
||||
| `` n `` | Nova branch | |
|
||||
| `` w `` | Nova árvore de trabalho | |
|
||||
| `` 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 `` | Apagar | Excluir o branch remoto do controle remoto. |
|
||||
@@ -130,7 +133,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Abrir ferramenta de diff externa (git difftool) | |
|
||||
| `` 0 `` | Focar visualização principal | |
|
||||
| `` <enter> `` | Ver commits | |
|
||||
| `` w `` | Ver opções da árvore de trabalho | |
|
||||
| `` / `` | Filtrar a visualização atual por texto | |
|
||||
|
||||
## Commit arquivos
|
||||
@@ -186,13 +188,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Abrir commit no navegador | |
|
||||
| `` n `` | Create new branch off of commit | |
|
||||
| `` N `` | Mover commits para uma nova branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | Nova árvore de trabalho | |
|
||||
| `` g `` | Restaurar | Ver opções de redefinição (soft/mixed/hard) para redefinir para o item selecionado. |
|
||||
| `` 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. |
|
||||
| `` <ctrl+t> `` | Abrir ferramenta de diff externa (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focar visualização principal | |
|
||||
| `` <enter> `` | Ver arquivos | |
|
||||
| `` w `` | Ver opções da árvore de trabalho | |
|
||||
| `` / `` | Pesquisar na visualização atual por texto | |
|
||||
|
||||
## Etiquetas
|
||||
@@ -202,13 +204,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | Copiar etiqueta para área de transferência | |
|
||||
| `` <space> `` | Verificar | Checar a tag selecionada como um HEAD, desanexado |
|
||||
| `` n `` | Nova etiqueta | Crie uma nova etiqueta a partir do commit atual. Você será solicitado a digitar um nome e uma descrição opcional. |
|
||||
| `` w `` | Nova árvore de trabalho | |
|
||||
| `` d `` | Apagar | Ver opções de exclusão para tag local/remoto. |
|
||||
| `` P `` | Empurrar etiqueta | Push the selected tag to a remote. You'll be prompted to select a remote. |
|
||||
| `` g `` | Restaurar | Ver opções de redefinição (soft/mixed/hard) para redefinir para o item selecionado. |
|
||||
| `` <ctrl+t> `` | Abrir ferramenta de diff externa (git difftool) | |
|
||||
| `` 0 `` | Focar visualização principal | |
|
||||
| `` <enter> `` | Ver commits | |
|
||||
| `` w `` | Ver opções da árvore de trabalho | |
|
||||
| `` / `` | Filtrar a visualização atual por texto | |
|
||||
|
||||
## Input prompt
|
||||
@@ -271,7 +273,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | Escolha o local | |
|
||||
| `` b `` | Pegar todos os pedaços | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | Trecho anterior | |
|
||||
| `` <down>, j `` | Próximo trecho | |
|
||||
| `` <left>, h `` | Conflito anterior | |
|
||||
@@ -308,6 +310,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Abrir commit no navegador | |
|
||||
| `` n `` | Create new branch off of commit | |
|
||||
| `` N `` | Mover commits para uma nova branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | Nova árvore de trabalho | |
|
||||
| `` g `` | Restaurar | Ver opções de redefinição (soft/mixed/hard) para redefinir para o item selecionado. |
|
||||
| `` 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. |
|
||||
| `` <ctrl+r> `` | Reset copied (cherry-picked) commits selection | |
|
||||
@@ -315,7 +318,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focar visualização principal | |
|
||||
| `` <enter> `` | Ver commits | |
|
||||
| `` w `` | Ver opções da árvore de trabalho | |
|
||||
| `` / `` | Filtrar a visualização atual por texto | |
|
||||
|
||||
## Remotes
|
||||
@@ -346,17 +348,16 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` 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. |
|
||||
| `` w `` | Nova árvore de trabalho | |
|
||||
| `` r `` | Renomear o stash | |
|
||||
| `` 0 `` | Focar visualização principal | |
|
||||
| `` <enter> `` | Ver arquivos | |
|
||||
| `` w `` | Ver opções da árvore de trabalho | |
|
||||
| `` / `` | Filtrar a visualização atual por texto | |
|
||||
|
||||
## 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 | |
|
||||
@@ -374,6 +375,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Abrir commit no navegador | |
|
||||
| `` n `` | Create new branch off of commit | |
|
||||
| `` N `` | Mover commits para uma nova branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | Nova árvore de trabalho | |
|
||||
| `` g `` | Restaurar | Ver opções de redefinição (soft/mixed/hard) para redefinir para o item selecionado. |
|
||||
| `` 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. |
|
||||
| `` <ctrl+r> `` | Reset copied (cherry-picked) commits selection | |
|
||||
@@ -381,7 +383,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focar visualização principal | |
|
||||
| `` <enter> `` | Ver arquivos | |
|
||||
| `` w `` | Ver opções da árvore de trabalho | |
|
||||
| `` / `` | Pesquisar na visualização atual por texto | |
|
||||
|
||||
## Submódulos
|
||||
|
||||
@@ -22,7 +22,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` R `` | Обновить | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||
| `` + `` | Следующий режим экрана (нормальный/полуэкранный/полноэкранный) | |
|
||||
| `` _ `` | Предыдущий режим экрана | |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers. |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | Отменить | |
|
||||
| `` ? `` | Открыть меню | |
|
||||
| `` <ctrl+s> `` | Просмотреть параметры фильтрации по пути | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
@@ -30,6 +31,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` q, <ctrl+c> `` | Выйти | |
|
||||
| `` <ctrl+z> `` | Suspend the application | |
|
||||
| `` <ctrl+w> `` | Переключить отображение изменении пробелов в просмотрщике сравнении | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` <alt+shift+c> `` | Редактировать файл конфигурации | Open file in external editor. |
|
||||
| `` z `` | Отменить (через reflog) (экспериментальный) | Журнал ссылок (reflog) будет использоваться для определения того, какую команду git запустить, чтобы отменить последнюю команду git. Сюда не входят изменения в рабочем дереве; учитываются только коммиты. |
|
||||
| `` Z `` | Повторить (через reflog) (экспериментальный) | Журнал ссылок (reflog) будет использоваться для определения того, какую команду git нужно запустить, чтобы повторить последнюю команду git. Сюда не входят изменения в рабочем дереве; учитываются только коммиты. |
|
||||
|
||||
@@ -112,7 +114,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | Выбрать эту часть | |
|
||||
| `` b `` | Выбрать все части | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | Выбрать предыдущую часть | |
|
||||
| `` <down>, j `` | Выбрать следующую часть | |
|
||||
| `` <left>, h `` | Выбрать предыдущий конфликт | |
|
||||
@@ -149,6 +151,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Открыть коммит в браузере | |
|
||||
| `` n `` | Создать новую ветку с этого коммита | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Просмотреть параметры сброса | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Скопировать отобранные коммит (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | Сбросить отобранную (скопированную \| cherry-picked) выборку коммитов | |
|
||||
@@ -156,7 +159,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Просмотреть коммиты | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Коммиты
|
||||
@@ -192,13 +194,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Открыть коммит в браузере | |
|
||||
| `` n `` | Создать новую ветку с этого коммита | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Просмотреть параметры сброса | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Скопировать отобранные коммит (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Просмотреть файлы выбранного элемента | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Найти | |
|
||||
|
||||
## Локальные Ветки
|
||||
@@ -210,6 +212,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <space> `` | Переключить | Checkout selected item. |
|
||||
| `` n `` | Новая ветка | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` o `` | Создать запрос на принятие изменений | |
|
||||
| `` O `` | Создать параметры запроса принятие изменений | |
|
||||
| `` G `` | Open pull request in browser | |
|
||||
@@ -229,7 +232,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Просмотреть коммиты | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Меню
|
||||
@@ -258,6 +260,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | Открыть коммит в браузере | |
|
||||
| `` n `` | Создать новую ветку с этого коммита | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | Просмотреть параметры сброса | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | Скопировать отобранные коммит (cherry-pick) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | Сбросить отобранную (скопированную \| cherry-picked) выборку коммитов | |
|
||||
@@ -265,7 +268,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Просмотреть файлы выбранного элемента | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Найти | |
|
||||
|
||||
## Подмодули
|
||||
@@ -313,7 +315,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` o `` | Открыть файл конфигурации | Open file in default application. |
|
||||
| `` e `` | Редактировать файл конфигурации | Open file in external editor. |
|
||||
| `` u `` | Проверить обновления | |
|
||||
| `` <enter> `` | Переключиться на последний репозиторий | |
|
||||
@@ -328,13 +329,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+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. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` d `` | Delete | View delete options for local/remote tag. |
|
||||
| `` P `` | Отправить тег | 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. |
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Просмотреть коммиты | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Удалённые ветки
|
||||
@@ -344,6 +345,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | Скопировать название ветки в буфер обмена | |
|
||||
| `` <space> `` | Переключить | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
|
||||
| `` n `` | Новая ветка | |
|
||||
| `` w `` | New worktree | |
|
||||
| `` 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. |
|
||||
@@ -353,7 +355,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | Open external diff tool (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Просмотреть коммиты | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
## Удалённые репозитории
|
||||
@@ -409,8 +410,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | Применить припрятанные изменения и тут же удалить их из хранилища | Apply the stash entry to your working directory and remove the stash entry. |
|
||||
| `` d `` | Удалить припрятанные изменения из хранилища | Remove the stash entry from the stash list. |
|
||||
| `` n `` | Новая ветка | Create a new branch from the selected stash entry. This works by git checking out the commit that the stash entry was created from, creating a new branch from that commit, then applying the stash entry to the new branch as an additional commit. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` r `` | Переименовать хранилище | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | Просмотреть файлы выбранного элемента | |
|
||||
| `` w `` | View worktree options | |
|
||||
| `` / `` | Filter the current view by text | |
|
||||
|
||||
@@ -23,6 +23,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` + `` | 下一屏模式(正常/半屏/全屏) | |
|
||||
| `` _ `` | 上一屏模式 | |
|
||||
| `` \| `` | 切换分页器 | 从已配置的分页器列表中选择下一个分页器 |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | 取消 | |
|
||||
| `` ? `` | 打开菜单 | |
|
||||
| `` <ctrl+s> `` | 查看按路径过滤选项 | 查看用于过滤提交日志的选项,以便仅显示与过滤器匹配的提交。 |
|
||||
@@ -30,6 +31,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` q, <ctrl+c> `` | 退出 | |
|
||||
| `` <ctrl+z> `` | 挂起应用程序 | |
|
||||
| `` <ctrl+w> `` | 切换是否在差异视图中显示空白字符差异 | 切换是否在差异视图中显示空白字符更改。<br><br>默认值可在配置文件中通过键 'git.ignoreWhitespaceInDiffView' 更改。 |
|
||||
| `` <alt+shift+c> `` | 编辑配置文件 | 使用外部编辑器打开文件 |
|
||||
| `` z `` | 撤销 | Reflog将用于确定运行哪个git命令来撤消最后一个git命令。这并不包括对工作树的更改,只考虑提交。 |
|
||||
| `` Z `` | 重做 | Reflog将用于确定运行哪个git命令来重做上一个git命令。这并不包括对工作树的更改,只考虑提交。 |
|
||||
|
||||
@@ -60,6 +62,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 在浏览器中打开提交 | |
|
||||
| `` n `` | 从提交创建新分支 | |
|
||||
| `` N `` | 移动提交至新分支 | 创建一个新分支,并将当前分支未推送的提交移动到该分支。如果您打算开始新工作但忘记先创建新分支,这会很有用。<br><br>请注意,此操作忽略选择,新分支总是从主分支创建或堆叠在当前分支之上(您可以选择哪种方式)。 |
|
||||
| `` w `` | 新建工作树 | |
|
||||
| `` g `` | 查看重置选项 | 查看重置选项 (soft/mixed/hard) 用于重置到选择项 |
|
||||
| `` C `` | 复制提交(拣选) | 标记提交为已复制。然后,在本地提交视图中,您可以按 `V` (Cherry-Pick) 将已复制的提交粘贴到已检出的分支中。任何时候都可以按 `<esc>` 来取消选择。 |
|
||||
| `` <ctrl+r> `` | 重置已拣选(复制)的提交 | |
|
||||
@@ -67,7 +70,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | 选择当前分支的提交 | |
|
||||
| `` 0 `` | 聚焦主视图 | |
|
||||
| `` <enter> `` | 查看提交的文件 | |
|
||||
| `` w `` | 查看工作区选项 | |
|
||||
| `` / `` | 开始搜索 | |
|
||||
|
||||
## 子模块
|
||||
@@ -104,6 +106,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 在浏览器中打开提交 | |
|
||||
| `` n `` | 从提交创建新分支 | |
|
||||
| `` N `` | 移动提交至新分支 | 创建一个新分支,并将当前分支未推送的提交移动到该分支。如果您打算开始新工作但忘记先创建新分支,这会很有用。<br><br>请注意,此操作忽略选择,新分支总是从主分支创建或堆叠在当前分支之上(您可以选择哪种方式)。 |
|
||||
| `` w `` | 新建工作树 | |
|
||||
| `` g `` | 查看重置选项 | 查看重置选项 (soft/mixed/hard) 用于重置到选择项 |
|
||||
| `` C `` | 复制提交(拣选) | 标记提交为已复制。然后,在本地提交视图中,您可以按 `V` (Cherry-Pick) 将已复制的提交粘贴到已检出的分支中。任何时候都可以按 `<esc>` 来取消选择。 |
|
||||
| `` <ctrl+r> `` | 重置已拣选(复制)的提交 | |
|
||||
@@ -111,7 +114,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | 选择当前分支的提交 | |
|
||||
| `` 0 `` | 聚焦主视图 | |
|
||||
| `` <enter> `` | 查看提交 | |
|
||||
| `` w `` | 查看工作区选项 | |
|
||||
| `` / `` | 通过文本过滤当前视图 | |
|
||||
|
||||
## 提交
|
||||
@@ -147,13 +149,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 在浏览器中打开提交 | |
|
||||
| `` n `` | 从提交创建新分支 | |
|
||||
| `` N `` | 移动提交至新分支 | 创建一个新分支,并将当前分支未推送的提交移动到该分支。如果您打算开始新工作但忘记先创建新分支,这会很有用。<br><br>请注意,此操作忽略选择,新分支总是从主分支创建或堆叠在当前分支之上(您可以选择哪种方式)。 |
|
||||
| `` w `` | 新建工作树 | |
|
||||
| `` g `` | 查看重置选项 | 查看重置选项 (soft/mixed/hard) 用于重置到选择项 |
|
||||
| `` C `` | 复制提交(拣选) | 标记提交为已复制。然后,在本地提交视图中,您可以按 `V` (Cherry-Pick) 将已复制的提交粘贴到已检出的分支中。任何时候都可以按 `<esc>` 来取消选择。 |
|
||||
| `` <ctrl+t> `` | 使用外部差异比较工具(git difftool) | |
|
||||
| `` * `` | 选择当前分支的提交 | |
|
||||
| `` 0 `` | 聚焦主视图 | |
|
||||
| `` <enter> `` | 查看提交的文件 | |
|
||||
| `` w `` | 查看工作区选项 | |
|
||||
| `` / `` | 开始搜索 | |
|
||||
|
||||
## 提交信息
|
||||
@@ -225,6 +227,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <space> `` | 检出 | 检出选中的项目 |
|
||||
| `` n `` | 新分支 | |
|
||||
| `` N `` | 移动提交至新分支 | 创建一个新分支,并将当前分支未推送的提交移动到该分支。如果您打算开始新工作但忘记先创建新分支,这会很有用。<br><br>请注意,此操作忽略选择,新分支总是从主分支创建或堆叠在当前分支之上(您可以选择哪种方式)。 |
|
||||
| `` w `` | 新建工作树 | |
|
||||
| `` o `` | 创建拉取请求 | |
|
||||
| `` O `` | 创建拉取请求选项 | |
|
||||
| `` G `` | 在浏览器中打开拉取请求 | |
|
||||
@@ -244,7 +247,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | 使用外部差异比较工具(git difftool) | |
|
||||
| `` 0 `` | 聚焦主视图 | |
|
||||
| `` <enter> `` | 查看提交 | |
|
||||
| `` w `` | 查看工作区选项 | |
|
||||
| `` / `` | 通过文本过滤当前视图 | |
|
||||
|
||||
## 构建补丁中
|
||||
@@ -270,13 +272,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | 复制标签到剪贴板 | |
|
||||
| `` <space> `` | 检出 | 检出选择的标签作为分离的HEAD |
|
||||
| `` n `` | 创建标签 | 基于当前提交创建一个新标签。您将在弹窗中输入标签名称和描述(可选)。 |
|
||||
| `` w `` | 新建工作树 | |
|
||||
| `` d `` | 删除 | 查看本地/远程标签的删除选项 |
|
||||
| `` P `` | 推送标签 | 推送选择的标签到远端。您将在弹窗中选择一个远端。 |
|
||||
| `` g `` | 重置 | 查看重置选项 (soft/mixed/hard) 用于重置到选择项 |
|
||||
| `` <ctrl+t> `` | 使用外部差异比较工具(git difftool) | |
|
||||
| `` 0 `` | 聚焦主视图 | |
|
||||
| `` <enter> `` | 查看提交 | |
|
||||
| `` w `` | 查看工作区选项 | |
|
||||
| `` / `` | 通过文本过滤当前视图 | |
|
||||
|
||||
## 次要
|
||||
@@ -292,7 +294,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | 选中区块 | |
|
||||
| `` b `` | 选中所有区块 | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | 选择顶部块 | |
|
||||
| `` <down>, j `` | 选择底部块 | |
|
||||
| `` <left>, h `` | 选择上一个冲突 | |
|
||||
@@ -339,7 +341,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` o `` | 打开配置文件 | 使用默认程序打开该文件 |
|
||||
| `` e `` | 编辑配置文件 | 使用外部编辑器打开文件 |
|
||||
| `` u `` | 检查更新 | |
|
||||
| `` <enter> `` | 切换到最近的仓库 | |
|
||||
@@ -371,10 +372,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | 应用并删除 | 将存储项应用到工作目录并删除存储项。 |
|
||||
| `` d `` | 删除 | 从贮藏列表中删除该贮藏项 |
|
||||
| `` n `` | 新分支 | 从选定的贮藏项创建一个新分支。这是通过 git 检查创建贮藏项的提交,从该提交创建一个新分支,然后将贮藏项作为附加提交应用到新分支来实现的。 |
|
||||
| `` w `` | 新建工作树 | |
|
||||
| `` r `` | 重命名贮藏 | |
|
||||
| `` 0 `` | 聚焦主视图 | |
|
||||
| `` <enter> `` | 查看提交的文件 | |
|
||||
| `` w `` | 查看工作区选项 | |
|
||||
| `` / `` | 通过文本过滤当前视图 | |
|
||||
|
||||
## 输入提示
|
||||
@@ -403,6 +404,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | 复制分支名称到剪贴板 | |
|
||||
| `` <space> `` | 检出 | 基于当前选中的远程分支检出一个新的本地分支,或者将远程分支作分离的HEAD。 |
|
||||
| `` n `` | 新分支 | |
|
||||
| `` w `` | 新建工作树 | |
|
||||
| `` M `` | 合并到当前检出的分支 | 查看将选中项合并到当前分支的选项(正常合并,压缩合并) |
|
||||
| `` r `` | 变基 | 将检出的分支变基到所选的分支上。 |
|
||||
| `` d `` | 删除 | 从远程删除远程分支。 |
|
||||
@@ -412,5 +414,4 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | 使用外部差异比较工具(git difftool) | |
|
||||
| `` 0 `` | 聚焦主视图 | |
|
||||
| `` <enter> `` | 查看提交 | |
|
||||
| `` w `` | 查看工作区选项 | |
|
||||
| `` / `` | 通过文本过滤当前视图 | |
|
||||
|
||||
@@ -22,7 +22,8 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` R `` | 重新整理 | Refresh the git state (i.e. run `git status`, `git branch`, etc in background to update the contents of panels). This does not run `git fetch`. |
|
||||
| `` + `` | 下一個螢幕模式(常規/半螢幕/全螢幕) | |
|
||||
| `` _ `` | 上一個螢幕模式 | |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers |
|
||||
| `` \| `` | Cycle pagers | Choose the next pager in the list of configured pagers. |
|
||||
| `` \ `` | Cycle pagers (reverse) | Choose the previous pager in the list of configured pagers. |
|
||||
| `` <esc> `` | 取消 | |
|
||||
| `` ? `` | 開啟選單 | |
|
||||
| `` <ctrl+s> `` | 檢視篩選路徑選項 | View options for filtering the commit log, so that only commits matching the filter are shown. |
|
||||
@@ -30,6 +31,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` q, <ctrl+c> `` | 結束 | |
|
||||
| `` <ctrl+z> `` | Suspend the application | |
|
||||
| `` <ctrl+w> `` | 切換是否在差異檢視中顯示空格變更 | Toggle whether or not whitespace changes are shown in the diff view.<br><br>The default can be changed in the config file with the key 'git.ignoreWhitespaceInDiffView'. |
|
||||
| `` <alt+shift+c> `` | 編輯設定檔案 | 使用外部編輯器開啟 |
|
||||
| `` z `` | 復原 | 將使用 reflog 確任 git 指令以復原。這不包括工作區更改;只考慮提交。 |
|
||||
| `` Z `` | 取消復原 | 將使用 reflog 確任 git 指令以重作。這不包括工作區更改;只考慮提交。 |
|
||||
|
||||
@@ -88,7 +90,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` <space> `` | 挑選程式碼片段 | |
|
||||
| `` b `` | 挑選所有程式碼片段 | |
|
||||
| `` b `` | Pick both hunks | |
|
||||
| `` <up>, k `` | 選擇上一段 | |
|
||||
| `` <down>, j `` | 選擇下一段 | |
|
||||
| `` <left>, h `` | 選擇上一個衝突 | |
|
||||
@@ -139,6 +141,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 在瀏覽器中開啟提交 | |
|
||||
| `` n `` | 從提交建立新分支 | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | 檢視重設選項 | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | 複製提交 (揀選) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | 重設選定的揀選 (複製) 提交 | |
|
||||
@@ -146,7 +149,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 檢視所選項目的檔案 | |
|
||||
| `` w `` | 檢視工作目錄選項 | |
|
||||
| `` / `` | 搜尋 | |
|
||||
|
||||
## 子模組
|
||||
@@ -206,13 +208,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 在瀏覽器中開啟提交 | |
|
||||
| `` n `` | 從提交建立新分支 | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | 檢視重設選項 | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | 複製提交 (揀選) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+t> `` | 開啟外部差異工具 (git difftool) | |
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 檢視所選項目的檔案 | |
|
||||
| `` w `` | 檢視工作目錄選項 | |
|
||||
| `` / `` | 搜尋 | |
|
||||
|
||||
## 提交摘要
|
||||
@@ -250,10 +252,10 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` g `` | 還原 | Apply the stash entry to your working directory and remove the stash entry. |
|
||||
| `` d `` | 捨棄 | Remove the stash entry from the stash list. |
|
||||
| `` n `` | 新分支 | Create a new branch from the selected stash entry. This works by git checking out the commit that the stash entry was created from, creating a new branch from that commit, then applying the stash entry to the new branch as an additional commit. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` r `` | 重新命名收藏 | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 檢視所選項目的檔案 | |
|
||||
| `` w `` | 檢視工作目錄選項 | |
|
||||
| `` / `` | 搜尋 | |
|
||||
|
||||
## 日誌
|
||||
@@ -266,6 +268,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` o `` | 在瀏覽器中開啟提交 | |
|
||||
| `` n `` | 從提交建立新分支 | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` g `` | 檢視重設選項 | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` C `` | 複製提交 (揀選) | Mark commit as copied. Then, within the local commits view, you can press `V` to paste (cherry-pick) the copied commit(s) into your checked out branch. At any time you can press `<esc>` to cancel the selection. |
|
||||
| `` <ctrl+r> `` | 重設選定的揀選 (複製) 提交 | |
|
||||
@@ -273,7 +276,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` * `` | Select commits of current branch | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 檢視提交 | |
|
||||
| `` w `` | 檢視工作目錄選項 | |
|
||||
| `` / `` | 搜尋 | |
|
||||
|
||||
## 本地分支
|
||||
@@ -285,6 +287,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <space> `` | 檢出 | 檢出選定的項目。 |
|
||||
| `` n `` | 新分支 | |
|
||||
| `` N `` | Move commits to new branch | Create a new branch and move the unpushed commits of the current branch to it. Useful if you meant to start new work and forgot to create a new branch first.<br><br>Note that this disregards the selection, the new branch is always created either from the main branch or stacked on top of the current branch (you get to choose which). |
|
||||
| `` w `` | New worktree | |
|
||||
| `` o `` | 建立拉取請求 | |
|
||||
| `` O `` | 建立拉取請求選項 | |
|
||||
| `` G `` | Open pull request in browser | |
|
||||
@@ -304,7 +307,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | 開啟外部差異工具 (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 檢視提交 | |
|
||||
| `` w `` | 檢視工作目錄選項 | |
|
||||
| `` / `` | 搜尋 | |
|
||||
|
||||
## 標籤
|
||||
@@ -314,13 +316,13 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+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. |
|
||||
| `` w `` | New worktree | |
|
||||
| `` d `` | 刪除 | View delete options for local/remote tag. |
|
||||
| `` P `` | 推送標籤 | Push the selected tag to a remote. You'll be prompted to select a remote. |
|
||||
| `` g `` | 重設 | View reset options (soft/mixed/hard) for resetting onto selected item. |
|
||||
| `` <ctrl+t> `` | 開啟外部差異工具 (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 檢視提交 | |
|
||||
| `` w `` | 檢視工作目錄選項 | |
|
||||
| `` / `` | 搜尋 | |
|
||||
|
||||
## 檔案
|
||||
@@ -368,7 +370,6 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
|
||||
| Key | Action | Info |
|
||||
|-----|--------|-------------|
|
||||
| `` o `` | 開啟設定檔案 | 使用預設軟體開啟 |
|
||||
| `` e `` | 編輯設定檔案 | 使用外部編輯器開啟 |
|
||||
| `` u `` | 檢查更新 | |
|
||||
| `` <enter> `` | 切換到最近使用的版本庫 | |
|
||||
@@ -403,6 +404,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+o> `` | 複製分支名稱到剪貼簿 | |
|
||||
| `` <space> `` | 檢出 | Checkout a new local branch based on the selected remote branch, or the remote branch as a detached head. |
|
||||
| `` n `` | 新分支 | |
|
||||
| `` w `` | New worktree | |
|
||||
| `` 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 the remote branch from the remote. |
|
||||
@@ -412,5 +414,4 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||
| `` <ctrl+t> `` | 開啟外部差異工具 (git difftool) | |
|
||||
| `` 0 `` | Focus main view | |
|
||||
| `` <enter> `` | 檢視提交 | |
|
||||
| `` w `` | 檢視工作目錄選項 | |
|
||||
| `` / `` | 搜尋 | |
|
||||
|
||||
@@ -25,8 +25,9 @@ require (
|
||||
github.com/lucasb-eyer/go-colorful v1.4.0
|
||||
github.com/mgutz/str v1.2.0
|
||||
github.com/mitchellh/go-ps v1.0.0
|
||||
github.com/petermattis/goid v0.0.0-20250813065127-a731cc31b4fe
|
||||
github.com/rivo/uniseg v0.4.7
|
||||
github.com/sahilm/fuzzy v0.1.2
|
||||
github.com/sahilm/fuzzy v0.1.3
|
||||
github.com/samber/lo v1.53.0
|
||||
github.com/sanity-io/litter v1.5.8
|
||||
github.com/sasha-s/go-deadlock v0.3.9
|
||||
@@ -37,8 +38,8 @@ require (
|
||||
github.com/stretchr/testify v1.11.1
|
||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e
|
||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
|
||||
golang.org/x/sync v0.20.0
|
||||
golang.org/x/sys v0.45.0
|
||||
golang.org/x/sync v0.21.0
|
||||
golang.org/x/sys v0.46.0
|
||||
gopkg.in/ozeidan/fuzzy-patricia.v3 v3.0.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
@@ -57,20 +58,22 @@ require (
|
||||
github.com/hpcloud/tail v1.0.0 // indirect
|
||||
github.com/invopop/jsonschema v0.10.0 // indirect
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 // indirect
|
||||
github.com/kr/pretty v0.3.1 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/onsi/ginkgo v1.10.3 // indirect
|
||||
github.com/onsi/gomega v1.34.1 // indirect
|
||||
github.com/petermattis/goid v0.0.0-20250813065127-a731cc31b4fe // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.14.1 // indirect
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
|
||||
golang.org/x/net v0.47.0 // indirect
|
||||
golang.org/x/mod v0.35.0 // indirect
|
||||
golang.org/x/net v0.55.0 // indirect
|
||||
golang.org/x/term v0.43.0 // indirect
|
||||
golang.org/x/text v0.37.0 // indirect
|
||||
golang.org/x/tools v0.44.0 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
|
||||
gopkg.in/fsnotify.v1 v1.4.7 // indirect
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
|
||||
mvdan.cc/gofumpt v0.9.2 // indirect
|
||||
)
|
||||
|
||||
tool mvdan.cc/gofumpt
|
||||
|
||||
@@ -21,7 +21,6 @@ github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJ
|
||||
github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
|
||||
github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21 h1:tuijfIjZyjZaHq9xDUh0tNitwXshJpbLkqMOJv4H3do=
|
||||
github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21/go.mod h1:po7NpZ/QiTKzBKyrsEAxwnTamCoh8uDk/egRpQ7siIc=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
|
||||
github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
|
||||
github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@@ -40,6 +39,8 @@ github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3Bop
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4=
|
||||
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
||||
github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI=
|
||||
github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/gookit/assert v0.1.1 h1:lh3GcawXe/p+cU7ESTZ5Ui3Sm/x8JWpIis4/1aF0mY0=
|
||||
@@ -98,17 +99,15 @@ github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
|
||||
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
|
||||
github.com/petermattis/goid v0.0.0-20250813065127-a731cc31b4fe h1:vHpqOnPlnkba8iSxU4j/CvDSS9J4+F4473esQsYLGoE=
|
||||
github.com/petermattis/goid v0.0.0-20250813065127-a731cc31b4fe/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4=
|
||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
github.com/sahilm/fuzzy v0.1.2 h1:kdSkz23lx1meNjEl+SLJULeSbjTI4Dn14K/YxdGrIww=
|
||||
github.com/sahilm/fuzzy v0.1.2/go.mod h1:au6//VbVSqu6DFrkL2CfjlJ5iURpNCPeE+1GwY3XsT8=
|
||||
github.com/sahilm/fuzzy v0.1.3 h1:juByESSS32nVD81vr6tHmKmA/8zde7gE+x5CLxrzXPU=
|
||||
github.com/sahilm/fuzzy v0.1.3/go.mod h1:au6//VbVSqu6DFrkL2CfjlJ5iURpNCPeE+1GwY3XsT8=
|
||||
github.com/samber/lo v1.53.0 h1:t975lj2py4kJPQ6haz1QMgtId2gtmfktACxIXArw3HM=
|
||||
github.com/samber/lo v1.53.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0=
|
||||
github.com/sanity-io/litter v1.5.8 h1:uM/2lKrWdGbRXDrIq08Lh9XtVYoeGtcQxk9rtQ7+rYg=
|
||||
@@ -140,17 +139,19 @@ golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0
|
||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM=
|
||||
golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
|
||||
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
|
||||
golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8=
|
||||
golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
|
||||
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||
golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM=
|
||||
golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||
golang.org/x/sys v0.0.0-20170407050850-f3918c30c5c2/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@@ -162,8 +163,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY=
|
||||
golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw=
|
||||
golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
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=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
@@ -180,6 +181,8 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c=
|
||||
golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
@@ -193,3 +196,5 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
mvdan.cc/gofumpt v0.9.2 h1:zsEMWL8SVKGHNztrx6uZrXdp7AX8r421Vvp23sz7ik4=
|
||||
mvdan.cc/gofumpt v0.9.2/go.mod h1:iB7Hn+ai8lPvofHd9ZFGVg2GOr8sBUw1QUWjNbmIL/s=
|
||||
|
||||
@@ -22,29 +22,50 @@ unit-test:
|
||||
go test ./... -short
|
||||
|
||||
# Run both unit tests and integration tests.
|
||||
test: unit-test e2e-all
|
||||
[unix]
|
||||
test: unit-test e2e
|
||||
|
||||
# On Windows, integration tests are not supported right now
|
||||
[windows]
|
||||
test: unit-test
|
||||
|
||||
# Generate all our auto-generated files (test list, cheatsheets, json schema, maybe other things in the future)
|
||||
generate:
|
||||
go generate ./...
|
||||
|
||||
format:
|
||||
gofumpt -l -w .
|
||||
go tool gofumpt -l -w .
|
||||
|
||||
lint:
|
||||
./scripts/gofumpt-check.sh
|
||||
./scripts/golangci-lint-shim.sh run
|
||||
|
||||
# Run integration tests with a visible UI. Most useful for running a single test; for running all tests, use `e2e-all` instead.
|
||||
e2e-test-command := "go test pkg/integration/clients/*.go"
|
||||
|
||||
# Run integration tests headlessly: no args runs all tests, a test name (or path) runs just that one. Use e2e-cli for a visible UI.
|
||||
e2e *args:
|
||||
{{ if args == "" { e2e-test-command } else { \
|
||||
e2e-test-command + " -run 'TestIntegration/" + \
|
||||
replace( \
|
||||
replace_regex( \
|
||||
replace_regex(args, '\S*pkg/integration/tests/', ''), \
|
||||
'\.go( |$)', '${1}' \
|
||||
), \
|
||||
" ", "$' && " + e2e-test-command + " -run 'TestIntegration/" \
|
||||
) + "$'" \
|
||||
} }}
|
||||
|
||||
# Run a single integration test with a visible UI; most useful with --sandbox or --slow.
|
||||
e2e-cli *args:
|
||||
go run cmd/integration_test/main.go cli {{ args }}
|
||||
|
||||
# Open the TUI for running integration tests.
|
||||
e2e-tui *args:
|
||||
go run cmd/integration_test/main.go tui {{ args }}
|
||||
|
||||
# Run all integration tests headlessly (without a visible UI).
|
||||
e2e-all:
|
||||
go test pkg/integration/clients/*.go
|
||||
# Run some tests on the current commit, similar to what CI does.
|
||||
check:
|
||||
./scripts/check_commit.sh
|
||||
|
||||
bump-gocui:
|
||||
scripts/bump_gocui.sh
|
||||
@@ -54,4 +75,4 @@ demo *args:
|
||||
demo/record_demo.sh {{ args }}
|
||||
|
||||
vendor:
|
||||
go mod vendor && go mod tidy
|
||||
go mod tidy && go mod vendor
|
||||
|
||||
+15
-7
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/spf13/afero"
|
||||
|
||||
appTypes "github.com/jesseduffield/lazygit/pkg/app/types"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/direnv"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
||||
"github.com/jesseduffield/lazygit/pkg/common"
|
||||
@@ -171,6 +172,17 @@ func openRecentRepo(app *App) bool {
|
||||
for _, repoDir := range app.Config.GetAppState().RecentRepos {
|
||||
if isRepo, _ := isDirectoryAGitRepository(repoDir); isRepo {
|
||||
if err := os.Chdir(repoDir); err == nil {
|
||||
// We're still in setup, before the gui exists, so we can't show the approval popup
|
||||
// that DispatchSwitchTo offers for blocked .envrc files; just log and move on.
|
||||
// Also, the logs only go to the debug log, not the Command Log, because that's not
|
||||
// available yet, either.
|
||||
result := direnv.Load(app.OSCommand.Cmd)
|
||||
if result.Message != "" {
|
||||
app.Log.WithField("message", result.Message).Info("direnv")
|
||||
}
|
||||
if result.Err != nil {
|
||||
app.Log.WithError(result.Err).Warn("direnv load failed")
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -239,12 +251,8 @@ func (app *App) setupRepo(
|
||||
}
|
||||
|
||||
// check if we have a recent repo we can open
|
||||
for _, repoDir := range app.Config.GetAppState().RecentRepos {
|
||||
if isRepo, _ := isDirectoryAGitRepository(repoDir); isRepo {
|
||||
if err := os.Chdir(repoDir); err == nil {
|
||||
return true, nil
|
||||
}
|
||||
}
|
||||
if openRecentRepo(app) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
fmt.Fprintln(os.Stderr, app.Tr.NoRecentRepositories)
|
||||
@@ -262,7 +270,7 @@ func (app *App) setupRepo(
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if didOpenRepo := openRecentRepo(app); didOpenRepo {
|
||||
if openRecentRepo(app) {
|
||||
return true, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ func Start(buildInfo *BuildInfo, integrationTest integrationTypes.IntegrationTes
|
||||
if cliArgs.PrintDefaultConfig {
|
||||
var buf bytes.Buffer
|
||||
encoder := yaml.NewEncoder(&buf)
|
||||
err := encoder.Encode(config.GetDefaultConfigForPlatform(runtime.GOOS))
|
||||
err := encoder.Encode(config.GetDefaultConfigForPlatform(config.KeybindingPlatform()))
|
||||
if err != nil {
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
package direnv
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
||||
)
|
||||
|
||||
// LoadResult bundles everything callers might want to know about a direnv
|
||||
// invocation. The env-var delta has already been applied to the process by
|
||||
// the time Load returns.
|
||||
type LoadResult struct {
|
||||
// Message is whatever direnv printed to stderr — useful to log
|
||||
// (success: "direnv: loading .envrc"; error: the error text).
|
||||
Message string
|
||||
|
||||
// Err is non-nil when direnv exited non-zero or its stdout could
|
||||
// not be parsed.
|
||||
Err error
|
||||
|
||||
// Blocked is true when the target .envrc exists but hasn't been
|
||||
// approved with `direnv allow` yet. EnvrcPath then holds the path
|
||||
// direnv said was blocked, suitable for passing to Allow.
|
||||
Blocked bool
|
||||
EnvrcPath string
|
||||
}
|
||||
|
||||
// Load runs `direnv export json` for the current working directory and applies
|
||||
// the resulting env-var delta to the current process. If direnv isn't on PATH,
|
||||
// it's a no-op — users who don't use direnv pay nothing, and users who do need
|
||||
// no config to opt in.
|
||||
func Load(cmd oscommands.ICmdObjBuilder) LoadResult {
|
||||
if _, lookupErr := exec.LookPath("direnv"); lookupErr != nil {
|
||||
return LoadResult{}
|
||||
}
|
||||
|
||||
stdout, stderr, runErr := cmd.New([]string{
|
||||
"direnv", "export", "json",
|
||||
}).DontLog().RunWithOutputs()
|
||||
|
||||
result := LoadResult{Message: strings.TrimRight(stderr, "\n")}
|
||||
|
||||
// Apply whatever delta direnv produced even if it exited non-zero.
|
||||
// When the new dir's .envrc is blocked, direnv still emits a valid
|
||||
// JSON delta on stdout that unloads vars from the previous dir;
|
||||
// without applying it the old env would leak into the new repo.
|
||||
delta, parseErr := parseDirenvExport([]byte(stdout))
|
||||
for k, v := range delta {
|
||||
if v == nil {
|
||||
_ = os.Unsetenv(k)
|
||||
} else {
|
||||
_ = os.Setenv(k, *v)
|
||||
}
|
||||
}
|
||||
|
||||
// Prefer the runtime error (whose Error() text is direnv's stderr)
|
||||
// over a parse error, since it's the more actionable signal.
|
||||
if runErr != nil {
|
||||
result.Err = runErr
|
||||
if envrcPath := queryBlockedEnvrc(cmd); envrcPath != "" {
|
||||
result.Blocked = true
|
||||
result.EnvrcPath = envrcPath
|
||||
}
|
||||
} else {
|
||||
result.Err = parseErr
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// Allow runs `direnv allow <envrcPath>` to approve a .envrc file so the next
|
||||
// Load can read it.
|
||||
func Allow(cmd oscommands.ICmdObjBuilder, envrcPath string) error {
|
||||
return cmd.New([]string{"direnv", "allow", envrcPath}).DontLog().Run()
|
||||
}
|
||||
|
||||
func parseDirenvExport(stdout []byte) (map[string]*string, error) {
|
||||
trimmed := bytes.TrimSpace(stdout)
|
||||
if len(trimmed) == 0 || bytes.Equal(trimmed, []byte("null")) {
|
||||
return nil, nil
|
||||
}
|
||||
var delta map[string]*string
|
||||
if err := json.Unmarshal(trimmed, &delta); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return delta, nil
|
||||
}
|
||||
|
||||
// queryBlockedEnvrc asks direnv (via `status --json`) whether the current
|
||||
// directory has a found-but-not-yet-allowed .envrc, and returns its path
|
||||
// if so. We use direnv's structured output rather than parsing the
|
||||
// human-readable "is blocked" line because the status output is more
|
||||
// stable across versions and locales.
|
||||
func queryBlockedEnvrc(cmd oscommands.ICmdObjBuilder) string {
|
||||
stdout, _, err := cmd.New([]string{
|
||||
"direnv", "status", "--json",
|
||||
}).DontLog().RunWithOutputs()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return parseDirenvStatus([]byte(stdout))
|
||||
}
|
||||
|
||||
func parseDirenvStatus(stdout []byte) string {
|
||||
var status struct {
|
||||
State struct {
|
||||
FoundRC *struct {
|
||||
Allowed int `json:"allowed"`
|
||||
Path string `json:"path"`
|
||||
} `json:"foundRC"`
|
||||
} `json:"state"`
|
||||
}
|
||||
if err := json.Unmarshal(stdout, &status); err != nil {
|
||||
return ""
|
||||
}
|
||||
if status.State.FoundRC == nil {
|
||||
return ""
|
||||
}
|
||||
// direnv's AllowStatus enum (`internal/cmd/rc.go`): 0=Allowed,
|
||||
// 1=NotAllowed, 2=Denied. Only NotAllowed is something the user
|
||||
// can approve; Denied means they already said no.
|
||||
const notAllowed = 1
|
||||
if status.State.FoundRC.Allowed != notAllowed {
|
||||
return ""
|
||||
}
|
||||
return status.State.FoundRC.Path
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package direnv
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestParseDirenvExport(t *testing.T) {
|
||||
hello := "hello"
|
||||
empty := ""
|
||||
|
||||
scenarios := []struct {
|
||||
name string
|
||||
input string
|
||||
want map[string]*string
|
||||
wantErr bool
|
||||
}{
|
||||
{name: "empty stdout means no .envrc was loaded", input: "", want: nil},
|
||||
{name: "literal null from direnv means no delta", input: "null", want: nil},
|
||||
{name: "empty object means no delta", input: "{}", want: map[string]*string{}},
|
||||
{name: "string value is a set", input: `{"FOO":"hello"}`, want: map[string]*string{"FOO": &hello}},
|
||||
{name: "null value is an unset", input: `{"FOO":null}`, want: map[string]*string{"FOO": nil}},
|
||||
{
|
||||
name: "set and unset can coexist",
|
||||
input: `{"FOO":"hello","BAR":null,"BAZ":""}`,
|
||||
want: map[string]*string{"FOO": &hello, "BAR": nil, "BAZ": &empty},
|
||||
},
|
||||
{name: "malformed JSON is an error", input: `{not json`, wantErr: true},
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
t.Run(s.name, func(t *testing.T) {
|
||||
got, err := parseDirenvExport([]byte(s.input))
|
||||
if s.wantErr {
|
||||
assert.Error(t, err)
|
||||
} else {
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, s.want, got)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseDirenvStatus(t *testing.T) {
|
||||
scenarios := []struct {
|
||||
name string
|
||||
input string
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "no .envrc found",
|
||||
input: `{"state":{"foundRC":null}}`,
|
||||
want: "",
|
||||
},
|
||||
{
|
||||
name: "found and allowed (0)",
|
||||
input: `{"state":{"foundRC":{"allowed":0,"path":"/repo/.envrc"}}}`,
|
||||
want: "",
|
||||
},
|
||||
{
|
||||
name: "found but not allowed (1) — eligible for approval",
|
||||
input: `{"state":{"foundRC":{"allowed":1,"path":"/repo/.envrc"}}}`,
|
||||
want: "/repo/.envrc",
|
||||
},
|
||||
{
|
||||
name: "found but denied (2) — user already said no",
|
||||
input: `{"state":{"foundRC":{"allowed":2,"path":"/repo/.envrc"}}}`,
|
||||
want: "",
|
||||
},
|
||||
{
|
||||
name: "malformed JSON",
|
||||
input: `{not json`,
|
||||
want: "",
|
||||
},
|
||||
{
|
||||
name: "empty input",
|
||||
input: "",
|
||||
want: "",
|
||||
},
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
t.Run(s.name, func(t *testing.T) {
|
||||
assert.Equal(t, s.want, parseDirenvStatus([]byte(s.input)))
|
||||
})
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -117,8 +117,8 @@ func NewGitCommandAux(
|
||||
rebaseCommands := git_commands.NewRebaseCommands(gitCommon, commitCommands, workingTreeCommands)
|
||||
stashCommands := git_commands.NewStashCommands(gitCommon, fileLoader, workingTreeCommands)
|
||||
patchBuilder := patch.NewPatchBuilder(cmn.Log,
|
||||
func(from string, to string, reverse bool, filename string, plain bool) (string, error) {
|
||||
return workingTreeCommands.ShowFileDiff(from, to, reverse, filename, plain)
|
||||
func(from string, to string, reverse bool, filename string, previousPath string, plain bool) (string, error) {
|
||||
return workingTreeCommands.ShowFileDiff(from, to, reverse, filename, previousPath, plain)
|
||||
})
|
||||
patchCommands := git_commands.NewPatchCommands(gitCommon, rebaseCommands, commitCommands, statusCommands, stashCommands, patchBuilder)
|
||||
bisectCommands := git_commands.NewBisectCommands(gitCommon)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
@@ -14,6 +15,12 @@ type gitCmdObjBuilder struct {
|
||||
|
||||
var _ oscommands.ICmdObjBuilder = &gitCmdObjBuilder{}
|
||||
|
||||
// We disable git's optional locks on every command by default so that our git
|
||||
// invocations never contend for index.lock. See git_commands.OptionalLocksEnvVar
|
||||
// for the full rationale. Individual commands that do want the lock (currently
|
||||
// only the foreground files refresh) opt back in via CmdObj.RemoveEnvVar.
|
||||
var defaultEnvVar = git_commands.OptionalLocksEnvVar + "=0"
|
||||
|
||||
func NewGitCmdObjBuilder(log *logrus.Entry, innerBuilder *oscommands.CmdObjBuilder) *gitCmdObjBuilder {
|
||||
// the price of having a convenient interface where we can say .New(...).Run() is that our builder now depends on our runner, so when we want to wrap the default builder/runner in new functionality we need to jump through some hoops. We could avoid the use of a decorator function here by just exporting the runner field on the default builder but that would be misleading because we don't want anybody using that to run commands (i.e. we want there to be a single API used across the codebase)
|
||||
updatedBuilder := innerBuilder.CloneWithNewRunner(func(runner oscommands.ICmdObjRunner) oscommands.ICmdObjRunner {
|
||||
@@ -28,8 +35,6 @@ func NewGitCmdObjBuilder(log *logrus.Entry, innerBuilder *oscommands.CmdObjBuild
|
||||
}
|
||||
}
|
||||
|
||||
var defaultEnvVar = "GIT_OPTIONAL_LOCKS=0"
|
||||
|
||||
func (self *gitCmdObjBuilder) New(args []string) *oscommands.CmdObj {
|
||||
return self.innerBuilder.New(args).AddEnvVars(defaultEnvVar)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/git_commands"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// Every git command we build disables optional locks by default, so that our
|
||||
// invocations never contend for index.lock (see git_commands.OptionalLocksEnvVar
|
||||
// for the rationale). Commands that want the lock opt back in with
|
||||
// CmdObj.RemoveEnvVar.
|
||||
func TestGitCmdObjBuilderDisablesOptionalLocksByDefault(t *testing.T) {
|
||||
builder := NewGitCmdObjBuilder(
|
||||
utils.NewDummyLog(),
|
||||
oscommands.NewDummyCmdObjBuilder(oscommands.NewFakeRunner(t)),
|
||||
)
|
||||
|
||||
assert.Contains(t, builder.New([]string{"git", "status"}).GetEnvVars(), git_commands.OptionalLocksEnvVar+"=0")
|
||||
assert.Contains(t, builder.NewShell("git status", "").GetEnvVars(), git_commands.OptionalLocksEnvVar+"=0")
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package git_commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
||||
"github.com/jesseduffield/lazygit/pkg/common"
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
|
||||
type CommitFileLoader struct {
|
||||
@@ -29,7 +29,7 @@ func (self *CommitFileLoader) GetFilesInDiff(from string, to string, reverse boo
|
||||
Arg("--no-ext-diff").
|
||||
Arg("--name-status").
|
||||
Arg("-z").
|
||||
Arg("--no-renames").
|
||||
Arg(fmt.Sprintf("--find-renames=%d%%", self.UserConfig().Git.RenameSimilarityThreshold)).
|
||||
ArgIf(reverse, "-R").
|
||||
Arg(from).
|
||||
Arg(to).
|
||||
@@ -44,18 +44,37 @@ func (self *CommitFileLoader) GetFilesInDiff(from string, to string, reverse boo
|
||||
}
|
||||
|
||||
// filenames string is something like "MM\x00file1\x00MU\x00file2\x00AA\x00file3\x00"
|
||||
// so we need to split it by the null character and then map each status-name pair to a commit file
|
||||
// so we need to split it by the null character and then map each status-name pair
|
||||
// to a commit file. Renames (and copies) are special: their status is followed by
|
||||
// two paths (the old one and the new one) rather than one, e.g.
|
||||
// "R100\x00old\x00new\x00".
|
||||
func getCommitFilesFromFilenames(filenames string) []*models.CommitFile {
|
||||
lines := strings.Split(strings.TrimRight(filenames, "\x00"), "\x00")
|
||||
if len(lines) == 1 {
|
||||
fields := strings.Split(strings.TrimRight(filenames, "\x00"), "\x00")
|
||||
if len(fields) == 1 {
|
||||
return []*models.CommitFile{}
|
||||
}
|
||||
|
||||
// typical result looks like 'A my_file' meaning my_file was added
|
||||
return lo.Map(lo.Chunk(lines, 2), func(chunk []string, _ int) *models.CommitFile {
|
||||
return &models.CommitFile{
|
||||
ChangeStatus: chunk[0],
|
||||
Path: chunk[1],
|
||||
commitFiles := make([]*models.CommitFile, 0, len(fields)/2)
|
||||
for i := 0; i < len(fields)-1; {
|
||||
changeStatus := fields[i]
|
||||
if changeStatus[0] == 'R' || changeStatus[0] == 'C' {
|
||||
// The status has a similarity score appended (e.g. "R100"); drop it
|
||||
// so the rest of the code only has to deal with a plain "R" or "C".
|
||||
commitFiles = append(commitFiles, &models.CommitFile{
|
||||
ChangeStatus: changeStatus[:1],
|
||||
PreviousPath: fields[i+1],
|
||||
Path: fields[i+2],
|
||||
})
|
||||
i += 3
|
||||
} else {
|
||||
// typical result looks like 'A my_file' meaning my_file was added
|
||||
commitFiles = append(commitFiles, &models.CommitFile{
|
||||
ChangeStatus: changeStatus,
|
||||
Path: fields[i+1],
|
||||
})
|
||||
i += 2
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return commitFiles
|
||||
}
|
||||
|
||||
@@ -60,6 +60,25 @@ func TestGetCommitFilesFromFilenames(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
testName: "a rename among regular files",
|
||||
input: "M\x00Myfile\x00R100\x00before\x00after\x00A\x00Added\x00",
|
||||
output: []*models.CommitFile{
|
||||
{
|
||||
Path: "Myfile",
|
||||
ChangeStatus: "M",
|
||||
},
|
||||
{
|
||||
Path: "after",
|
||||
PreviousPath: "before",
|
||||
ChangeStatus: "R",
|
||||
},
|
||||
{
|
||||
Path: "Added",
|
||||
ChangeStatus: "A",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
||||
@@ -168,6 +168,12 @@ func buildBranchCommands(deps commonDeps) *BranchCommands {
|
||||
return NewBranchCommands(gitCommon)
|
||||
}
|
||||
|
||||
func buildStatusCommands(deps commonDeps) *StatusCommands {
|
||||
gitCommon := buildGitCommon(deps)
|
||||
|
||||
return NewStatusCommands(gitCommon)
|
||||
}
|
||||
|
||||
func buildFlowCommands(deps commonDeps) *FlowCommands {
|
||||
gitCommon := buildGitCommon(deps)
|
||||
|
||||
|
||||
@@ -36,6 +36,12 @@ type GetStatusFileOptions struct {
|
||||
// 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
|
||||
// When true, this status is part of an unattended background refresh, so it
|
||||
// keeps the default suppression of optional locks (avoiding index.lock
|
||||
// contention with git commands the user runs in a terminal, at the cost of
|
||||
// not persisting git's refreshed stat-cache). A foreground status opts back
|
||||
// in; see gitStatus.
|
||||
Background bool
|
||||
}
|
||||
|
||||
func (self *FileLoader) GetStatusFiles(opts GetStatusFileOptions) []*models.File {
|
||||
@@ -47,7 +53,7 @@ func (self *FileLoader) GetStatusFiles(opts GetStatusFileOptions) []*models.File
|
||||
}
|
||||
untrackedFilesArg := fmt.Sprintf("--untracked-files=%s", untrackedFilesSetting)
|
||||
|
||||
statuses, err := self.gitStatus(GitStatusOptions{NoRenames: opts.NoRenames, UntrackedFilesArg: untrackedFilesArg})
|
||||
statuses, err := self.gitStatus(GitStatusOptions{NoRenames: opts.NoRenames, UntrackedFilesArg: untrackedFilesArg, Background: opts.Background})
|
||||
if err != nil {
|
||||
self.Log.Error(err)
|
||||
}
|
||||
@@ -148,6 +154,7 @@ func (self *FileLoader) getFileDiffs() (map[string]FileDiff, error) {
|
||||
type GitStatusOptions struct {
|
||||
NoRenames bool
|
||||
UntrackedFilesArg string
|
||||
Background bool
|
||||
}
|
||||
|
||||
type FileStatus struct {
|
||||
@@ -179,7 +186,17 @@ func (self *FileLoader) gitStatus(opts GitStatusOptions) ([]FileStatus, error) {
|
||||
).
|
||||
ToArgv()
|
||||
|
||||
statusLines, _, err := self.cmd.New(cmdArgs).DontLog().RunWithOutputs()
|
||||
cmdObj := self.cmd.New(cmdArgs).DontLog()
|
||||
if !opts.Background {
|
||||
// Every git command suppresses optional locks by default (see
|
||||
// OptionalLocksEnvVar). A foreground refresh is the one exception: we let
|
||||
// it take the lock so it persists git's refreshed stat-cache, which keeps
|
||||
// subsequent status calls fast. Background refreshes leave it suppressed so
|
||||
// they can't contend for index.lock.
|
||||
cmdObj.RemoveEnvVar(OptionalLocksEnvVar)
|
||||
}
|
||||
|
||||
statusLines, _, err := cmdObj.RunWithOutputs()
|
||||
if err != nil {
|
||||
return []FileStatus{}, err
|
||||
}
|
||||
|
||||
@@ -6,6 +6,16 @@ import (
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
||||
)
|
||||
|
||||
// OptionalLocksEnvVar is the name of the environment variable that tells git
|
||||
// whether it may take "optional" locks — chiefly the index.lock that `git
|
||||
// status` grabs to write back a refreshed stat-cache. We set it to 0 on every
|
||||
// git command by default (see NewGitCmdObjBuilder) so our invocations never
|
||||
// contend for index.lock, neither with each other (e.g. a main-view `git diff
|
||||
// --submodule`, which runs `git status` inside submodules, racing a submodule
|
||||
// action) nor with git commands the user runs in a terminal. The one command
|
||||
// that opts back in is the foreground files refresh; see FileLoader.gitStatus.
|
||||
const OptionalLocksEnvVar = "GIT_OPTIONAL_LOCKS"
|
||||
|
||||
// convenience struct for building git commands. Especially useful when
|
||||
// including conditional args
|
||||
type GitCommandBuilder struct {
|
||||
|
||||
@@ -4,8 +4,10 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||
"github.com/spf13/afero"
|
||||
)
|
||||
|
||||
type StatusCommands struct {
|
||||
@@ -82,6 +84,66 @@ func (self *StatusCommands) IsInRevert() (bool, error) {
|
||||
return self.os.FileExists(filepath.Join(self.repoPaths.WorktreeGitDirPath(), "REVERT_HEAD"))
|
||||
}
|
||||
|
||||
// RefsSnapshot returns a string fingerprint of the current state of local
|
||||
// branches and HEAD. Comparing two snapshots byte-for-byte tells us whether
|
||||
// any local ref or HEAD has moved since the last snapshot.
|
||||
func (self *StatusCommands) RefsSnapshot() (string, error) {
|
||||
t := time.Now()
|
||||
defer func() { self.Log.Infof("RefsSnapshot took %s", time.Since(t)) }()
|
||||
|
||||
refsArgs := NewGitCmd("for-each-ref").
|
||||
Arg("--format=%(objectname) %(refname)").
|
||||
Arg("refs/heads").
|
||||
ToArgv()
|
||||
refs, err := self.cmd.New(refsArgs).DontLog().RunWithOutput()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
head, err := self.headSnapshot()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return refs + head, nil
|
||||
}
|
||||
|
||||
// headSnapshot returns a fingerprint of HEAD that distinguishes "detached at
|
||||
// commit X" from "on a branch that points at X". The commit hash alone can't
|
||||
// tell those apart, which matters at the end of a rebase: HEAD reattaches to
|
||||
// the branch without the hash changing, and we'd otherwise miss that refresh.
|
||||
//
|
||||
// We read .git/HEAD directly rather than shelling out: it's faster (no child
|
||||
// process) and its content is exactly the symref-or-hash distinction we want
|
||||
// ("ref: refs/heads/foo" when attached, the raw hash when detached). The
|
||||
// reftable backend, however, doesn't keep a real .git/HEAD — it writes a fixed
|
||||
// stub ("ref: refs/heads/.invalid") that never reflects the actual HEAD. When
|
||||
// we see that stub (or the file is missing/unreadable) we fall back to
|
||||
// porcelain commands, which are backend-agnostic.
|
||||
func (self *StatusCommands) headSnapshot() (string, error) {
|
||||
headPath := filepath.Join(self.repoPaths.WorktreeGitDirPath(), "HEAD")
|
||||
if content, err := afero.ReadFile(self.Fs, headPath); err == nil {
|
||||
head := strings.TrimSpace(string(content))
|
||||
if head != "" && head != "ref: refs/heads/.invalid" {
|
||||
return head, nil
|
||||
}
|
||||
}
|
||||
|
||||
// symbolic-ref gives the branch when HEAD is attached and fails when it's
|
||||
// detached, in which case rev-parse gives the commit HEAD points at.
|
||||
symbolicRefArgs := NewGitCmd("symbolic-ref").Arg("HEAD").ToArgv()
|
||||
if symref, err := self.cmd.New(symbolicRefArgs).DontLog().RunWithOutput(); err == nil {
|
||||
return strings.TrimSpace(symref), nil
|
||||
}
|
||||
|
||||
revParseArgs := NewGitCmd("rev-parse").Arg("HEAD").ToArgv()
|
||||
head, err := self.cmd.New(revParseArgs).DontLog().RunWithOutput()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return strings.TrimSpace(head), nil
|
||||
}
|
||||
|
||||
// Full ref (e.g. "refs/heads/mybranch") of the branch that is currently
|
||||
// being rebased, or empty string when we're not in a rebase
|
||||
func (self *StatusCommands) BranchBeingRebased() string {
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package git_commands
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-errors/errors"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
||||
"github.com/samber/lo"
|
||||
"github.com/spf13/afero"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestStatusRefsSnapshot(t *testing.T) {
|
||||
const forEachRefOutput = "aaaa refs/heads/main\nbbbb refs/heads/topic\n"
|
||||
forEachRefArgs := []string{"for-each-ref", "--format=%(objectname) %(refname)", "refs/heads"}
|
||||
|
||||
scenarios := []struct {
|
||||
testName string
|
||||
headFile *string // nil means: don't create a .git/HEAD file (simulates it being unreadable).
|
||||
runner *oscommands.FakeCmdObjRunner
|
||||
expectedHead string
|
||||
}{
|
||||
{
|
||||
// files backend, on a branch: read straight from .git/HEAD, no
|
||||
// child process for HEAD.
|
||||
testName: "attached, read from HEAD file",
|
||||
headFile: lo.ToPtr("ref: refs/heads/main\n"),
|
||||
runner: oscommands.NewFakeRunner(t).
|
||||
ExpectGitArgs(forEachRefArgs, forEachRefOutput, nil),
|
||||
expectedHead: "ref: refs/heads/main",
|
||||
},
|
||||
{
|
||||
// files backend, detached: .git/HEAD holds the raw hash.
|
||||
testName: "detached, read from HEAD file",
|
||||
headFile: lo.ToPtr("aaaa\n"),
|
||||
runner: oscommands.NewFakeRunner(t).
|
||||
ExpectGitArgs(forEachRefArgs, forEachRefOutput, nil),
|
||||
expectedHead: "aaaa",
|
||||
},
|
||||
{
|
||||
// reftable backend (HEAD is a fixed stub), attached: fall back to
|
||||
// symbolic-ref, which succeeds.
|
||||
testName: "reftable stub, attached, fall back to symbolic-ref",
|
||||
headFile: lo.ToPtr("ref: refs/heads/.invalid\n"),
|
||||
runner: oscommands.NewFakeRunner(t).
|
||||
ExpectGitArgs(forEachRefArgs, forEachRefOutput, nil).
|
||||
ExpectGitArgs([]string{"symbolic-ref", "HEAD"}, "refs/heads/main\n", nil),
|
||||
expectedHead: "refs/heads/main",
|
||||
},
|
||||
{
|
||||
// reftable backend, detached: symbolic-ref fails, fall back to
|
||||
// rev-parse.
|
||||
testName: "reftable stub, detached, fall back to rev-parse",
|
||||
headFile: lo.ToPtr("ref: refs/heads/.invalid\n"),
|
||||
runner: oscommands.NewFakeRunner(t).
|
||||
ExpectGitArgs(forEachRefArgs, forEachRefOutput, nil).
|
||||
ExpectGitArgs([]string{"symbolic-ref", "HEAD"}, "", errors.New("fatal: ref HEAD is not a symbolic ref")).
|
||||
ExpectGitArgs([]string{"rev-parse", "HEAD"}, "aaaa\n", nil),
|
||||
expectedHead: "aaaa",
|
||||
},
|
||||
{
|
||||
// HEAD file missing/unreadable: same fallback as reftable.
|
||||
testName: "no HEAD file, fall back to symbolic-ref",
|
||||
headFile: nil,
|
||||
runner: oscommands.NewFakeRunner(t).
|
||||
ExpectGitArgs(forEachRefArgs, forEachRefOutput, nil).
|
||||
ExpectGitArgs([]string{"symbolic-ref", "HEAD"}, "refs/heads/main\n", nil),
|
||||
expectedHead: "refs/heads/main",
|
||||
},
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
fs := afero.NewMemMapFs()
|
||||
if s.headFile != nil {
|
||||
assert.NoError(t, afero.WriteFile(fs, "/repo/.git/HEAD", []byte(*s.headFile), 0o600))
|
||||
}
|
||||
|
||||
instance := buildStatusCommands(commonDeps{
|
||||
runner: s.runner,
|
||||
fs: fs,
|
||||
repoPaths: MockRepoPaths("/repo"),
|
||||
})
|
||||
|
||||
snapshot, err := instance.RefsSnapshot()
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, forEachRefOutput+s.expectedHead, snapshot)
|
||||
s.runner.CheckForMissingCalls()
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
|
||||
// .gitmodules looks like this:
|
||||
@@ -86,6 +87,96 @@ func (self *SubmoduleCommands) GetConfigs(parentModule *models.SubmoduleConfig)
|
||||
return configs, nil
|
||||
}
|
||||
|
||||
// AnyHaveStageableChanges reports whether any of the given submodule paths has
|
||||
// a checked-out commit that differs from the one recorded in the
|
||||
// superproject's index, i.e. a change that `git add <path>` would actually
|
||||
// stage. A submodule that only has dirty or untracked content (with no new
|
||||
// commit) can't be staged from the superproject, so it won't be reported here.
|
||||
func (self *SubmoduleCommands) AnyHaveStageableChanges(paths []string) (bool, error) {
|
||||
if len(paths) == 0 {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
cmdArgs := NewGitCmd("submodule").Arg("status", "--").Arg(paths...).ToArgv()
|
||||
output, err := self.cmd.New(cmdArgs).DontLog().RunWithOutput()
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
// Each line looks like "<prefix><sha> <path> (<describe>)". A '+' prefix
|
||||
// means the checked-out commit differs from the index, i.e. there's a
|
||||
// commit change to stage.
|
||||
return lo.SomeBy(strings.Split(output, "\n"), func(line string) bool {
|
||||
return strings.HasPrefix(line, "+")
|
||||
}), nil
|
||||
}
|
||||
|
||||
// GetConflictCommits returns the three gitlink commits of a conflicted submodule
|
||||
// from the index: the merge base, our (current) commit, and their (incoming)
|
||||
// commit. Any of them can be empty if that stage is absent (e.g. a submodule
|
||||
// that was added on only one side). The path is relative to the repo root.
|
||||
func (self *SubmoduleCommands) GetConflictCommits(path string) (base string, ours string, theirs string, err error) {
|
||||
cmdArgs := NewGitCmd("ls-files").Arg("-u", "-z", "--", path).ToArgv()
|
||||
output, err := self.cmd.New(cmdArgs).DontLog().RunWithOutput()
|
||||
if err != nil {
|
||||
return "", "", "", err
|
||||
}
|
||||
|
||||
// Each NUL-terminated entry looks like "<mode> <sha> <stage>\t<path>".
|
||||
for _, entry := range strings.Split(output, "\x00") {
|
||||
// fields are split on the tab and the spaces, so the leading three are
|
||||
// always mode, sha, stage regardless of what the path contains.
|
||||
fields := strings.Fields(entry)
|
||||
if len(fields) < 3 {
|
||||
continue
|
||||
}
|
||||
switch fields[2] {
|
||||
case "1":
|
||||
base = fields[1]
|
||||
case "2":
|
||||
ours = fields[1]
|
||||
case "3":
|
||||
theirs = fields[1]
|
||||
}
|
||||
}
|
||||
|
||||
return base, ours, theirs, nil
|
||||
}
|
||||
|
||||
// GetCommitSummary returns "<short-sha> <subject>" for a commit inside the
|
||||
// submodule at the given path, for display in the conflict menu.
|
||||
func (self *SubmoduleCommands) GetCommitSummary(path string, sha string) (string, error) {
|
||||
cmdArgs := NewGitCmd("log").
|
||||
Dir(path).
|
||||
Arg("--format=%h %s", "--max-count=1", sha).
|
||||
Config("log.showsignature=false").
|
||||
ToArgv()
|
||||
|
||||
summary, err := self.cmd.New(cmdArgs).DontLog().RunWithOutput()
|
||||
return strings.TrimSpace(summary), err
|
||||
}
|
||||
|
||||
// CheckoutConflictCommit resolves a submodule conflict by checking the submodule
|
||||
// out at the given commit. `git checkout --ours/--theirs` is a no-op on
|
||||
// gitlinks, so we check out the chosen commit in the submodule itself; the
|
||||
// caller then stages the submodule to record the resolution.
|
||||
func (self *SubmoduleCommands) CheckoutConflictCommit(path string, sha string) error {
|
||||
cmdArgs := NewGitCmd("checkout").Dir(path).Arg(sha).ToArgv()
|
||||
return self.cmd.New(cmdArgs).Run()
|
||||
}
|
||||
|
||||
// ConflictSideLog returns a oneline log, run inside the submodule, of the commits
|
||||
// that `side` has but `otherSide` does not (i.e. `otherSide..side`) — the commits
|
||||
// unique to one side of a commit conflict, relative to their common ancestor. It
|
||||
// is empty if `side` is an ancestor of `otherSide` (e.g. that side was rewound).
|
||||
func (self *SubmoduleCommands) ConflictSideLog(path string, side string, otherSide string) (string, error) {
|
||||
cmdArgs := NewGitCmd("log").Dir(path).
|
||||
Arg("--oneline", "--color=always", otherSide+".."+side).
|
||||
ToArgv()
|
||||
|
||||
return self.cmd.New(cmdArgs).DontLog().RunWithOutput()
|
||||
}
|
||||
|
||||
func (self *SubmoduleCommands) Stash(submodule *models.SubmoduleConfig) error {
|
||||
// if the path does not exist then it hasn't yet been initialized so we'll swallow the error
|
||||
// because the intention here is to have no dirty worktree state
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package git_commands
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-errors/errors"
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/oscommands"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestSubmoduleGetConflictCommits(t *testing.T) {
|
||||
type scenario struct {
|
||||
testName string
|
||||
output string
|
||||
expectedBase string
|
||||
expectedOurs string
|
||||
expectedTheirs string
|
||||
}
|
||||
|
||||
scenarios := []scenario{
|
||||
{
|
||||
testName: "all three stages present (both modified)",
|
||||
output: "160000 aaaaaaa 1\tmysub\x00160000 bbbbbbb 2\tmysub\x00160000 ccccccc 3\tmysub\x00",
|
||||
expectedBase: "aaaaaaa",
|
||||
expectedOurs: "bbbbbbb",
|
||||
expectedTheirs: "ccccccc",
|
||||
},
|
||||
{
|
||||
testName: "only our and their stages (added on both sides)",
|
||||
output: "160000 bbbbbbb 2\tmysub\x00160000 ccccccc 3\tmysub\x00",
|
||||
expectedBase: "",
|
||||
expectedOurs: "bbbbbbb",
|
||||
expectedTheirs: "ccccccc",
|
||||
},
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
t.Run(s.testName, func(t *testing.T) {
|
||||
runner := oscommands.NewFakeRunner(t).
|
||||
ExpectGitArgs([]string{"ls-files", "-u", "-z", "--", "mysub"}, s.output, nil)
|
||||
instance := buildSubmoduleCommands(commonDeps{runner: runner})
|
||||
|
||||
base, ours, theirs, err := instance.GetConflictCommits("mysub")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, s.expectedBase, base)
|
||||
assert.Equal(t, s.expectedOurs, ours)
|
||||
assert.Equal(t, s.expectedTheirs, theirs)
|
||||
runner.CheckForMissingCalls()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestSubmoduleGetConflictCommitsError(t *testing.T) {
|
||||
runner := oscommands.NewFakeRunner(t).
|
||||
ExpectGitArgs([]string{"ls-files", "-u", "-z", "--", "mysub"}, "", errors.New("error"))
|
||||
instance := buildSubmoduleCommands(commonDeps{runner: runner})
|
||||
|
||||
_, _, _, err := instance.GetConflictCommits("mysub")
|
||||
assert.Error(t, err)
|
||||
runner.CheckForMissingCalls()
|
||||
}
|
||||
|
||||
func TestSubmoduleGetCommitSummary(t *testing.T) {
|
||||
runner := oscommands.NewFakeRunner(t).
|
||||
ExpectGitArgs([]string{"-c", "log.showsignature=false", "-C", "mysub", "log", "--format=%h %s", "--max-count=1", "bbbbbbb"}, "bbbbbbb the subject\n", nil)
|
||||
instance := buildSubmoduleCommands(commonDeps{runner: runner})
|
||||
|
||||
summary, err := instance.GetCommitSummary("mysub", "bbbbbbb")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "bbbbbbb the subject", summary)
|
||||
runner.CheckForMissingCalls()
|
||||
}
|
||||
|
||||
func TestSubmoduleCheckoutConflictCommit(t *testing.T) {
|
||||
runner := oscommands.NewFakeRunner(t).
|
||||
ExpectGitArgs([]string{"-C", "mysub", "checkout", "bbbbbbb"}, "", nil)
|
||||
instance := buildSubmoduleCommands(commonDeps{runner: runner})
|
||||
|
||||
assert.NoError(t, instance.CheckoutConflictCommit("mysub", "bbbbbbb"))
|
||||
runner.CheckForMissingCalls()
|
||||
}
|
||||
|
||||
func TestSubmoduleConflictSideLog(t *testing.T) {
|
||||
runner := oscommands.NewFakeRunner(t).
|
||||
ExpectGitArgs([]string{"-C", "mysub", "log", "--oneline", "--color=always", "ccccccc..bbbbbbb"}, "bbbbbbb left\n", nil)
|
||||
instance := buildSubmoduleCommands(commonDeps{runner: runner})
|
||||
|
||||
output, err := instance.ConflictSideLog("mysub", "bbbbbbb", "ccccccc")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "bbbbbbb left\n", output)
|
||||
runner.CheckForMissingCalls()
|
||||
}
|
||||
@@ -432,8 +432,14 @@ func (self *WorkingTreeCommands) WorktreeFileDiffCmdObj(node models.IFile, plain
|
||||
|
||||
// ShowFileDiff get the diff of specified from and to. Typically this will be used for a single commit so it'll be 123abc^..123abc
|
||||
// but when we're in diff mode it could be any 'from' to any 'to'. The reverse flag is also here thanks to diff mode.
|
||||
func (self *WorkingTreeCommands) ShowFileDiff(from string, to string, reverse bool, fileName string, plain bool) (string, error) {
|
||||
return self.ShowFileDiffCmdObj(from, to, reverse, []string{fileName}, plain).RunWithOutput()
|
||||
// For a renamed file, previousPath is the path it was renamed from (empty otherwise);
|
||||
// both paths must be passed to git for the rename to be detected.
|
||||
func (self *WorkingTreeCommands) ShowFileDiff(from string, to string, reverse bool, fileName string, previousPath string, plain bool) (string, error) {
|
||||
fileNames := []string{fileName}
|
||||
if previousPath != "" {
|
||||
fileNames = append(fileNames, previousPath)
|
||||
}
|
||||
return self.ShowFileDiffCmdObj(from, to, reverse, fileNames, plain).RunWithOutput()
|
||||
}
|
||||
|
||||
func (self *WorkingTreeCommands) ShowFileDiffCmdObj(from string, to string, reverse bool, fileNames []string, plain bool) *oscommands.CmdObj {
|
||||
@@ -454,7 +460,7 @@ func (self *WorkingTreeCommands) ShowFileDiffCmdObj(from string, to string, reve
|
||||
ArgIfElse(useExtDiff || useExtDiffGitConfig, "--ext-diff", "--no-ext-diff").
|
||||
Arg("--submodule").
|
||||
Arg(fmt.Sprintf("--unified=%d", contextSize)).
|
||||
Arg("--no-renames").
|
||||
Arg(fmt.Sprintf("--find-renames=%d%%", self.UserConfig().Git.RenameSimilarityThreshold)).
|
||||
Arg(fmt.Sprintf("--color=%s", colorArg)).
|
||||
Arg(from).
|
||||
Arg(to).
|
||||
|
||||
@@ -339,6 +339,8 @@ func TestWorkingTreeShowFileDiff(t *testing.T) {
|
||||
from string
|
||||
to string
|
||||
reverse bool
|
||||
fileName string
|
||||
previousPath string
|
||||
plain bool
|
||||
ignoreWhitespace bool
|
||||
contextSize uint64
|
||||
@@ -353,33 +355,49 @@ func TestWorkingTreeShowFileDiff(t *testing.T) {
|
||||
from: "1234567890",
|
||||
to: "0987654321",
|
||||
reverse: false,
|
||||
fileName: "test.txt",
|
||||
plain: false,
|
||||
ignoreWhitespace: false,
|
||||
contextSize: 3,
|
||||
runner: oscommands.NewFakeRunner(t).
|
||||
ExpectGitArgs([]string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "diff", "--no-ext-diff", "--submodule", "--unified=3", "--no-renames", "--color=always", "1234567890", "0987654321", "--", "test.txt"}, expectedResult, nil),
|
||||
ExpectGitArgs([]string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "diff", "--no-ext-diff", "--submodule", "--unified=3", "--find-renames=50%", "--color=always", "1234567890", "0987654321", "--", "test.txt"}, expectedResult, nil),
|
||||
},
|
||||
{
|
||||
testName: "Show diff with custom context size",
|
||||
from: "1234567890",
|
||||
to: "0987654321",
|
||||
reverse: false,
|
||||
fileName: "test.txt",
|
||||
plain: false,
|
||||
ignoreWhitespace: false,
|
||||
contextSize: 123,
|
||||
runner: oscommands.NewFakeRunner(t).
|
||||
ExpectGitArgs([]string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "diff", "--no-ext-diff", "--submodule", "--unified=123", "--no-renames", "--color=always", "1234567890", "0987654321", "--", "test.txt"}, expectedResult, nil),
|
||||
ExpectGitArgs([]string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "diff", "--no-ext-diff", "--submodule", "--unified=123", "--find-renames=50%", "--color=always", "1234567890", "0987654321", "--", "test.txt"}, expectedResult, nil),
|
||||
},
|
||||
{
|
||||
testName: "Default case (ignore whitespace)",
|
||||
from: "1234567890",
|
||||
to: "0987654321",
|
||||
reverse: false,
|
||||
fileName: "test.txt",
|
||||
plain: false,
|
||||
ignoreWhitespace: true,
|
||||
contextSize: 3,
|
||||
runner: oscommands.NewFakeRunner(t).
|
||||
ExpectGitArgs([]string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "diff", "--no-ext-diff", "--submodule", "--unified=3", "--no-renames", "--color=always", "1234567890", "0987654321", "--ignore-all-space", "--", "test.txt"}, expectedResult, nil),
|
||||
ExpectGitArgs([]string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "diff", "--no-ext-diff", "--submodule", "--unified=3", "--find-renames=50%", "--color=always", "1234567890", "0987654321", "--ignore-all-space", "--", "test.txt"}, expectedResult, nil),
|
||||
},
|
||||
{
|
||||
testName: "Renamed file passes both paths so the rename is detected",
|
||||
from: "1234567890",
|
||||
to: "0987654321",
|
||||
reverse: false,
|
||||
fileName: "new.txt",
|
||||
previousPath: "old.txt",
|
||||
plain: false,
|
||||
ignoreWhitespace: false,
|
||||
contextSize: 3,
|
||||
runner: oscommands.NewFakeRunner(t).
|
||||
ExpectGitArgs([]string{"-C", "/path/to/worktree", "-c", "diff.noprefix=false", "diff", "--no-ext-diff", "--submodule", "--unified=3", "--find-renames=50%", "--color=always", "1234567890", "0987654321", "--", "new.txt", "old.txt"}, expectedResult, nil),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -394,7 +412,7 @@ func TestWorkingTreeShowFileDiff(t *testing.T) {
|
||||
|
||||
instance := buildWorkingTreeCommands(commonDeps{runner: s.runner, userConfig: userConfig, appState: &config.AppState{}, repoPaths: &repoPaths})
|
||||
|
||||
result, err := instance.ShowFileDiff(s.from, s.to, s.reverse, "test.txt", s.plain)
|
||||
result, err := instance.ShowFileDiff(s.from, s.to, s.reverse, s.fileName, s.previousPath, s.plain)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expectedResult, result)
|
||||
s.runner.CheckForMissingCalls()
|
||||
|
||||
@@ -160,3 +160,13 @@ func (c *Commit) IsTODO() bool {
|
||||
func IsHeadCommit(commits []*Commit, index int) bool {
|
||||
return !commits[index].IsTODO() && (index == 0 || commits[index-1].IsTODO())
|
||||
}
|
||||
|
||||
func HeadCommitIdx(commits []*Commit) int {
|
||||
for index, commit := range commits {
|
||||
if !commit.IsTODO() {
|
||||
return index
|
||||
}
|
||||
}
|
||||
|
||||
return -1
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ package models
|
||||
type CommitFile struct {
|
||||
Path string
|
||||
|
||||
// For a renamed file, the path it was renamed from; empty otherwise.
|
||||
PreviousPath string
|
||||
|
||||
ChangeStatus string // e.g. 'A' for added or 'M' for modified. This is based on the result from git diff --name-status
|
||||
}
|
||||
|
||||
@@ -23,6 +26,24 @@ func (f *CommitFile) Deleted() bool {
|
||||
return f.ChangeStatus == "D"
|
||||
}
|
||||
|
||||
func (f *CommitFile) IsRename() bool {
|
||||
return f.PreviousPath != ""
|
||||
}
|
||||
|
||||
// Names returns an array containing just the path, or in the case of a rename,
|
||||
// the after path and the before path.
|
||||
func (f *CommitFile) Names() []string {
|
||||
result := []string{f.Path}
|
||||
if f.PreviousPath != "" {
|
||||
result = append(result, f.PreviousPath)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func (f *CommitFile) GetPath() string {
|
||||
return f.Path
|
||||
}
|
||||
|
||||
func (f *CommitFile) GetPreviousPath() string {
|
||||
return f.PreviousPath
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||
"github.com/stefanhaller/git-todo-parser/todo"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestHeadCommitIdx(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
commits []*Commit
|
||||
expected int
|
||||
}{
|
||||
{
|
||||
name: "first commit without rebase todos",
|
||||
commits: makeTestCommits("a", "b"),
|
||||
expected: 0,
|
||||
},
|
||||
{
|
||||
name: "first non-todo commit during an interactive rebase",
|
||||
commits: []*Commit{
|
||||
makeTestTodoCommit(todo.Pick),
|
||||
makeTestTodoCommit(todo.Reword),
|
||||
makeTestCommit("a"),
|
||||
makeTestCommit("b"),
|
||||
},
|
||||
expected: 2,
|
||||
},
|
||||
{
|
||||
name: "no commits",
|
||||
commits: nil,
|
||||
expected: -1,
|
||||
},
|
||||
{
|
||||
name: "only rebase todos",
|
||||
commits: []*Commit{
|
||||
makeTestTodoCommit(todo.Pick),
|
||||
makeTestTodoCommit(todo.Reword),
|
||||
},
|
||||
expected: -1,
|
||||
},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
assert.Equal(t, testCase.expected, HeadCommitIdx(testCase.commits))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsHeadCommit(t *testing.T) {
|
||||
commits := []*Commit{
|
||||
makeTestTodoCommit(todo.Pick),
|
||||
makeTestCommit("a"),
|
||||
makeTestCommit("b"),
|
||||
}
|
||||
|
||||
assert.False(t, IsHeadCommit(commits, 0))
|
||||
assert.True(t, IsHeadCommit(commits, 1))
|
||||
assert.False(t, IsHeadCommit(commits, 2))
|
||||
}
|
||||
|
||||
func makeTestCommits(hashes ...string) []*Commit {
|
||||
commits := make([]*Commit, 0, len(hashes))
|
||||
for _, hash := range hashes {
|
||||
commits = append(commits, makeTestCommit(hash))
|
||||
}
|
||||
|
||||
return commits
|
||||
}
|
||||
|
||||
func makeTestCommit(hash string) *Commit {
|
||||
return NewCommit(&utils.StringPool{}, NewCommitOpts{Hash: hash})
|
||||
}
|
||||
|
||||
func makeTestTodoCommit(action todo.TodoCommand) *Commit {
|
||||
return NewCommit(&utils.StringPool{}, NewCommitOpts{Action: action})
|
||||
}
|
||||
@@ -91,6 +91,19 @@ func (self *CmdObj) AddEnvVars(vars ...string) *CmdObj {
|
||||
return self
|
||||
}
|
||||
|
||||
// RemoveEnvVar removes every occurrence of the named environment variable from
|
||||
// the command's environment. It's the counterpart to AddEnvVars, used to opt a
|
||||
// single command out of a variable that the builder sets on every command by
|
||||
// default.
|
||||
func (self *CmdObj) RemoveEnvVar(name string) *CmdObj {
|
||||
prefix := name + "="
|
||||
self.cmd.Env = lo.Filter(self.cmd.Env, func(envVar string, _ int) bool {
|
||||
return !strings.HasPrefix(envVar, prefix)
|
||||
})
|
||||
|
||||
return self
|
||||
}
|
||||
|
||||
func (self *CmdObj) GetEnvVars() []string {
|
||||
return self.cmd.Env
|
||||
}
|
||||
@@ -144,7 +157,7 @@ func (self *CmdObj) ShouldStreamOutput() bool {
|
||||
}
|
||||
|
||||
// when you call this, then call Run(), we'll use a PTY to run the command. Only
|
||||
// has an effect if StreamOutput() was also called. Ignored on Windows.
|
||||
// has an effect if StreamOutput() was also called.
|
||||
func (self *CmdObj) UsePty() *CmdObj {
|
||||
self.usePty = true
|
||||
|
||||
|
||||
@@ -48,26 +48,34 @@ func (self *CmdObjBuilder) NewShell(commandStr string, shellFunctionsFile string
|
||||
if len(shellFunctionsFile) > 0 {
|
||||
commandStr = fmt.Sprintf("%ssource %s\n%s", self.platform.PrefixForShellFunctionsFile, shellFunctionsFile, commandStr)
|
||||
}
|
||||
quotedCommand := self.quotedCommandString(commandStr)
|
||||
|
||||
if self.platform.OS == "windows" {
|
||||
return self.newWindowsShell(commandStr)
|
||||
}
|
||||
|
||||
quotedCommand := self.Quote(commandStr)
|
||||
cmdArgs := str.ToArgv(fmt.Sprintf("%s %s %s", self.platform.Shell, self.platform.ShellArg, quotedCommand))
|
||||
|
||||
return self.New(cmdArgs)
|
||||
}
|
||||
|
||||
func (self *CmdObjBuilder) quotedCommandString(commandStr string) string {
|
||||
// Windows does not seem to like quotes around the command
|
||||
if self.platform.OS == "windows" {
|
||||
return strings.NewReplacer(
|
||||
"^", "^^",
|
||||
"&", "^&",
|
||||
"|", "^|",
|
||||
"<", "^<",
|
||||
">", "^>",
|
||||
"%", "^%",
|
||||
).Replace(commandStr)
|
||||
}
|
||||
// newWindowsShell wraps the command in `cmd.exe /s /c "<command>"`. The /s
|
||||
// flag tells cmd to strip exactly the outermost pair of quotes and pass the
|
||||
// rest through unchanged, which preserves any quoting the command itself
|
||||
// contains (e.g. `"C:\Program Files\my-editor.exe" file.txt`). Without /s,
|
||||
// cmd's default rules drop the wrong quotes once the command line contains
|
||||
// more than two of them.
|
||||
//
|
||||
// We bypass Go's standard arg quoting via SysProcAttr.CmdLine: it follows the
|
||||
// CommandLineToArgvW convention (`\"` for inner quotes), but cmd.exe doesn't.
|
||||
func (self *CmdObjBuilder) newWindowsShell(commandStr string) *CmdObj {
|
||||
args := []string{self.platform.Shell, "/s", self.platform.ShellArg, commandStr}
|
||||
cmdObj := self.New(args)
|
||||
|
||||
return self.Quote(commandStr)
|
||||
cmdLine := fmt.Sprintf(`%s /s %s "%s"`, self.platform.Shell, self.platform.ShellArg, commandStr)
|
||||
setRawCmdLine(cmdObj.GetCmd(), cmdLine)
|
||||
|
||||
return cmdObj
|
||||
}
|
||||
|
||||
func (self *CmdObjBuilder) CloneWithNewRunner(decorate func(ICmdObjRunner) ICmdObjRunner) *CmdObjBuilder {
|
||||
@@ -80,21 +88,47 @@ func (self *CmdObjBuilder) CloneWithNewRunner(decorate func(ICmdObjRunner) ICmdO
|
||||
}
|
||||
|
||||
func (self *CmdObjBuilder) Quote(message string) string {
|
||||
var quote string
|
||||
if self.platform.OS == "windows" {
|
||||
quote = `\"`
|
||||
message = strings.NewReplacer(
|
||||
`"`, `"'"'"`,
|
||||
`\"`, `\\"`,
|
||||
).Replace(message)
|
||||
} else {
|
||||
quote = `"`
|
||||
message = strings.NewReplacer(
|
||||
`\`, `\\`,
|
||||
`"`, `\"`,
|
||||
`$`, `\$`,
|
||||
"`", "\\`",
|
||||
).Replace(message)
|
||||
return quoteForWindows(message)
|
||||
}
|
||||
return quote + message + quote
|
||||
message = strings.NewReplacer(
|
||||
`\`, `\\`,
|
||||
`"`, `\"`,
|
||||
`$`, `\$`,
|
||||
"`", "\\`",
|
||||
).Replace(message)
|
||||
return `"` + message + `"`
|
||||
}
|
||||
|
||||
// quoteForWindows encodes a value using the standard Windows command-line
|
||||
// convention (the algorithm behind syscall.EscapeArg, reimplemented here so
|
||||
// it's available on all platforms). The result is always wrapped in double
|
||||
// quotes so cmd.exe and CommandLineToArgvW treat it as a single argument
|
||||
// regardless of what shell metacharacters it contains.
|
||||
func quoteForWindows(s string) string {
|
||||
var b strings.Builder
|
||||
b.WriteByte('"')
|
||||
slashes := 0
|
||||
for i := range len(s) {
|
||||
c := s[i]
|
||||
switch c {
|
||||
case '\\':
|
||||
slashes++
|
||||
b.WriteByte(c)
|
||||
case '"':
|
||||
for ; slashes > 0; slashes-- {
|
||||
b.WriteByte('\\')
|
||||
}
|
||||
b.WriteByte('\\')
|
||||
b.WriteByte(c)
|
||||
default:
|
||||
slashes = 0
|
||||
b.WriteByte(c)
|
||||
}
|
||||
}
|
||||
for ; slashes > 0; slashes-- {
|
||||
b.WriteByte('\\')
|
||||
}
|
||||
b.WriteByte('"')
|
||||
return b.String()
|
||||
}
|
||||
|
||||
@@ -105,12 +105,18 @@ func (self *cmdObjRunner) RunWithOutputAux(cmdObj *CmdObj) (string, error) {
|
||||
}
|
||||
|
||||
t := time.Now()
|
||||
output, err := sanitisedCommandOutput(cmdObj.GetCmd().CombinedOutput())
|
||||
cmd := cmdObj.GetCmd()
|
||||
output, err := sanitisedCommandOutput(cmd.CombinedOutput())
|
||||
if err != nil {
|
||||
self.log.WithField("command", cmdObj.ToString()).Error(output)
|
||||
}
|
||||
|
||||
self.log.Infof("%s (%s)", cmdObj.ToString(), time.Since(t))
|
||||
wall := time.Since(t)
|
||||
if ps := cmd.ProcessState; ps != nil {
|
||||
self.log.Infof("%s (wall %s, cpu %s)", cmdObj.ToString(), wall, ps.UserTime()+ps.SystemTime())
|
||||
} else {
|
||||
self.log.Infof("%s (wall %s)", cmdObj.ToString(), wall)
|
||||
}
|
||||
|
||||
return output, err
|
||||
}
|
||||
@@ -213,6 +219,10 @@ type cmdHandler struct {
|
||||
stdoutPipe io.Reader
|
||||
stdinPipe io.Writer
|
||||
close func() error
|
||||
// wait blocks until the child process exits. Needed as a separate
|
||||
// field because the pty path on Windows spawns via CreateProcess and
|
||||
// never runs *exec.Cmd.Start — so cmd.Wait wouldn't work there.
|
||||
wait func() error
|
||||
}
|
||||
|
||||
func (self *cmdObjRunner) runAndStream(cmdObj *CmdObj) error {
|
||||
@@ -268,7 +278,7 @@ func (self *cmdObjRunner) runAndStreamAux(
|
||||
|
||||
onRun(handler, cmdWriter)
|
||||
|
||||
err = cmd.Wait()
|
||||
err = handler.wait()
|
||||
|
||||
self.log.Infof("%s (%s)", cmdObj.ToString(), time.Since(t))
|
||||
|
||||
@@ -370,9 +380,7 @@ func (self *cmdObjRunner) processOutput(
|
||||
responseChan := promptUserForCredential(askFor)
|
||||
if responseChan == nil {
|
||||
// Returning a nil channel means we should terminate the process.
|
||||
// We achieve this by closing the pty that it's running in. Note that this won't
|
||||
// work for the case where we're not running in a pty (i.e. on Windows), but
|
||||
// in that case we'll never be prompted for credentials, so it's not a concern.
|
||||
// We achieve this by closing the pty that it's running in.
|
||||
if err := closeFunc(); err != nil {
|
||||
self.log.Error(err)
|
||||
}
|
||||
@@ -475,5 +483,21 @@ func (self *cmdObjRunner) getCmdHandlerNonPty(cmd *exec.Cmd) (*cmdHandler, error
|
||||
stdoutPipe: stdoutReader,
|
||||
stdinPipe: buf,
|
||||
close: func() error { return nil },
|
||||
wait: cmd.Wait,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (self *cmdObjRunner) getCmdHandlerPty(cmd *exec.Cmd) (*cmdHandler, error) {
|
||||
// Size will be adjusted by the caller if it cares; this just avoids a
|
||||
// zero-size pty.
|
||||
sp, err := StartPty(cmd, 80, 24)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &cmdHandler{
|
||||
stdoutPipe: sp.Pty,
|
||||
stdinPipe: sp.Pty,
|
||||
close: sp.Pty.Close,
|
||||
wait: sp.Wait,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
//go:build !windows
|
||||
|
||||
package oscommands
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
|
||||
"github.com/creack/pty"
|
||||
)
|
||||
|
||||
// we define this separately for windows and non-windows given that windows does
|
||||
// not have great PTY support and we need a PTY to handle a credential request
|
||||
func (self *cmdObjRunner) getCmdHandlerPty(cmd *exec.Cmd) (*cmdHandler, error) {
|
||||
ptmx, err := pty.Start(cmd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &cmdHandler{
|
||||
stdoutPipe: ptmx,
|
||||
stdinPipe: ptmx,
|
||||
close: ptmx.Close,
|
||||
}, nil
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package oscommands
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func (self *cmdObjRunner) getCmdHandlerPty(cmd *exec.Cmd) (*cmdHandler, error) {
|
||||
// We don't have PTY support on Windows yet, so we just return a non-PTY handler.
|
||||
return self.getCmdHandlerNonPty(cmd)
|
||||
}
|
||||
@@ -5,8 +5,29 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/gocui"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestRemoveEnvVar(t *testing.T) {
|
||||
cmd := exec.Command("git", "status")
|
||||
cmd.Env = []string{
|
||||
"PATH=/usr/bin",
|
||||
"GIT_OPTIONAL_LOCKS=0",
|
||||
"GIT_OPTIONAL_LOCKS_OTHER=1", // name is a prefix of ours but not the same var
|
||||
"GIT_OPTIONAL_LOCKS=0", // duplicates must all be removed
|
||||
"HOME=/home/me",
|
||||
}
|
||||
cmdObj := &CmdObj{cmd: cmd}
|
||||
|
||||
cmdObj.RemoveEnvVar("GIT_OPTIONAL_LOCKS")
|
||||
|
||||
assert.Equal(t, []string{
|
||||
"PATH=/usr/bin",
|
||||
"GIT_OPTIONAL_LOCKS_OTHER=1",
|
||||
"HOME=/home/me",
|
||||
}, cmdObj.GetEnvVars())
|
||||
}
|
||||
|
||||
func TestCmdObjToString(t *testing.T) {
|
||||
quote := func(s string) string {
|
||||
return "\"" + s + "\""
|
||||
|
||||
@@ -0,0 +1,389 @@
|
||||
//go:build windows
|
||||
|
||||
package oscommands
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// These tests run only on Windows because they exercise real cmd.exe
|
||||
// quote-parsing behaviour, which has only been a problem on Windows.
|
||||
|
||||
// makeWindowsShellBuilder returns a CmdObjBuilder configured for a real
|
||||
// Windows cmd shell, bypassing the test "dummy" platform (which is darwin).
|
||||
func makeWindowsShellBuilder() *CmdObjBuilder {
|
||||
log := utils.NewDummyLog()
|
||||
return &CmdObjBuilder{
|
||||
runner: &cmdObjRunner{log: log, guiIO: NewNullGuiIO(log)},
|
||||
platform: &Platform{OS: "windows", Shell: "cmd", ShellArg: "/c"},
|
||||
}
|
||||
}
|
||||
|
||||
// fakeEditorSrc is a minimal Go program that records the args it received,
|
||||
// one per line, to marker.txt in its own directory. Using a real .exe (not a
|
||||
// .bat) means args are parsed by Go's runtime via CommandLineToArgvW — the
|
||||
// same algorithm used by ~all real Windows GUI editors. A .bat would parse
|
||||
// args via cmd.exe's own rules, which can hide bugs that affect editors.
|
||||
const fakeEditorSrc = `package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
exe, err := os.Executable()
|
||||
if err != nil {
|
||||
os.Exit(2)
|
||||
}
|
||||
marker := filepath.Join(filepath.Dir(exe), "marker.txt")
|
||||
body := strings.Join(os.Args[1:], "\n")
|
||||
if err := os.WriteFile(marker, []byte(body), 0o644); err != nil {
|
||||
os.Exit(3)
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
var (
|
||||
fakeEditorOnce sync.Once
|
||||
fakeEditorBytes []byte
|
||||
fakeEditorErr error
|
||||
)
|
||||
|
||||
// loadFakeEditorBytes builds the fake editor exactly once per test process
|
||||
// and returns its bytes. Tests then drop a copy at a path containing spaces.
|
||||
func loadFakeEditorBytes(t *testing.T) []byte {
|
||||
t.Helper()
|
||||
fakeEditorOnce.Do(func() {
|
||||
buildDir, err := os.MkdirTemp("", "lazygit-fake-editor-build-*")
|
||||
if err != nil {
|
||||
fakeEditorErr = err
|
||||
return
|
||||
}
|
||||
defer os.RemoveAll(buildDir)
|
||||
|
||||
srcPath := filepath.Join(buildDir, "main.go")
|
||||
binPath := filepath.Join(buildDir, "fake-editor.exe")
|
||||
if err := os.WriteFile(srcPath, []byte(fakeEditorSrc), 0o644); err != nil {
|
||||
fakeEditorErr = err
|
||||
return
|
||||
}
|
||||
cmd := exec.Command("go", "build", "-o", binPath, srcPath)
|
||||
cmd.Stderr = os.Stderr
|
||||
if err := cmd.Run(); err != nil {
|
||||
fakeEditorErr = err
|
||||
return
|
||||
}
|
||||
fakeEditorBytes, fakeEditorErr = os.ReadFile(binPath)
|
||||
})
|
||||
if fakeEditorErr != nil {
|
||||
t.Fatalf("failed to build fake editor helper: %v", fakeEditorErr)
|
||||
}
|
||||
return fakeEditorBytes
|
||||
}
|
||||
|
||||
// placeFakeEditor builds the fake editor and places it at a path containing
|
||||
// a space (mirroring `C:\Program Files\...`). The marker the editor writes
|
||||
// lives next to the exe.
|
||||
func placeFakeEditor(t *testing.T) (exe, markerFile string) {
|
||||
t.Helper()
|
||||
bin := loadFakeEditorBytes(t)
|
||||
exeDir := filepath.Join(t.TempDir(), "Program Files", "FakeEditor")
|
||||
if err := os.MkdirAll(exeDir, 0o755); err != nil {
|
||||
t.Fatalf("mkdir exeDir: %v", err)
|
||||
}
|
||||
exe = filepath.Join(exeDir, "fake-editor.exe")
|
||||
markerFile = filepath.Join(exeDir, "marker.txt")
|
||||
if err := os.WriteFile(exe, bin, 0o755); err != nil {
|
||||
t.Fatalf("write fake editor: %v", err)
|
||||
}
|
||||
return exe, markerFile
|
||||
}
|
||||
|
||||
// placeTargetFile creates a file at <freshTempDir>/<dirName>/<basename> with
|
||||
// a trivial body. Use a dirName containing a space (e.g. "my repo") to put
|
||||
// the file at a path with spaces.
|
||||
func placeTargetFile(t *testing.T, dirName, basename string) string {
|
||||
t.Helper()
|
||||
dir := filepath.Join(t.TempDir(), dirName)
|
||||
if err := os.MkdirAll(dir, 0o755); err != nil {
|
||||
t.Fatalf("mkdir target dir: %v", err)
|
||||
}
|
||||
target := filepath.Join(dir, basename)
|
||||
if err := os.WriteFile(target, []byte("hello"), 0o644); err != nil {
|
||||
t.Fatalf("write target: %v", err)
|
||||
}
|
||||
return target
|
||||
}
|
||||
|
||||
// setupFakeEditor is a convenience wrapper for the common case: editor at a
|
||||
// spacey path AND target file at a spacey path — the conditions that
|
||||
// trigger the cmd.exe quote-stripping bug.
|
||||
func setupFakeEditor(t *testing.T) (fakeExe, targetFile, markerFile string) {
|
||||
t.Helper()
|
||||
fakeExe, markerFile = placeFakeEditor(t)
|
||||
targetFile = placeTargetFile(t, "my repo", "file.txt")
|
||||
return fakeExe, targetFile, markerFile
|
||||
}
|
||||
|
||||
// resolveTemplate mirrors what pkg/commands/git_commands/file.go does: it
|
||||
// substitutes {{filename}} with the Windows-quoted filename and {{line}}
|
||||
// with a line number.
|
||||
func resolveTemplate(builder *CmdObjBuilder, template, filename, line string) string {
|
||||
out := strings.ReplaceAll(template, "{{filename}}", builder.Quote(filename))
|
||||
out = strings.ReplaceAll(out, "{{line}}", line)
|
||||
return out
|
||||
}
|
||||
|
||||
// readMarkerArgs reads the args the fake editor recorded. Each arg is on its
|
||||
// own line (so an arg that itself contains a space stays one element). An
|
||||
// empty file means the editor ran with zero args.
|
||||
func readMarkerArgs(t *testing.T, markerFile string) []string {
|
||||
t.Helper()
|
||||
data, err := os.ReadFile(markerFile)
|
||||
if err != nil {
|
||||
t.Fatalf("marker file was not written; the fake editor never ran: %v", err)
|
||||
}
|
||||
s := strings.TrimRight(string(data), "\r\n")
|
||||
if s == "" {
|
||||
return nil
|
||||
}
|
||||
return strings.Split(s, "\n")
|
||||
}
|
||||
|
||||
func TestNewShell_QuotedExePath_FilenameWithSpaces_EditAtLineAndWait(t *testing.T) {
|
||||
builder := makeWindowsShellBuilder()
|
||||
fakeExe, targetFile, markerFile := setupFakeEditor(t)
|
||||
|
||||
template := `"` + fakeExe + `" -multiInst -nosession -noPlugin -n{{line}} {{filename}}`
|
||||
cmdStr := resolveTemplate(builder, template, targetFile, "42")
|
||||
|
||||
out, err := builder.NewShell(cmdStr, "").GetCmd().CombinedOutput()
|
||||
if err != nil {
|
||||
t.Fatalf("shell command failed: %v\ncmd.exe output:\n%s", err, string(out))
|
||||
}
|
||||
|
||||
assert.Equal(t,
|
||||
[]string{"-multiInst", "-nosession", "-noPlugin", "-n42", targetFile},
|
||||
readMarkerArgs(t, markerFile),
|
||||
)
|
||||
}
|
||||
|
||||
func TestNewShell_QuotedExePath_FilenameWithSpaces_EditAtLine(t *testing.T) {
|
||||
builder := makeWindowsShellBuilder()
|
||||
fakeExe, targetFile, markerFile := setupFakeEditor(t)
|
||||
|
||||
template := `"` + fakeExe + `" -n{{line}} {{filename}}`
|
||||
cmdStr := resolveTemplate(builder, template, targetFile, "42")
|
||||
|
||||
out, err := builder.NewShell(cmdStr, "").GetCmd().CombinedOutput()
|
||||
if err != nil {
|
||||
t.Fatalf("shell command failed: %v\ncmd.exe output:\n%s", err, string(out))
|
||||
}
|
||||
|
||||
assert.Equal(t,
|
||||
[]string{"-n42", targetFile},
|
||||
readMarkerArgs(t, markerFile),
|
||||
)
|
||||
}
|
||||
|
||||
func TestNewShell_QuotedExePath_FilenameWithSpaces_Edit(t *testing.T) {
|
||||
builder := makeWindowsShellBuilder()
|
||||
fakeExe, targetFile, markerFile := setupFakeEditor(t)
|
||||
|
||||
template := `"` + fakeExe + `" {{filename}}`
|
||||
cmdStr := resolveTemplate(builder, template, targetFile, "")
|
||||
|
||||
out, err := builder.NewShell(cmdStr, "").GetCmd().CombinedOutput()
|
||||
if err != nil {
|
||||
t.Fatalf("shell command failed: %v\ncmd.exe output:\n%s", err, string(out))
|
||||
}
|
||||
|
||||
assert.Equal(t,
|
||||
[]string{targetFile},
|
||||
readMarkerArgs(t, markerFile),
|
||||
)
|
||||
}
|
||||
|
||||
// Sanity check: for a filename WITHOUT spaces the same templates already work,
|
||||
// because the resulting cmd.exe line has exactly two quote characters and
|
||||
// cmd /c keeps them. This pins the difference down to filename quoting and
|
||||
// guards against a regression where the no-spaces case starts failing too.
|
||||
func TestNewShell_QuotedExePath_FilenameWithoutSpaces_StillWorks(t *testing.T) {
|
||||
builder := makeWindowsShellBuilder()
|
||||
fakeExe, markerFile := placeFakeEditor(t)
|
||||
plainTarget := placeTargetFile(t, "repo", "plain.txt") // no-space dir
|
||||
|
||||
template := `"` + fakeExe + `" -multiInst -nosession -noPlugin -n{{line}} {{filename}}`
|
||||
cmdStr := resolveTemplate(builder, template, plainTarget, "42")
|
||||
|
||||
out, err := builder.NewShell(cmdStr, "").GetCmd().CombinedOutput()
|
||||
if err != nil {
|
||||
t.Fatalf("shell command failed: %v\ncmd.exe output:\n%s", err, string(out))
|
||||
}
|
||||
|
||||
assert.Equal(t,
|
||||
[]string{"-multiInst", "-nosession", "-noPlugin", "-n42", plainTarget},
|
||||
readMarkerArgs(t, markerFile),
|
||||
)
|
||||
}
|
||||
|
||||
// TestNewShell_VarietyOfEditorTemplates exercises NewShell with a range of
|
||||
// realistic editor templates, all with the trigger conditions of the bug
|
||||
// (quoted exe at a spacey path + filename at a spacey path). Each subtest
|
||||
// asserts the editor receives the exact args lazygit intended.
|
||||
//
|
||||
// Args in `wantArgs` may use the literal "<file>" placeholder; it gets
|
||||
// substituted with the resolved target file path before comparison.
|
||||
func TestNewShell_VarietyOfEditorTemplates(t *testing.T) {
|
||||
const filePlaceholder = "<file>"
|
||||
|
||||
cases := []struct {
|
||||
name string
|
||||
template string // <exe> stands for the fake editor's full path
|
||||
line string
|
||||
wantArgs []string
|
||||
}{
|
||||
{
|
||||
name: "vim/nvim style: +line filename",
|
||||
template: `"<exe>" +{{line}} {{filename}}`,
|
||||
line: "42",
|
||||
wantArgs: []string{"+42", filePlaceholder},
|
||||
},
|
||||
{
|
||||
name: "emacs-like with explicit +N",
|
||||
template: `"<exe>" +{{line}} -nw {{filename}}`,
|
||||
line: "7",
|
||||
wantArgs: []string{"+7", "-nw", filePlaceholder},
|
||||
},
|
||||
{
|
||||
name: "long flag with =value",
|
||||
template: `"<exe>" --line={{line}} --tab-size=4 {{filename}}`,
|
||||
line: "42",
|
||||
wantArgs: []string{"--line=42", "--tab-size=4", filePlaceholder},
|
||||
},
|
||||
{
|
||||
name: "many short and long flags before filename",
|
||||
template: `"<exe>" -a -b -c --foo --bar -n{{line}} {{filename}}`,
|
||||
line: "42",
|
||||
wantArgs: []string{"-a", "-b", "-c", "--foo", "--bar", "-n42", filePlaceholder},
|
||||
},
|
||||
{
|
||||
name: "flag after filename",
|
||||
template: `"<exe>" {{filename}} --readonly`,
|
||||
line: "",
|
||||
wantArgs: []string{filePlaceholder, "--readonly"},
|
||||
},
|
||||
{
|
||||
name: "single short flag attached to value",
|
||||
template: `"<exe>" -n{{line}} {{filename}}`,
|
||||
line: "1",
|
||||
wantArgs: []string{"-n1", filePlaceholder},
|
||||
},
|
||||
{
|
||||
name: "no flags, just filename",
|
||||
template: `"<exe>" {{filename}}`,
|
||||
line: "",
|
||||
wantArgs: []string{filePlaceholder},
|
||||
},
|
||||
{
|
||||
name: "flag with separate value (space-separated)",
|
||||
template: `"<exe>" --goto {{line}} {{filename}}`,
|
||||
line: "42",
|
||||
wantArgs: []string{"--goto", "42", filePlaceholder},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
builder := makeWindowsShellBuilder()
|
||||
fakeExe, targetFile, markerFile := setupFakeEditor(t)
|
||||
|
||||
template := strings.ReplaceAll(tc.template, "<exe>", fakeExe)
|
||||
cmdStr := resolveTemplate(builder, template, targetFile, tc.line)
|
||||
|
||||
out, err := builder.NewShell(cmdStr, "").GetCmd().CombinedOutput()
|
||||
if err != nil {
|
||||
t.Fatalf("shell command failed: %v\ncmd.exe output:\n%s", err, string(out))
|
||||
}
|
||||
|
||||
want := make([]string, len(tc.wantArgs))
|
||||
for i, a := range tc.wantArgs {
|
||||
want[i] = strings.ReplaceAll(a, filePlaceholder, targetFile)
|
||||
}
|
||||
assert.Equal(t, want, readMarkerArgs(t, markerFile))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestNewShell_FilenameSpecialCharacters varies the basename of the target
|
||||
// file across characters that are legal in Windows filenames but might
|
||||
// interact badly with cmd.exe / Quote(): parentheses, brackets, single
|
||||
// quote, comma, semicolon, equals, etc. The exe is at a spacey path and
|
||||
// the target dir has spaces, so the bug-trigger conditions are still met.
|
||||
func TestNewShell_FilenameSpecialCharacters(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
basename string
|
||||
}{
|
||||
{"parens", "file (1).txt"},
|
||||
{"brackets", "file[v2].txt"},
|
||||
{"single quote", "it's a file.txt"},
|
||||
{"comma", "a,b,c.txt"},
|
||||
{"semicolon", "a;b.txt"},
|
||||
{"equals", "key=value.txt"},
|
||||
{"plus", "a+b.txt"},
|
||||
{"hash", "issue#42.txt"},
|
||||
{"at sign", "user@host.txt"},
|
||||
{"tilde", "~backup.txt"},
|
||||
{"dot leading", ".gitignore.txt"},
|
||||
{"multiple dots", "v1.2.3.txt"},
|
||||
{"dash leading", "-flag-looking.txt"},
|
||||
}
|
||||
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
builder := makeWindowsShellBuilder()
|
||||
fakeExe, markerFile := placeFakeEditor(t)
|
||||
targetFile := placeTargetFile(t, "my repo", tc.basename)
|
||||
|
||||
template := `"` + fakeExe + `" -n{{line}} {{filename}}`
|
||||
cmdStr := resolveTemplate(builder, template, targetFile, "42")
|
||||
|
||||
out, err := builder.NewShell(cmdStr, "").GetCmd().CombinedOutput()
|
||||
if err != nil {
|
||||
t.Fatalf("shell command failed: %v\ncmd.exe output:\n%s", err, string(out))
|
||||
}
|
||||
|
||||
assert.Equal(t,
|
||||
[]string{"-n42", targetFile},
|
||||
readMarkerArgs(t, markerFile),
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Command chaining with && must work: cmd /s /c runs the assembled line verbatim,
|
||||
// so cmd treats && as a separator and runs both commands. The two echoes
|
||||
// therefore produce two separate output lines.
|
||||
func TestNewShell_CommandChaining(t *testing.T) {
|
||||
builder := makeWindowsShellBuilder()
|
||||
|
||||
out, err := builder.NewShell("echo first&&echo second", "").GetCmd().CombinedOutput()
|
||||
if err != nil {
|
||||
t.Fatalf("shell command failed: %v\ncmd.exe output:\n%s", err, string(out))
|
||||
}
|
||||
|
||||
normalized := strings.ReplaceAll(string(out), "\r\n", "\n")
|
||||
lines := strings.Split(strings.TrimSpace(normalized), "\n")
|
||||
assert.Equal(t, []string{"first", "second"}, lines)
|
||||
}
|
||||
@@ -40,10 +40,15 @@ func (c *OSCommand) UpdateWindowTitle() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func TerminateProcessGracefully(cmd *exec.Cmd) error {
|
||||
if cmd.Process == nil {
|
||||
// setRawCmdLine is the non-Windows no-op counterpart of the Windows shim
|
||||
// (see the comment there). NewShell's shell-building logic is portable, so
|
||||
// this call is reached on every host; only the Windows build does anything.
|
||||
func setRawCmdLine(cmd *exec.Cmd, cmdLine string) {}
|
||||
|
||||
func TerminateProcessGracefully(proc *os.Process) error {
|
||||
if proc == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return cmd.Process.Signal(syscall.SIGTERM)
|
||||
return proc.Signal(syscall.SIGTERM)
|
||||
}
|
||||
|
||||
@@ -75,11 +75,26 @@ func TestOSCommandQuoteWindows(t *testing.T) {
|
||||
|
||||
actual := osCommand.Quote(`hello "test" 'test2'`)
|
||||
|
||||
expected := `\"hello "'"'"test"'"'" 'test2'\"`
|
||||
expected := `"hello \"test\" 'test2'"`
|
||||
|
||||
assert.EqualValues(t, expected, actual)
|
||||
}
|
||||
|
||||
// On Windows, NewShell must hand the command to cmd.exe verbatim.
|
||||
func TestNewShellWindowsPassesMetacharactersVerbatim(t *testing.T) {
|
||||
osCommand := NewDummyOSCommand()
|
||||
platform := &Platform{OS: "windows", Shell: "cmd", ShellArg: "/c"}
|
||||
osCommand.Platform = platform
|
||||
osCommand.Cmd.platform = platform
|
||||
|
||||
command := `echo a && echo b | sort > out.txt < in.txt %PATH%`
|
||||
|
||||
assert.Equal(t,
|
||||
[]string{"cmd", "/s", "/c", command},
|
||||
osCommand.Cmd.NewShell(command, "").Args(),
|
||||
)
|
||||
}
|
||||
|
||||
func TestOSCommandFileType(t *testing.T) {
|
||||
type scenario struct {
|
||||
path string
|
||||
|
||||
@@ -5,8 +5,25 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// setRawCmdLine hands cmd.exe the exact command line we built, bypassing
|
||||
// os/exec's default composition (which quotes args with the
|
||||
// CommandLineToArgvW `\"` convention that cmd.exe doesn't understand).
|
||||
//
|
||||
// The shell-building logic in NewShell is portable and dispatches on
|
||||
// platform.OS, which keeps it (and its quoting) unit-testable on any host.
|
||||
// Assigning SysProcAttr.CmdLine is the only step that needs a Windows-only
|
||||
// field, so it's the single piece split out behind a build tag; every other
|
||||
// platform gets the no-op in os_default_platform.go.
|
||||
func setRawCmdLine(cmd *exec.Cmd, cmdLine string) {
|
||||
if cmd.SysProcAttr == nil {
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{}
|
||||
}
|
||||
cmd.SysProcAttr.CmdLine = cmdLine
|
||||
}
|
||||
|
||||
func GetPlatform() *Platform {
|
||||
return &Platform{
|
||||
OS: "windows",
|
||||
@@ -24,7 +41,7 @@ func (c *OSCommand) UpdateWindowTitle() error {
|
||||
return c.Cmd.NewShell(argString, c.UserConfig().OS.ShellFunctionsFile).Run()
|
||||
}
|
||||
|
||||
func TerminateProcessGracefully(cmd *exec.Cmd) error {
|
||||
func TerminateProcessGracefully(proc *os.Process) error {
|
||||
// Signals other than SIGKILL are not supported on Windows
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ func TestOSCommandOpenFileWindows(t *testing.T) {
|
||||
{
|
||||
filename: "test",
|
||||
runner: NewFakeRunner(t).
|
||||
ExpectArgs([]string{"cmd", "/c", "start", "", "test"}, "", errors.New("error")),
|
||||
ExpectArgs([]string{"cmd", "/s", "/c", `start "" "test"`}, "", errors.New("error")),
|
||||
test: func(err error) {
|
||||
assert.Error(t, err)
|
||||
},
|
||||
@@ -28,7 +28,7 @@ func TestOSCommandOpenFileWindows(t *testing.T) {
|
||||
{
|
||||
filename: "test",
|
||||
runner: NewFakeRunner(t).
|
||||
ExpectArgs([]string{"cmd", "/c", "start", "", "test"}, "", nil),
|
||||
ExpectArgs([]string{"cmd", "/s", "/c", `start "" "test"`}, "", nil),
|
||||
test: func(err error) {
|
||||
assert.NoError(t, err)
|
||||
},
|
||||
@@ -36,7 +36,7 @@ func TestOSCommandOpenFileWindows(t *testing.T) {
|
||||
{
|
||||
filename: "filename with spaces",
|
||||
runner: NewFakeRunner(t).
|
||||
ExpectArgs([]string{"cmd", "/c", "start", "", "filename with spaces"}, "", nil),
|
||||
ExpectArgs([]string{"cmd", "/s", "/c", `start "" "filename with spaces"`}, "", nil),
|
||||
test: func(err error) {
|
||||
assert.NoError(t, err)
|
||||
},
|
||||
@@ -44,7 +44,7 @@ func TestOSCommandOpenFileWindows(t *testing.T) {
|
||||
{
|
||||
filename: "let's_test_with_single_quote",
|
||||
runner: NewFakeRunner(t).
|
||||
ExpectArgs([]string{"cmd", "/c", "start", "", "let's_test_with_single_quote"}, "", nil),
|
||||
ExpectArgs([]string{"cmd", "/s", "/c", `start "" "let's_test_with_single_quote"`}, "", nil),
|
||||
test: func(err error) {
|
||||
assert.NoError(t, err)
|
||||
},
|
||||
@@ -52,7 +52,7 @@ func TestOSCommandOpenFileWindows(t *testing.T) {
|
||||
{
|
||||
filename: "$USER.txt",
|
||||
runner: NewFakeRunner(t).
|
||||
ExpectArgs([]string{"cmd", "/c", "start", "", "$USER.txt"}, "", nil),
|
||||
ExpectArgs([]string{"cmd", "/s", "/c", `start "" "$USER.txt"`}, "", nil),
|
||||
test: func(err error) {
|
||||
assert.NoError(t, err)
|
||||
},
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package oscommands
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Pty is the master side of a pseudo-terminal running a subprocess. The
|
||||
// concrete implementation is platform-specific: creack/pty on Unix and
|
||||
// ConPTY on Windows.
|
||||
type Pty interface {
|
||||
io.ReadWriteCloser
|
||||
Resize(cols, rows uint16) error
|
||||
}
|
||||
|
||||
// StartedPty is the result of StartPty.
|
||||
type StartedPty struct {
|
||||
// Pty is the master side of the pseudo-terminal; read from it to get
|
||||
// the child's combined stdout/stderr and write to it to feed stdin.
|
||||
Pty Pty
|
||||
// Process is the spawned child. Useful for signalling; on Windows the
|
||||
// original *exec.Cmd was not Start()ed (ConPTY spawns via
|
||||
// CreateProcess, not os/exec) so cmd.Process is nil and this is the
|
||||
// only handle.
|
||||
Process *os.Process
|
||||
// Wait blocks until the child exits and returns a non-nil error on a
|
||||
// nonzero exit status, matching *exec.Cmd.Wait semantics.
|
||||
Wait func() error
|
||||
}
|
||||
|
||||
// StartPty runs cmd in a pseudo-terminal with the given initial dimensions.
|
||||
// Implemented per-platform in pty_unix.go / pty_windows.go.
|
||||
//
|
||||
// func StartPty(cmd *exec.Cmd, cols, rows uint16) (StartedPty, error)
|
||||
@@ -0,0 +1,34 @@
|
||||
//go:build !windows
|
||||
|
||||
package oscommands
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
creackpty "github.com/creack/pty"
|
||||
)
|
||||
|
||||
type unixPty struct {
|
||||
master *os.File
|
||||
}
|
||||
|
||||
func (u *unixPty) Read(p []byte) (int, error) { return u.master.Read(p) }
|
||||
func (u *unixPty) Write(p []byte) (int, error) { return u.master.Write(p) }
|
||||
func (u *unixPty) Close() error { return u.master.Close() }
|
||||
|
||||
func (u *unixPty) Resize(cols, rows uint16) error {
|
||||
return creackpty.Setsize(u.master, &creackpty.Winsize{Cols: cols, Rows: rows})
|
||||
}
|
||||
|
||||
func StartPty(cmd *exec.Cmd, cols, rows uint16) (StartedPty, error) {
|
||||
f, err := creackpty.StartWithSize(cmd, &creackpty.Winsize{Cols: cols, Rows: rows})
|
||||
if err != nil {
|
||||
return StartedPty{}, err
|
||||
}
|
||||
return StartedPty{
|
||||
Pty: &unixPty{master: f},
|
||||
Process: cmd.Process,
|
||||
Wait: cmd.Wait,
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
package oscommands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"sync"
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/sys/windows"
|
||||
)
|
||||
|
||||
type winPty struct {
|
||||
hpc windows.Handle
|
||||
inWrite *os.File
|
||||
outRead *os.File
|
||||
|
||||
// mu guards the teardown state below and serializes it against Resize.
|
||||
// hpcClosed gates ClosePseudoConsole (it must run exactly once) and also
|
||||
// keeps Resize from touching the HPCON once it's been freed: the
|
||||
// background waiter in StartPty closes the pseudoconsole on child exit,
|
||||
// which would otherwise race a concurrent onResize and hand
|
||||
// ResizePseudoConsole a freed handle.
|
||||
mu sync.Mutex
|
||||
hpcClosed bool
|
||||
closed bool
|
||||
}
|
||||
|
||||
func (p *winPty) Read(buf []byte) (int, error) { return p.outRead.Read(buf) }
|
||||
func (p *winPty) Write(buf []byte) (int, error) { return p.inWrite.Write(buf) }
|
||||
|
||||
func (p *winPty) Resize(cols, rows uint16) error {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
if p.hpcClosed {
|
||||
// The child already exited and the pseudoconsole was torn down, so
|
||||
// there is nothing left to resize.
|
||||
return nil
|
||||
}
|
||||
return windows.ResizePseudoConsole(p.hpc, windows.Coord{X: int16(cols), Y: int16(rows)})
|
||||
}
|
||||
|
||||
// closeHpc closes the pseudoconsole exactly once. Safe to call from multiple
|
||||
// goroutines and at any time. We need this separately from Close because the
|
||||
// background waiter in StartPty closes the pseudoconsole as soon as the child
|
||||
// exits — that's what makes outRead return EOF, matching the Unix behavior
|
||||
// where the master fd EOFs when the slave closes — while the pipe fds stay
|
||||
// open until somebody explicitly tears the pty down.
|
||||
func (p *winPty) closeHpc() {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
p.closeHpcLocked()
|
||||
}
|
||||
|
||||
// closeHpcLocked closes the pseudoconsole; the caller must hold p.mu.
|
||||
func (p *winPty) closeHpcLocked() {
|
||||
if p.hpcClosed {
|
||||
return
|
||||
}
|
||||
p.hpcClosed = true
|
||||
windows.ClosePseudoConsole(p.hpc)
|
||||
}
|
||||
|
||||
func (p *winPty) Close() error {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
if p.closed {
|
||||
return nil
|
||||
}
|
||||
p.closed = true
|
||||
// Closing the pseudoconsole breaks the pipes; the child's next write
|
||||
// fails and it exits. Then we close our ends of the pipes.
|
||||
p.closeHpcLocked()
|
||||
p.inWrite.Close()
|
||||
p.outRead.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
// startWaiter runs proc.Wait in a goroutine and, as soon as the child exits,
|
||||
// closes the pseudoconsole so that any pending Read on outRead returns EOF
|
||||
// after buffered output drains. Returns a Wait func that blocks until the
|
||||
// child has exited and reports its exit status with *exec.Cmd.Wait semantics.
|
||||
//
|
||||
// This shape exists because on Unix the master fd EOFs naturally when the
|
||||
// slave closes on child exit, but ConPTY keeps the pipe alive until we call
|
||||
// ClosePseudoConsole explicitly. Without doing that on child exit, the
|
||||
// scanner in pkg/tasks.NewCmdTask would block forever on the next read and
|
||||
// the post-content view never gets cleared (FlushStaleCells never fires).
|
||||
func startWaiter(proc *os.Process, p *winPty) func() error {
|
||||
done := make(chan struct{})
|
||||
var waitErr error
|
||||
go func() {
|
||||
defer close(done)
|
||||
state, err := proc.Wait()
|
||||
p.closeHpc()
|
||||
if err != nil {
|
||||
waitErr = err
|
||||
return
|
||||
}
|
||||
if !state.Success() {
|
||||
waitErr = fmt.Errorf("exit status %d", state.ExitCode())
|
||||
}
|
||||
}()
|
||||
return func() error {
|
||||
<-done
|
||||
return waitErr
|
||||
}
|
||||
}
|
||||
|
||||
func StartPty(cmd *exec.Cmd, cols, rows uint16) (sp StartedPty, err error) {
|
||||
// Two pipes: one for the child's stdin (we never write to it, but ConPTY
|
||||
// needs a handle), one for the child's stdout/stderr multiplexed through
|
||||
// the pseudoconsole.
|
||||
var inRead, inWrite, outRead, outWrite windows.Handle
|
||||
if err = windows.CreatePipe(&inRead, &inWrite, nil, 0); err != nil {
|
||||
return StartedPty{}, fmt.Errorf("CreatePipe (in): %w", err)
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
_ = windows.CloseHandle(inWrite)
|
||||
}
|
||||
}()
|
||||
if err = windows.CreatePipe(&outRead, &outWrite, nil, 0); err != nil {
|
||||
_ = windows.CloseHandle(inRead)
|
||||
return StartedPty{}, fmt.Errorf("CreatePipe (out): %w", err)
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
_ = windows.CloseHandle(outRead)
|
||||
}
|
||||
}()
|
||||
|
||||
// CreatePseudoConsole dupes the handles it needs internally; we release
|
||||
// our references to the child-side ends immediately after.
|
||||
var hpc windows.Handle
|
||||
size := windows.Coord{X: int16(cols), Y: int16(rows)}
|
||||
if err = windows.CreatePseudoConsole(size, inRead, outWrite, 0, &hpc); err != nil {
|
||||
_ = windows.CloseHandle(inRead)
|
||||
_ = windows.CloseHandle(outWrite)
|
||||
return StartedPty{}, fmt.Errorf("CreatePseudoConsole: %w", err)
|
||||
}
|
||||
_ = windows.CloseHandle(inRead)
|
||||
_ = windows.CloseHandle(outWrite)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
windows.ClosePseudoConsole(hpc)
|
||||
}
|
||||
}()
|
||||
|
||||
// Attach the pseudoconsole to the child via a process attribute list.
|
||||
attrList, err := windows.NewProcThreadAttributeList(1)
|
||||
if err != nil {
|
||||
return StartedPty{}, fmt.Errorf("NewProcThreadAttributeList: %w", err)
|
||||
}
|
||||
defer attrList.Delete()
|
||||
// PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE wants the HPCON value itself as
|
||||
// the attribute value, not a pointer to it — an HPCON is already a
|
||||
// pointer-sized handle, per Microsoft's ConPTY sample. Spelling that as
|
||||
// unsafe.Pointer(hpc) trips go vet's unsafeptr check (a uintptr-based
|
||||
// type converted straight to unsafe.Pointer), which gopls surfaces in
|
||||
// the editor. Reinterpret the handle's bits through its address instead:
|
||||
// &hpc is a real pointer, so none of these conversions is the flagged
|
||||
// uintptr→unsafe.Pointer cast, while the resulting value is identical.
|
||||
if err = attrList.Update(
|
||||
windows.PROC_THREAD_ATTRIBUTE_PSEUDOCONSOLE,
|
||||
*(*unsafe.Pointer)(unsafe.Pointer(&hpc)),
|
||||
unsafe.Sizeof(hpc),
|
||||
); err != nil {
|
||||
return StartedPty{}, fmt.Errorf("UpdateProcThreadAttribute: %w", err)
|
||||
}
|
||||
|
||||
var si windows.StartupInfoEx
|
||||
si.Cb = uint32(unsafe.Sizeof(si))
|
||||
si.ProcThreadAttributeList = attrList.List()
|
||||
|
||||
var appNamePtr *uint16
|
||||
if cmd.Path != "" {
|
||||
if appNamePtr, err = windows.UTF16PtrFromString(cmd.Path); err != nil {
|
||||
return StartedPty{}, err
|
||||
}
|
||||
}
|
||||
cmdLinePtr, err := windows.UTF16PtrFromString(windows.ComposeCommandLine(cmd.Args))
|
||||
if err != nil {
|
||||
return StartedPty{}, err
|
||||
}
|
||||
var dirPtr *uint16
|
||||
if cmd.Dir != "" {
|
||||
if dirPtr, err = windows.UTF16PtrFromString(cmd.Dir); err != nil {
|
||||
return StartedPty{}, err
|
||||
}
|
||||
}
|
||||
envBlock, err := createEnvBlock(cmd.Env)
|
||||
if err != nil {
|
||||
return StartedPty{}, err
|
||||
}
|
||||
var envPtr *uint16
|
||||
if envBlock != nil {
|
||||
envPtr = &envBlock[0]
|
||||
}
|
||||
|
||||
var pi windows.ProcessInformation
|
||||
err = windows.CreateProcess(
|
||||
appNamePtr,
|
||||
cmdLinePtr,
|
||||
nil, // process security
|
||||
nil, // thread security
|
||||
false,
|
||||
windows.EXTENDED_STARTUPINFO_PRESENT|windows.CREATE_UNICODE_ENVIRONMENT,
|
||||
envPtr,
|
||||
dirPtr,
|
||||
&si.StartupInfo,
|
||||
&pi,
|
||||
)
|
||||
if err != nil {
|
||||
return StartedPty{}, fmt.Errorf("CreateProcess: %w", err)
|
||||
}
|
||||
_ = windows.CloseHandle(pi.Thread)
|
||||
|
||||
// Re-open the process by PID to get an *os.Process to wait on. Do this
|
||||
// while pi.Process is still open: Windows won't recycle a PID while any
|
||||
// handle to the process remains, so FindProcess can't latch onto a
|
||||
// different process that has since reused the PID. Release the original
|
||||
// handle once we have our own.
|
||||
proc, err := os.FindProcess(int(pi.ProcessId))
|
||||
_ = windows.CloseHandle(pi.Process)
|
||||
if err != nil {
|
||||
return StartedPty{}, err
|
||||
}
|
||||
|
||||
wp := &winPty{
|
||||
hpc: hpc,
|
||||
inWrite: os.NewFile(uintptr(inWrite), "conpty-in"),
|
||||
outRead: os.NewFile(uintptr(outRead), "conpty-out"),
|
||||
}
|
||||
return StartedPty{
|
||||
Pty: wp,
|
||||
Process: proc,
|
||||
Wait: startWaiter(proc, wp),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// createEnvBlock packs env vars into the UTF-16 double-null-terminated block
|
||||
// that CreateProcess expects. Returns nil if env is empty, which tells
|
||||
// CreateProcess to inherit the parent's environment.
|
||||
func createEnvBlock(env []string) ([]uint16, error) {
|
||||
if len(env) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
var block []uint16
|
||||
for _, s := range env {
|
||||
utf16s, err := windows.UTF16FromString(s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
block = append(block, utf16s...)
|
||||
}
|
||||
block = append(block, 0)
|
||||
return block, nil
|
||||
}
|
||||
@@ -25,10 +25,14 @@ type fileInfo struct {
|
||||
mode PatchStatus
|
||||
includedLineIndices []int
|
||||
diff string
|
||||
// For a renamed file, the path it was renamed from; empty otherwise. We
|
||||
// need to keep hold of it so we can re-render the file's patch (which is
|
||||
// keyed by the new path) without the caller having to supply it again.
|
||||
previousPath string
|
||||
}
|
||||
|
||||
type (
|
||||
loadFileDiffFunc func(from string, to string, reverse bool, filename string, plain bool) (string, error)
|
||||
loadFileDiffFunc func(from string, to string, reverse bool, filename string, previousPath string, plain bool) (string, error)
|
||||
)
|
||||
|
||||
// PatchBuilder manages the building of a patch for a commit to be applied to another commit (or the working tree, or removed from the current commit). We also support building patches from things like stashes, for which there is less flexibility
|
||||
@@ -75,6 +79,7 @@ func (p *PatchBuilder) PatchToApply(reverse bool, turnAddedFilesIntoDiffAgainstE
|
||||
|
||||
patch.WriteString(p.RenderPatchForFile(RenderPatchForFileOpts{
|
||||
Filename: filename,
|
||||
PreviousPath: info.previousPath,
|
||||
Plain: true,
|
||||
Reverse: reverse,
|
||||
TurnAddedFilesIntoDiffAgainstEmptyFile: turnAddedFilesIntoDiffAgainstEmptyFile,
|
||||
@@ -102,8 +107,8 @@ func (p *PatchBuilder) removeFile(info *fileInfo) {
|
||||
info.includedLineIndices = nil
|
||||
}
|
||||
|
||||
func (p *PatchBuilder) AddFileWhole(filename string) error {
|
||||
info, err := p.getFileInfo(filename)
|
||||
func (p *PatchBuilder) AddFileWhole(filename string, previousPath string) error {
|
||||
info, err := p.getFileInfo(filename, previousPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -113,8 +118,8 @@ func (p *PatchBuilder) AddFileWhole(filename string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *PatchBuilder) RemoveFile(filename string) error {
|
||||
info, err := p.getFileInfo(filename)
|
||||
func (p *PatchBuilder) RemoveFile(filename string, previousPath string) error {
|
||||
info, err := p.getFileInfo(filename, previousPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -124,19 +129,20 @@ func (p *PatchBuilder) RemoveFile(filename string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *PatchBuilder) getFileInfo(filename string) (*fileInfo, error) {
|
||||
func (p *PatchBuilder) getFileInfo(filename string, previousPath string) (*fileInfo, error) {
|
||||
info, ok := p.fileInfoMap[filename]
|
||||
if ok {
|
||||
return info, nil
|
||||
}
|
||||
|
||||
diff, err := p.loadFileDiff(p.From, p.To, p.reverse, filename, true)
|
||||
diff, err := p.loadFileDiff(p.From, p.To, p.reverse, filename, previousPath, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
info = &fileInfo{
|
||||
mode: UNSELECTED,
|
||||
diff: diff,
|
||||
mode: UNSELECTED,
|
||||
diff: diff,
|
||||
previousPath: previousPath,
|
||||
}
|
||||
|
||||
p.fileInfoMap[filename] = info
|
||||
@@ -144,8 +150,8 @@ func (p *PatchBuilder) getFileInfo(filename string) (*fileInfo, error) {
|
||||
return info, nil
|
||||
}
|
||||
|
||||
func (p *PatchBuilder) AddFileLineRange(filename string, lineIndices []int) error {
|
||||
info, err := p.getFileInfo(filename)
|
||||
func (p *PatchBuilder) AddFileLineRange(filename string, previousPath string, lineIndices []int) error {
|
||||
info, err := p.getFileInfo(filename, previousPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -155,8 +161,8 @@ func (p *PatchBuilder) AddFileLineRange(filename string, lineIndices []int) erro
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *PatchBuilder) RemoveFileLineRange(filename string, lineIndices []int) error {
|
||||
info, err := p.getFileInfo(filename)
|
||||
func (p *PatchBuilder) RemoveFileLineRange(filename string, previousPath string, lineIndices []int) error {
|
||||
info, err := p.getFileInfo(filename, previousPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -171,13 +177,14 @@ func (p *PatchBuilder) RemoveFileLineRange(filename string, lineIndices []int) e
|
||||
|
||||
type RenderPatchForFileOpts struct {
|
||||
Filename string
|
||||
PreviousPath string
|
||||
Plain bool
|
||||
Reverse bool
|
||||
TurnAddedFilesIntoDiffAgainstEmptyFile bool
|
||||
}
|
||||
|
||||
func (p *PatchBuilder) RenderPatchForFile(opts RenderPatchForFileOpts) string {
|
||||
info, err := p.getFileInfo(opts.Filename)
|
||||
info, err := p.getFileInfo(opts.Filename, opts.PreviousPath)
|
||||
if err != nil {
|
||||
p.Log.Error(err)
|
||||
return ""
|
||||
@@ -198,7 +205,12 @@ func (p *PatchBuilder) RenderPatchForFile(opts RenderPatchForFileOpts) string {
|
||||
Transform(TransformOpts{
|
||||
Reverse: opts.Reverse,
|
||||
TurnAddedFilesIntoDiffAgainstEmptyFile: opts.TurnAddedFilesIntoDiffAgainstEmptyFile,
|
||||
IncludedLineIndices: info.includedLineIndices,
|
||||
// For a partial selection of a renamed file we keep only the
|
||||
// content change and drop the rename, so that the rename stays in
|
||||
// the commit. A whole-file selection keeps the rename (and short-
|
||||
// circuits before this for plain output).
|
||||
StripRename: info.mode == PART && info.previousPath != "",
|
||||
IncludedLineIndices: info.includedLineIndices,
|
||||
})
|
||||
|
||||
if opts.Plain {
|
||||
@@ -215,6 +227,7 @@ func (p *PatchBuilder) renderEachFilePatch(plain bool) []string {
|
||||
patches := lo.Map(filenames, func(filename string, _ int) string {
|
||||
return p.RenderPatchForFile(RenderPatchForFileOpts{
|
||||
Filename: filename,
|
||||
PreviousPath: p.fileInfoMap[filename].previousPath,
|
||||
Plain: plain,
|
||||
Reverse: false,
|
||||
TurnAddedFilesIntoDiffAgainstEmptyFile: true,
|
||||
@@ -244,8 +257,8 @@ func (p *PatchBuilder) GetFileStatus(filename string, parent string) PatchStatus
|
||||
return info.mode
|
||||
}
|
||||
|
||||
func (p *PatchBuilder) GetFileIncLineIndices(filename string) ([]int, error) {
|
||||
info, err := p.getFileInfo(filename)
|
||||
func (p *PatchBuilder) GetFileIncLineIndices(filename string, previousPath string) ([]int, error) {
|
||||
info, err := p.getFileInfo(filename, previousPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -19,6 +19,22 @@ index dcd3485..1ba5540 100644
|
||||
...
|
||||
`
|
||||
|
||||
const renameWithModificationDiff = `diff --git a/oldname b/newname
|
||||
similarity index 62%
|
||||
rename from oldname
|
||||
rename to newname
|
||||
index dcd3485..1ba5540 100644
|
||||
--- a/oldname
|
||||
+++ b/newname
|
||||
@@ -1,5 +1,5 @@
|
||||
apple
|
||||
-orange
|
||||
+grape
|
||||
...
|
||||
...
|
||||
...
|
||||
`
|
||||
|
||||
const addNewlineToEndOfFile = `diff --git a/filename b/filename
|
||||
index 80a73f1..e48a11c 100644
|
||||
--- a/filename
|
||||
@@ -152,6 +168,7 @@ func TestTransform(t *testing.T) {
|
||||
firstLineIndex int
|
||||
lastLineIndex int
|
||||
reverse bool
|
||||
stripRename bool
|
||||
expected string
|
||||
}
|
||||
|
||||
@@ -515,6 +532,43 @@ func TestTransform(t *testing.T) {
|
||||
orange
|
||||
banana
|
||||
lemon
|
||||
`,
|
||||
},
|
||||
{
|
||||
testName: "renamed file, whole change selected, strips the rename so only the content change is applied",
|
||||
firstLineIndex: 9,
|
||||
lastLineIndex: 10,
|
||||
stripRename: true,
|
||||
diffText: renameWithModificationDiff,
|
||||
expected: `diff --git a/newname b/newname
|
||||
index dcd3485..1ba5540 100644
|
||||
--- a/newname
|
||||
+++ b/newname
|
||||
@@ -1,5 +1,5 @@
|
||||
apple
|
||||
-orange
|
||||
+grape
|
||||
...
|
||||
...
|
||||
...
|
||||
`,
|
||||
},
|
||||
{
|
||||
testName: "renamed file, only removal selected, strips the rename",
|
||||
firstLineIndex: 9,
|
||||
lastLineIndex: 9,
|
||||
stripRename: true,
|
||||
diffText: renameWithModificationDiff,
|
||||
expected: `diff --git a/newname b/newname
|
||||
index dcd3485..1ba5540 100644
|
||||
--- a/newname
|
||||
+++ b/newname
|
||||
@@ -1,5 +1,4 @@
|
||||
apple
|
||||
-orange
|
||||
...
|
||||
...
|
||||
...
|
||||
`,
|
||||
},
|
||||
}
|
||||
@@ -527,6 +581,7 @@ func TestTransform(t *testing.T) {
|
||||
Transform(TransformOpts{
|
||||
Reverse: s.reverse,
|
||||
FileNameOverride: s.filename,
|
||||
StripRename: s.stripRename,
|
||||
IncludedLineIndices: lineIndices,
|
||||
}).
|
||||
FormatPlain()
|
||||
|
||||
@@ -33,6 +33,13 @@ type TransformOpts struct {
|
||||
// treat it as a diff against an empty file.
|
||||
TurnAddedFilesIntoDiffAgainstEmptyFile bool
|
||||
|
||||
// When building a partial patch for a renamed file, strip the rename
|
||||
// metadata from the header and point it at the new path. Applying the
|
||||
// resulting patch then only changes the file's contents and leaves the
|
||||
// rename itself in place. (For a whole-file selection we keep the rename
|
||||
// so that it moves or is discarded together with the contents.)
|
||||
StripRename bool
|
||||
|
||||
// The indices of lines that should be included in the patch.
|
||||
IncludedLineIndices []int
|
||||
}
|
||||
@@ -72,21 +79,61 @@ func (self *patchTransformer) transformHeader() []string {
|
||||
"--- a/" + self.opts.FileNameOverride,
|
||||
"+++ b/" + self.opts.FileNameOverride,
|
||||
}
|
||||
} else if self.opts.TurnAddedFilesIntoDiffAgainstEmptyFile {
|
||||
result := make([]string, 0, len(self.patch.header))
|
||||
for idx, line := range self.patch.header {
|
||||
}
|
||||
|
||||
header := self.patch.header
|
||||
if self.opts.StripRename {
|
||||
header = stripRenameFromHeader(header)
|
||||
}
|
||||
|
||||
if self.opts.TurnAddedFilesIntoDiffAgainstEmptyFile {
|
||||
result := make([]string, 0, len(header))
|
||||
for idx, line := range header {
|
||||
if strings.HasPrefix(line, "new file mode") {
|
||||
continue
|
||||
}
|
||||
if line == "--- /dev/null" && strings.HasPrefix(self.patch.header[idx+1], "+++ b/") {
|
||||
line = "--- a/" + self.patch.header[idx+1][6:]
|
||||
if line == "--- /dev/null" && strings.HasPrefix(header[idx+1], "+++ b/") {
|
||||
line = "--- a/" + header[idx+1][6:]
|
||||
}
|
||||
result = append(result, line)
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
return self.patch.header
|
||||
return header
|
||||
}
|
||||
|
||||
// stripRenameFromHeader rewrites a rename diff header so that it looks like a
|
||||
// plain modification of the new path: it drops the rename metadata and points
|
||||
// the diff at the new path on both sides, while keeping the blob index line so
|
||||
// that `git apply --3way` can still fall back to a blob merge. See the
|
||||
// StripRename option for why we do this.
|
||||
func stripRenameFromHeader(header []string) []string {
|
||||
newPath := ""
|
||||
for _, line := range header {
|
||||
if path, ok := strings.CutPrefix(line, "+++ b/"); ok {
|
||||
newPath = path
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
result := make([]string, 0, len(header))
|
||||
for _, line := range header {
|
||||
switch {
|
||||
case strings.HasPrefix(line, "similarity index "),
|
||||
strings.HasPrefix(line, "dissimilarity index "),
|
||||
strings.HasPrefix(line, "rename from "),
|
||||
strings.HasPrefix(line, "rename to "):
|
||||
// drop the rename metadata
|
||||
case strings.HasPrefix(line, "diff --git "):
|
||||
result = append(result, "diff --git a/"+newPath+" b/"+newPath)
|
||||
case strings.HasPrefix(line, "--- "):
|
||||
result = append(result, "--- a/"+newPath)
|
||||
default:
|
||||
result = append(result, line)
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func (self *patchTransformer) transformHunks() []*Hunk {
|
||||
|
||||
@@ -136,8 +136,23 @@ func findOrCreateConfigDir() (string, error) {
|
||||
return folder, os.MkdirAll(folder, 0o755)
|
||||
}
|
||||
|
||||
// KeybindingPlatform returns the platform whose default keybindings should be
|
||||
// used. Normally this is the OS we're running on, but it can be overridden with
|
||||
// the LAZYGIT_KEYBINDING_PLATFORM environment variable; this is useful e.g. when
|
||||
// running lazygit in a Linux container that you access over ssh from a Mac, and
|
||||
// you'd rather use the Mac keybindings. An unrecognized value falls back to the
|
||||
// real OS, which gives meaningful bindings, rather than to the (arbitrary)
|
||||
// non-darwin defaults.
|
||||
func KeybindingPlatform() string {
|
||||
platform := os.Getenv("LAZYGIT_KEYBINDING_PLATFORM")
|
||||
if lo.Contains([]string{"darwin", "linux", "windows"}, platform) {
|
||||
return platform
|
||||
}
|
||||
return runtime.GOOS
|
||||
}
|
||||
|
||||
func loadUserConfigWithDefaults(configFiles []*ConfigFile, isGuiInitialized bool) (*UserConfig, error) {
|
||||
return loadUserConfig(configFiles, GetDefaultConfigForPlatform(runtime.GOOS), isGuiInitialized)
|
||||
return loadUserConfig(configFiles, GetDefaultConfigForPlatform(KeybindingPlatform()), isGuiInitialized)
|
||||
}
|
||||
|
||||
func loadUserConfig(configFiles []*ConfigFile, base *UserConfig, isGuiInitialized bool) (*UserConfig, error) {
|
||||
@@ -287,6 +302,26 @@ func computeMigratedConfig(path string, content []byte, changes *ChangesSet) ([]
|
||||
}
|
||||
}
|
||||
|
||||
pathsToMove := []struct {
|
||||
oldPath []string
|
||||
newPath []string
|
||||
}{
|
||||
{
|
||||
[]string{"keybinding", "worktrees", "viewWorktreeOptions"},
|
||||
[]string{"keybinding", "universal", "newWorktree"},
|
||||
},
|
||||
}
|
||||
|
||||
for _, pathToMove := range pathsToMove {
|
||||
err, didMove := yaml_utils.MoveYamlKey(&rootNode, pathToMove.oldPath, pathToMove.newPath)
|
||||
if err != nil {
|
||||
return nil, false, fmt.Errorf("Couldn't migrate config file at `%s` for key %s: %w", path, strings.Join(pathToMove.oldPath, "."), err)
|
||||
}
|
||||
if didMove {
|
||||
changes.Add(fmt.Sprintf("Moved '%s' to '%s'", strings.Join(pathToMove.oldPath, "."), strings.Join(pathToMove.newPath, ".")))
|
||||
}
|
||||
}
|
||||
|
||||
err = changeNullKeybindingsToDisabled(&rootNode, changes)
|
||||
if err != nil {
|
||||
return nil, false, fmt.Errorf("Couldn't migrate config file at `%s`: %w", path, err)
|
||||
@@ -449,7 +484,8 @@ func migrateAllBranchesLogCmd(rootNode *yaml.Node, changes *ChangesSet) error {
|
||||
// We will later populate it with the individual allBranchesLogCmd record
|
||||
cmdsKeyNode = &yaml.Node{Kind: yaml.ScalarNode, Value: "allBranchesLogCmds"}
|
||||
cmdsValueNode = &yaml.Node{Kind: yaml.SequenceNode, Content: []*yaml.Node{}}
|
||||
gitNode.Content = append(gitNode.Content,
|
||||
gitNode.Content = append(
|
||||
gitNode.Content,
|
||||
cmdsKeyNode,
|
||||
cmdsValueNode,
|
||||
)
|
||||
|
||||
@@ -1,11 +1,53 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestKeybindingPlatform(t *testing.T) {
|
||||
scenarios := []struct {
|
||||
name string
|
||||
envValue string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
name: "Not set falls back to the host OS",
|
||||
envValue: "",
|
||||
expected: runtime.GOOS,
|
||||
},
|
||||
{
|
||||
name: "darwin is honored",
|
||||
envValue: "darwin",
|
||||
expected: "darwin",
|
||||
},
|
||||
{
|
||||
name: "linux is honored",
|
||||
envValue: "linux",
|
||||
expected: "linux",
|
||||
},
|
||||
{
|
||||
name: "windows is honored",
|
||||
envValue: "windows",
|
||||
expected: "windows",
|
||||
},
|
||||
{
|
||||
name: "An unrecognized value falls back to the host OS",
|
||||
envValue: "mac",
|
||||
expected: runtime.GOOS,
|
||||
},
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
t.Run(s.name, func(t *testing.T) {
|
||||
t.Setenv("LAZYGIT_KEYBINDING_PLATFORM", s.envValue)
|
||||
assert.Equal(t, s.expected, KeybindingPlatform())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestMigrationOfRenamedKeys(t *testing.T) {
|
||||
scenarios := []struct {
|
||||
name string
|
||||
@@ -78,6 +120,73 @@ keybinding:
|
||||
}
|
||||
}
|
||||
|
||||
func TestMigrationOfMovedKeys(t *testing.T) {
|
||||
scenarios := []struct {
|
||||
name string
|
||||
input string
|
||||
expected string
|
||||
expectedDidChange bool
|
||||
expectedChanges []string
|
||||
}{
|
||||
{
|
||||
name: "Empty String",
|
||||
input: "",
|
||||
expectedDidChange: false,
|
||||
expectedChanges: []string{},
|
||||
},
|
||||
{
|
||||
name: "No move needed",
|
||||
input: `foo:
|
||||
bar: 5
|
||||
`,
|
||||
expectedDidChange: false,
|
||||
expectedChanges: []string{},
|
||||
},
|
||||
{
|
||||
name: "Move worktree keybinding into the universal section",
|
||||
input: `keybinding:
|
||||
universal:
|
||||
quit: q
|
||||
worktrees:
|
||||
viewWorktreeOptions: w
|
||||
`,
|
||||
expected: `keybinding:
|
||||
universal:
|
||||
quit: q
|
||||
newWorktree: w
|
||||
`,
|
||||
expectedDidChange: true,
|
||||
expectedChanges: []string{"Moved 'keybinding.worktrees.viewWorktreeOptions' to 'keybinding.universal.newWorktree'"},
|
||||
},
|
||||
{
|
||||
name: "Create the universal section if it doesn't exist",
|
||||
input: `keybinding:
|
||||
worktrees:
|
||||
viewWorktreeOptions: w
|
||||
`,
|
||||
expected: `keybinding:
|
||||
universal:
|
||||
newWorktree: w
|
||||
`,
|
||||
expectedDidChange: true,
|
||||
expectedChanges: []string{"Moved 'keybinding.worktrees.viewWorktreeOptions' to 'keybinding.universal.newWorktree'"},
|
||||
},
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
t.Run(s.name, func(t *testing.T) {
|
||||
changes := NewChangesSet()
|
||||
actual, didChange, err := computeMigratedConfig("path doesn't matter", []byte(s.input), changes)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, s.expectedDidChange, didChange)
|
||||
if didChange {
|
||||
assert.Equal(t, s.expected, string(actual))
|
||||
}
|
||||
assert.Equal(t, s.expectedChanges, changes.ToSliceFromOldest())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestMigrateNullKeybindingsToDisabled(t *testing.T) {
|
||||
scenarios := []struct {
|
||||
name string
|
||||
@@ -654,6 +763,12 @@ git:
|
||||
# If true, periodically refresh files and submodules
|
||||
autoRefresh: true
|
||||
|
||||
# If true, poll the repo periodically for external ref changes (commits,
|
||||
# branch updates, checkouts made outside lazygit) and refresh when one
|
||||
# is detected. Independent of autoRefresh, which only governs the files
|
||||
# panel.
|
||||
autoDetectExternalChanges: true
|
||||
|
||||
# If true, pass the --all arg to git fetch
|
||||
fetchAll: true
|
||||
|
||||
@@ -723,6 +838,11 @@ refresher:
|
||||
# Auto-fetch can be disabled via option 'git.autoFetch'.
|
||||
fetchInterval: 60
|
||||
|
||||
# Interval in seconds at which lazygit polls for external ref changes
|
||||
# (commits, branch updates, checkouts made outside lazygit).
|
||||
# Detection can be disabled via option 'git.autoDetectExternalChanges'.
|
||||
externalChangeCheckInterval: 2
|
||||
|
||||
# If true, show a confirmation popup before quitting Lazygit
|
||||
confirmOnQuit: false
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package config
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/utils"
|
||||
)
|
||||
@@ -77,6 +78,49 @@ func (self *PagerConfig) CyclePagers() {
|
||||
self.pagerIndex = (self.pagerIndex + 1) % len(self.getUserConfig().Git.Pagers)
|
||||
}
|
||||
|
||||
func (self *PagerConfig) CyclePagersBackward() {
|
||||
n := len(self.getUserConfig().Git.Pagers)
|
||||
self.pagerIndex = (self.pagerIndex - 1 + n) % n
|
||||
}
|
||||
|
||||
func (self *PagerConfig) CurrentPagerIndex() (int, int) {
|
||||
return self.pagerIndex, len(self.getUserConfig().Git.Pagers)
|
||||
}
|
||||
|
||||
// CurrentPagerName returns a name for the current pager, suitable for showing
|
||||
// to the user. It returns an empty string if no name can be derived; callers
|
||||
// should substitute a localized fallback in that case.
|
||||
func (self *PagerConfig) CurrentPagerName() string {
|
||||
currentPagerConfig := self.currentPagerConfig()
|
||||
if currentPagerConfig == nil {
|
||||
return ""
|
||||
}
|
||||
return currentPagerConfig.displayName()
|
||||
}
|
||||
|
||||
// CurrentPagerUsesGitConfigDiff reports whether the current pager defers to
|
||||
// git's own external diff config. Such an entry has no name we can derive (the
|
||||
// actual command may even vary per file via .gitattributes), so callers show a
|
||||
// generic label rather than treating it like the default no-pager entry.
|
||||
func (self *PagerConfig) CurrentPagerUsesGitConfigDiff() bool {
|
||||
currentPagerConfig := self.currentPagerConfig()
|
||||
return currentPagerConfig != nil && currentPagerConfig.UseExternalDiffGitConfig
|
||||
}
|
||||
|
||||
func (self *PagingConfig) displayName() string {
|
||||
if self.Name != "" {
|
||||
return self.Name
|
||||
}
|
||||
if word := firstWord(string(self.Pager)); word != "" {
|
||||
return word
|
||||
}
|
||||
return firstWord(self.ExternalDiffCommand)
|
||||
}
|
||||
|
||||
func firstWord(command string) string {
|
||||
fields := strings.Fields(command)
|
||||
if len(fields) == 0 {
|
||||
return ""
|
||||
}
|
||||
return fields[0]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestCurrentPagerName(t *testing.T) {
|
||||
scenarios := []struct {
|
||||
name string
|
||||
pager PagingConfig
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
name: "explicit name takes precedence over the command",
|
||||
pager: PagingConfig{Name: "delta side-by-side", Pager: "delta --side-by-side"},
|
||||
expected: "delta side-by-side",
|
||||
},
|
||||
{
|
||||
name: "derived from the first word of the pager command",
|
||||
pager: PagingConfig{Pager: "delta --side-by-side"},
|
||||
expected: "delta",
|
||||
},
|
||||
{
|
||||
name: "surrounding whitespace in the command is ignored",
|
||||
pager: PagingConfig{Pager: " diff-so-fancy "},
|
||||
expected: "diff-so-fancy",
|
||||
},
|
||||
{
|
||||
name: "falls back to the external diff command when there is no pager",
|
||||
pager: PagingConfig{ExternalDiffCommand: "difft --color=always"},
|
||||
expected: "difft",
|
||||
},
|
||||
{
|
||||
name: "no name can be derived",
|
||||
pager: PagingConfig{UseExternalDiffGitConfig: true},
|
||||
expected: "",
|
||||
},
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
t.Run(s.name, func(t *testing.T) {
|
||||
userConfig := &UserConfig{}
|
||||
userConfig.Git.Pagers = []PagingConfig{s.pager}
|
||||
config := NewPagerConfig(func() *UserConfig { return userConfig })
|
||||
|
||||
assert.Equal(t, s.expected, config.CurrentPagerName())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestCurrentPagerNameWithoutPagers(t *testing.T) {
|
||||
config := NewPagerConfig(func() *UserConfig { return &UserConfig{} })
|
||||
|
||||
assert.Equal(t, "", config.CurrentPagerName())
|
||||
}
|
||||
|
||||
func TestCyclePagers(t *testing.T) {
|
||||
userConfig := &UserConfig{}
|
||||
userConfig.Git.Pagers = []PagingConfig{{Name: "a"}, {Name: "b"}, {Name: "c"}}
|
||||
config := NewPagerConfig(func() *UserConfig { return userConfig })
|
||||
|
||||
currentIndex := func() int {
|
||||
index, _ := config.CurrentPagerIndex()
|
||||
return index
|
||||
}
|
||||
|
||||
assert.Equal(t, 0, currentIndex())
|
||||
|
||||
config.CyclePagers()
|
||||
assert.Equal(t, 1, currentIndex())
|
||||
config.CyclePagers()
|
||||
assert.Equal(t, 2, currentIndex())
|
||||
config.CyclePagers()
|
||||
assert.Equal(t, 0, currentIndex(), "cycling forward past the last pager wraps to the first")
|
||||
|
||||
config.CyclePagersBackward()
|
||||
assert.Equal(t, 2, currentIndex(), "cycling backward past the first pager wraps to the last")
|
||||
config.CyclePagersBackward()
|
||||
assert.Equal(t, 1, currentIndex())
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"github.com/karimkhaleel/jsonschema"
|
||||
"github.com/samber/lo"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
// SidePanel is one entry in gui.sidePanels: a side panel made up of one or more
|
||||
// tabs, written in YAML as a list of tab names (e.g. [files, worktrees]).
|
||||
type SidePanel []string
|
||||
|
||||
// ValidSidePanelTabs lists every name that may appear in gui.sidePanels. Each
|
||||
// names a list that can stand alone as a panel or be grouped with others as the
|
||||
// tabs of one panel. The resolver in the gui package must handle every entry
|
||||
// here; a test enforces that the two stay in sync.
|
||||
var ValidSidePanelTabs = []string{
|
||||
"status",
|
||||
"files",
|
||||
"worktrees",
|
||||
"submodules",
|
||||
"branches",
|
||||
"remotes",
|
||||
"tags",
|
||||
"commits",
|
||||
"reflog",
|
||||
"stash",
|
||||
}
|
||||
|
||||
func (p SidePanel) MarshalYAML() (any, error) {
|
||||
// Render in flow style (`[a, b]`) rather than the default block style, which
|
||||
// is more compact and reads better in the generated docs.
|
||||
node := &yaml.Node{
|
||||
Kind: yaml.SequenceNode,
|
||||
Style: yaml.FlowStyle,
|
||||
}
|
||||
for _, s := range p {
|
||||
node.Content = append(node.Content, &yaml.Node{
|
||||
Kind: yaml.ScalarNode,
|
||||
Value: s,
|
||||
})
|
||||
}
|
||||
return node, nil
|
||||
}
|
||||
|
||||
// JSONSchema describes a side panel as a list of tab names, restricted to the
|
||||
// known names.
|
||||
func (SidePanel) JSONSchema() *jsonschema.Schema {
|
||||
names := lo.Map(ValidSidePanelTabs, func(name string, _ int) any { return name })
|
||||
return &jsonschema.Schema{
|
||||
Type: "array",
|
||||
Items: &jsonschema.Schema{Type: "string", Enum: names},
|
||||
}
|
||||
}
|
||||
+72
-24
@@ -11,6 +11,8 @@ type UserConfig struct {
|
||||
Gui GuiConfig `yaml:"gui"`
|
||||
// Config relating to git
|
||||
Git GitConfig `yaml:"git"`
|
||||
// Config relating to git worktrees
|
||||
Worktree WorktreeConfig `yaml:"worktree"`
|
||||
// Periodic update checks
|
||||
Update UpdateConfig `yaml:"update"`
|
||||
// Background refreshes
|
||||
@@ -44,10 +46,13 @@ type UserConfig struct {
|
||||
type RefresherConfig struct {
|
||||
// File/submodule refresh interval in seconds.
|
||||
// Auto-refresh can be disabled via option 'git.autoRefresh'.
|
||||
RefreshInterval int `yaml:"refreshInterval" jsonschema:"minimum=0"`
|
||||
RefreshInterval int `yaml:"refreshInterval" jsonschema:"exclusiveMinimum=0"`
|
||||
// Re-fetch interval in seconds.
|
||||
// Auto-fetch can be disabled via option 'git.autoFetch'.
|
||||
FetchInterval int `yaml:"fetchInterval" jsonschema:"minimum=0"`
|
||||
FetchInterval int `yaml:"fetchInterval" jsonschema:"exclusiveMinimum=0"`
|
||||
// Interval in seconds at which lazygit polls for external ref changes (commits, branch updates, checkouts made outside lazygit).
|
||||
// Detection can be disabled via option 'git.autoDetectExternalChanges'.
|
||||
ExternalChangeCheckInterval int `yaml:"externalChangeCheckInterval" jsonschema:"exclusiveMinimum=0"`
|
||||
}
|
||||
|
||||
func (c *RefresherConfig) RefreshIntervalDuration() time.Duration {
|
||||
@@ -58,6 +63,10 @@ func (c *RefresherConfig) FetchIntervalDuration() time.Duration {
|
||||
return time.Second * time.Duration(c.FetchInterval)
|
||||
}
|
||||
|
||||
func (c *RefresherConfig) ExternalChangeCheckIntervalDuration() time.Duration {
|
||||
return time.Second * time.Duration(c.ExternalChangeCheckInterval)
|
||||
}
|
||||
|
||||
type GuiConfig struct {
|
||||
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-author-color
|
||||
AuthorColors map[string]string `yaml:"authorColors"`
|
||||
@@ -82,6 +91,7 @@ type GuiConfig struct {
|
||||
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.
|
||||
// Mouse capture can also be toggled at runtime with the 'toggleMouseCapture' keybinding ('%' by default).
|
||||
MouseEvents bool `yaml:"mouseEvents"`
|
||||
// If true, do not show a warning when amending a commit.
|
||||
SkipAmendWarning bool `yaml:"skipAmendWarning"`
|
||||
@@ -102,6 +112,13 @@ type GuiConfig struct {
|
||||
ExpandFocusedSidePanel bool `yaml:"expandFocusedSidePanel"`
|
||||
// The weight of the expanded side panel, relative to the other panels. 2 means twice as tall as the other panels. Only relevant if `expandFocusedSidePanel` is true.
|
||||
ExpandedSidePanelWeight int `yaml:"expandedSidePanelWeight"`
|
||||
// If true, don't give a side panel more height than it needs to show its content; when all panels fit, the leftover height is shared among them so that they still fill the screen.
|
||||
ShrinkSidePanelsToContent bool `yaml:"shrinkSidePanelsToContent"`
|
||||
// The side panels, in the order they appear from top to bottom.
|
||||
// Each entry is a list of one or more names that share a single panel as tabs (cycle through them with the next-tab/previous-tab keys).
|
||||
// Omit a name to hide it; give a name its own one-element list to promote a tab to a top-level panel.
|
||||
// Valid names are: 'status', 'files', 'worktrees', 'submodules', 'branches', 'remotes', 'tags', 'commits', 'reflog', 'stash'. 'files', 'branches', and 'commits' must always be included; they can't be hidden.
|
||||
SidePanels []SidePanel `yaml:"sidePanels"`
|
||||
// Sometimes the main window is split in two (e.g. when the selected file has both staged and unstaged changes). This setting controls how the two sections are split.
|
||||
// Options are:
|
||||
// - 'horizontal': split the window horizontally
|
||||
@@ -256,6 +273,11 @@ type GitConfig struct {
|
||||
// Array of pagers. Each entry has the following format:
|
||||
// [dev] The following documentation is duplicated from the PagingConfig struct below.
|
||||
//
|
||||
// # A name for the pager, shown in the notification when cycling pagers.
|
||||
// # If not set, the name is derived from the first word of the pager
|
||||
// # command (or of the external diff command).
|
||||
// name: ""
|
||||
//
|
||||
// # Value of the --color arg in the git diff command. Some pagers want
|
||||
// # this to be set to 'always' and some want it set to 'never'
|
||||
// colorArg: "always"
|
||||
@@ -275,6 +297,8 @@ type GitConfig struct {
|
||||
// # https://git-scm.com/docs/gitattributes#_defining_an_external_diff_driver.
|
||||
// useExternalDiffGitConfig: false
|
||||
//
|
||||
// 'pager', 'externalDiffCommand', and 'useExternalDiffGitConfig' are mutually exclusive; set at most one per entry.
|
||||
//
|
||||
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Pagers.md for more information.
|
||||
Pagers []PagingConfig `yaml:"pagers"`
|
||||
// Config relating to committing
|
||||
@@ -289,6 +313,8 @@ type GitConfig struct {
|
||||
AutoFetch bool `yaml:"autoFetch"`
|
||||
// If true, periodically refresh files and submodules
|
||||
AutoRefresh bool `yaml:"autoRefresh"`
|
||||
// If true, poll the repo periodically for external ref changes (commits, branch updates, checkouts made outside lazygit) and refresh when one is detected. Independent of autoRefresh, which only governs the files panel.
|
||||
AutoDetectExternalChanges bool `yaml:"autoDetectExternalChanges"`
|
||||
// If not "none", lazygit will automatically fast-forward local branches to match their upstream after fetching. Applies to branches that are not the currently checked out branch, and only to those that are strictly behind their upstream (as opposed to diverged).
|
||||
// Possible values: 'none' | 'onlyMainBranches' | 'allBranches'
|
||||
AutoForwardBranches string `yaml:"autoForwardBranches" jsonschema:"enum=none,enum=onlyMainBranches,enum=allBranches"`
|
||||
@@ -345,6 +371,8 @@ func (PagerType) JSONSchemaExtend(schema *jsonschema.Schema) {
|
||||
|
||||
// [dev] This documentation is duplicated in the GitConfig struct. If you make changes here, make them there too.
|
||||
type PagingConfig struct {
|
||||
// A name for the pager, shown in the notification when cycling pagers. If not set, the name is derived from the first word of the pager command (or of the external diff command).
|
||||
Name string `yaml:"name"`
|
||||
// Value of the --color arg in the git diff command. Some pagers want this to be set to 'always' and some want it set to 'never'
|
||||
ColorArg string `yaml:"colorArg" jsonschema:"enum=always,enum=never"`
|
||||
// e.g.
|
||||
@@ -399,6 +427,13 @@ type CommitPrefixConfig struct {
|
||||
Replace string `yaml:"replace" jsonschema:"example=[$1]"`
|
||||
}
|
||||
|
||||
type WorktreeConfig struct {
|
||||
// Default parent directory for new worktrees. It is offered as a candidate location alongside the parent directories of any worktrees you already have.
|
||||
// A relative path is resolved against the repository's root directory, so "../worktrees" sits beside the repo and ".worktrees" sits inside it.
|
||||
// A leading "~" is expanded to your home directory, so "~/worktrees" works.
|
||||
DefaultPath string `yaml:"defaultPath"`
|
||||
}
|
||||
|
||||
type UpdateConfig struct {
|
||||
// One of: 'prompt' (default) | 'background' | 'never'
|
||||
Method string `yaml:"method" jsonschema:"enum=prompt,enum=background,enum=never"`
|
||||
@@ -411,7 +446,6 @@ type KeybindingConfig struct {
|
||||
Status KeybindingStatusConfig `yaml:"status"`
|
||||
Files KeybindingFilesConfig `yaml:"files"`
|
||||
Branches KeybindingBranchesConfig `yaml:"branches"`
|
||||
Worktrees KeybindingWorktreesConfig `yaml:"worktrees"`
|
||||
Commits KeybindingCommitsConfig `yaml:"commits"`
|
||||
AmendAttribute KeybindingAmendAttributeConfig `yaml:"amendAttribute"`
|
||||
Stash KeybindingStashConfig `yaml:"stash"`
|
||||
@@ -479,6 +513,7 @@ type KeybindingUniversalConfig struct {
|
||||
ConfirmInEditorAlt Keybinding `yaml:"confirmInEditor-alt"`
|
||||
Remove Keybinding `yaml:"remove"`
|
||||
New Keybinding `yaml:"new"`
|
||||
NewWorktree Keybinding `yaml:"newWorktree"`
|
||||
Edit Keybinding `yaml:"edit"`
|
||||
OpenFile Keybinding `yaml:"openFile"`
|
||||
ScrollUpMain Keybinding `yaml:"scrollUpMain"`
|
||||
@@ -502,6 +537,7 @@ type KeybindingUniversalConfig struct {
|
||||
NextScreenMode Keybinding `yaml:"nextScreenMode"`
|
||||
PrevScreenMode Keybinding `yaml:"prevScreenMode"`
|
||||
CyclePagers Keybinding `yaml:"cyclePagers"`
|
||||
CyclePagersReverse Keybinding `yaml:"cyclePagersReverse"`
|
||||
Undo Keybinding `yaml:"undo"`
|
||||
Redo Keybinding `yaml:"redo"`
|
||||
FilteringMenu Keybinding `yaml:"filteringMenu"`
|
||||
@@ -513,11 +549,13 @@ type KeybindingUniversalConfig struct {
|
||||
SubmitEditorText Keybinding `yaml:"submitEditorText"`
|
||||
ExtrasMenu Keybinding `yaml:"extrasMenu"`
|
||||
ToggleWhitespaceInDiffView Keybinding `yaml:"toggleWhitespaceInDiffView"`
|
||||
ToggleMouseCapture Keybinding `yaml:"toggleMouseCapture"`
|
||||
IncreaseContextInDiffView Keybinding `yaml:"increaseContextInDiffView"`
|
||||
DecreaseContextInDiffView Keybinding `yaml:"decreaseContextInDiffView"`
|
||||
IncreaseRenameSimilarityThreshold Keybinding `yaml:"increaseRenameSimilarityThreshold"`
|
||||
DecreaseRenameSimilarityThreshold Keybinding `yaml:"decreaseRenameSimilarityThreshold"`
|
||||
OpenDiffTool Keybinding `yaml:"openDiffTool"`
|
||||
EditConfig Keybinding `yaml:"editConfig"`
|
||||
}
|
||||
|
||||
type KeybindingStatusConfig struct {
|
||||
@@ -571,10 +609,6 @@ type KeybindingBranchesConfig struct {
|
||||
SortOrder Keybinding `yaml:"sortOrder"`
|
||||
}
|
||||
|
||||
type KeybindingWorktreesConfig struct {
|
||||
ViewWorktreeOptions Keybinding `yaml:"viewWorktreeOptions"`
|
||||
}
|
||||
|
||||
type KeybindingCommitsConfig struct {
|
||||
SquashDown Keybinding `yaml:"squashDown"`
|
||||
RenameCommit Keybinding `yaml:"renameCommit"`
|
||||
@@ -817,18 +851,26 @@ func GetDefaultConfig() *UserConfig {
|
||||
func GetDefaultConfigForPlatform(platform string) *UserConfig {
|
||||
return &UserConfig{
|
||||
Gui: GuiConfig{
|
||||
ScrollHeight: 2,
|
||||
ScrollPastBottom: true,
|
||||
ScrollOffMargin: 2,
|
||||
ScrollOffBehavior: "margin",
|
||||
TabWidth: 4,
|
||||
MouseEvents: true,
|
||||
SkipAmendWarning: false,
|
||||
SkipDiscardChangeWarning: false,
|
||||
SkipStashWarning: false,
|
||||
SidePanelWidth: 0.3333,
|
||||
ExpandFocusedSidePanel: false,
|
||||
ExpandedSidePanelWeight: 2,
|
||||
ScrollHeight: 2,
|
||||
ScrollPastBottom: true,
|
||||
ScrollOffMargin: 2,
|
||||
ScrollOffBehavior: "margin",
|
||||
TabWidth: 4,
|
||||
MouseEvents: true,
|
||||
SkipAmendWarning: false,
|
||||
SkipDiscardChangeWarning: false,
|
||||
SkipStashWarning: false,
|
||||
SidePanelWidth: 0.3333,
|
||||
ExpandFocusedSidePanel: false,
|
||||
ExpandedSidePanelWeight: 2,
|
||||
ShrinkSidePanelsToContent: false,
|
||||
SidePanels: []SidePanel{
|
||||
{"status"},
|
||||
{"files", "worktrees", "submodules"},
|
||||
{"branches", "remotes", "tags"},
|
||||
{"commits", "reflog"},
|
||||
{"stash"},
|
||||
},
|
||||
MainPanelSplitMode: "flexible",
|
||||
EnlargedSideViewLocation: "left",
|
||||
WrapLinesInStagingView: true,
|
||||
@@ -912,6 +954,7 @@ func GetDefaultConfigForPlatform(platform string) *UserConfig {
|
||||
MainBranches: []string{"master", "main"},
|
||||
AutoFetch: true,
|
||||
AutoRefresh: true,
|
||||
AutoDetectExternalChanges: true,
|
||||
AutoForwardBranches: "onlyMainBranches",
|
||||
FetchAll: true,
|
||||
AutoStageResolvedConflicts: true,
|
||||
@@ -926,9 +969,13 @@ func GetDefaultConfigForPlatform(platform string) *UserConfig {
|
||||
ParseEmoji: false,
|
||||
TruncateCopiedCommitHashesTo: 12,
|
||||
},
|
||||
Worktree: WorktreeConfig{
|
||||
DefaultPath: "",
|
||||
},
|
||||
Refresher: RefresherConfig{
|
||||
RefreshInterval: 10,
|
||||
FetchInterval: 60,
|
||||
RefreshInterval: 10,
|
||||
FetchInterval: 60,
|
||||
ExternalChangeCheckInterval: 2,
|
||||
},
|
||||
Update: UpdateConfig{
|
||||
Method: "prompt",
|
||||
@@ -990,6 +1037,7 @@ func GetDefaultConfigForPlatform(platform string) *UserConfig {
|
||||
ConfirmInEditorAlt: Keybinding{"<ctrl+s>"},
|
||||
Remove: Keybinding{"d"},
|
||||
New: Keybinding{"n"},
|
||||
NewWorktree: Keybinding{"w"},
|
||||
Edit: Keybinding{"e"},
|
||||
OpenFile: Keybinding{"o"},
|
||||
OpenRecentRepos: Keybinding{"<ctrl+r>"},
|
||||
@@ -1010,6 +1058,7 @@ func GetDefaultConfigForPlatform(platform string) *UserConfig {
|
||||
NextScreenMode: Keybinding{"+"},
|
||||
PrevScreenMode: Keybinding{"_"},
|
||||
CyclePagers: Keybinding{"|"},
|
||||
CyclePagersReverse: Keybinding{"\\"},
|
||||
Undo: Keybinding{"z"},
|
||||
Redo: Keybinding{"Z"},
|
||||
FilteringMenu: Keybinding{"<ctrl+s>"},
|
||||
@@ -1019,11 +1068,13 @@ func GetDefaultConfigForPlatform(platform string) *UserConfig {
|
||||
SubmitEditorText: Keybinding{"<enter>"},
|
||||
ExtrasMenu: Keybinding{"@"},
|
||||
ToggleWhitespaceInDiffView: Keybinding{"<ctrl+w>"},
|
||||
ToggleMouseCapture: Keybinding{"%"},
|
||||
IncreaseContextInDiffView: Keybinding{"}"},
|
||||
DecreaseContextInDiffView: Keybinding{"{"},
|
||||
IncreaseRenameSimilarityThreshold: Keybinding{")"},
|
||||
DecreaseRenameSimilarityThreshold: Keybinding{"("},
|
||||
OpenDiffTool: Keybinding{"<ctrl+t>"},
|
||||
EditConfig: Keybinding{"<alt+shift+c>"},
|
||||
},
|
||||
Status: KeybindingStatusConfig{
|
||||
CheckForUpdate: Keybinding{"u"},
|
||||
@@ -1073,9 +1124,6 @@ func GetDefaultConfigForPlatform(platform string) *UserConfig {
|
||||
AddForkRemote: Keybinding{"F"},
|
||||
SortOrder: Keybinding{"s"},
|
||||
},
|
||||
Worktrees: KeybindingWorktreesConfig{
|
||||
ViewWorktreeOptions: Keybinding{"w"},
|
||||
},
|
||||
Commits: KeybindingCommitsConfig{
|
||||
SquashDown: Keybinding{"s"},
|
||||
RenameCommit: Keybinding{"r"},
|
||||
|
||||
@@ -46,6 +46,9 @@ func (config *UserConfig) Validate() error {
|
||||
[]string{"always", "never", "when-maximised"}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := validatePagers(config.Git.Pagers); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := validateKeybindings(config.Keybinding); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -55,6 +58,42 @@ func (config *UserConfig) Validate() error {
|
||||
if err := validateSpinner(config.Gui.Spinner); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := validateSidePanels(config.Gui.SidePanels); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateSidePanels(panels []SidePanel) error {
|
||||
seen := map[string]bool{}
|
||||
total := 0
|
||||
for _, panel := range panels {
|
||||
if len(panel) == 0 {
|
||||
return errors.New("gui.sidePanels: a side panel must have at least one tab.")
|
||||
}
|
||||
for _, name := range panel {
|
||||
if !slices.Contains(ValidSidePanelTabs, name) {
|
||||
return fmt.Errorf("gui.sidePanels: unknown side panel '%s'. Allowed values: %s",
|
||||
name, strings.Join(ValidSidePanelTabs, ", "))
|
||||
}
|
||||
if seen[name] {
|
||||
return fmt.Errorf("gui.sidePanels: '%s' is listed more than once; each side panel may appear only once.", name)
|
||||
}
|
||||
seen[name] = true
|
||||
total++
|
||||
}
|
||||
}
|
||||
if total == 0 {
|
||||
return errors.New("gui.sidePanels must not be empty.")
|
||||
}
|
||||
// A lot of code focuses these panels directly (e.g. after resolving a
|
||||
// conflict or popping a stash), so they must always be present; otherwise
|
||||
// that code would focus a hidden panel.
|
||||
for _, required := range []string{"files", "branches", "commits"} {
|
||||
if !seen[required] {
|
||||
return fmt.Errorf("gui.sidePanels: '%s' must be included; it can't be hidden.", required)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -71,6 +110,30 @@ func validateSpinner(spinner SpinnerConfig) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// validatePagers rejects pager entries that combine more than one diff
|
||||
// mechanism. A pager (GIT_PAGER) formats the diff that git produces, whereas
|
||||
// externalDiffCommand and useExternalDiffGitConfig change how git produces the
|
||||
// diff in the first place; piping one through the other almost always yields
|
||||
// garbled output, so we treat the three as mutually exclusive.
|
||||
func validatePagers(pagers []PagingConfig) error {
|
||||
for i, pager := range pagers {
|
||||
count := 0
|
||||
if pager.Pager != "" {
|
||||
count++
|
||||
}
|
||||
if pager.ExternalDiffCommand != "" {
|
||||
count++
|
||||
}
|
||||
if pager.UseExternalDiffGitConfig {
|
||||
count++
|
||||
}
|
||||
if count > 1 {
|
||||
return fmt.Errorf("git.pagers[%d]: at most one of 'pager', 'externalDiffCommand', and 'useExternalDiffGitConfig' may be set; they are mutually exclusive", i)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateEnum(name string, value string, allowedValues []string) error {
|
||||
if slices.Contains(allowedValues, value) {
|
||||
return nil
|
||||
@@ -114,16 +177,7 @@ func validateKeybindingsRecurse(path string, node any) error {
|
||||
}
|
||||
|
||||
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
|
||||
return validateKeybindingsRecurse("", keybindingConfig)
|
||||
}
|
||||
|
||||
func validateCustomCommandKey(key Keybinding) error {
|
||||
|
||||
@@ -134,11 +134,12 @@ func TestUserConfigValidate_enums(t *testing.T) {
|
||||
})
|
||||
},
|
||||
testCases: []testCase{
|
||||
{value: "", valid: false},
|
||||
{value: "1,2,3", valid: false},
|
||||
// The number of entries no longer has to match the number of side
|
||||
// panels, so only the validity of the individual keys matters.
|
||||
{value: "1,2,3", valid: true},
|
||||
{value: "1,2,3,4,5", valid: true},
|
||||
{value: "1,2,3,4,5,6", valid: true},
|
||||
{value: "1,2,3,4,invalid", valid: false},
|
||||
{value: "1,2,3,4,5,6", valid: false},
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -323,3 +324,70 @@ func TestUserConfigValidate_spinnerFrames(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestUserConfigValidate_sidePanels(t *testing.T) {
|
||||
scenarios := []struct {
|
||||
name string
|
||||
panels []SidePanel
|
||||
valid bool
|
||||
}{
|
||||
{name: "default layout", panels: []SidePanel{{"status"}, {"files", "worktrees", "submodules"}, {"branches", "remotes", "tags"}, {"commits", "reflog"}, {"stash"}}, valid: true},
|
||||
{name: "reordered", panels: []SidePanel{{"status"}, {"files"}, {"commits"}, {"branches"}, {"stash"}}, valid: true},
|
||||
{name: "hidden stash panel", panels: []SidePanel{{"status"}, {"files"}, {"branches"}, {"commits"}}, valid: true},
|
||||
{name: "promoted tab", panels: []SidePanel{{"files", "submodules"}, {"worktrees"}, {"branches"}, {"commits"}}, valid: true},
|
||||
{name: "core panels only", panels: []SidePanel{{"files"}, {"branches"}, {"commits"}}, valid: true},
|
||||
{name: "empty", panels: []SidePanel{}, valid: false},
|
||||
{name: "empty panel", panels: []SidePanel{{"files"}, {"branches"}, {"commits"}, {}}, valid: false},
|
||||
{name: "unknown name", panels: []SidePanel{{"files"}, {"branches"}, {"commits"}, {"bogus"}}, valid: false},
|
||||
{name: "duplicate within panel", panels: []SidePanel{{"files", "files"}, {"branches"}, {"commits"}}, valid: false},
|
||||
{name: "duplicate across panels", panels: []SidePanel{{"files"}, {"branches", "files"}, {"commits"}}, valid: false},
|
||||
{name: "missing files", panels: []SidePanel{{"branches"}, {"commits"}}, valid: false},
|
||||
{name: "missing branches", panels: []SidePanel{{"files"}, {"commits"}}, valid: false},
|
||||
{name: "missing commits", panels: []SidePanel{{"files"}, {"branches"}}, valid: false},
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
t.Run(s.name, func(t *testing.T) {
|
||||
config := GetDefaultConfig()
|
||||
config.Gui.SidePanels = s.panels
|
||||
err := config.Validate()
|
||||
|
||||
if s.valid {
|
||||
assert.NoError(t, err)
|
||||
} else {
|
||||
assert.Error(t, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestUserConfigValidate_pagers(t *testing.T) {
|
||||
scenarios := []struct {
|
||||
name string
|
||||
pager PagingConfig
|
||||
valid bool
|
||||
}{
|
||||
{name: "empty", pager: PagingConfig{}, valid: true},
|
||||
{name: "pager only", pager: PagingConfig{Pager: "delta"}, valid: true},
|
||||
{name: "external diff command only", pager: PagingConfig{ExternalDiffCommand: "difft"}, valid: true},
|
||||
{name: "git config external diff only", pager: PagingConfig{UseExternalDiffGitConfig: true}, valid: true},
|
||||
{name: "pager and external diff command", pager: PagingConfig{Pager: "delta", ExternalDiffCommand: "difft"}, valid: false},
|
||||
{name: "pager and git config external diff", pager: PagingConfig{Pager: "delta", UseExternalDiffGitConfig: true}, valid: false},
|
||||
{name: "both external diff mechanisms", pager: PagingConfig{ExternalDiffCommand: "difft", UseExternalDiffGitConfig: true}, valid: false},
|
||||
{name: "all three", pager: PagingConfig{Pager: "delta", ExternalDiffCommand: "difft", UseExternalDiffGitConfig: true}, valid: false},
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
t.Run(s.name, func(t *testing.T) {
|
||||
config := GetDefaultConfig()
|
||||
config.Git.Pagers = []PagingConfig{s.pager}
|
||||
err := config.Validate()
|
||||
|
||||
if s.valid {
|
||||
assert.NoError(t, err)
|
||||
} else {
|
||||
assert.Error(t, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
+229
-14
@@ -19,6 +19,21 @@ type escapeInterpreter struct {
|
||||
mode OutputMode
|
||||
instruction instruction
|
||||
hyperlink strings.Builder
|
||||
|
||||
// ConPTY emits cursor-positioning escapes (CUP) to skip over blank
|
||||
// rows rather than emitting LFs for them. To convert those into row
|
||||
// advances the view can act on, we track where in the pseudo-terminal
|
||||
// screen the cursor currently is. 1-based to match the escape
|
||||
// sequences.
|
||||
//
|
||||
// We also have to track the column, but only well enough to count
|
||||
// soft-wraps when written content runs past the right edge: ConPTY's
|
||||
// CUPs are addressed against its post-wrap screen, so a logical line
|
||||
// long enough to wrap in ConPTY's screen counts for two rows from the
|
||||
// next CUP's perspective. Column accuracy past wrap-counting isn't
|
||||
// modelled — we don't track the col argument of CUPs, and most
|
||||
// pager-style emitters use col 1 anyway.
|
||||
screenRow, screenCol int
|
||||
}
|
||||
|
||||
type (
|
||||
@@ -32,6 +47,21 @@ type eraseInLineFromCursor struct{}
|
||||
|
||||
func (self eraseInLineFromCursor) isInstruction() {}
|
||||
|
||||
// cursorDown asks the view to advance N rows. Emitted when CUP / CUD /
|
||||
// CNL / VPA targets a row past the current one; backward moves are
|
||||
// ignored because the view's buffer is line-based and can't undo.
|
||||
type cursorDown struct{ n int }
|
||||
|
||||
func (self cursorDown) isInstruction() {}
|
||||
|
||||
// cursorForward asks the view to materialize N space cells. Emitted
|
||||
// when CUF advances the cursor right — ConPTY uses CUF (often paired
|
||||
// with ECH) to encode runs of default-colored spaces compactly, so we
|
||||
// have to render the gap, not just bump a counter.
|
||||
type cursorForward struct{ n int }
|
||||
|
||||
func (self cursorForward) isInstruction() {}
|
||||
|
||||
type noInstruction struct{}
|
||||
|
||||
func (self noInstruction) isInstruction() {}
|
||||
@@ -42,6 +72,7 @@ const (
|
||||
stateCharacterSetDesignation
|
||||
stateCSI
|
||||
stateParams
|
||||
stateCSIDiscard
|
||||
stateOSC
|
||||
stateOSCWaitForParams
|
||||
stateOSCParams
|
||||
@@ -66,8 +97,6 @@ const (
|
||||
var (
|
||||
errNotCSI = errors.New("Not a CSI escape sequence")
|
||||
errCSIParseError = errors.New("CSI escape sequence parsing error")
|
||||
errCSITooLong = errors.New("CSI escape sequence is too long")
|
||||
errOSCParseError = errors.New("OSC escape sequence parsing error")
|
||||
)
|
||||
|
||||
// characters in case of error will output the non-parsed characters as a string.
|
||||
@@ -100,11 +129,15 @@ func newEscapeInterpreter(mode OutputMode) *escapeInterpreter {
|
||||
curBgColor: ColorDefault,
|
||||
mode: mode,
|
||||
instruction: noInstruction{},
|
||||
screenRow: 1,
|
||||
screenCol: 1,
|
||||
}
|
||||
return ei
|
||||
}
|
||||
|
||||
// reset sets the escapeInterpreter in initial state.
|
||||
// reset sets the escapeInterpreter in initial state. Note: this only resets
|
||||
// escape-parsing state. Screen cursor state survives so that mid-stream
|
||||
// malformed escapes don't desync the row tracking from the view.
|
||||
func (ei *escapeInterpreter) reset() {
|
||||
ei.state = stateNone
|
||||
ei.curFgColor = ColorDefault
|
||||
@@ -112,6 +145,80 @@ func (ei *escapeInterpreter) reset() {
|
||||
ei.csiParam = nil
|
||||
}
|
||||
|
||||
// resetScreenCursor returns the screen-cursor tracking to the top of the
|
||||
// pseudo-terminal screen. Called when the view is rewound before a fresh pty
|
||||
// render, and on cursor-home (which ConPTY emits at the start of each screen)
|
||||
// for views that aren't rewound in lockstep — see the CUP handling in parseOne.
|
||||
func (ei *escapeInterpreter) resetScreenCursor() {
|
||||
ei.screenRow = 1
|
||||
ei.screenCol = 1
|
||||
}
|
||||
|
||||
// notifyRowAdvance must be called by the view whenever it advances to the
|
||||
// next row in response to an LF / CRLF outside of an escape sequence
|
||||
// (i.e. the row transitions the parser doesn't see directly). Keeps the
|
||||
// parser's notion of the current screen row in sync with the view.
|
||||
func (ei *escapeInterpreter) notifyRowAdvance() {
|
||||
ei.screenRow++
|
||||
ei.screenCol = 1
|
||||
}
|
||||
|
||||
// notifyColumnReset must be called when the view processes a bare CR
|
||||
// (column reset without row advance). Keeps screenCol in sync so wrap
|
||||
// counting starts over from col 1.
|
||||
func (ei *escapeInterpreter) notifyColumnReset() {
|
||||
ei.screenCol = 1
|
||||
}
|
||||
|
||||
// notifyCellsWritten must be called after the view writes visible cells
|
||||
// to its buffer. Advances the parser's idea of the cursor by `width`
|
||||
// columns; if that crosses the right edge of a `screenColMax`-wide pty
|
||||
// screen, the corresponding number of soft-wraps are added to screenRow
|
||||
// so subsequent CUPs land on the right line.
|
||||
func (ei *escapeInterpreter) notifyCellsWritten(width, screenColMax int) {
|
||||
if screenColMax <= 0 {
|
||||
return
|
||||
}
|
||||
// One column at a time: matches ConPTY's "pending wrap" semantics
|
||||
// where the cursor stays at col max+1 after writing the rightmost
|
||||
// cell and only wraps on the next cell. Loops over individual
|
||||
// columns rather than doing the math in one shot so wide cells on a
|
||||
// row boundary still wrap cleanly.
|
||||
for range width {
|
||||
if ei.screenCol > screenColMax {
|
||||
ei.screenRow++
|
||||
ei.screenCol = 1
|
||||
}
|
||||
ei.screenCol++
|
||||
}
|
||||
}
|
||||
|
||||
// emitCursorAdvance schedules a cursorDown instruction for the next time
|
||||
// the view checks ei.instruction, advancing the parser's screen row by
|
||||
// the same amount. n <= 0 is a no-op (backward / same-row CUPs are
|
||||
// ignored — the view's buffer is line-based and can't undo).
|
||||
func (ei *escapeInterpreter) emitCursorAdvance(n int) {
|
||||
if n <= 0 {
|
||||
return
|
||||
}
|
||||
ei.instruction = cursorDown{n: n}
|
||||
ei.screenRow += n
|
||||
ei.screenCol = 1
|
||||
}
|
||||
|
||||
// firstParamOrDefault returns the first CSI parameter parsed as an int,
|
||||
// or dflt if it's absent / empty / unparseable.
|
||||
func (ei *escapeInterpreter) firstParamOrDefault(dflt int) int {
|
||||
if len(ei.csiParam) == 0 || ei.csiParam[0] == "" {
|
||||
return dflt
|
||||
}
|
||||
n, err := strconv.Atoi(ei.csiParam[0])
|
||||
if err != nil {
|
||||
return dflt
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (ei *escapeInterpreter) instructionRead() {
|
||||
ei.instruction = noInstruction{}
|
||||
}
|
||||
@@ -120,12 +227,13 @@ func (ei *escapeInterpreter) instructionRead() {
|
||||
// is part of an escape sequence, and as such should not be printed verbatim. Otherwise, it's not an
|
||||
// escape sequence.
|
||||
func (ei *escapeInterpreter) parseOne(ch []byte) (isEscape bool, err error) {
|
||||
// Sanity checks
|
||||
if len(ei.csiParam) > 20 {
|
||||
return false, errCSITooLong
|
||||
}
|
||||
if len(ei.csiParam) > 0 && len(ei.csiParam[len(ei.csiParam)-1]) > 255 {
|
||||
return false, errCSITooLong
|
||||
// Sanity checks: if a sequence has grown absurdly long, stop
|
||||
// accumulating state and just swallow bytes until its final byte —
|
||||
// much better than leaking the accumulated garbage into the view.
|
||||
if len(ei.csiParam) > 20 || (len(ei.csiParam) > 0 && len(ei.csiParam[len(ei.csiParam)-1]) > 255) {
|
||||
ei.state = stateCSIDiscard
|
||||
ei.csiParam = nil
|
||||
return true, nil
|
||||
}
|
||||
|
||||
ei.curch = string(ch)
|
||||
@@ -151,6 +259,12 @@ func (ei *escapeInterpreter) parseOne(ch []byte) (isEscape bool, err error) {
|
||||
characterEquals(ch, '+'):
|
||||
ei.state = stateCharacterSetDesignation
|
||||
return true, nil
|
||||
case len(ch) == 1 && ch[0] >= 0x30 && ch[0] <= 0x7E:
|
||||
// Single-byte ESC sequence (e.g. ESC c = RIS). We don't
|
||||
// interpret these, but we must consume them so they don't
|
||||
// leak into the view as literal text.
|
||||
ei.state = stateNone
|
||||
return true, nil
|
||||
default:
|
||||
return false, errNotCSI
|
||||
}
|
||||
@@ -164,8 +278,38 @@ func (ei *escapeInterpreter) parseOne(ch []byte) (isEscape bool, err error) {
|
||||
ei.csiParam = append(ei.csiParam, "")
|
||||
case characterEquals(ch, 'm'):
|
||||
ei.csiParam = append(ei.csiParam, "0")
|
||||
case characterEquals(ch, 'K'):
|
||||
// fall through
|
||||
case characterEquals(ch, 'K'),
|
||||
characterEquals(ch, 'H'), characterEquals(ch, 'f'), characterEquals(ch, 'd'),
|
||||
characterEquals(ch, 'B'), characterEquals(ch, 'E'),
|
||||
characterEquals(ch, 'C'):
|
||||
// fall through — let stateParams handle these with default
|
||||
// params (CUP/VPA default to row 1, CUD/CNL/CUF default to
|
||||
// advance by 1).
|
||||
case characterEquals(ch, ';'):
|
||||
// Empty first param ([;Xm ≡ [0;Xm). Seed a slot for the
|
||||
// empty param; stateParams will append the next one when it
|
||||
// re-reads this ';' via the fallthrough.
|
||||
ei.csiParam = append(ei.csiParam, "")
|
||||
case len(ch) == 1 && ch[0] >= 0x3C && ch[0] <= 0x3F:
|
||||
// Private-mode prefix byte (<, =, >, ?). We don't interpret
|
||||
// DEC private-mode sequences, but must consume them so they
|
||||
// don't leak into the view as literal text. Seed an empty
|
||||
// param so the subsequent digits land on a valid slot.
|
||||
ei.csiParam = append(ei.csiParam, "")
|
||||
ei.state = stateParams
|
||||
return true, nil
|
||||
case len(ch) == 1 && ch[0] >= 0x20 && ch[0] <= 0x2F:
|
||||
// CSI intermediate byte. A sequence with intermediates is
|
||||
// one we don't implement; consume the rest until the final
|
||||
// byte.
|
||||
ei.state = stateCSIDiscard
|
||||
ei.csiParam = nil
|
||||
return true, nil
|
||||
case len(ch) == 1 && ch[0] >= 0x40 && ch[0] <= 0x7E:
|
||||
// Valid CSI final byte we don't implement — swallow.
|
||||
ei.state = stateNone
|
||||
ei.csiParam = nil
|
||||
return true, nil
|
||||
default:
|
||||
return false, errCSIParseError
|
||||
}
|
||||
@@ -180,10 +324,16 @@ func (ei *escapeInterpreter) parseOne(ch []byte) (isEscape bool, err error) {
|
||||
ei.csiParam = append(ei.csiParam, "")
|
||||
return true, nil
|
||||
case characterEquals(ch, 'm'):
|
||||
// outputCSI applies params left-to-right and mutates as it
|
||||
// goes, so on failure some leading params may already have
|
||||
// taken effect (e.g. `[1;;m` would leave AttrBold set before
|
||||
// hitting the empty param). Snapshot the colors beforehand
|
||||
// and restore them on error so a malformed SGR is truly a
|
||||
// no-op rather than a partial apply.
|
||||
savedFg, savedBg := ei.curFgColor, ei.curBgColor
|
||||
if err := ei.outputCSI(); err != nil {
|
||||
return false, errCSIParseError
|
||||
ei.curFgColor, ei.curBgColor = savedFg, savedBg
|
||||
}
|
||||
|
||||
ei.state = stateNone
|
||||
ei.csiParam = nil
|
||||
return true, nil
|
||||
@@ -203,12 +353,71 @@ func (ei *escapeInterpreter) parseOne(ch []byte) (isEscape bool, err error) {
|
||||
ei.instruction = noInstruction{}
|
||||
}
|
||||
|
||||
ei.state = stateNone
|
||||
ei.csiParam = nil
|
||||
return true, nil
|
||||
case characterEquals(ch, 'H'), characterEquals(ch, 'f'),
|
||||
characterEquals(ch, 'd'):
|
||||
// CUP / HVP (absolute (row, col), col ignored) or VPA (absolute row).
|
||||
targetRow := ei.firstParamOrDefault(1)
|
||||
if targetRow <= 1 {
|
||||
// Cursor home. ConPTY emits this (after [2J) at the start of
|
||||
// every screen, so it marks where ConPTY's coordinate origin
|
||||
// now sits. Re-anchor our row tracking to the current write
|
||||
// position rather than treating it as a backward move: a view
|
||||
// that isn't rewound in lockstep with ConPTY's screen (the
|
||||
// command log) would otherwise carry stale drift, making every
|
||||
// later absolute CUP compute a negative, dropped advance and
|
||||
// collapsing the blank rows ConPTY positioned with.
|
||||
ei.resetScreenCursor()
|
||||
} else {
|
||||
// Skip forward to the target row; ignore backward moves.
|
||||
ei.emitCursorAdvance(targetRow - ei.screenRow)
|
||||
}
|
||||
ei.state = stateNone
|
||||
ei.csiParam = nil
|
||||
return true, nil
|
||||
case characterEquals(ch, 'B'), characterEquals(ch, 'E'):
|
||||
// CUD / CNL — relative row advance by N. CNL also resets
|
||||
// the column, which we don't track, so the two are
|
||||
// equivalent for our purposes.
|
||||
ei.emitCursorAdvance(ei.firstParamOrDefault(1))
|
||||
ei.state = stateNone
|
||||
ei.csiParam = nil
|
||||
return true, nil
|
||||
case characterEquals(ch, 'C'):
|
||||
// CUF — cursor forward N. Emit space cells so the gap
|
||||
// renders. (screenCol is updated by the view via
|
||||
// notifyCellsWritten as those spaces are emitted.)
|
||||
ei.instruction = cursorForward{n: ei.firstParamOrDefault(1)}
|
||||
ei.state = stateNone
|
||||
ei.csiParam = nil
|
||||
return true, nil
|
||||
case len(ch) == 1 && ch[0] >= 0x20 && ch[0] <= 0x2F:
|
||||
// CSI intermediate byte after params. The final byte will
|
||||
// have a semantic we don't implement (e.g. `[0 q` =
|
||||
// DECSCUSR); consume everything until it arrives.
|
||||
ei.state = stateCSIDiscard
|
||||
ei.csiParam = nil
|
||||
return true, nil
|
||||
case len(ch) == 1 && ch[0] >= 0x40 && ch[0] <= 0x7E:
|
||||
// Valid CSI final byte we don't implement — swallow the
|
||||
// whole sequence rather than printing it as text.
|
||||
ei.state = stateNone
|
||||
ei.csiParam = nil
|
||||
return true, nil
|
||||
default:
|
||||
return false, errCSIParseError
|
||||
}
|
||||
case stateCSIDiscard:
|
||||
// Consume the rest of a CSI sequence whose semantic we don't
|
||||
// interpret (one with intermediate bytes, or one the sanity
|
||||
// checks at the top of parseOne bailed out of). Any byte in the
|
||||
// final-byte range ends it.
|
||||
if len(ch) == 1 && ch[0] >= 0x40 && ch[0] <= 0x7E {
|
||||
ei.state = stateNone
|
||||
}
|
||||
return true, nil
|
||||
case stateOSC:
|
||||
if characterEquals(ch, '8') {
|
||||
ei.state = stateOSCWaitForParams
|
||||
@@ -220,7 +429,13 @@ func (ei *escapeInterpreter) parseOne(ch []byte) (isEscape bool, err error) {
|
||||
return true, nil
|
||||
case stateOSCWaitForParams:
|
||||
if !characterEquals(ch, ';') {
|
||||
return true, errOSCParseError
|
||||
// Malformed OSC 8 (expected ';' after '8'). Rather than
|
||||
// erroring — which would reset state mid-OSC and cause the
|
||||
// rest of the sequence to leak as literal text — treat the
|
||||
// whole OSC as one we don't understand and skip to its
|
||||
// terminator.
|
||||
ei.state = stateOSCSkipUnknown
|
||||
return true, nil
|
||||
}
|
||||
|
||||
ei.state = stateOSCParams
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package gocui
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -150,6 +151,121 @@ func TestParseOneColours(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseOneIgnoresUnknownSequences(t *testing.T) {
|
||||
// Escape sequences the interpreter doesn't implement -- whether well-formed-but-unsupported
|
||||
// (private modes, DECSCUSR, …) or outright malformed -- must be silently
|
||||
// consumed rather than leaked into the view as literal text.
|
||||
scenarios := []string{
|
||||
"\x1b[?9001h", // DEC private-mode set (?-prefix)
|
||||
"\x1b[?25l", // hide cursor
|
||||
"\x1b[?25h", // show cursor
|
||||
"\x1b[2;J", // erase display (unusual 2;J variant)
|
||||
"\x1b[H", // cursor home — re-anchors to row 1 (no-op when already there)
|
||||
"\x1bc", // RIS — single-char ESC sequence
|
||||
"\x1b[;5H", // empty first param — defaults to row 1, no-op
|
||||
"\x1b[ q", // intermediate byte with no params (DECSCUSR family)
|
||||
"\x1b[0 q", // intermediate byte after a param
|
||||
"\x1b[1;;m", // malformed SGR: empty middle param
|
||||
"\x1b]8bogus\x07", // OSC 8 missing ';'
|
||||
"\x1b[" + strings.Repeat("0", 300) + "m", // single param overflows length cap
|
||||
"\x1b[" + strings.Repeat("1;", 25) + "1m", // too many params
|
||||
}
|
||||
|
||||
for _, input := range scenarios {
|
||||
ei := newEscapeInterpreter(OutputNormal)
|
||||
parseEscRunes(t, ei, input)
|
||||
// An unimplemented/malformed sequence must leave no trace: no
|
||||
// pending instruction, no color change.
|
||||
_, noop := ei.instruction.(noInstruction)
|
||||
assert.True(t, noop, "input %q left a pending instruction", input)
|
||||
assert.Equal(t, ColorDefault, ei.curFgColor, "input %q mutated fg color", input)
|
||||
assert.Equal(t, ColorDefault, ei.curBgColor, "input %q mutated bg color", input)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseOneCursorPositioning(t *testing.T) {
|
||||
// Cursor-positioning escapes that advance the row forward emit a
|
||||
// cursorDown instruction; backward / same-row moves are ignored
|
||||
// because the view's buffer is line-based.
|
||||
scenarios := []struct {
|
||||
input string
|
||||
startRow int // parser's screenRow before parsing
|
||||
wantAdvance int // 0 means "no instruction emitted"
|
||||
}{
|
||||
{"\x1b[5;1H", 1, 4}, // CUP — absolute row 5 from row 1
|
||||
{"\x1b[5H", 1, 4}, // CUP with only the row param
|
||||
{"\x1b[5;1H", 5, 0}, // CUP to the same row we're on — no-op
|
||||
{"\x1b[2;1H", 5, 0}, // CUP backward — ignored
|
||||
{"\x1b[5;1f", 1, 4}, // HVP alias for CUP
|
||||
{"\x1b[5d", 1, 4}, // VPA — absolute row
|
||||
{"\x1b[2d", 5, 0}, // VPA backward — ignored
|
||||
{"\x1b[3B", 1, 3}, // CUD — relative
|
||||
{"\x1b[B", 1, 1}, // CUD with default param of 1
|
||||
{"\x1b[2E", 1, 2}, // CNL — relative
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
ei := newEscapeInterpreter(OutputNormal)
|
||||
ei.screenRow = s.startRow
|
||||
parseEscRunes(t, ei, s.input)
|
||||
if s.wantAdvance == 0 {
|
||||
_, noop := ei.instruction.(noInstruction)
|
||||
assert.True(t, noop, "input %q at row %d should be a no-op", s.input, s.startRow)
|
||||
} else {
|
||||
cd, ok := ei.instruction.(cursorDown)
|
||||
if assert.True(t, ok, "input %q at row %d should emit cursorDown", s.input, s.startRow) {
|
||||
assert.Equal(t, s.wantAdvance, cd.n, "input %q at row %d", s.input, s.startRow)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseOneCursorHomeReanchors(t *testing.T) {
|
||||
// ConPTY emits cursor-home ([H) after [2J at the start of every screen.
|
||||
// In a view that isn't rewound in lockstep with ConPTY (the command log)
|
||||
// screenRow has drifted, so home must re-anchor it to the current write
|
||||
// position rather than be dropped as a backward move — otherwise the
|
||||
// absolute CUPs that follow compute negative, dropped advances and the
|
||||
// rows ConPTY positioned with collapse together.
|
||||
ei := newEscapeInterpreter(OutputNormal)
|
||||
ei.screenRow = 12 // accumulated drift from earlier command-log output
|
||||
|
||||
parseEscRunes(t, ei, "\x1b[H")
|
||||
assert.Equal(t, 1, ei.screenRow, "home should re-anchor screenRow")
|
||||
_, noop := ei.instruction.(noInstruction)
|
||||
assert.True(t, noop, "home should not emit an instruction")
|
||||
|
||||
// A subsequent CUP now advances relative to the re-anchored origin.
|
||||
parseEscRunes(t, ei, "\x1b[3;1H")
|
||||
cd, ok := ei.instruction.(cursorDown)
|
||||
if assert.True(t, ok, "CUP after home should emit cursorDown") {
|
||||
assert.Equal(t, 2, cd.n)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseOneCursorForward(t *testing.T) {
|
||||
// CUF (\x1b[NC) emits a cursorForward instruction so the view can
|
||||
// materialize the N-cell gap as spaces. ConPTY uses this (often
|
||||
// paired with ECH) to encode runs of default-colored spaces.
|
||||
scenarios := []struct {
|
||||
input string
|
||||
wantN int
|
||||
}{
|
||||
{"\x1b[5C", 5},
|
||||
{"\x1b[1C", 1},
|
||||
{"\x1b[C", 1}, // no param defaults to 1
|
||||
}
|
||||
|
||||
for _, s := range scenarios {
|
||||
ei := newEscapeInterpreter(OutputNormal)
|
||||
parseEscRunes(t, ei, s.input)
|
||||
cf, ok := ei.instruction.(cursorForward)
|
||||
if assert.True(t, ok, "input %q should emit cursorForward", s.input) {
|
||||
assert.Equal(t, s.wantN, cf.n, "input %q", s.input)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func parseEscRunes(t *testing.T, ei *escapeInterpreter, runes string) {
|
||||
t.Helper()
|
||||
for _, b := range []byte(runes) {
|
||||
|
||||
+135
-24
@@ -9,11 +9,13 @@ import (
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/gdamore/tcell/v3"
|
||||
"github.com/go-errors/errors"
|
||||
"github.com/jesseduffield/generics/set"
|
||||
"github.com/petermattis/goid"
|
||||
"github.com/rivo/uniseg"
|
||||
"github.com/samber/lo"
|
||||
)
|
||||
@@ -103,6 +105,7 @@ type replayedEvents struct {
|
||||
Keys chan *TcellKeyEventWrapper
|
||||
Resizes chan *TcellResizeEventWrapper
|
||||
MouseEvents chan *TcellMouseEventWrapper
|
||||
FocusEvents chan *TcellFocusEventWrapper
|
||||
}
|
||||
|
||||
type RecordingConfig struct {
|
||||
@@ -192,7 +195,18 @@ type Gui struct {
|
||||
|
||||
taskManager *TaskManager
|
||||
|
||||
// The task of the event currently being processed on the main goroutine, if
|
||||
// any. Only touched from the main goroutine (in processEvent). It's excluded
|
||||
// from the Busy() check so that an event handler asking "is anything else
|
||||
// busy?" doesn't count itself.
|
||||
currentTask Task
|
||||
|
||||
lastHoverView *View
|
||||
|
||||
// uiThreadID is the goroutine id of the main event loop, recorded when
|
||||
// MainLoop starts. IsUIThread compares against it. Written once, read from
|
||||
// worker goroutines, so it's atomic.
|
||||
uiThreadID atomic.Int64
|
||||
}
|
||||
|
||||
type NewGuiOpts struct {
|
||||
@@ -237,7 +251,12 @@ func NewGui(opts NewGuiOpts) (*Gui, error) {
|
||||
g.stop = make(chan struct{})
|
||||
|
||||
g.gEvents = make(chan GocuiEvent, 20)
|
||||
g.userEvents = make(chan userEvent, 20)
|
||||
// Update does a non-blocking send and panics on a full channel rather than
|
||||
// blocking (which would deadlock the UI goroutine against itself) or
|
||||
// silently reordering. The buffer is sized well above the peak occupancy we
|
||||
// see in practice, so the panic stays unreachable in normal use; if it ever
|
||||
// fires, that's a real anomaly to investigate, not a cue to grow the buffer.
|
||||
g.userEvents = make(chan userEvent, 256)
|
||||
g.taskManager = newTaskManager()
|
||||
|
||||
if opts.PlayRecording {
|
||||
@@ -245,6 +264,7 @@ func NewGui(opts NewGuiOpts) (*Gui, error) {
|
||||
Keys: make(chan *TcellKeyEventWrapper),
|
||||
Resizes: make(chan *TcellResizeEventWrapper),
|
||||
MouseEvents: make(chan *TcellMouseEventWrapper),
|
||||
FocusEvents: make(chan *TcellFocusEventWrapper),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +286,22 @@ func NewGui(opts NewGuiOpts) (*Gui, error) {
|
||||
}
|
||||
|
||||
func (g *Gui) NewTask() *TaskImpl {
|
||||
return g.taskManager.NewTask()
|
||||
return g.taskManager.NewTask(false)
|
||||
}
|
||||
|
||||
// NewBackgroundTask creates a task that is tracked for idle detection but does
|
||||
// not count towards the program being busy for repo-switch safety. See
|
||||
// TaskImpl.background.
|
||||
func (g *Gui) NewBackgroundTask() *TaskImpl {
|
||||
return g.taskManager.NewTask(true)
|
||||
}
|
||||
|
||||
// Busy reports whether any foreground work is in flight, ignoring the event
|
||||
// currently being processed on the main goroutine (see currentTask). Background
|
||||
// routines (auto-fetch etc.) don't count. It's used to decide whether it's safe
|
||||
// to switch repos. Must be called on the main goroutine.
|
||||
func (g *Gui) Busy() bool {
|
||||
return g.taskManager.hasBusyForegroundTaskExcept(g.currentTask)
|
||||
}
|
||||
|
||||
// An idle listener listens for when the program is idle. This is useful for
|
||||
@@ -611,36 +646,91 @@ type userEvent struct {
|
||||
contentOnly bool
|
||||
}
|
||||
|
||||
// Update executes the passed function. This method can be called safely from a
|
||||
// goroutine in order to update the GUI. It is important to note that the
|
||||
// passed function won't be executed immediately, instead it will be added to
|
||||
// the user events queue. Given that Update spawns a goroutine, the order in
|
||||
// which the user events will be handled is not guaranteed.
|
||||
// Update enqueues f on the user-events channel for the UI loop to run on its
|
||||
// next iteration. Multiple Update calls from the same goroutine arrive in
|
||||
// source order via the channel's FIFO. The send is non-blocking — if the
|
||||
// channel is full we panic rather than block or silently reorder, since a
|
||||
// blocked send from the UI goroutine would deadlock against itself and
|
||||
// silently switching to inline execution would break the ordering guarantee
|
||||
// callers rely on. The buffer is sized generously enough that this should
|
||||
// never fire in practice; if it does, that's a signal to investigate, not
|
||||
// to grow the buffer reflexively.
|
||||
func (g *Gui) Update(f func(*Gui) error) {
|
||||
task := g.NewTask()
|
||||
|
||||
go g.updateAsyncAux(f, task)
|
||||
g.update(f, false)
|
||||
}
|
||||
|
||||
// UpdateAsync is a version of Update that does not spawn a go routine, it can
|
||||
// be a bit more efficient in cases where Update is called many times like when
|
||||
// tailing a file. In general you should use Update()
|
||||
func (g *Gui) UpdateAsync(f func(*Gui) error) {
|
||||
task := g.NewTask()
|
||||
|
||||
g.updateAsyncAux(f, task)
|
||||
// Like Update, but the enqueued work is a background routine (or triggered by
|
||||
// one), so it doesn't count towards the program being busy for repo-switch
|
||||
// safety. See TaskImpl.background.
|
||||
func (g *Gui) UpdateBackground(f func(*Gui) error) {
|
||||
g.update(f, true)
|
||||
}
|
||||
|
||||
func (g *Gui) updateAsyncAux(f func(*Gui) error, task Task) {
|
||||
g.userEvents <- userEvent{f: f, task: task}
|
||||
func (g *Gui) update(f func(*Gui) error, background bool) {
|
||||
task := g.taskManager.NewTask(background)
|
||||
|
||||
select {
|
||||
case g.userEvents <- userEvent{f: f, task: task}:
|
||||
default:
|
||||
panic("gocui: userEvents channel full; refusing to block or reorder")
|
||||
}
|
||||
}
|
||||
|
||||
// Like Update, but signals that the callback only modifies content.
|
||||
func (g *Gui) UpdateContentOnly(f func(*Gui) error) {
|
||||
task := g.NewTask()
|
||||
g.updateContentOnly(f, false)
|
||||
}
|
||||
|
||||
// Like UpdateContentOnly, but for background work (see UpdateBackground).
|
||||
func (g *Gui) UpdateContentOnlyBackground(f func(*Gui) error) {
|
||||
g.updateContentOnly(f, true)
|
||||
}
|
||||
|
||||
func (g *Gui) updateContentOnly(f func(*Gui) error, background bool) {
|
||||
task := g.taskManager.NewTask(background)
|
||||
g.userEvents <- userEvent{f: f, task: task, contentOnly: true}
|
||||
}
|
||||
|
||||
// IsUIThread reports whether the caller is running on the main event-loop
|
||||
// goroutine (the one running MainLoop). It calls goid.Get, so use it only for
|
||||
// debug assertions, not to drive production control flow.
|
||||
func (g *Gui) IsUIThread() bool {
|
||||
return goid.Get() == g.uiThreadID.Load()
|
||||
}
|
||||
|
||||
// OnUIThreadAndWait runs f on the main event-loop goroutine and blocks the
|
||||
// caller until f has run, returning f's error. Use it to read UI-thread-owned
|
||||
// state (the model, contexts) from a worker without racing the UI thread.
|
||||
//
|
||||
// It must be called from a worker goroutine, never from the UI thread itself:
|
||||
// the UI thread would block waiting for a callback only it can run, which
|
||||
// deadlocks. Callers arrange this by construction (see the refresh helper's
|
||||
// RefreshFromWorker); a debug-only assertion there guards against getting it
|
||||
// wrong.
|
||||
func (g *Gui) OnUIThreadAndWait(f func() error) error {
|
||||
return g.onUIThreadAndWait(f, false)
|
||||
}
|
||||
|
||||
// Like OnUIThreadAndWait, but the enqueued work belongs to a background routine,
|
||||
// so it doesn't count towards the program being busy (see UpdateBackground).
|
||||
func (g *Gui) OnUIThreadAndWaitBackground(f func() error) error {
|
||||
return g.onUIThreadAndWait(f, true)
|
||||
}
|
||||
|
||||
func (g *Gui) onUIThreadAndWait(f func() error, background bool) error {
|
||||
enqueue := g.Update
|
||||
if background {
|
||||
enqueue = g.UpdateBackground
|
||||
}
|
||||
|
||||
result := make(chan error, 1)
|
||||
enqueue(func(*Gui) error {
|
||||
result <- f()
|
||||
return nil
|
||||
})
|
||||
return <-result
|
||||
}
|
||||
|
||||
// Calls a function in a goroutine. Handles panics gracefully and tracks
|
||||
// number of background tasks.
|
||||
// Always use this when you want to spawn a goroutine and you want lazygit to
|
||||
@@ -648,7 +738,18 @@ func (g *Gui) UpdateContentOnly(f func(*Gui) error) {
|
||||
// background goroutines where you wouldn't want lazygit to be considered busy
|
||||
// (i.e. when you wouldn't want a loader to be shown to the user)
|
||||
func (g *Gui) OnWorker(f func(Task) error) {
|
||||
task := g.NewTask()
|
||||
g.onWorker(f, false)
|
||||
}
|
||||
|
||||
// Like OnWorker, but for a background routine (or work triggered by one), so it
|
||||
// doesn't count towards the program being busy for repo-switch safety. See
|
||||
// TaskImpl.background.
|
||||
func (g *Gui) OnWorkerBackground(f func(Task) error) {
|
||||
g.onWorker(f, true)
|
||||
}
|
||||
|
||||
func (g *Gui) onWorker(f func(Task) error, background bool) {
|
||||
task := g.taskManager.NewTask(background)
|
||||
go func() {
|
||||
g.onWorkerAux(f, task)
|
||||
task.Done()
|
||||
@@ -712,6 +813,8 @@ func (g *Gui) SetManagerFunc(manager func(*Gui) error) {
|
||||
// MainLoop runs the main loop until an error is returned. A successful
|
||||
// finish should return ErrQuit.
|
||||
func (g *Gui) MainLoop() error {
|
||||
g.uiThreadID.Store(goid.Get())
|
||||
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
@@ -756,17 +859,25 @@ func (g *Gui) handleError(err error) error {
|
||||
func (g *Gui) processEvent() error {
|
||||
contentOnly := false
|
||||
|
||||
// currentTask is the task of the event we're about to handle; recording it
|
||||
// lets Busy() ignore it, so a handler asking "is anything else busy?" (the
|
||||
// repo-switch guard does) doesn't count itself. Handlers of the remaining
|
||||
// events drained below run with currentTask still set to this primary event;
|
||||
// that's fine because the only Busy() callers are keybinding handlers, which
|
||||
// are always the primary event here.
|
||||
select {
|
||||
case ev := <-g.gEvents:
|
||||
task := g.NewTask()
|
||||
defer func() { task.Done() }()
|
||||
g.currentTask = task
|
||||
defer func() { g.currentTask = nil; task.Done() }()
|
||||
|
||||
if err := g.handleError(g.handleEvent(&ev)); err != nil {
|
||||
return err
|
||||
}
|
||||
case ev := <-g.userEvents:
|
||||
contentOnly = ev.contentOnly
|
||||
defer func() { ev.task.Done() }()
|
||||
g.currentTask = ev.task
|
||||
defer func() { g.currentTask = nil; ev.task.Done() }()
|
||||
|
||||
if err := g.handleError(ev.f(g)); err != nil {
|
||||
return err
|
||||
@@ -1345,7 +1456,7 @@ func (g *Gui) onKey(ev *GocuiEvent) error {
|
||||
}
|
||||
|
||||
visibleLineWidth := 0
|
||||
for _, c := range v.lines[newY] {
|
||||
for _, c := range v.lines[newY].cells {
|
||||
visibleLineWidth += c.width
|
||||
}
|
||||
if visibleLineWidth < newX {
|
||||
|
||||
+21
-1
@@ -8,8 +8,9 @@ type Task interface {
|
||||
Done()
|
||||
Pause()
|
||||
Continue()
|
||||
// not exporting because we don't need to
|
||||
// not exporting these because we don't need to
|
||||
isBusy() bool
|
||||
isBackground() bool
|
||||
}
|
||||
|
||||
type TaskImpl struct {
|
||||
@@ -17,6 +18,17 @@ type TaskImpl struct {
|
||||
busy bool
|
||||
onDone func()
|
||||
withMutex func(func())
|
||||
// Background tasks don't count towards the program being "busy" for the
|
||||
// purpose of deciding whether a repo switch is safe (see
|
||||
// TaskManager.hasBusyForegroundTaskExcept). Two kinds of work are tagged
|
||||
// this way: the ongoing background routines (auto-fetch, files refresh,
|
||||
// external-change detection) and the refreshes they trigger, whose model
|
||||
// writes are already guarded against a concurrent repo switch by the repo
|
||||
// generation; and view-buffer content rendering, which only paints a view
|
||||
// and so is harmless to leave running across a switch. What stays
|
||||
// foreground is lazygit driving a git operation and applying its results
|
||||
// to the model — exactly the work a repo switch must not run underneath.
|
||||
background bool
|
||||
}
|
||||
|
||||
func (self *TaskImpl) Done() {
|
||||
@@ -39,6 +51,10 @@ func (self *TaskImpl) isBusy() bool {
|
||||
return self.busy
|
||||
}
|
||||
|
||||
func (self *TaskImpl) isBackground() bool {
|
||||
return self.background
|
||||
}
|
||||
|
||||
type TaskStatus int
|
||||
|
||||
const (
|
||||
@@ -73,6 +89,10 @@ func (self *FakeTask) isBusy() bool {
|
||||
return self.status == TaskStatusBusy
|
||||
}
|
||||
|
||||
func (self *FakeTask) isBackground() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (self *FakeTask) Status() TaskStatus {
|
||||
return self.status
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ func newTaskManager() *TaskManager {
|
||||
}
|
||||
}
|
||||
|
||||
func (self *TaskManager) NewTask() *TaskImpl {
|
||||
func (self *TaskManager) NewTask(background bool) *TaskImpl {
|
||||
self.mutex.Lock()
|
||||
defer self.mutex.Unlock()
|
||||
|
||||
@@ -30,12 +30,34 @@ func (self *TaskManager) NewTask() *TaskImpl {
|
||||
taskId := self.nextId
|
||||
|
||||
onDone := func() { self.delete(taskId) }
|
||||
task := &TaskImpl{id: taskId, busy: true, onDone: onDone, withMutex: self.withMutex}
|
||||
task := &TaskImpl{id: taskId, busy: true, background: background, onDone: onDone, withMutex: self.withMutex}
|
||||
self.tasks[taskId] = task
|
||||
|
||||
return task
|
||||
}
|
||||
|
||||
// hasBusyForegroundTaskExcept reports whether any task other than `ignore` is
|
||||
// currently busy and not a background task. It's used to decide whether a repo
|
||||
// switch is safe: a foreground operation (or the refresh it triggers, or that
|
||||
// refresh's follow-up callbacks) still in flight means the switch must wait, so
|
||||
// it doesn't run against a repo that's about to be swapped out.
|
||||
//
|
||||
// `ignore` is the event currently being processed on the UI thread — the switch
|
||||
// attempt itself — which is always busy and so must not count as a reason to
|
||||
// refuse itself.
|
||||
func (self *TaskManager) hasBusyForegroundTaskExcept(ignore Task) bool {
|
||||
self.mutex.Lock()
|
||||
defer self.mutex.Unlock()
|
||||
|
||||
for _, task := range self.tasks {
|
||||
if task != ignore && task.isBusy() && !task.isBackground() {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (self *TaskManager) addIdleListener(c chan struct{}) {
|
||||
self.idleListeners = append(self.idleListeners, c)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package gocui
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestTaskManagerHasBusyForegroundTaskExcept(t *testing.T) {
|
||||
t.Run("no tasks", func(t *testing.T) {
|
||||
tm := newTaskManager()
|
||||
assert.False(t, tm.hasBusyForegroundTaskExcept(nil))
|
||||
})
|
||||
|
||||
t.Run("a busy foreground task counts", func(t *testing.T) {
|
||||
tm := newTaskManager()
|
||||
tm.NewTask(false)
|
||||
assert.True(t, tm.hasBusyForegroundTaskExcept(nil))
|
||||
})
|
||||
|
||||
t.Run("a busy background task does not count", func(t *testing.T) {
|
||||
tm := newTaskManager()
|
||||
tm.NewTask(true)
|
||||
assert.False(t, tm.hasBusyForegroundTaskExcept(nil))
|
||||
})
|
||||
|
||||
t.Run("a done foreground task does not count", func(t *testing.T) {
|
||||
tm := newTaskManager()
|
||||
task := tm.NewTask(false)
|
||||
task.Done()
|
||||
assert.False(t, tm.hasBusyForegroundTaskExcept(nil))
|
||||
})
|
||||
|
||||
t.Run("a paused foreground task does not count", func(t *testing.T) {
|
||||
tm := newTaskManager()
|
||||
task := tm.NewTask(false)
|
||||
task.Pause()
|
||||
assert.False(t, tm.hasBusyForegroundTaskExcept(nil))
|
||||
})
|
||||
|
||||
t.Run("the ignored task does not count", func(t *testing.T) {
|
||||
tm := newTaskManager()
|
||||
task := tm.NewTask(false)
|
||||
assert.False(t, tm.hasBusyForegroundTaskExcept(task))
|
||||
})
|
||||
|
||||
t.Run("another foreground task counts even when one is ignored", func(t *testing.T) {
|
||||
tm := newTaskManager()
|
||||
ignored := tm.NewTask(false)
|
||||
tm.NewTask(false)
|
||||
assert.True(t, tm.hasBusyForegroundTaskExcept(ignored))
|
||||
})
|
||||
|
||||
t.Run("only a background task alongside the ignored current event", func(t *testing.T) {
|
||||
// This is the repo-switch case: the switch is handled as the current
|
||||
// event (ignored) while a background refresh is in flight; it must not
|
||||
// be considered busy.
|
||||
tm := newTaskManager()
|
||||
current := tm.NewTask(false)
|
||||
tm.NewTask(true)
|
||||
assert.False(t, tm.hasBusyForegroundTaskExcept(current))
|
||||
})
|
||||
}
|
||||
@@ -266,6 +266,22 @@ func (wrapper TcellResizeEventWrapper) toTcellEvent() tcell.Event {
|
||||
return tcell.NewEventResize(wrapper.Width, wrapper.Height)
|
||||
}
|
||||
|
||||
type TcellFocusEventWrapper struct {
|
||||
Timestamp int64
|
||||
Focused bool
|
||||
}
|
||||
|
||||
func NewTcellFocusEventWrapper(event *tcell.EventFocus, timestamp int64) *TcellFocusEventWrapper {
|
||||
return &TcellFocusEventWrapper{
|
||||
Timestamp: timestamp,
|
||||
Focused: event.Focused,
|
||||
}
|
||||
}
|
||||
|
||||
func (wrapper TcellFocusEventWrapper) toTcellEvent() tcell.Event {
|
||||
return tcell.NewEventFocus(wrapper.Focused)
|
||||
}
|
||||
|
||||
// pollEvent get tcell.Event and transform it into gocuiEvent
|
||||
func (g *Gui) pollEvent() GocuiEvent {
|
||||
var tev tcell.Event
|
||||
@@ -277,6 +293,8 @@ func (g *Gui) pollEvent() GocuiEvent {
|
||||
tev = (ev).toTcellEvent()
|
||||
case ev := <-g.ReplayedEvents.MouseEvents:
|
||||
tev = (ev).toTcellEvent()
|
||||
case ev := <-g.ReplayedEvents.FocusEvents:
|
||||
tev = (ev).toTcellEvent()
|
||||
}
|
||||
} else {
|
||||
tev = <-Screen.EventQ()
|
||||
|
||||
+193
-101
@@ -28,12 +28,12 @@ const (
|
||||
// position.
|
||||
type View struct {
|
||||
name string
|
||||
x0, y0, x1, y1 int // left top right bottom
|
||||
ox, oy int // view offsets
|
||||
cx, cy int // cursor position
|
||||
rx, ry int // Read() offsets
|
||||
wx, wy int // Write() offsets
|
||||
lines [][]cell // All the data
|
||||
x0, y0, x1, y1 int // left top right bottom
|
||||
ox, oy int // view offsets
|
||||
cx, cy int // cursor position
|
||||
rx, ry int // Read() offsets
|
||||
wx, wy int // Write() offsets
|
||||
lines []lineType // All the data
|
||||
outMode OutputMode
|
||||
// The y position of the first line of a range selection.
|
||||
// This is not relative to the view's origin: it is relative to the first line
|
||||
@@ -50,6 +50,14 @@ type View struct {
|
||||
// tained is true if the viewLines must be updated
|
||||
tainted bool
|
||||
|
||||
// firstDirtyLine is the index of the lowest line in `lines` that has been
|
||||
// written to or highlighted since viewLines was last refreshed, and whose
|
||||
// cached wrapping (lineType.wrappedCells) may therefore be stale. Lines
|
||||
// below it are unchanged and can reuse their cached wrapping instead of
|
||||
// being re-wrapped, which keeps refreshViewLinesIfNeeded cheap while
|
||||
// scrolling appends new lines to a long buffer.
|
||||
firstDirtyLine int
|
||||
|
||||
// the last position that the mouse was hovering over; nil if the mouse is outside of
|
||||
// this view, or not hovering over a cell
|
||||
lastHoverPosition *pos
|
||||
@@ -444,6 +452,38 @@ type SearchPosition struct {
|
||||
type viewLine struct {
|
||||
linesX, linesY int // coordinates relative to v.lines
|
||||
line []cell
|
||||
|
||||
// Colors used to extend the bg past this wrapped segment's content.
|
||||
// Derived at wrap time from the source line — see refreshViewLinesIfNeeded
|
||||
// for the per-segment rule.
|
||||
trailingFillAttributes *trailingFillAttributes
|
||||
}
|
||||
|
||||
// lineType is one of v.lines: the cells of a source line, plus optional
|
||||
// trailingFillAttributes recording the colors used to extend the bg
|
||||
// past the line's content when the writer emitted '\x1b[K'.
|
||||
type lineType struct {
|
||||
cells cells
|
||||
trailingFillAttributes *trailingFillAttributes
|
||||
|
||||
// wrappedCells caches the result of wrapping `cells` to `wrappedColumns`
|
||||
// columns, so that unchanged lines don't have to be re-wrapped on every
|
||||
// refreshViewLinesIfNeeded (which runs on every scroll event, via
|
||||
// ViewLinesHeight). Wrapping measures every cell's width and allocates, so
|
||||
// for a long buffer that dominates the cost of scrolling. The cache is used
|
||||
// only for lines below View.firstDirtyLine whose wrappedColumns still
|
||||
// matches the current width; nil means nothing is cached yet.
|
||||
wrappedCells [][]cell
|
||||
wrappedColumns int
|
||||
}
|
||||
|
||||
// trailingFillAttributes describes the fg/bg colors that draw() should
|
||||
// use for cells past the end of a wrapped segment's content. On a source
|
||||
// line this records what the writer asked for via '\x1b[K' (and so opts
|
||||
// the line in to trailing fill at all); the per-segment values on each
|
||||
// viewLine are derived from it at wrap time.
|
||||
type trailingFillAttributes struct {
|
||||
fg, bg Attribute
|
||||
}
|
||||
|
||||
type cell struct {
|
||||
@@ -453,7 +493,7 @@ type cell struct {
|
||||
hyperlink string
|
||||
}
|
||||
|
||||
type lineType []cell
|
||||
type cells []cell
|
||||
|
||||
func characterEquals(chr []byte, b byte) bool {
|
||||
return len(chr) == 1 && chr[0] == b
|
||||
@@ -464,7 +504,7 @@ func isCRLF(chr []byte) bool {
|
||||
}
|
||||
|
||||
// String returns a string from a given cell slice.
|
||||
func (l lineType) String() string {
|
||||
func (l cells) String() string {
|
||||
var str strings.Builder
|
||||
for _, c := range l {
|
||||
str.WriteString(c.chr)
|
||||
@@ -738,20 +778,20 @@ func (v *View) makeWriteable(x, y int) {
|
||||
}
|
||||
v.lines = v.lines[:newLen]
|
||||
} else {
|
||||
v.lines = append(v.lines, nil)
|
||||
v.lines = append(v.lines, lineType{})
|
||||
}
|
||||
}
|
||||
// cell `x` need not be index-able (that's why `<`)
|
||||
// append should be used by `lines[y]` user if he wants to write beyond `x`
|
||||
for len(v.lines[y]) < x {
|
||||
if cap(v.lines[y]) > len(v.lines[y]) {
|
||||
newLen := cap(v.lines[y])
|
||||
for len(v.lines[y].cells) < x {
|
||||
if cap(v.lines[y].cells) > len(v.lines[y].cells) {
|
||||
newLen := cap(v.lines[y].cells)
|
||||
if newLen > x {
|
||||
newLen = x
|
||||
}
|
||||
v.lines[y] = v.lines[y][:newLen]
|
||||
v.lines[y].cells = v.lines[y].cells[:newLen]
|
||||
} else {
|
||||
v.lines[y] = append(v.lines[y], cell{})
|
||||
v.lines[y].cells = append(v.lines[y].cells, cell{})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -761,7 +801,7 @@ func (v *View) makeWriteable(x, y int) {
|
||||
func (v *View) writeCells(cells []cell) {
|
||||
var newLen int
|
||||
// use maximum len available
|
||||
line := v.lines[v.wy][:cap(v.lines[v.wy])]
|
||||
line := v.lines[v.wy].cells[:cap(v.lines[v.wy].cells)]
|
||||
maxCopy := len(line) - v.wx
|
||||
if maxCopy < len(cells) {
|
||||
copy(line[v.wx:], cells[:maxCopy])
|
||||
@@ -770,11 +810,11 @@ func (v *View) writeCells(cells []cell) {
|
||||
} else { // maxCopy >= len(cells)
|
||||
copy(line[v.wx:], cells)
|
||||
newLen = v.wx + len(cells)
|
||||
if newLen < len(v.lines[v.wy]) {
|
||||
newLen = len(v.lines[v.wy])
|
||||
if newLen < len(v.lines[v.wy].cells) {
|
||||
newLen = len(v.lines[v.wy].cells)
|
||||
}
|
||||
}
|
||||
v.lines[v.wy] = line[:newLen]
|
||||
v.lines[v.wy].cells = line[:newLen]
|
||||
v.wx += len(cells)
|
||||
}
|
||||
|
||||
@@ -793,6 +833,9 @@ func (v *View) Write(p []byte) (n int, err error) {
|
||||
|
||||
func (v *View) write(p []byte) {
|
||||
v.tainted = true
|
||||
// write only ever touches lines from v.wy onwards, so any cached wrapping
|
||||
// below that stays valid.
|
||||
v.firstDirtyLine = min(v.firstDirtyLine, v.wy)
|
||||
v.clearHover()
|
||||
|
||||
// Fill with empty cells, if writing outside current view buffer
|
||||
@@ -800,26 +843,19 @@ func (v *View) write(p []byte) {
|
||||
|
||||
finishLine := func() {
|
||||
v.autoRenderHyperlinksInCurrentLine()
|
||||
if v.wx >= len(v.lines[v.wy]) {
|
||||
v.writeCells([]cell{{
|
||||
chr: "",
|
||||
width: 0,
|
||||
fgColor: 0,
|
||||
bgColor: 0,
|
||||
}})
|
||||
}
|
||||
}
|
||||
|
||||
advanceToNextLine := func() {
|
||||
v.wx = 0
|
||||
v.wy++
|
||||
if v.wy >= len(v.lines) {
|
||||
v.lines = append(v.lines, nil)
|
||||
v.lines = append(v.lines, lineType{})
|
||||
}
|
||||
}
|
||||
|
||||
if v.pendingNewline {
|
||||
advanceToNextLine()
|
||||
v.ei.notifyRowAdvance()
|
||||
v.pendingNewline = false
|
||||
}
|
||||
|
||||
@@ -841,17 +877,37 @@ func (v *View) write(p []byte) {
|
||||
case characterEquals(chr, '\n') || isCRLF(chr):
|
||||
finishLine()
|
||||
advanceToNextLine()
|
||||
v.ei.notifyRowAdvance()
|
||||
case characterEquals(chr, '\r'):
|
||||
finishLine()
|
||||
v.wx = 0
|
||||
v.ei.notifyColumnReset()
|
||||
default:
|
||||
truncateLine, cells := v.parseInput(chr, width, v.wx, v.wy)
|
||||
if cd, ok := v.ei.instruction.(cursorDown); ok {
|
||||
v.ei.instructionRead()
|
||||
for range cd.n {
|
||||
v.autoRenderHyperlinksInCurrentLine()
|
||||
advanceToNextLine()
|
||||
}
|
||||
}
|
||||
if cells == nil {
|
||||
continue
|
||||
}
|
||||
v.writeCells(cells)
|
||||
if truncateLine {
|
||||
v.lines[v.wy] = v.lines[v.wy][:v.wx]
|
||||
v.lines[v.wy].cells = v.lines[v.wy].cells[:v.wx]
|
||||
}
|
||||
// Soft-wrap tracking. truncateLine is true exactly when the
|
||||
// cells are from \x1b[K filling to end of line — ConPTY
|
||||
// doesn't advance the cursor for that, so we shouldn't count
|
||||
// it toward wraps either.
|
||||
if !truncateLine {
|
||||
totalWidth := 0
|
||||
for _, c := range cells {
|
||||
totalWidth += c.width
|
||||
}
|
||||
v.ei.notifyCellsWritten(totalWidth, v.InnerWidth())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -910,7 +966,7 @@ func (v *View) autoRenderHyperlinksInCurrentLine() {
|
||||
return
|
||||
}
|
||||
|
||||
line := v.lines[v.wy]
|
||||
line := v.lines[v.wy].cells
|
||||
start := 0
|
||||
for {
|
||||
linkStart := findLinkStart(line[start:])
|
||||
@@ -927,7 +983,7 @@ func (v *View) autoRenderHyperlinksInCurrentLine() {
|
||||
link.WriteString(line[linkEnd].chr)
|
||||
}
|
||||
for i := linkStart; i < linkEnd; i++ {
|
||||
v.lines[v.wy][i].hyperlink = link.String()
|
||||
v.lines[v.wy].cells[i].hyperlink = link.String()
|
||||
}
|
||||
start = linkEnd
|
||||
}
|
||||
@@ -955,16 +1011,27 @@ func (v *View) parseInput(ch []byte, width int, x int, _ int) (bool, []cell) {
|
||||
} else {
|
||||
repeatCount := 1
|
||||
if _, ok := v.ei.instruction.(eraseInLineFromCursor); ok {
|
||||
// fill rest of line
|
||||
// Discard any old content past the cursor and record the
|
||||
// fill colors so draw() paints the trailing area with them.
|
||||
// This extends the bg to the right edge in both the
|
||||
// content-fits and content-wraps cases — for the latter,
|
||||
// the metadata is what reaches every wrapped segment past
|
||||
// the last word.
|
||||
v.ei.instructionRead()
|
||||
cx := 0
|
||||
for _, cell := range v.lines[v.wy][0:v.wx] {
|
||||
cx += cell.width
|
||||
truncateLine = true
|
||||
v.lines[v.wy].trailingFillAttributes = &trailingFillAttributes{
|
||||
fg: v.ei.curFgColor,
|
||||
bg: v.ei.curBgColor,
|
||||
}
|
||||
repeatCount = v.InnerWidth() - cx
|
||||
return truncateLine, []cell{}
|
||||
} else if cf, ok := v.ei.instruction.(cursorForward); ok {
|
||||
// emit `n` space cells under the parser-tracked SGR — used
|
||||
// to materialize ConPTY's compressed runs of spaces (which
|
||||
// it emits as ECH+CUF instead of literal whitespace).
|
||||
v.ei.instructionRead()
|
||||
repeatCount = cf.n
|
||||
ch = []byte{' '}
|
||||
width = 1
|
||||
truncateLine = true
|
||||
} else if isEscape {
|
||||
// do not output anything
|
||||
return truncateLine, nil
|
||||
@@ -1010,8 +1077,8 @@ func (v *View) Read(p []byte) (n int, err error) {
|
||||
v.readBuffer = nil
|
||||
}
|
||||
for v.ry < len(v.lines) {
|
||||
for v.rx < len(v.lines[v.ry]) {
|
||||
s := v.lines[v.ry][v.rx].chr
|
||||
for v.rx < len(v.lines[v.ry].cells) {
|
||||
s := v.lines[v.ry].cells[v.rx].chr
|
||||
count := len(s)
|
||||
copy(p[offset:], s)
|
||||
v.rx++
|
||||
@@ -1099,6 +1166,7 @@ func (v *View) FlushStaleCells() {
|
||||
|
||||
func (v *View) rewind() {
|
||||
v.ei.reset()
|
||||
v.ei.resetScreenCursor()
|
||||
|
||||
v.SetReadPos(0, 0)
|
||||
v.SetWritePos(0, 0)
|
||||
@@ -1175,9 +1243,9 @@ func (v *View) updateSearchPositions() {
|
||||
}
|
||||
|
||||
// If a view line exists for this line index:
|
||||
if v.lines[result.Y] != nil {
|
||||
if v.lines[result.Y].cells != nil {
|
||||
// search this view line for the search string
|
||||
positions := searchPositionsForLine(v.lines[result.Y], result.Y)
|
||||
positions := searchPositionsForLine(v.lines[result.Y].cells, result.Y)
|
||||
if len(positions) > 0 {
|
||||
// If we found any occurrences, add them
|
||||
v.searcher.searchPositions = append(v.searcher.searchPositions, positions...)
|
||||
@@ -1248,13 +1316,21 @@ func (v *View) draw() {
|
||||
}
|
||||
|
||||
emptyCell := cell{chr: " ", width: 1, fgColor: ColorDefault, bgColor: ColorDefault}
|
||||
var prevFgColor Attribute
|
||||
|
||||
for y, vline := range v.viewLines[start:] {
|
||||
if y >= maxY {
|
||||
break
|
||||
}
|
||||
|
||||
// Decide the colors used for cells past the end of vline.line:
|
||||
// the source line's trailingFillAttributes (set by '\x1b[K') if
|
||||
// any, otherwise plain defaults.
|
||||
trailingCell := emptyCell
|
||||
if attrs := vline.trailingFillAttributes; attrs != nil {
|
||||
trailingCell.fgColor = attrs.fg
|
||||
trailingCell.bgColor = attrs.bg
|
||||
}
|
||||
|
||||
// x tracks the current x position in the view, and cellIdx tracks the
|
||||
// index of the cell. If we print a double-sized rune, we increment cellIdx
|
||||
// by one but x by two.
|
||||
@@ -1277,14 +1353,9 @@ func (v *View) draw() {
|
||||
|
||||
// if we're out of cells to write, we'll just print empty cells.
|
||||
if cellIdx > len(vline.line)-1 {
|
||||
c = emptyCell
|
||||
c.fgColor = prevFgColor
|
||||
c = trailingCell
|
||||
} else {
|
||||
c = vline.line[cellIdx]
|
||||
// capturing previous foreground colour so that if we're using the reverse
|
||||
// attribute we honour the final character's colour and don't awkwardly switch
|
||||
// to a new background colour for the remainder of the line
|
||||
prevFgColor = c.fgColor
|
||||
}
|
||||
|
||||
fgColor := c.fgColor
|
||||
@@ -1308,30 +1379,64 @@ func (v *View) draw() {
|
||||
}
|
||||
|
||||
func (v *View) refreshViewLinesIfNeeded() {
|
||||
if v.tainted {
|
||||
maxX := v.InnerWidth()
|
||||
lineIdx := 0
|
||||
lines := v.lines
|
||||
for i, line := range lines {
|
||||
wrap := 0
|
||||
if v.Wrap {
|
||||
wrap = maxX
|
||||
}
|
||||
|
||||
ls := lineWrap(line, wrap)
|
||||
for j := range ls {
|
||||
vline := viewLine{linesX: j, linesY: i, line: ls[j]}
|
||||
|
||||
if lineIdx > len(v.viewLines)-1 {
|
||||
v.viewLines = append(v.viewLines, vline)
|
||||
} else {
|
||||
v.viewLines[lineIdx] = vline
|
||||
}
|
||||
lineIdx++
|
||||
}
|
||||
}
|
||||
v.tainted = false
|
||||
if !v.tainted {
|
||||
return
|
||||
}
|
||||
|
||||
maxX := v.InnerWidth()
|
||||
wrap := 0
|
||||
if v.Wrap {
|
||||
wrap = maxX
|
||||
}
|
||||
|
||||
lineIdx := 0
|
||||
lines := v.lines
|
||||
for i := range lines {
|
||||
line := &lines[i]
|
||||
|
||||
// Reuse the previously wrapped result for lines that haven't changed
|
||||
// since the last refresh (i.e. below firstDirtyLine) and were wrapped at
|
||||
// the current width. Wrapping is expensive and this loop runs on every
|
||||
// scroll event, so only the lines that were actually just read (or
|
||||
// re-highlighted) should be wrapped afresh.
|
||||
if line.wrappedCells == nil || line.wrappedColumns != wrap || i >= v.firstDirtyLine {
|
||||
line.wrappedCells = lineWrap(line.cells, wrap)
|
||||
line.wrappedColumns = wrap
|
||||
}
|
||||
ls := line.wrappedCells
|
||||
|
||||
for j := range ls {
|
||||
// Per-segment trailing fill. When the source line opted in
|
||||
// via '\x1b[K', the LAST wrapped segment uses those colors
|
||||
// directly; earlier segments use the colors of their own
|
||||
// last cell, so the trailing area matches the bg active
|
||||
// where that segment ended rather than bleeding the
|
||||
// '\x1b[K' bg back across color changes in the line.
|
||||
var attrs *trailingFillAttributes
|
||||
if line.trailingFillAttributes != nil {
|
||||
if j == len(ls)-1 {
|
||||
attrs = line.trailingFillAttributes
|
||||
} else if len(ls[j]) > 0 {
|
||||
last := ls[j][len(ls[j])-1]
|
||||
attrs = &trailingFillAttributes{fg: last.fgColor, bg: last.bgColor}
|
||||
}
|
||||
}
|
||||
vline := viewLine{
|
||||
linesX: j, linesY: i, line: ls[j],
|
||||
trailingFillAttributes: attrs,
|
||||
}
|
||||
|
||||
if lineIdx > len(v.viewLines)-1 {
|
||||
v.viewLines = append(v.viewLines, vline)
|
||||
} else {
|
||||
v.viewLines[lineIdx] = vline
|
||||
}
|
||||
lineIdx++
|
||||
}
|
||||
}
|
||||
|
||||
v.firstDirtyLine = len(lines)
|
||||
v.tainted = false
|
||||
}
|
||||
|
||||
// if autoscroll is enabled but we only have a single row of cells shown to the
|
||||
@@ -1411,9 +1516,7 @@ func (v *View) BufferLines() []string {
|
||||
|
||||
lines := make([]string, len(v.lines))
|
||||
for i, l := range v.lines {
|
||||
str := lineType(l).String()
|
||||
str = strings.ReplaceAll(str, "\x00", "")
|
||||
lines[i] = str
|
||||
lines[i] = l.cells.String()
|
||||
}
|
||||
return lines
|
||||
}
|
||||
@@ -1434,9 +1537,7 @@ func (v *View) ViewBufferLines() []string {
|
||||
|
||||
lines := make([]string, len(v.viewLines))
|
||||
for i, l := range v.viewLines {
|
||||
str := lineType(l.line).String()
|
||||
str = strings.ReplaceAll(str, "\x00", "")
|
||||
lines[i] = str
|
||||
lines[i] = cells(l.line).String()
|
||||
}
|
||||
return lines
|
||||
}
|
||||
@@ -1458,12 +1559,12 @@ func (v *View) ViewLinesHeight() int {
|
||||
// ViewBuffer returns a string with the contents of the view's buffer that is
|
||||
// shown to the user.
|
||||
func (v *View) ViewBuffer() string {
|
||||
lines := make([][]cell, len(v.viewLines))
|
||||
strs := make([]string, len(v.viewLines))
|
||||
for i := range v.viewLines {
|
||||
lines[i] = v.viewLines[i].line
|
||||
strs[i] = cells(v.viewLines[i].line).String()
|
||||
}
|
||||
|
||||
return linesToString(lines)
|
||||
return strings.Join(strs, "\n")
|
||||
}
|
||||
|
||||
// Line returns a string with the line of the view's internal buffer
|
||||
@@ -1478,7 +1579,7 @@ func (v *View) Line(y int) (string, bool) {
|
||||
return "", false
|
||||
}
|
||||
|
||||
return lineType(v.lines[y]).String(), true
|
||||
return v.lines[y].cells.String(), true
|
||||
}
|
||||
|
||||
// Word returns a string with the word of the view's internal buffer
|
||||
@@ -1489,11 +1590,11 @@ func (v *View) Word(x, y int) (string, bool) {
|
||||
return "", false
|
||||
}
|
||||
|
||||
if x < 0 || y < 0 || y >= len(v.lines) || x >= len(v.lines[y]) {
|
||||
if x < 0 || y < 0 || y >= len(v.lines) || x >= len(v.lines[y].cells) {
|
||||
return "", false
|
||||
}
|
||||
|
||||
str := lineType(v.lines[y]).String()
|
||||
str := v.lines[y].cells.String()
|
||||
|
||||
nl := strings.LastIndexFunc(str[:x], indexFunc)
|
||||
if nl == -1 {
|
||||
@@ -1523,9 +1624,8 @@ func (v *View) SetHighlight(y int, on bool) {
|
||||
return
|
||||
}
|
||||
|
||||
line := v.lines[y]
|
||||
cells := make([]cell, 0)
|
||||
for _, c := range line {
|
||||
cells := make([]cell, 0, len(v.lines[y].cells))
|
||||
for _, c := range v.lines[y].cells {
|
||||
if on {
|
||||
c.bgColor = v.SelBgColor
|
||||
c.fgColor = v.SelFgColor
|
||||
@@ -1536,7 +1636,8 @@ func (v *View) SetHighlight(y int, on bool) {
|
||||
cells = append(cells, c)
|
||||
}
|
||||
v.tainted = true
|
||||
v.lines[y] = cells
|
||||
v.firstDirtyLine = min(v.firstDirtyLine, y)
|
||||
v.lines[y].cells = cells
|
||||
v.clearHover()
|
||||
}
|
||||
|
||||
@@ -1602,17 +1703,10 @@ func lineWrap(line []cell, columns int) [][]cell {
|
||||
return lines
|
||||
}
|
||||
|
||||
func linesToString(lines [][]cell) string {
|
||||
func linesToString(lines []lineType) string {
|
||||
str := make([]string, len(lines))
|
||||
for i := range lines {
|
||||
rns := make([]rune, 0, len(lines[i]))
|
||||
line := lineType(lines[i]).String()
|
||||
for _, c := range line {
|
||||
if c != '\x00' {
|
||||
rns = append(rns, c)
|
||||
}
|
||||
}
|
||||
str[i] = string(rns)
|
||||
str[i] = lines[i].cells.String()
|
||||
}
|
||||
|
||||
return strings.Join(str, "\n")
|
||||
@@ -1682,9 +1776,7 @@ func (v *View) SelectedLines() []string {
|
||||
}
|
||||
|
||||
func (v *View) lineContentAtIdx(idx int) string {
|
||||
line := v.lines[idx]
|
||||
str := lineType(line).String()
|
||||
return strings.ReplaceAll(str, "\x00", "")
|
||||
return v.lines[idx].cells.String()
|
||||
}
|
||||
|
||||
func (v *View) SelectedPoint() (int, int) {
|
||||
@@ -1788,11 +1880,11 @@ func (v *View) OverwriteLinesAndClearEverythingElse(lineCount int, y int, conten
|
||||
v.overwriteLines(y, content)
|
||||
|
||||
for i := range y {
|
||||
v.lines[i] = nil
|
||||
v.lines[i] = lineType{}
|
||||
}
|
||||
|
||||
for i := v.wy + 1; i < len(v.lines); i += 1 {
|
||||
v.lines[i] = nil
|
||||
v.lines[i] = lineType{}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1935,7 +2027,7 @@ func (v *View) scrollMargin() int {
|
||||
// foreground color
|
||||
func (v *View) ContainsColoredText(fgColor string, text string) bool {
|
||||
for _, line := range v.lines {
|
||||
if containsColoredTextInLine(fgColor, text, line) {
|
||||
if containsColoredTextInLine(fgColor, text, line.cells) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
+263
-12
@@ -8,10 +8,28 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/gdamore/tcell/v3"
|
||||
"github.com/gdamore/tcell/v3/color"
|
||||
"github.com/rivo/uniseg"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// WithSimulationScreen swaps the package-level Screen for a tcell
|
||||
// terminfo-backed mock terminal so tests can call view.draw() and
|
||||
// inspect rendered cells via Screen.Get(). The previous Screen is
|
||||
// restored on test cleanup.
|
||||
func WithSimulationScreen(t *testing.T, width, height int) {
|
||||
t.Helper()
|
||||
saved := Screen
|
||||
if err := (&Gui{}).tcellInitSimulation(width, height); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() {
|
||||
Screen.Fini()
|
||||
Screen = saved
|
||||
})
|
||||
}
|
||||
|
||||
func TestWriteString(t *testing.T) {
|
||||
tests := []struct {
|
||||
existingLines []string
|
||||
@@ -26,17 +44,17 @@ func TestWriteString(t *testing.T) {
|
||||
{
|
||||
[]string{},
|
||||
[]string{"1\n"},
|
||||
[][]string{{"1", ""}},
|
||||
[][]string{{"1"}},
|
||||
},
|
||||
{
|
||||
[]string{},
|
||||
[]string{"1\n", "2\n"},
|
||||
[][]string{{"1", ""}, {"2", ""}},
|
||||
[][]string{{"1"}, {"2"}},
|
||||
},
|
||||
{
|
||||
[]string{"a"},
|
||||
[]string{"1\n"},
|
||||
[][]string{{"1", ""}},
|
||||
[][]string{{"1"}},
|
||||
},
|
||||
{
|
||||
[]string{"a\x00"},
|
||||
@@ -56,12 +74,12 @@ func TestWriteString(t *testing.T) {
|
||||
{
|
||||
[]string{},
|
||||
[]string{"1\r"},
|
||||
[][]string{{"1", ""}},
|
||||
[][]string{{"1"}},
|
||||
},
|
||||
{
|
||||
[]string{"a"},
|
||||
[]string{"1\r"},
|
||||
[][]string{{"1", ""}},
|
||||
[][]string{{"1"}},
|
||||
},
|
||||
{
|
||||
[]string{"a\x00"},
|
||||
@@ -83,14 +101,14 @@ func TestWriteString(t *testing.T) {
|
||||
for _, test := range tests {
|
||||
v := NewView("name", 0, 0, 10, 10, OutputNormal)
|
||||
for _, l := range test.existingLines {
|
||||
v.lines = append(v.lines, stringToCells(l))
|
||||
v.lines = append(v.lines, lineType{cells: stringToCells(l)})
|
||||
}
|
||||
for _, s := range test.stringsToWrite {
|
||||
v.writeString(s)
|
||||
}
|
||||
var resultingLines [][]string
|
||||
for _, l := range v.lines {
|
||||
resultingLines = append(resultingLines, cellsToStrings(l))
|
||||
resultingLines = append(resultingLines, cellsToStrings(l.cells))
|
||||
}
|
||||
assert.Equal(t, test.expectedLines, resultingLines)
|
||||
}
|
||||
@@ -126,19 +144,19 @@ func TestAutoRenderingHyperlinks(t *testing.T) {
|
||||
|
||||
v.writeString("htt")
|
||||
// No hyperlinks are generated for incomplete URLs
|
||||
assert.Equal(t, "", v.lines[0][0].hyperlink)
|
||||
assert.Equal(t, "", v.lines[0].cells[0].hyperlink)
|
||||
// Writing more characters to the same line makes the link complete (even
|
||||
// though we didn't see a newline yet)
|
||||
v.writeString("ps://example.com")
|
||||
assert.Equal(t, "https://example.com", v.lines[0][0].hyperlink)
|
||||
assert.Equal(t, "https://example.com", v.lines[0].cells[0].hyperlink)
|
||||
|
||||
v.Clear()
|
||||
// Valid but incomplete URL
|
||||
v.writeString("https://exa")
|
||||
assert.Equal(t, "https://exa", v.lines[0][0].hyperlink)
|
||||
assert.Equal(t, "https://exa", v.lines[0].cells[0].hyperlink)
|
||||
// Writing more characters to the same fixes the link
|
||||
v.writeString("mple.com")
|
||||
assert.Equal(t, "https://example.com", v.lines[0][0].hyperlink)
|
||||
assert.Equal(t, "https://example.com", v.lines[0].cells[0].hyperlink)
|
||||
}
|
||||
|
||||
func TestContainsColoredText(t *testing.T) {
|
||||
@@ -211,11 +229,100 @@ func TestContainsColoredText(t *testing.T) {
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
v := &View{lines: test.lines}
|
||||
lines := make([]lineType, len(test.lines))
|
||||
for j, cells := range test.lines {
|
||||
lines[j] = lineType{cells: cells}
|
||||
}
|
||||
v := &View{lines: lines}
|
||||
assert.Equal(t, test.expected, v.ContainsColoredText(test.fgColorStr, test.text), "Test %d failed", i)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWriteCursorPositionEscape(t *testing.T) {
|
||||
// ConPTY presents its child's output as a screen buffer and uses cursor
|
||||
// positioning escapes (CUP, `\x1b[<row>;<col>H`) to skip over blank rows
|
||||
// rather than emitting empty LFs for them. The escape interpreter must
|
||||
// synthesize the row advances those CUPs imply; otherwise non-blank rows
|
||||
// that the child separated with blank lines end up adjacent in the view.
|
||||
v := NewView("name", 0, 0, 20, 10, OutputNormal)
|
||||
// "a", then "skip to row 3" (i.e. one blank row), then "b".
|
||||
v.writeString("a\r\n\x1b[3;1Hb\r\n")
|
||||
|
||||
got := make([][]string, 0, len(v.lines))
|
||||
for _, l := range v.lines {
|
||||
got = append(got, cellsToStrings(l.cells))
|
||||
}
|
||||
|
||||
assert.Equal(t, [][]string{{"a"}, {}, {"b"}}, got)
|
||||
}
|
||||
|
||||
func TestWriteCursorPositionEscapeAcrossWrites(t *testing.T) {
|
||||
// Mirrors the production flow: bufio.Scanner splits the pty output on
|
||||
// LF and feeds the view one Write per line (each with a trailing \n
|
||||
// appended). The parser's screen-row counter must keep ticking across
|
||||
// writes; otherwise CUPs are evaluated against a stale row and
|
||||
// overshoot, producing too many blank lines instead of the right
|
||||
// number.
|
||||
v := NewView("name", 0, 0, 30, 30, OutputNormal)
|
||||
v.writeString("a\n")
|
||||
v.writeString("b\n")
|
||||
// ConPTY is on row 3 here; CUP to row 5 should skip exactly one row.
|
||||
v.writeString("c\x1b[5;1Hd\n")
|
||||
|
||||
got := make([][]string, 0, len(v.lines))
|
||||
for _, l := range v.lines {
|
||||
got = append(got, cellsToStrings(l.cells))
|
||||
}
|
||||
assert.Equal(t, [][]string{
|
||||
{"a"},
|
||||
{"b"},
|
||||
{"c"},
|
||||
{},
|
||||
{"d"},
|
||||
}, got)
|
||||
}
|
||||
|
||||
func TestWriteCursorForwardEscape(t *testing.T) {
|
||||
// ConPTY compresses runs of default-colored spaces into ECH (\x1b[NX,
|
||||
// "clear N cells, cursor stationary") + CUF (\x1b[NC, "cursor forward
|
||||
// N") rather than emitting them literally. The interpreter has to
|
||||
// materialize CUF as N visible spaces; otherwise the gap collapses
|
||||
// and content that followed the indentation slides left.
|
||||
v := NewView("name", 0, 0, 20, 10, OutputNormal)
|
||||
// "a" + ECH 5 + CUF 5 + "b" — visually "a b".
|
||||
v.writeString("a\x1b[5X\x1b[5Cb\n")
|
||||
|
||||
got := make([][]string, 0, len(v.lines))
|
||||
for _, l := range v.lines {
|
||||
got = append(got, cellsToStrings(l.cells))
|
||||
}
|
||||
|
||||
assert.Equal(t, [][]string{{"a", " ", " ", " ", " ", " ", "b"}}, got)
|
||||
}
|
||||
|
||||
func TestWriteCursorPositionEscapeWithSoftWraps(t *testing.T) {
|
||||
// If a logical line is longer than ConPTY's terminal width, ConPTY
|
||||
// soft-wraps it onto multiple physical rows in its screen, and any
|
||||
// subsequent CUP is addressed against the post-wrap row count. To
|
||||
// keep our screen-row counter accurate we have to count those wraps
|
||||
// as we write the cells. InnerWidth here is 5; "abcdefghij" (10
|
||||
// cells) wraps onto 2 rows, so ConPTY is on row 3 after the LF and a
|
||||
// CUP to row 4 should skip exactly one row.
|
||||
v := NewView("name", 0, 0, 6, 30, OutputNormal) // Width=7, InnerWidth=5
|
||||
v.writeString("abcdefghij\n")
|
||||
v.writeString("\x1b[4;1Hxyz\n")
|
||||
|
||||
got := make([][]string, 0, len(v.lines))
|
||||
for _, l := range v.lines {
|
||||
got = append(got, cellsToStrings(l.cells))
|
||||
}
|
||||
assert.Equal(t, [][]string{
|
||||
{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j"},
|
||||
{},
|
||||
{"x", "y", "z"},
|
||||
}, got)
|
||||
}
|
||||
|
||||
func stringToCells(s string) []cell {
|
||||
var cells []cell
|
||||
state := -1
|
||||
@@ -413,3 +520,147 @@ func TestLineWrap(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestNewlineTerminatedLineClearsTrailingBg verifies that a '\n' resets
|
||||
// any attributes (e.g. AttrReverse-driven background) past the line's
|
||||
// content, so a reversed cell at the end doesn't bleed into the empty
|
||||
// area to the right.
|
||||
func TestNewlineTerminatedLineClearsTrailingBg(t *testing.T) {
|
||||
WithSimulationScreen(t, 14, 5)
|
||||
|
||||
v := NewView("name", 0, 0, 11, 4, OutputNormal)
|
||||
|
||||
// \x1b[7m sets reverse; \x1b[31m sets fg=red. With reverse the cell
|
||||
// renders with bg=red. The trailing area past "foo" must NOT extend
|
||||
// the red bg because '\n' marks the line as cleanly terminated.
|
||||
v.writeString("\x1b[7m\x1b[31mfoo\x1b[0m\n")
|
||||
v.draw()
|
||||
|
||||
// First row: cells 1..3 are "foo" (render with red bg via reverse),
|
||||
// cells 4..10 are trailing and should be plain default.
|
||||
for x := 4; x <= 10; x++ {
|
||||
_, style, _ := Screen.Get(x, 1)
|
||||
assert.Equal(t, tcell.ColorDefault, style.GetForeground(),
|
||||
"trailing cell at (%d, 1) should have default fg", x)
|
||||
assert.False(t, style.HasReverse(),
|
||||
"trailing cell at (%d, 1) should not have reverse attribute", x)
|
||||
}
|
||||
}
|
||||
|
||||
// TestUnterminatedReverseLineDoesNotExtend verifies that an unterminated
|
||||
// line ending with an AttrReverse cell does NOT propagate the reversed
|
||||
// background past the line's content — matching real terminal behavior
|
||||
// (try `print '\x1b[7m\x1b[31mfoo'` in a shell). The trailing area
|
||||
// is rendered as plain default.
|
||||
func TestUnterminatedReverseLineDoesNotExtend(t *testing.T) {
|
||||
WithSimulationScreen(t, 14, 5)
|
||||
|
||||
v := NewView("name", 0, 0, 11, 4, OutputNormal)
|
||||
|
||||
// Reverse + red fg, "foo", no termination. The trailing cells past
|
||||
// "foo" should be plain default, NOT a continuation of the red bg.
|
||||
v.writeString("\x1b[7m\x1b[31mfoo")
|
||||
v.draw()
|
||||
|
||||
// Cells 4..10 are trailing and should be default with no reverse.
|
||||
for x := 4; x <= 10; x++ {
|
||||
_, style, _ := Screen.Get(x, 1)
|
||||
assert.Equal(t, tcell.ColorDefault, style.GetForeground(),
|
||||
"trailing cell at (%d, 1) should have default fg", x)
|
||||
assert.False(t, style.HasReverse(),
|
||||
"trailing cell at (%d, 1) should not have reverse attribute", x)
|
||||
}
|
||||
}
|
||||
|
||||
// TestShortFilledLineExtendsBgWithoutWrap verifies that '\x1b[K' fills
|
||||
// the rest of the line with the current bg color for a line that's
|
||||
// short enough to fit within the view's inner width.
|
||||
func TestShortFilledLineExtendsBgWithoutWrap(t *testing.T) {
|
||||
WithSimulationScreen(t, 14, 5)
|
||||
|
||||
v := NewView("name", 0, 0, 11, 4, OutputNormal)
|
||||
|
||||
// \x1b[41m sets bg=red. "hi" fits within InnerWidth=10; \x1b[K should
|
||||
// fill the remaining 8 cells with red.
|
||||
v.writeString("\x1b[41mhi\x1b[K\x1b[0m\n")
|
||||
v.draw()
|
||||
|
||||
// All ten cells at (1..10, 1) should have red bg.
|
||||
for x := 1; x <= 10; x++ {
|
||||
_, style, _ := Screen.Get(x, 1)
|
||||
assert.Equal(t, color.Maroon, style.GetBackground(),
|
||||
"cell at (%d, 1) should have red bg", x)
|
||||
}
|
||||
}
|
||||
|
||||
// TestWrappedFilledLineExtendsBgToEdge verifies that when a line is
|
||||
// filled to the edge with \x1b[K (the pattern used by `delta` for diff
|
||||
// lines) but exceeds the view's inner width, every wrapped segment
|
||||
// extends the fill background past its content to the right edge.
|
||||
func TestWrappedFilledLineExtendsBgToEdge(t *testing.T) {
|
||||
WithSimulationScreen(t, 14, 6)
|
||||
|
||||
// View dimensions: Width=12 (x0=0..x1=11), Height=6; InnerWidth=10,
|
||||
// InnerHeight=4. Frame inset of 1 places content cells at screen
|
||||
// (1..10, 1..4).
|
||||
v := NewView("name", 0, 0, 11, 5, OutputNormal)
|
||||
v.Wrap = true
|
||||
|
||||
// Content with spaces so word wrap ends each segment before the
|
||||
// right edge: "aaa bbb ccc ddd eee" wraps at InnerWidth=10 to three
|
||||
// segments — "aaa bbb" / "ccc ddd" / "eee". Each row's trailing area
|
||||
// must pick up the red fill from \x1b[K.
|
||||
v.writeString("\x1b[41m" + "aaa bbb ccc ddd eee" + "\x1b[0m\x1b[41m\x1b[K\x1b[0m\n")
|
||||
v.draw()
|
||||
|
||||
// All three wrapped rows should have the red fill background across
|
||||
// the full InnerWidth, including the trailing cells past each row's
|
||||
// last word.
|
||||
for y := 1; y <= 3; y++ {
|
||||
for x := 1; x <= 10; x++ {
|
||||
_, style, _ := Screen.Get(x, y)
|
||||
assert.Equal(t, color.Maroon, style.GetBackground(),
|
||||
"cell at (%d, %d) should have red bg", x, y)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestMulticolorWrappedFillUsesLastCellOfEachSegment demonstrates that
|
||||
// when a wrapped line switches bg color part-way through and ends with
|
||||
// \x1b[K, the trailing area on each wrapped row should match the bg
|
||||
// that was active where that row's content ended — not the \x1b[K bg,
|
||||
// which would bleed the color from the end of the logical line back
|
||||
// into the earlier wrapped rows.
|
||||
func TestMulticolorWrappedFillUsesLastCellOfEachSegment(t *testing.T) {
|
||||
WithSimulationScreen(t, 14, 6)
|
||||
|
||||
// View dimensions: Width=12 (x0=0..x1=11), Height=6; InnerWidth=10,
|
||||
// InnerHeight=4. Frame inset of 1 places content cells at screen
|
||||
// (1..10, 1..4).
|
||||
v := NewView("name", 0, 0, 11, 5, OutputNormal)
|
||||
v.Wrap = true
|
||||
|
||||
// Content "aaa bbb ccc" is 11 cells; lineWrap breaks at the space
|
||||
// between "bbb" and "ccc" (index 7) so segment 1 is "aaa bbb" (red,
|
||||
// last cell red) and segment 2 is "ccc" (green, last cell green).
|
||||
// \x1b[K records the green bg on the source line.
|
||||
v.writeString("\x1b[41maaa bbb\x1b[42m ccc\x1b[K\x1b[0m\n")
|
||||
v.draw()
|
||||
|
||||
// Row 1's content ends with a red cell at x=7, so trailing columns
|
||||
// 8..10 should pick up red rather than the \x1b[K's green.
|
||||
for x := 8; x <= 10; x++ {
|
||||
_, style, _ := Screen.Get(x, 1)
|
||||
assert.Equal(t, color.Maroon, style.GetBackground(),
|
||||
"trailing cell at (%d, 1) should have red bg (matching segment's last cell)", x)
|
||||
}
|
||||
|
||||
// Row 2's content ends with a green cell at x=3, so trailing
|
||||
// columns 4..10 should pick up green (matching both the segment's
|
||||
// last cell and the \x1b[K bg — these happen to agree here).
|
||||
for x := 4; x <= 10; x++ {
|
||||
_, style, _ := Screen.Get(x, 2)
|
||||
assert.Equal(t, color.Green, style.GetBackground(),
|
||||
"trailing cell at (%d, 2) should have green bg", x)
|
||||
}
|
||||
}
|
||||
|
||||
+84
-10
@@ -3,6 +3,7 @@ package gui
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/gocui"
|
||||
@@ -13,17 +14,27 @@ import (
|
||||
type BackgroundRoutineMgr struct {
|
||||
gui *Gui
|
||||
|
||||
// if we've suspended the gui (e.g. because we've switched to a subprocess)
|
||||
// we typically want to pause some things that are running like background
|
||||
// file refreshes
|
||||
pauseBackgroundRefreshes bool
|
||||
// When this is greater than zero, the background routines (e.g. file refresh)
|
||||
// skip their work. We pause them while the gui is suspended (e.g. for a
|
||||
// subprocess) and while lazygit is itself driving a git operation that would
|
||||
// otherwise be caught mid-flight (see the waiting-status helpers). It's a
|
||||
// count rather than a bool because these pause scopes can overlap.
|
||||
pauseRefreshesCount atomic.Int32
|
||||
|
||||
// a channel to trigger an immediate background fetch; we use this when switching repos
|
||||
triggerFetch chan struct{}
|
||||
}
|
||||
|
||||
func (self *BackgroundRoutineMgr) PauseBackgroundRefreshes(pause bool) {
|
||||
self.pauseBackgroundRefreshes = pause
|
||||
if pause {
|
||||
self.pauseRefreshesCount.Add(1)
|
||||
} else {
|
||||
self.pauseRefreshesCount.Add(-1)
|
||||
}
|
||||
}
|
||||
|
||||
func (self *BackgroundRoutineMgr) backgroundRefreshesPaused() bool {
|
||||
return self.pauseRefreshesCount.Load() > 0
|
||||
}
|
||||
|
||||
func (self *BackgroundRoutineMgr) startBackgroundRoutines() {
|
||||
@@ -51,6 +62,17 @@ func (self *BackgroundRoutineMgr) startBackgroundRoutines() {
|
||||
}
|
||||
}
|
||||
|
||||
if userConfig.Git.AutoDetectExternalChanges {
|
||||
interval := userConfig.Refresher.ExternalChangeCheckInterval
|
||||
if interval > 0 {
|
||||
go utils.Safe(self.startBackgroundExternalChangeDetection)
|
||||
} else {
|
||||
self.gui.c.Log.Errorf(
|
||||
"Value of config option 'refresher.externalChangeCheckInterval' (%d) is invalid, disabling external change detection",
|
||||
interval)
|
||||
}
|
||||
}
|
||||
|
||||
if self.gui.Config.GetDebug() {
|
||||
self.goEvery(time.Second*time.Duration(10), self.gui.stopChan, func(_ bool) error {
|
||||
formatBytes := func(b uint64) string {
|
||||
@@ -92,7 +114,7 @@ func (self *BackgroundRoutineMgr) startBackgroundFetch() {
|
||||
if self.gui.UserConfig().Gui.ShowBottomLine || firstTimeOrRetriggered {
|
||||
return self.gui.helpers.AppStatus.WithWaitingStatusImpl(self.gui.Tr.FetchingStatus, func(gocui.Task) error {
|
||||
return self.backgroundFetch()
|
||||
}, nil)
|
||||
}, nil, true)
|
||||
}
|
||||
|
||||
return self.backgroundFetch()
|
||||
@@ -111,11 +133,60 @@ func (self *BackgroundRoutineMgr) startBackgroundFilesRefresh() {
|
||||
|
||||
userConfig := self.gui.UserConfig()
|
||||
self.goEvery(userConfig.Refresher.RefreshIntervalDuration(), self.gui.stopChan, func(_ bool) error {
|
||||
self.gui.c.Refresh(types.RefreshOptions{Scope: []types.RefreshableView{types.FILES}})
|
||||
self.gui.c.RefreshFromWorker(types.RefreshOptions{Scope: []types.RefreshableView{types.FILES}, Background: true})
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (self *BackgroundRoutineMgr) startBackgroundExternalChangeDetection() {
|
||||
self.gui.waitForIntro.Wait()
|
||||
|
||||
// We don't seed the snapshot here. The startup refresh captures one on
|
||||
// entry (like every refs-touching refresh), and until one has been
|
||||
// captured RefsSnapshotChangedSince treats the empty baseline as
|
||||
// "unchanged", so we never fire a spurious refresh before a baseline
|
||||
// exists — no need to depend on the timing of that startup refresh.
|
||||
|
||||
userConfig := self.gui.UserConfig()
|
||||
self.goEvery(
|
||||
userConfig.Refresher.ExternalChangeCheckIntervalDuration(),
|
||||
self.gui.stopChan,
|
||||
func(_ bool) error {
|
||||
self.checkForExternalChanges()
|
||||
return nil
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func (self *BackgroundRoutineMgr) checkForExternalChanges() {
|
||||
current, err := self.gui.git.Status.RefsSnapshot()
|
||||
if err != nil {
|
||||
// Transient error (e.g. git process couldn't start). Don't update the
|
||||
// stored snapshot; we'll retry next tick.
|
||||
self.gui.c.Log.Warnf("RefsSnapshot failed: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
if !self.gui.helpers.Refresh.RefsSnapshotChangedSince(current) {
|
||||
return
|
||||
}
|
||||
|
||||
// goEvery checks the pause count before starting us, but a git operation
|
||||
// may have begun (and paused refreshes) after that check, while we were
|
||||
// reading the snapshot above. In that case the change we detected is the
|
||||
// operation's own intermediate state, so back off: the operation will
|
||||
// refresh and re-snapshot when it finishes, and if the change was really
|
||||
// external we'll catch it on the next tick after the pause lifts. We don't
|
||||
// update the stored snapshot, so nothing is swallowed.
|
||||
if self.backgroundRefreshesPaused() {
|
||||
return
|
||||
}
|
||||
|
||||
// No need to update the stored snapshot here; Refresh does that.
|
||||
self.gui.c.Log.Info("External ref change detected — refreshing")
|
||||
self.gui.c.RefreshFromWorker(types.RefreshOptions{Background: true})
|
||||
}
|
||||
|
||||
// returns a channel that can be used to trigger the callback immediately
|
||||
func (self *BackgroundRoutineMgr) goEvery(interval time.Duration, stop chan struct{}, function func(bool) error) chan struct{} {
|
||||
done := make(chan struct{})
|
||||
@@ -124,10 +195,13 @@ func (self *BackgroundRoutineMgr) goEvery(interval time.Duration, stop chan stru
|
||||
ticker := time.NewTicker(interval)
|
||||
defer ticker.Stop()
|
||||
doit := func(retriggered bool) {
|
||||
if self.pauseBackgroundRefreshes {
|
||||
if self.backgroundRefreshesPaused() {
|
||||
return
|
||||
}
|
||||
self.gui.c.OnWorker(func(gocui.Task) error {
|
||||
// OnWorkerBackground, not OnWorker: these routines and the refreshes
|
||||
// they trigger must not count towards lazygit being busy, or they'd
|
||||
// spuriously block a repo switch every time one happens to be running.
|
||||
self.gui.c.OnWorkerBackground(func(gocui.Task) error {
|
||||
_ = function(retriggered)
|
||||
done <- struct{}{}
|
||||
return nil
|
||||
@@ -155,7 +229,7 @@ func (self *BackgroundRoutineMgr) goEvery(interval time.Duration, stop chan stru
|
||||
func (self *BackgroundRoutineMgr) backgroundFetch() (err error) {
|
||||
err = self.gui.git.Sync.FetchBackground()
|
||||
|
||||
return self.gui.helpers.BranchesHelper.PostFetchRefresh(err)
|
||||
return self.gui.helpers.BranchesHelper.PostFetchRefresh(err, true)
|
||||
}
|
||||
|
||||
func (self *BackgroundRoutineMgr) triggerImmediateFetch() {
|
||||
|
||||
@@ -27,10 +27,20 @@ func (gui *Gui) LogAction(action string) {
|
||||
return
|
||||
}
|
||||
|
||||
gui.Views.Extras.Autoscroll = true
|
||||
// LogAction and LogCommand are called both from the UI thread and from git
|
||||
// worker goroutines, so bounce the writes onto the UI thread: they touch the
|
||||
// view's autoscroll flag and the GuiLog slice, which the layout/draw code
|
||||
// reads. Ordering between successive log calls is preserved by the FIFO the
|
||||
// bounce enqueues onto. It's a background bounce because writing the command
|
||||
// log is incidental display work that must not count towards lazygit being
|
||||
// busy (otherwise it could block a repo switch).
|
||||
gui.onUIThreadBackground(func() error {
|
||||
gui.Views.Extras.Autoscroll = true
|
||||
|
||||
gui.GuiLog = append(gui.GuiLog, action)
|
||||
fmt.Fprint(gui.Views.Extras, "\n"+style.FgYellow.Sprint(action))
|
||||
gui.GuiLog = append(gui.GuiLog, action)
|
||||
fmt.Fprint(gui.Views.Extras, "\n"+style.FgYellow.Sprint(action))
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (gui *Gui) LogCommand(cmdStr string, commandLine bool) {
|
||||
@@ -38,17 +48,23 @@ func (gui *Gui) LogCommand(cmdStr string, commandLine bool) {
|
||||
return
|
||||
}
|
||||
|
||||
gui.Views.Extras.Autoscroll = true
|
||||
|
||||
textStyle := theme.DefaultTextColor
|
||||
if !commandLine {
|
||||
// if we're not dealing with a direct command that could be run on the command line,
|
||||
// we style it differently to communicate that
|
||||
textStyle = style.FgMagenta
|
||||
}
|
||||
gui.GuiLog = append(gui.GuiLog, cmdStr)
|
||||
indentedCmdStr := " " + strings.ReplaceAll(cmdStr, "\n", "\n ")
|
||||
fmt.Fprint(gui.Views.Extras, "\n"+textStyle.Sprint(indentedCmdStr))
|
||||
|
||||
// See the comment in LogAction: bounce onto the UI thread since we may be
|
||||
// called from a git worker, in the background so it can't block a repo switch.
|
||||
gui.onUIThreadBackground(func() error {
|
||||
gui.Views.Extras.Autoscroll = true
|
||||
|
||||
gui.GuiLog = append(gui.GuiLog, cmdStr)
|
||||
fmt.Fprint(gui.Views.Extras, "\n"+textStyle.Sprint(indentedCmdStr))
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (gui *Gui) printCommandLogHeader() {
|
||||
|
||||
@@ -32,34 +32,76 @@ type ListRenderer struct {
|
||||
getNonModelItems func() []*NonModelItem
|
||||
|
||||
// The remaining fields are private and shouldn't be initialized by clients
|
||||
numNonModelItems int
|
||||
viewIndicesByModelIndex []int
|
||||
modelIndicesByViewIndex []int
|
||||
columnPositions []int
|
||||
columnPositions []int
|
||||
}
|
||||
|
||||
func (self *ListRenderer) GetList() types.IList {
|
||||
return self.list
|
||||
}
|
||||
|
||||
func (self *ListRenderer) ModelIndexToViewIndex(modelIndex int) int {
|
||||
modelIndex = lo.Clamp(modelIndex, 0, self.list.Len())
|
||||
if self.viewIndicesByModelIndex != nil {
|
||||
return self.viewIndicesByModelIndex[modelIndex]
|
||||
func (self *ListRenderer) getNonModelItemList() []*NonModelItem {
|
||||
if self.getNonModelItems == nil {
|
||||
return nil
|
||||
}
|
||||
return self.getNonModelItems()
|
||||
}
|
||||
|
||||
return modelIndex
|
||||
func (self *ListRenderer) ModelIndexToViewIndex(modelIndex int) int {
|
||||
return modelIndexToViewIndex(self.list.Len(), self.getNonModelItemList(), modelIndex)
|
||||
}
|
||||
|
||||
func (self *ListRenderer) ViewIndexToModelIndex(viewIndex int) int {
|
||||
viewIndex = lo.Clamp(viewIndex, 0, self.list.Len()+self.numNonModelItems)
|
||||
if self.modelIndicesByViewIndex != nil {
|
||||
return self.modelIndicesByViewIndex[viewIndex]
|
||||
}
|
||||
return viewIndexToModelIndex(self.list.Len(), self.getNonModelItemList(), viewIndex)
|
||||
}
|
||||
|
||||
// modelToViewIndexConverter returns a model-to-view index conversion that
|
||||
// reuses a single snapshot of the non-model items. Callers that convert many
|
||||
// indices in a row (e.g. search, which converts every commit) should use this
|
||||
// rather than calling ModelIndexToViewIndex per index, which would rebuild the
|
||||
// non-model items each time.
|
||||
func (self *ListRenderer) modelToViewIndexConverter() func(modelIndex int) int {
|
||||
listLength := self.list.Len()
|
||||
nonModelItems := self.getNonModelItemList()
|
||||
return func(modelIndex int) int {
|
||||
return modelIndexToViewIndex(listLength, nonModelItems, modelIndex)
|
||||
}
|
||||
}
|
||||
|
||||
// The view shows the model items with the non-model items (e.g. section
|
||||
// headers) inserted at their model indices. The two conversions below are
|
||||
// computed directly from the current list length and non-model items, so they
|
||||
// don't depend on the list having been rendered, and they can never be stale
|
||||
// with respect to a model that changed since the last render (which used to
|
||||
// cause both wrong results and index-out-of-range panics).
|
||||
//
|
||||
// The non-model items are assumed to be ordered by their Index, which is how
|
||||
// all producers build them; the i-th one therefore ends up at view index
|
||||
// Index+i.
|
||||
func modelIndexToViewIndex(listLength int, nonModelItems []*NonModelItem, modelIndex int) int {
|
||||
modelIndex = lo.Clamp(modelIndex, 0, listLength)
|
||||
// Each non-model item inserted at or before this model item pushes it down
|
||||
// by one row in the view.
|
||||
viewIndex := modelIndex
|
||||
for _, item := range nonModelItems {
|
||||
if item.Index <= modelIndex {
|
||||
viewIndex++
|
||||
}
|
||||
}
|
||||
return viewIndex
|
||||
}
|
||||
|
||||
func viewIndexToModelIndex(listLength int, nonModelItems []*NonModelItem, viewIndex int) int {
|
||||
viewIndex = lo.Clamp(viewIndex, 0, listLength+len(nonModelItems))
|
||||
// Subtract the non-model items that appear before this view index.
|
||||
modelIndex := viewIndex
|
||||
for i, item := range nonModelItems {
|
||||
if item.Index+i < viewIndex {
|
||||
modelIndex--
|
||||
}
|
||||
}
|
||||
return modelIndex
|
||||
}
|
||||
|
||||
func (self *ListRenderer) ColumnPositions() []int {
|
||||
return self.columnPositions
|
||||
}
|
||||
@@ -71,23 +113,18 @@ func (self *ListRenderer) renderLines(startIdx int, endIdx int) string {
|
||||
if self.getColumnAlignments != nil {
|
||||
columnAlignments = self.getColumnAlignments()
|
||||
}
|
||||
nonModelItems := []*NonModelItem{}
|
||||
self.numNonModelItems = 0
|
||||
if self.getNonModelItems != nil {
|
||||
nonModelItems = self.getNonModelItems()
|
||||
self.prepareConversionArrays(nonModelItems)
|
||||
}
|
||||
nonModelItems := self.getNonModelItemList()
|
||||
startModelIdx := 0
|
||||
if startIdx == -1 {
|
||||
startIdx = 0
|
||||
} else {
|
||||
startModelIdx = self.ViewIndexToModelIndex(startIdx)
|
||||
startModelIdx = viewIndexToModelIndex(self.list.Len(), nonModelItems, startIdx)
|
||||
}
|
||||
endModelIdx := self.list.Len()
|
||||
if endIdx == -1 {
|
||||
endIdx = endModelIdx + len(nonModelItems)
|
||||
} else {
|
||||
endModelIdx = self.ViewIndexToModelIndex(endIdx)
|
||||
endModelIdx = viewIndexToModelIndex(self.list.Len(), nonModelItems, endIdx)
|
||||
}
|
||||
lines, columnPositions := utils.RenderDisplayStrings(
|
||||
self.getDisplayStrings(startModelIdx, endModelIdx),
|
||||
@@ -97,23 +134,6 @@ func (self *ListRenderer) renderLines(startIdx int, endIdx int) string {
|
||||
return strings.Join(lines, "\n")
|
||||
}
|
||||
|
||||
func (self *ListRenderer) prepareConversionArrays(nonModelItems []*NonModelItem) {
|
||||
self.numNonModelItems = len(nonModelItems)
|
||||
viewIndicesByModelIndex := lo.Range(self.list.Len() + 1)
|
||||
modelIndicesByViewIndex := lo.Range(self.list.Len() + 1)
|
||||
offset := 0
|
||||
for _, item := range nonModelItems {
|
||||
for i := item.Index; i <= self.list.Len(); i++ {
|
||||
viewIndicesByModelIndex[i]++
|
||||
}
|
||||
modelIndicesByViewIndex = slices.Insert(
|
||||
modelIndicesByViewIndex, item.Index+offset, modelIndicesByViewIndex[item.Index+offset])
|
||||
offset++
|
||||
}
|
||||
self.viewIndicesByModelIndex = viewIndicesByModelIndex
|
||||
self.modelIndicesByViewIndex = modelIndicesByViewIndex
|
||||
}
|
||||
|
||||
func (self *ListRenderer) insertNonModelItems(
|
||||
nonModelItems []*NonModelItem, endIdx int, startIdx int, lines []string, columnPositions []int,
|
||||
) []string {
|
||||
|
||||
@@ -254,9 +254,6 @@ func TestListRenderer_ModelIndexToViewIndex_and_back(t *testing.T) {
|
||||
getNonModelItems: getNonModelItems,
|
||||
}
|
||||
|
||||
// Need to render first so that it knows the non-model items
|
||||
self.renderLines(-1, -1)
|
||||
|
||||
for i := range len(s.modelIndices) {
|
||||
assert.Equal(t, s.expectedViewIndices[i], self.ModelIndexToViewIndex(s.modelIndices[i]))
|
||||
}
|
||||
@@ -267,3 +264,27 @@ func TestListRenderer_ModelIndexToViewIndex_and_back(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// The index conversions must not depend on the list having been rendered
|
||||
// first. It used to be renderLines that populated the conversion arrays, so
|
||||
// converting an index before the first render silently ignored the non-model
|
||||
// items (and converting after the model changed used a stale snapshot).
|
||||
func TestListRenderer_IndexConversionsAreRenderIndependent(t *testing.T) {
|
||||
modelInts := lo.Map(lo.Range(3), func(i int, _ int) myint { return myint(i) })
|
||||
self := &ListRenderer{
|
||||
list: NewListViewModel(func() []myint { return modelInts }),
|
||||
getDisplayStrings: func(startIdx int, endIdx int) [][]string {
|
||||
return lo.Map(modelInts[startIdx:endIdx],
|
||||
func(i myint, _ int) []string { return []string{fmt.Sprint(i)} })
|
||||
},
|
||||
// A section header sits at model index 1, so model item 1 is pushed down
|
||||
// to view index 2, and view index 2 maps back to model item 1.
|
||||
getNonModelItems: func() []*NonModelItem {
|
||||
return []*NonModelItem{{Index: 1, Content: "--- header ---"}}
|
||||
},
|
||||
}
|
||||
|
||||
// Deliberately convert without rendering first.
|
||||
assert.Equal(t, 2, self.ModelIndexToViewIndex(1))
|
||||
assert.Equal(t, 1, self.ViewIndexToModelIndex(2))
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/jesseduffield/lazygit/pkg/commands/models"
|
||||
@@ -142,7 +143,9 @@ type LocalCommitsViewModel struct {
|
||||
|
||||
// If this is true we limit the amount of commits we load, for the sake of keeping things fast.
|
||||
// If the user attempts to scroll past the end of the list, we will load more commits.
|
||||
limitCommits bool
|
||||
// Atomic because a checkout or reset sets it from a worker goroutine while the
|
||||
// commits refresh reads it on the UI thread to decide how many commits to load.
|
||||
limitCommits atomic.Bool
|
||||
|
||||
// If this is true we'll use git log --all when fetching the commits.
|
||||
showWholeGitGraph bool
|
||||
@@ -151,9 +154,9 @@ type LocalCommitsViewModel struct {
|
||||
func NewLocalCommitsViewModel(getModel func() []*models.Commit, c *ContextCommon) *LocalCommitsViewModel {
|
||||
self := &LocalCommitsViewModel{
|
||||
ListViewModel: NewListViewModel(getModel),
|
||||
limitCommits: true,
|
||||
showWholeGitGraph: c.UserConfig().Git.Log.ShowWholeGraph,
|
||||
}
|
||||
self.limitCommits.Store(true)
|
||||
|
||||
return self
|
||||
}
|
||||
@@ -221,15 +224,15 @@ func (self *LocalCommitsContext) RefForAdjustingLineNumberInDiff() string {
|
||||
}
|
||||
|
||||
func (self *LocalCommitsContext) ModelSearchResults(searchStr string, caseSensitive bool) []gocui.SearchPosition {
|
||||
return searchModelCommits(caseSensitive, self.GetCommits(), self.ColumnPositions(), self.ModelIndexToViewIndex, searchStr)
|
||||
return searchModelCommits(caseSensitive, self.GetCommits(), self.ColumnPositions(), self.modelToViewIndexConverter(), searchStr)
|
||||
}
|
||||
|
||||
func (self *LocalCommitsViewModel) SetLimitCommits(value bool) {
|
||||
self.limitCommits = value
|
||||
self.limitCommits.Store(value)
|
||||
}
|
||||
|
||||
func (self *LocalCommitsViewModel) GetLimitCommits() bool {
|
||||
return self.limitCommits
|
||||
return self.limitCommits.Load()
|
||||
}
|
||||
|
||||
func (self *LocalCommitsViewModel) SetShowWholeGitGraph(value bool) {
|
||||
|
||||
@@ -60,8 +60,11 @@ func NewContextTree(c *ContextCommon) *ContextTree {
|
||||
"main",
|
||||
PATCH_BUILDING_MAIN_CONTEXT_KEY,
|
||||
func() []int {
|
||||
filename := commitFilesContext.GetSelectedPath()
|
||||
includedLineIndices, err := c.Git().Patch.PatchBuilder.GetFileIncLineIndices(filename)
|
||||
file := commitFilesContext.GetSelectedFile()
|
||||
if file == nil {
|
||||
return nil
|
||||
}
|
||||
includedLineIndices, err := c.Git().Patch.PatchBuilder.GetFileIncLineIndices(file.Path, file.PreviousPath)
|
||||
if err != nil {
|
||||
c.Log.Error(err)
|
||||
return nil
|
||||
|
||||
@@ -223,7 +223,7 @@ func (self *SubCommitsContext) RefForAdjustingLineNumberInDiff() string {
|
||||
}
|
||||
|
||||
func (self *SubCommitsContext) ModelSearchResults(searchStr string, caseSensitive bool) []gocui.SearchPosition {
|
||||
return searchModelCommits(caseSensitive, self.GetCommits(), self.ColumnPositions(), self.ModelIndexToViewIndex, searchStr)
|
||||
return searchModelCommits(caseSensitive, self.GetCommits(), self.ColumnPositions(), self.modelToViewIndexConverter(), searchStr)
|
||||
}
|
||||
|
||||
func (self *SubCommitsContext) IndexForGotoBottom() int {
|
||||
|
||||
@@ -207,18 +207,6 @@ func (gui *Gui) resetHelpersAndControllers() {
|
||||
controllers.AttachControllers(context, searchControllerFactory.Create(context))
|
||||
}
|
||||
|
||||
for _, context := range []controllers.CanViewWorktreeOptions{
|
||||
gui.State.Contexts.LocalCommits,
|
||||
gui.State.Contexts.ReflogCommits,
|
||||
gui.State.Contexts.SubCommits,
|
||||
gui.State.Contexts.Stash,
|
||||
gui.State.Contexts.Branches,
|
||||
gui.State.Contexts.RemoteBranches,
|
||||
gui.State.Contexts.Tags,
|
||||
} {
|
||||
controllers.AttachControllers(context, controllers.NewWorktreeOptionsController(common, context))
|
||||
}
|
||||
|
||||
// allow for navigating between side window contexts
|
||||
for _, context := range []types.Context{
|
||||
gui.State.Contexts.Status,
|
||||
|
||||
@@ -89,6 +89,12 @@ func (self *BasicCommitsController) GetKeybindings(opts types.KeybindingsOpts) [
|
||||
Description: self.c.Tr.MoveCommitsToNewBranch,
|
||||
Tooltip: self.c.Tr.MoveCommitsToNewBranchTooltip,
|
||||
},
|
||||
{
|
||||
Keys: opts.GetKeys(opts.Config.Universal.NewWorktree),
|
||||
Handler: self.withItem(self.c.Helpers().Worktree.NewWorktreeMenuForCommit),
|
||||
Description: self.c.Tr.NewWorktree,
|
||||
OpensMenu: true,
|
||||
},
|
||||
{
|
||||
Keys: opts.GetKeys(opts.Config.Commits.ViewResetOptions),
|
||||
Handler: self.withItem(self.createResetMenu),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user