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

175 Commits

Author SHA1 Message Date
Stefan Haller
d50c58b4c6 Implement "edit commit" in terms of the new EditRebase function 2023-04-29 07:28:33 +02:00
Stefan Haller
5645a662de Use --rebase-merges for interactive rebase
At the moment it doesn't make a big difference, because the vast majority of
callers create a list of todos themselves to completely replace what git came up
with. We're changing this in the following commits though, and then it's helpful
to preserve merges.
2023-04-29 07:28:33 +02:00
Stefan Haller
a41218551d Put gitCommon.version back in deps_test.go
This was reverted in 3546ab8f21, but shouldn't have.
2023-04-29 07:28:33 +02:00
Jesse Duffield
aa70723e3a
Merge pull request #2558 from stefanhaller/allow-resetting-author-during-rebase 2023-04-29 12:44:14 +10:00
Jesse Duffield
7db54a948a
Merge pull request #2548 from AKARSHITJOSHI/fix/tagPush 2023-04-29 12:43:55 +10:00
Stefan Haller
b09000194a Allow resetting author of HEAD commit during rebase 2023-04-18 17:33:33 +02:00
Ryooooooga
3546ab8f21
Revert "feat: support for push --force-if-includes"
This reverts commit e00f248cf7.
2023-04-17 19:37:33 +09:00
Personal
9a13447b97 Change push tag command
Signed-off-by: AKARSHITJOSHI <akarshitjoshi@gmail.com>
2023-04-16 10:37:11 +05:30
AzraelSec
ddcd6be245 refactor: introduce a struct to pack the
`PrepareInteractiveRebaseCommand` function
2023-04-15 17:26:08 +10:00
AzraelSec
a3fdf91714 feat: allow to perform a rebase with breaking before the first commit 2023-04-15 17:26:08 +10:00
AzraelSec
368f9c8cb3 feat: let interactive rebase prepend commands to the default todo file 2023-04-15 17:26:08 +10:00
Stefan Haller
dc4e88f8a4 Make moving todo commits more robust 2023-04-15 08:36:03 +02:00
Stefan Haller
120dd1530a Make EditRebaseTodo more robust
It used to work on the assumption that rebasing commits in lazygit's model
correspond one-to-one to lines in the git-rebase-todo file, which isn't
necessarily true (e.g. when users use "git rebase --edit-todo" at the custom
command prompt and add a "break" between lines).
2023-04-15 08:36:03 +02:00
Stefan Haller
a304fed68c Add GitVersion field to NewIntegrationTestArgs
It can be used to specify which git versions a given test should or should not run on.
2023-04-15 08:36:03 +02:00
Stefan Haller
227b0b781c Show update-ref commands in rebase todo list
This is useful when working with stacked branches, because you can now move
"pick" entries across an update-ref command and you can tell exactly which
branch the commit will end up in.

It's also useful to spot situations where the --update-refs option didn't work
as desired. For example, if you duplicate a branch and want to rebase only one
of the branches but not the other (maybe for testing); if you have
rebase.updateRefs=true in your git config, then rebasing one branch will move
the other branch along. To solve this we'll have to introduce a way to delete
the update-ref entry (maybe by hitting backspace?); this is out of scope for
this PR, so for now users will have to type "git rebase --edit-todo" into the
custom command prompt to sort this out.

We will also have to prevent users from trying to turn update-ref commands into
other commands like "pick" or "drop"; we'll do this later in this branch.
2023-04-15 08:36:03 +02:00
Stefan Haller
a0d179b6dc Make getHydratedRebasingCommits more robust
So far the algorithm worked on the assumption that the output of the "git show"
command corresponds one-to-one to the lines of the rebase-todo file. This
assumption doesn't hold once we start to include todo lines that don't have a
sha (like update-ref), or when the todo file contains multiple entries for the
same sha. This should never happen normally, but it can if users manually edit
the todo file and duplicate a line.
2023-04-15 08:36:03 +02:00
Stefan Haller
c53c5e47ef Store commit.Action as an enum instead of a string
The main reason for doing this (besides the reasons given for Status in the
previous commit) is that it allows us to easily convert from TodoCommand to
Action and back. This will be needed later in the branch. Fortunately,
TodoCommand is one-based, so this allows us to add an ActionNone constant with
the value 0.
2023-04-15 08:36:03 +02:00
Stefan Haller
188773511e Store commit.Status as an enum instead of a string
This is unrelated to the changes in this PR, but since we are doing the same
thing for the commit.Action field in the next commit, it makes sense to do it
for Status too for consistency. Modelling this as an enum feels more natural
than modelling it as a string, since there's a finite set of possible values.
And it saves a little bit of memory (not very much, since none of the strings
were heap-allocated, but still).
2023-04-15 08:36:03 +02:00
Jesse Duffield
82c54ed3d2
Merge pull request #2544 from scallaway/git-diff-detect-renames 2023-04-13 21:47:59 +10:00
Stefan Haller
2947b56134 Add support for falling back to legacy edit config 2023-04-13 13:14:00 +02:00
Stefan Haller
659d668e16 Implement edit presets 2023-04-13 13:14:00 +02:00
Scott Callaway
6ffe98abac
feat: remove --no-renames flag from main panel diffs (to show renamed files) 2023-04-13 10:57:38 +01:00
Scott Callaway
046cb942c2
fix: organise commit test file
Pulled this out into a separate commit since it was unrelated to the
feature coming behind it.

This just cleans up the `commit_test.go` file slightly (for the method
that I was working on) so that the tests are built in a way that is
slightly more readable - testing each configuration option individually
without combining any of them.
2023-04-12 12:31:06 +01:00
Stefan Haller
b24955063c Allow rewording the head commit during interactive rebase 2023-04-01 08:16:15 +02:00
Stefan Haller
c6930e0538 Cleanup: use commit.isTODO() consistently
It seems cleaner than checking the Status for "rebasing".
2023-04-01 08:16:15 +02:00
Jesse Duffield
60f902f026 rename patch manager to patch builder 2023-03-19 16:35:57 +11:00
Stefan Haller
4b4dccfd7d
Fix "move patch into new commit" for partial hunk (#2507) 2023-03-18 18:17:47 +11:00
Ryooooooga
55fb3ef4e6
fix(commit_loader): fix log command 2023-03-16 20:13:23 +09:00
Stefan Haller
6af8f278d0 Don't put "<--- YOU ARE HERE" in the commit model's name
Instead, derive it from context at display time (if we're rebasing, it's the
first non-todo commit). This fixes the problem that unfolding the current
commit's files in the local commits panel would show junk in the frame's title.

Along the way we make sure to only display the "<--- YOU ARE HERE" string in the
local commits panel; previously it would show for the top commit of a branch or
tag if mid-rebase.
2023-03-01 09:12:00 +01:00
Jesse Duffield
78f3a7a478 migrate interactive rebase integration tests 2023-02-22 19:36:31 +11:00
Jesse Duffield
e1c376ef54
Merge pull request #2453 from stefanhaller/allow-rebasing-to-first-commit 2023-02-20 19:21:37 +11:00
Jesse Duffield
39c56553b3 show tag message 2023-02-20 19:01:08 +11:00
Stefan Haller
c5cd217a65 Allow squashing fixups above the first commit of a repo
This includes amending changes into a given commit, since that's implemented in
terms of the former.
2023-02-20 08:29:43 +01:00
Jesse Duffield
9e1e20fef2
Merge pull request #2421 from Ryooooooga/tag-on-branch 2023-02-20 18:20:16 +11:00
Stefan Haller
a349e886ce Allow interactive rebasing all the way down to the first commit
Pass --root instead of a sha when we want to rebase down to the initial commit.
2023-02-20 07:40:05 +01:00
Stefan Haller
dd61c49a15 Better error message for trying to squash or fixup the first commit
It's not so much the total number of commits that matters here, it's just
whether we are on the first one. (This includes the other condition.)

This allows us to get rid of the condition in rebase.go.
2023-02-20 07:40:04 +01:00
Stefan Haller
ac9515d8c7 Revert "fix: improve backward compatibility"
Since we now require git 2.20, we don't need this any more.

This reverts commit 7c5f33980f.
2023-02-19 16:13:31 +01:00
Ryooooooga
67b08ac239
feat: support to create tag on branch 2023-02-19 23:31:46 +09:00
Stefan Haller
67b8ef449c Edit by breaking after current commit
Instead of rebasing from the commit below the current one and then setting the
current one to "edit", we rebase from the current one and insert a "break" after
it. In most cases the behavior is exactly the same as before, except that the
new method also works if the current commit is a merge commit. This is useful if
you want to create a new commit at the very beginning of your branch (by editing
the last commit before your branch).
2023-02-19 10:21:01 +01:00
Stefan Haller
979c3d6278
Fix yellow/red coloring of pushed/unpushed commits in branch commits panel (#2448) 2023-02-19 10:13:46 +11:00
stk
1da762c295 Explicitly pass --no-autosquash when rebasing
This fixes the problem shown in the previous commit.
2023-02-09 18:21:11 +01:00
stk
5bb6198219 Allow ignoring whitespace in diff in commits panel 2023-02-07 12:14:29 +01:00
stk
946c1dff99 Cleanup: remove extra space 2023-02-07 12:09:15 +01:00
Jesse Duffield
469938ee9b
Merge pull request #2342 from knutwalker/override-git-sequence-editor-for-rebase 2023-02-05 13:52:35 +11:00
Jesse Duffield
f79a8c281f
Merge pull request #2398 from Ryooooooga/fix-detached-head
fix https://github.com/jesseduffield/lazygit/issues/1467
2023-01-29 14:19:05 +11:00
Ryooooooga
2183c157d4
feat(log): allow to disable git.log.order 2023-01-28 21:17:05 +09:00
Ryooooooga
5dec080719
fix: fix RefName of detached HEAD to works in Chinese 2023-01-27 20:45:18 +09:00
Ryooooooga
21f8857d36
refactor: simplify log format 2023-01-06 11:15:33 +09:00
Ryooooooga
965f7bfcb2
feat(config): change git.commit.verbose to accept "default" 2023-01-06 11:15:33 +09:00
Paul Horn
bc7873144e
Override GIT_SEQUENCE_EDITOR for rebase commands
I noticed that `$GIT_SEQUENCE_EDITOR` is overridden in `PrepareInteractiveRebaseCommand`
but not in `runSkipEditorCommand`.

Before this change, some commands such as `SquashAllAboveFixupCommits`
would not work when a different sequence editor, e.g.
[git-interactive-rebase-tool](https://github.com/MitMaro/git-interactive-rebase-tool)
is configured.
2023-01-01 04:37:19 +01:00
Jesse Duffield
1bb138c79c
Merge pull request #2341 from knutwalker/commit-verbose 2023-01-01 13:57:49 +11:00
Paul Horn
d98130c3ef
Add option to allow --verbose commit in editor commits 2023-01-01 02:01:04 +01:00
Ryooooooga
7c5f33980f
fix: improve backward compatibility 2022-12-31 22:47:21 +09:00
Ryooooooga
e00f248cf7
feat: support for push --force-if-includes 2022-12-30 20:01:15 +09:00
Ryooooooga
cd9111837e
feat: add GitVersion struct 2022-12-30 20:01:14 +09:00
Nils Andresen
245563bc99 (#2288) quote remoteName before compiling regex
If the remote name contains special regex-chars,
the compilation of the regex might fail.
Quoting the remoteName ensures that all special chars
in the remoteName are properly escaped before compiling
the regex.
2022-11-24 12:56:28 +00:00
Ryooooooga
52a2e4c1dc fix: fix ambiguous branch name
test: add an integration test for checkout branch by name

fix: fix full ref name of detached head

refactor: refactor current branch loader

chore: use field name explicitly
2022-11-14 19:05:07 +11:00
Jesse Duffield
b33ec5a050
Merge pull request #1980 from ajhynes7/stash-untracked-changes 2022-11-14 18:46:53 +11:00
sudoburt
3e73dacce3 Merge loaders package into git_commands package 2022-11-14 18:11:45 +11:00
Jesse Duffield
df3cd941d7 use tempdir in tests to prevent polluting worktree 2022-11-13 14:10:21 +11:00
Jesse Duffield
97ced9e14f fix could-not-access error 2022-11-12 18:09:15 -03:30
Jesse Duffield
e8b97c9fe2 fix could-not-access error 2022-11-11 12:30:14 +11:00
Andrew Hynes
a47e72892a
Merge branch 'master' into stash-untracked-changes 2022-11-01 16:08:34 -02:30
Ryooooooga
3103398e31
chore: refactor rename stash 2022-10-16 09:30:04 +09:00
Ryooooooga
eceb3a5aa6
chore: refactor rename stash 2022-10-16 09:12:43 +09:00
Ryoga
8a9eefa4d2
chore: remove unnecessary space
Co-authored-by: Jesse Duffield <jessedduffield@gmail.com>
2022-10-16 09:12:43 +09:00
Ryooooooga
11316b7a48
feat: add rename stash 2022-10-16 09:12:42 +09:00
Andrew Hynes
8c46a0110d
Merge branch 'master' into stash-untracked-changes 2022-10-06 22:59:06 -02:30
Luka Markušić
41f86f6535 Rebase merges by default 2022-09-24 23:37:17 +02:00
jiepeng
b8900baf1a remove deprecated calls 2022-09-17 15:10:41 -07:00
Andrew Hynes
c7733aa5e5 refactor: rename method to StashIncludeUntrackedChanges 2022-09-15 21:48:49 -02:30
Andrew Hynes
6feb301c2a fix: use message in git stash command 2022-09-15 21:48:49 -02:30
Andrew Hynes
e66b162726 refactor: remove redundant if statement 2022-09-15 21:48:49 -02:30
Andrew Hynes
4f8816ebf2 refactor: use extended flag name 2022-09-15 21:48:49 -02:30
Andrew Hynes
7ddb80a13e feat: add stash option to include untracked changes 2022-09-15 21:48:48 -02:30
nullishamy
154bd975a6
Apply refactoring suggestions 2022-08-15 13:59:34 +01:00
Jesse Duffield
755ae0ef84 add deadlock mutex package
write to deadlock stderr after closing gocui

more deadlock checking
2022-08-07 11:16:14 +10:00
Jesse Duffield
524bf83a4a refactor to only have one context per view 2022-08-06 13:49:11 +10:00
Jesse Duffield
86ac309e08 add build info when building from source 2022-08-01 20:16:50 +10:00
Juan Sanchez Montalvo
11d766053e Allow adding a file to the .git/info/exclude file 2022-07-05 19:33:44 +10:00
Jesse Duffield
9591cc381a support setting the author of a commit
update copy
2022-06-09 19:12:20 +10:00
Luka Markušić
ca191159f5 Discard staged changes only 2022-05-08 14:24:28 +02:00
Jens Pfeifle
fbe23b3754 fixup! Add command to reset the commit author from the commits panel. 2022-05-08 13:29:57 +10:00
Jens Pfeifle
7ac487545c fixup! Add command to reset the commit author from the commits panel. 2022-05-08 13:29:56 +10:00
Jens Pfeifle
7c573a5bea Add command to reset the commit author from the commits panel. 2022-05-08 13:29:56 +10:00
Ryooooooga
5717e72366
fix: fix copying author name to clipboard 2022-05-07 18:08:05 +09:00
Jesse Duffield
cd5b041b0f clearer separation of concerns when bootstrapping application 2022-05-07 16:02:04 +10:00
Ryooooooga
d458e78d95
feat: add ability to edit hunk 2022-05-06 21:53:00 +09:00
Jesse Duffield
0940e0182b
Merge pull request #1870 from mark2185/feature/stash-unstaged 2022-05-06 20:17:33 +10:00
Jesse Duffield
f7fae0b82e
Merge pull request #1869 from mark2185/feature/unset-upstream 2022-05-06 20:14:13 +10:00
Jesse Duffield
4dd09ee0d5 allow copying commit author to clipboard 2022-05-01 14:14:29 +10:00
Ryooooooga
e5730cb80b
fix: improve default editCommandTemplate 2022-04-23 17:39:12 +09:00
Luka Markušić
bd9daf80b7 Add integration tests 2022-04-17 11:08:36 +02:00
Luka Markušić
1ae2dc9941 The four horsemen of stashing 2022-04-14 21:45:55 +02:00
Luka Markušić
f83308c8df Add option to (un)set upstream for a local branch 2022-04-11 14:04:06 +02:00
Luka Markušić
6f7038c827 Add option to stash only unstaged files 2022-04-10 09:35:59 +02:00
Ryooooooga
53257db99d fix: fix diff of renamed files 2022-04-06 08:26:13 +10:00
Ryooooooga
99ecc1cfdf fix loaders 2022-04-02 17:04:42 +11:00
Ryooooooga
86c259623c feat: fix permission problem of temp dirs 2022-04-02 08:48:38 +11:00
Luka Markušić
540edb0bf4 Add copy commit attributes option 2022-03-26 17:22:42 +11:00