1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-14 11:23:09 +02:00
Commit Graph

5039 Commits

Author SHA1 Message Date
README-bot
b657fc4f0b Updated README.md 2024-01-10 08:17:42 +00:00
Stefan Haller
d294d51791
Add command to find base commit for creating a fixup () 2024-01-10 09:17:29 +01:00
Stefan Haller
b35f8776e1 Warn when there are hunks with only added lines
The algorithm works by blaming the deleted lines, so if a hunk contains only
added lines, we can only hope that it also belongs in the same commit. Warn the
user about this.

Note: the warning might be overly agressive, we'll have to see if this is
annoying. The reason is that it depends on the diff context size whether added
lines go into their own hunk or are grouped together with other added or deleted
lines into one hunk. However, our algorithm uses a diff context size of 0,
because that makes it easiest to parse the diff; this results in hunks having
only added lines more often than what the user sees. For example, moving a line
of code down by two lines will likely result in a single hunk for the user, but
in two hunks for our algorithm. On the other hand, being this strict makes the
warning consistent. We could consider using the user's diff context size in the
algorithm, but then it would depend on the current context size whether the
warning appears, which could be confusing. Plus, it would make the algorithm
quite a bit more complicated.
2024-01-10 09:11:40 +01:00
Stefan Haller
8ca78412ac Add command to find base commit for creating a fixup 2024-01-10 09:11:40 +01:00
Stefan Haller
33f933ba21
Add config setting for splitting window vertically in half screen mode () 2024-01-09 15:53:32 +01:00
Stefan Haller
d70dd5123d Add config setting for side panel location (left or top) in half screen mode 2024-01-09 15:45:26 +01:00
Stefan Haller
15da702140
Fix preserving the commit message when description contains blank lines () 2024-01-09 14:35:43 +01:00
Stefan Haller
cd50c79ae4 Preserve the commit message correctly even if the description has blank lines
There are two possible fixes for this bug, and they differ in behavior when
rewording a commit. The one I chose here always splits at the first line feed,
which means that for an improperly formatted commit message such as this one:

   This is a very long multi-line subject,
   which you shouldn't really use in git.

   And this is the body (we call it "description" in lazygit).

we split after the first line instead of after the first paragraph. This is
arguably not what the original author meant, but splitting after the first
paragraph doesn't really work well in lazygit, because we would try to put both
lines into the one-line subject field of the message panel, and you'd only see
the second and not even know that there are more.

The other potential fix would have been to join subject and description with two
line feeds instead of one in JoinCommitMessageAndDescription; this would have
fixed our bug in the same way, but would result in splitting the above message
after the second line instead of the first. I think that's worse, so I decided
for the first fix.

While we're at it, simplify the code a little bit; strings.Cut is documented to
return (s, "") when the separator is not found, so there's no need to do this on
our side.

We do have to trim spaces on the description now, to support the regular reword
case where subject and body are separated by a blank line.
2024-01-09 14:31:53 +01:00
Stefan Haller
3ebba5f32c Add test demonstrating a bug with preserving the commit message
SplitCommitMessageAndDescription splits at the first '\n\n' that it finds (if
there is one), which in this case is between the two paragraphs of the
description. This is wrong.
2024-01-09 14:31:53 +01:00
Stefan Haller
9a423c388d Remove unused function
I think this is a left-over from before we had the new commit message panel. It
no longer makes sense to add a newline to the commit subject.
2024-01-09 14:31:53 +01:00
Stefan Haller
daf9b8cfa9 Simplify GetCommitMessage
Use git log instead of git rev-list, this way we don't get a line "commit <sha>"
at the beginning that we then have to discard again.

The test TestGetCommitMsg is becoming a bit pointless now, since it just
compares that input and output are identical.
2024-01-09 14:31:53 +01:00
README-bot
b6a9220343 Updated README.md 2024-01-09 13:30:54 +00:00
Stefan Haller
aeb017e029
Add command to open git difftool () 2024-01-09 14:29:26 +01:00
Stefan Haller
a6174271aa Update cheat sheets and json schema 2024-01-09 14:27:33 +01:00
Stefan Haller
517e0f8248 Add command to open git difftool 2024-01-09 14:27:33 +01:00
Stefan Haller
c1cb95db6f Remove unused function 2024-01-09 14:24:14 +01:00
Stefan Haller
966e5f5337
Fix checking out a tag when there is a branch with the same name () 2024-01-09 14:23:08 +01:00
Stefan Haller
f244ec8251 Fix checking out a tag when a branch with the same name exists 2024-01-09 14:18:35 +01:00
Stefan Haller
2b97f0fb43 Add test demonstrating the problem
When there's a branch with the same name as the tag, the branch gets checked out
instead of the tag.
2024-01-09 14:18:35 +01:00
Stefan Haller
af5e25cfb5
Replace copy commit SHA with copy commit subject on the y s keybind in the commits view () 2024-01-09 14:17:05 +01:00
README-bot
93cae68e94 Updated README.md 2024-01-09 09:55:08 +00:00
Jesse Duffield
6e6fe6a489
Show a friendly error message when starting lazygit from a non-existent cwd ()
Closes 

- **PR Description**

 observes that lazygit crashes with a stack trace if it's run from
a non-existent current working directory. The steps to reproduce are:

```
mkdir test
cd test
rm -r ../test
lazygit
```

(Note: I can repro this on Ubuntu, but not on macOS Sonoma, where
lazygit starts regardless of whether the current working directory
exists or not.)

Here's how the repro steps look on Ubuntu with this PR applied:

```
simon@ubuntu:/Users/simon/src/3p/lazygit$ go build .
simon@ubuntu:/Users/simon/src/3p/lazygit$ mkdir deleteme
simon@ubuntu:/Users/simon/src/3p/lazygit$ cd deleteme/
simon@ubuntu:/Users/simon/src/3p/lazygit/deleteme$ rm -r ../deleteme
simon@ubuntu:/Users/simon/src/3p/lazygit/deleteme$ ../lazygit
2024/01/02 18:40:15 Error: the current working directory does not exist
```

- **Please check if the PR fulfills these requirements**

* [x] Cheatsheets are up-to-date (run `go generate ./...`)
* [x] Code has been formatted (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting))
* [x] Tests have been added/updated (see
[here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md)
for the integration test guide)
* [x] Text is internationalised (see
[here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation))
* [x] Docs (specifically `docs/Config.md`) have been updated if
necessary
* [x] You've read through your own file changes for silly mistakes etc

<!--
Be sure to name your PR with an imperative e.g. 'Add worktrees view'
see https://github.com/jesseduffield/lazygit/releases/tag/v0.40.0 for
examples
-->
2024-01-09 20:54:50 +11:00
Karim Khaleel
2c2436574d Replace copy SHA with copy subject on commit 'y s' 2024-01-03 02:19:39 +03:00
Simon Whitaker
0cdca9ac2c Update error message 2024-01-02 18:43:39 +00:00
Simon Whitaker
4172be6bc8 Show a friendly error message when starting lazygit from a non-existent cwd
Closes 3187
2024-01-02 18:25:28 +00:00
Stefan Haller
d97b37a178
Add local branch sorting menu () 2023-12-27 15:30:25 +01:00
Alex March
21334fa889 Add integration test for local branch sort order 2023-12-27 15:25:29 +01:00
Alex March
36a29f225b Add a sort order menu for local branches 2023-12-27 15:25:29 +01:00
README-bot
1e85c4379f Updated README.md 2023-12-27 10:24:12 +00:00
Stefan Haller
470632b97a
Add age to stash entries () 2023-12-27 11:23:57 +01:00
AzraelSec
50044dd5e0 chore: use null char as a stash entries divider during loading 2023-12-27 11:21:49 +01:00
AzraelSec
bc330b8ff3 feat: add age on stash lines 2023-12-27 11:21:49 +01:00
README-bot
7f36494eb2 Updated README.md 2023-12-22 08:16:48 +00:00
Stefan Haller
85c48ba887
Add remote branch sorting menu, saving the option to state.yml () 2023-12-22 09:16:34 +01:00
Stefan Haller
1e3935cbaf Add integration test for remote branch sort order 2023-12-22 16:30:20 +09:00
Alex March
3fe491fcb2 Implement a sort order menu for remote branches 2023-12-22 16:30:20 +09:00
README-bot
66b608b2f9 Updated README.md 2023-12-15 15:39:58 +00:00
Stefan Haller
4ee01d153b
fix(config): add yaml:"options" struct tag to CustomCommandPrompt.[]Options () 2023-12-15 16:39:43 +01:00
Emre Deger
79e04fad9a
fix(config): add yaml struct tag to CustomCommandPrompt.[]Options
add `yaml` struct tag for fixing uppercase issue on json schema
2023-12-15 07:29:48 +03:00
README-bot
6778bc04a3 Updated README.md 2023-12-10 15:07:02 +00:00
Stefan Haller
d548f857a4
Fall back to WithWaitingStatus if item is not visible () 2023-12-10 16:06:49 +01:00
Stefan Haller
f99c59b6d5 Fall back to WithWaitingStatus if item is scrolled out of view 2023-12-10 16:03:25 +01:00
Stefan Haller
0fd4983c66 Fall back to WithWaitingStatus if view showing the item is not visible 2023-12-10 15:57:51 +01:00
Stefan Haller
240948b882 Return only visible views from TopViewInWindow
Without this it's not reliably possible to ask whether a given view is visible
by asking

  windowHelper.TopViewInWindow(context.GetWindowName()) == context.GetView()

because there could be transient, invisible contexts after it in the Z order.

I guess it's a bit of a coincidence that this has never been a problem so far.
2023-12-10 15:57:51 +01:00
README-bot
cf82e69bbe Updated README.md 2023-12-09 14:40:36 +00:00
Stefan Haller
653e59a3d5
Make move up/down blocking () 2023-12-09 15:40:23 +01:00
Stefan Haller
e342860ef1 Add WithWaitingStatusSync for reverting commits 2023-12-09 15:28:41 +01:00
Stefan Haller
569adae6a2 Use WithWaitingStatusSync for move commit up/down 2023-12-09 15:28:40 +01:00
Stefan Haller
79fe885dcd Add WithWaitingStatusSync 2023-12-09 15:28:40 +01:00
Stefan Haller
a46f26e148 Bump gocui 2023-12-09 15:23:40 +01:00