Commit graph

1496 commits

Author SHA1 Message Date
Stefan Haller 7270dea48d Switch git-todo-parser from fsmiamoto original repo to stefanhaller's fork
Sometimes it takes a while to get PRs accepted upstream, and this blocks our
progress. Since I'm pretty much the only one making changes there anyway, it
makes sense to point to my fork directly.
2024-04-22 20:59:15 +02:00
pikomonde 19bef17042 rename sha to hash 10, last remaining sha (hopefully) 2024-04-12 08:33:47 +02:00
pikomonde 170c4ecb8c rename sha to hash 9, case: Sha 2024-04-12 08:33:47 +02:00
pikomonde de1c495704 rename sha to hash 8, update some log and comment 2024-04-12 08:33:47 +02:00
pikomonde 05fb12b1d5 rename sha to hash 6, update short hash 2024-04-12 08:33:47 +02:00
pikomonde 9cf1ca10a2 rename sha to hash 5 2024-04-12 08:33:47 +02:00
pikomonde 13af335b37 rename sha to hash 3 2024-04-12 08:33:47 +02:00
pikomonde 92aab21d3a rename sha to hash 2 2024-04-12 08:33:47 +02:00
pikomonde e6ef1642fa rename sha to hash 2024-04-12 08:33:47 +02:00
pikomonde 84333eebc3 renaming variable to CommitHash 2024-04-12 08:33:47 +02:00
pikomonde 7f6eea2a55 standardize 'Commit Sha' to 'Commit Hash' 2024-04-12 08:31:40 +02:00
Emanuele "Lele" Calo 7b0e06d885 TERM: remove TERM variable hard-coded value set 2024-04-09 04:15:03 +02:00
Stefan Haller f774b7eb5c Fix rewording signed commits when the log.showsignature git config is true
For people who have the log.showsignature git config set to true, trying to
reword a signed commit would put the signature verification into the subject
field and the commit subject into the description field of the commit message
panel. Amending commits, adding co-authors to a commit, and copying a commit
message to the clipboard would all be broken in a similar way.
2024-03-28 13:16:10 +01:00
Stefan Haller 93251db67e Fix the "Add to .git/info/exclude" command in submodules or worktrees 2024-03-28 13:11:08 +01:00
Stefan Haller 1fdcc29277 Fix deleting update-ref todos
It is a bad idea to read a git-rebase-todo file, remove some update-ref todos,
and write it back out behind git's back. This will cause git to actually remove
the branches referenced by those update-ref todos when the rebase is continued.

The reason is that git remembers the refs affected by update-ref todos at the
beginning of the rebase, and remembers information about them in the file
.git/rebase-merge/update-refs. Then, whenever the user performs a "git rebase
--edit-todo" command, it updates that file based on whether update-ref todos
were added or removed by that edit. If we rewrite the git-rebase-todo file
behind git's back, this updating doesn't happen.

Fix this by not updating the git-rebase-todo file directly in this case, but
performing a "git rebase --edit-todo" command where we set ourselves as the
editor and change the file in there. This makes git update the bookkeeping
information properly.

Ideally we would use this method for all cases where we change the
git-rebase-todo file (e.g. moving todos up/down, or changing the type of a
todo); this would be cleaner because we wouldn't mess with git's private
implementation details. I tried this, but unfortunately it isn't fast enough.
Right now, moving a todo up or down takes between 1 and 2ms on my machine;
changing it to do a "git rebase --edit-todo" slows it down to over 100ms, which
is unacceptable.
2024-03-26 22:29:56 +01:00
Stefan Haller 6da9d55e47 Cleanup: update outdated comment
We used to pass the todo string, but this has changed to instructions a while
ago.
2024-03-26 22:25:43 +01:00
Stefan Haller 150cc70698 Make it easy to create "amend!" commits
To support this, we turn the confirmation prompt of the "Create fixup commit"
command into a menu; creating a fixup commit is the first entry, so that
"shift-F, enter" behaves the same as before. But there are additional entries
for creating "amend!" commits, either with or without file changes. These make
it easy to reword commit messages of existing commits.
2024-03-22 08:27:45 +01:00
Stefan Haller 73019574a8 Support editing multiple files at once using range selection
We pass all of them to a single editor command, hoping that the editor will be
able to handle multiple files (VS Code and vim do).

We ignore directories that happen to be in the selection range; this makes it
easier to edit multiple files in different folders in tree view. We show an
error if only directories are selected, though.
2024-03-22 08:20:16 +01:00
Stefan Haller e42cbf95ae When checking out a remote branch by name, ask the user how
The choices are to create a new local branch that tracks the remote, or a
detached head.
2024-03-17 07:53:38 +01:00
Stefan Haller 0608fc6471 Allow deleting update-ref todos 2024-03-16 22:01:13 +01:00
Stefan Haller bd975a8dcb Allow moving update-ref todos up/down 2024-03-16 22:01:03 +01:00
Stefan Haller e5fa9e1c4a Store full ref in Name field of update-ref commits
Strip the prefix at presentation time instead. This makes it easier to find
update-ref todos in order to move them up/down, or delete them.
2024-03-16 15:48:34 +01:00
Stefan Haller b8f4cd0ef6 Extract functions AddCoAuthorToMessage and AddCoAuthorToDescription
In this commit we only need the former; the latter will be reused later in this
branch.
2024-03-11 09:18:40 +01:00
Stefan Haller 944d82028f Replace DOS linefeeds with Unix line feeds when loading a commit message
I have seen some commit messages that contain CRLF instead of just LF; I'm not
sure if these were created by a broken git client, but they exist, so we need to
deal with them. Editing them when rewording a commit sort of works, but is a
little strange; the \r characters are invisble, so you need an extra arrow key
press to skip over them.

In the next commit we are going to add more logic related to line breaks, and it
is getting confused by the \r, so it is becoming more important to fix this. The
easiest fix is to normalize the line endings right after loading.
2024-03-09 10:00:44 +01:00
Stefan Haller 3b723282cb Show all submodules recursively 2024-03-07 20:16:28 +01:00
Stefan Haller db4f12929e Pass entire submodule to UpdateUrl instead of name and path separately
This will make the next commit slightly simpler.
2024-03-07 20:16:28 +01:00
Stefan Haller ea87912a74 Fix deleting submodule where name and path are different 2024-03-07 20:16:28 +01:00
Stefan Haller eb0f7e3d02 Remove support for old-style non-interactive rebases
When doing a non-interactive rebase using a version of git earlier than 2.26, or
by explicitly calling `git -c rebase.backend=apply rebase`, lazygit can display
the pending todos by parsing the numbered patch files in `.git/rebase-apply/`.
Unfortunately, support for this has been broken for more than three years
because of the change in 682db77401 (the string literal "normal" should have
been changed to REBASE_MODE_NORMAL instead of REBASE_MODE_MERGING).

It's not an important bug since you can only get into this situation by doing a
rebase outside of lazygit, and then only with a pretty old git version or by
using very uncommon git options. So instead of fixing the bug, just remove the
code.
2024-03-02 10:26:15 +01:00
Stefan Haller 253a0096f9 Break git.merging.args config into separate arguments on whitespace
This makes it possible again to pass multiple arguments, for example
"--ff-only --autostash". This won't work correctly if you want to use
an argument that contains a space, but it's very unlikely that people
will want to do that, so I think this is good enough.
2024-03-02 10:22:01 +01:00
Stefan Haller aa81c456bb Add a test that demonstrates a bug with multiple args in git.merging.args config
We are currently passing the whole string as a single argument, which doesn't
work of course.
2024-03-02 10:22:01 +01:00
Tristan Déplantes 503422a72e Add author filtering to commit view
This commit introduces a new feature to the commit view, allowing users
to filter commits based on the author's name or email address. Similar
to the existing path filtering functionality, accessible through <c-s>,
this feature allows users to filter the commit history by the currently
selected commit's author if the commit view is focused, or by typing in
the author's name or email address.

This feature adds an entry to the filtering menu, to provide users with
a familiar and intuitive experience
2024-02-21 09:58:09 +01:00
Stefan Haller d329c92554 Set diff.noprefix=false for all other diff commands too
This fixes problems with being able to stage things in a custom patch correctly.
2024-02-18 15:22:43 +01:00
Matthias Richerzhagen afbaf82395 Fix problems with patches if git diff was customized with config. 2024-02-18 15:22:43 +01:00
Alex March e354a9bb48 Deprecate git.log.showGraph and git.log.order config
Added identical properties to AppState that should eventually have their defaults set.
2024-02-16 13:23:35 +01:00
Aaron Hoffman 15d5261933 Support range select removing files from a commit 2024-02-13 09:10:15 -06:00
Aaron Hoffman 510f9a1ae1 Support selecting file range in patch builder
test: add move_range_to_index

test: add toggle_range
2024-01-28 12:00:47 +11:00
Jesse Duffield 0f9d9e13d1 Show mode-specific keybinding suggestions
As part of making lazygit more discoverable, there are certain keys which you almost certainly
need to press when you're in a given mode e.g. 'v' to paste commits when cherry-picking. This
commit prominently shows these keybinding suggestions alongside the others in the option view.

I'm using the same colours for these keybindings as is associated with the mode elsewhere e.g.
yellow for rebasing and cyan for cherry-picking. The cherry-picking one is a bit weird because
we also use cyan text to show loaders and app status at the bottom left so it may be confusing,
but I haven't personally found it awkward from having tested it out myself.

Previously we would render these options whenever a new context was activated, but now that we
need to re-render options whenever a mode changes, I'm instead rendering them on each screen
re-render (i.e. in the layout function). Given how cheap it is to render this text, I think
it's fine performance-wise.
2024-01-28 08:33:13 +11:00
Stefan Haller 7fb5266027 Use inline status for fetching remotes 2024-01-26 08:29:04 +01:00
Jesse Duffield 269ef7f250 Support range select for staging/discarding files
As part of this, you must now press enter on a merge conflict file
to focus the merge view; you can no longer press space and if you do
it will raise an error.
2024-01-25 11:34:59 +11:00
John Whitley 3d9f1e02e5 Refactor repo_paths.go to use git rev-parse
This changes GetRepoPaths() to pull information from `git rev-parse`
instead of effectively reimplementing git's logic for pathfinding. This
change fixes issues with bare repos, esp. versioned homedir use cases,
by aligning lazygit's path handling to what git itself does.

This change also enables lazygit to run from arbitrary subdirectories of
a repository, including correct handling of symlinks, including "deep"
symlinks into a repo, worktree, a repo's submodules, etc.

Integration tests are now resilient against unintended side effects from
the host's environment variables. Of necessity, $PATH and $TERM are the
only env vars allowed through now.
2024-01-24 08:40:01 +01:00
Jesse Duffield f0de880136 Support range select in rebase actions 2024-01-23 17:23:56 +11:00
Jesse Duffield f3eb180f75 Standardise display of range selection across views
We're not fully standardising here: different contexts can store their range state however
they like. What we are standardising on is that now the view is always responsible for
highlighting the selected lines, meaning the context/controller needs to tell the view
where the range start is.

Two convenient benefits from this change:
1) we no longer need bespoke code in integration tests for asserting on selected lines because
we can just ask the view
2) line selection in staging/patch-building/merge-conflicts views now look the same as in
list views i.e. the highlight applies to the whole line (including trailing space)

I also noticed a bug with merge conflicts not rendering the selection on focus though I suspect
it wasn't a bug with any real consequences when the view wasn't displaying the selection.

I'm going to scrap the selectedRangeBgColor config and just let it use the single line
background color. Hopefully nobody cares, but there's really no need for an extra config.
2024-01-19 10:47:21 +11:00
Stefan Haller b470442a46 Obtain remote URL by calling "ls-remote --get-url" instead of using git config
This has the advantage that it still works when the user has configured aliases
using the insteadOf feature [1].

[1] https://git-scm.com/docs/git-config/2.42.0#Documentation/git-config.txt-urlltbasegtinsteadOf)
2024-01-10 09:24:23 +01:00
Stefan Haller 76e39af76f Allow multiple fetch commands (or fetch and pull) to run concurrently
Git has a bug [1] whereby running multiple fetch commands at the same time
causes all of them to append their information to the .git/FETCH_HEAD file,
causing the next git pull that wants to use the information to become confused,
and show an error like "Cannot rebase onto multiple branches". This error would
occur when pressing "f" and "p" in quick succession in the files panel, but also
when pressing "p" while a background fetch happens to be running. One likely
situation for this is pressing "p" right after startup.

Since lazygit never uses the information written to .git/FETCH_HEAD, it's best
to avoid writing to it, which fixes the scenarios described above.

However, it doesn't fix the problem of repeatedly pressing "f" quickly on the
checked-out branch; since we call "git pull" in that case, the above fix doesn't
help there. We'll address this separately in another PR.

[1] See https://public-inbox.org/git/xmqqy1daffk8.fsf@gitster.g/ for more
information.
2024-01-10 09:18:38 +01:00
Stefan Haller 5b91cd0cc8 Extract a function fetchCommandBuilder 2024-01-10 09:18:38 +01:00
Stefan Haller 6255728e63 Add a method GitVersion.IsAtLeast 2024-01-10 09:18:38 +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 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
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
Karim Khaleel 2c2436574d Replace copy SHA with copy subject on commit 'y s' 2024-01-03 02:19:39 +03:00
Alex March 36a29f225b Add a sort order menu for local branches 2023-12-27 15:25:29 +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
Alex March 3fe491fcb2 Implement a sort order menu for remote branches 2023-12-22 16:30:20 +09:00
AzraelSec c7012528fc feat: introduce a copy menu into the file view 2023-12-07 08:30:03 +01:00
Karim Khaleel 1a035db4c8 Add UserConfig jsonschema generation script 2023-12-02 10:46:24 +01:00
Stefan Haller be3b4bd791 Remove sync mutex
I'm pretty convinced we don't need it. Git itself does a good job of making sure
that concurrent operations don't corrupt anything.
2023-10-08 18:45:36 +02:00
Stefan Haller 3d6965ccbb Add inline status for pushing tags and deleting remote tags 2023-10-08 18:45:36 +02:00
Stefan Haller 707fa37160 Add inline status for pushing/pulling/fast-forwarding branches
When pulling/pushing/fast-forwarding a branch, show this state in the branches
list for that branch for as long as the operation takes, to make it easier to
see when it's done (without having to stare at the status bar in the lower
left).

This will hopefully help with making these operations feel more predictable, now
that we no longer show a loader panel for them.
2023-10-08 18:45:36 +02:00
Eng Zer Jun deed9eb18e
Remove redundant len check
From the Go specification [1]:

  "3. If the map is nil, the number of iterations is 0."

`len` returns 0 if the map is nil [2]. Therefore, checking `len(v) > 0`
before a loop is unnecessary.

[1]: https://go.dev/ref/spec#For_range
[2]: https://pkg.go.dev/builtin#len

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-10-04 21:03:26 +08:00
Stefan Haller a642395e9f Allow cherry-picking commits during a rebase
This can be useful when you know that a cherry-picked commit would conflict at
the tip of your branch, but doesn't at the beginning of the branch (or
somewhere in the middle). In that case you want to be able to edit the commit
before where you want to insert the cherry-picked commits, and then paste to
insert them into the todo list at that point.
2023-09-18 10:50:19 +02:00
Stefan Haller 70bfeddc90 Add StatusCommands.IsInNormalRebase and IsInInteractiveRebase
... and implement RebaseMode in terms of these.
2023-09-18 10:50:19 +02:00
Orlando Maussa db409fa69f
Add coauthor (#2)
Add co-author to commits

Add addCoAuthor command for commits

- Implement the `addCoAuthor` command to add co-authors to commits.
- Utilize suggestions helpers to populate author names from the suggestions list.
- Added command to gui at `LocalCommitsController`.

This commit introduces the `addCoAuthor` command, which allows users to easily add co-authors to their commits. The co-author names are populated from the suggestions list, minimizing the chances of user input errors. The co-authors are added using the Co-authored-by metadata format recognized by GitHub and GitLab.
2023-09-09 07:18:47 -05:00
Stefan Haller 7774fe0ab3 Move diff context size from UserConfig to AppState 2023-09-05 13:55:30 +02:00
Stefan Haller 1dac4158e9 Don't pass ignoreWhitespace to git commands
Now that AppState is available via common.Common, they can take it from there.
2023-09-04 17:50:49 +02:00
Stefan Haller 18c5780485 Add AppState to common.Common 2023-09-04 17:48:39 +02:00
Stefan Haller 6266e19623 Add support for external diff commands (e.g. difftastic) 2023-09-04 16:52:30 +02:00
Stefan Haller c67aa49856 Add explicit --no-ext-diff arg to CommitCommands.ShowCmdObj
We do this for ShowFileDiffCmdObj and WorktreeFileDiffCmdObj too, so why not
here.
2023-09-04 13:16:00 +02:00
Stefan Haller 572d1b5920 Add "Show divergence from upstream" entry to Upstream menu in branches panel 2023-08-29 08:16:40 +02:00
Stefan Haller 12f24aa8b4 Add option RefToShowDivergenceFrom to GetCommitsOptions
Not used yet.
2023-08-29 08:16:40 +02:00
Stefan Haller 911aa7774b Don't return commits from setCommitMergedStatuses
Since the slice stores pointers to objects, and we're only modifying the objects
but not the slice itself, there's no need to return it and assign it back. This
will allow us to call the function for subslices of commits.

Also, move the condition that checks for an empty string inside the function;
we're going to call it from more than one place, so this makes it easier.
2023-08-29 08:16:40 +02:00
Jesse Duffield 28353da61b
Allow adding a port to webDomain part of services config (#2908) 2023-08-28 19:38:45 +10:00
Raido Oras d7b611aa05 Allow port in webDomain for services config values 2023-08-21 14:33:58 +03:00
Stefan Haller 61bd3e8dd2 Add key binding for switching from the commit message panel to an editor
This is useful for when you begin to type the message in lazygit's commit panel,
and then realize that you'd rather use your editor's more powerful editing
capabilities. Pressing <c-o> will take you right there.
2023-08-21 10:03:34 +02:00
Cristian Betivu 7a4a0c85c4 Fix test 2023-08-19 19:12:36 +03:00
Cristian Betivu 382ecb6bfe Add unit test 2023-08-19 19:10:35 +03:00
Cristian Betivu 03694f7502 Fix arg order to asserts 2023-08-19 19:10:25 +03:00
Cristian Betivu ee308a4994 Clean before convertion? 2023-08-19 18:36:57 +03:00
Cristian Betivu a2b2336173 Stylistic changes 2023-08-19 18:36:57 +03:00
Cristian Betivu d7b1deb465 Clean path 2023-08-19 18:36:57 +03:00
Cristian Betivu dd01639f57 Improve error message 2023-08-19 18:36:57 +03:00
Stefan Haller b1314349d7 Fix yellow/red coloring while rebasing
It determines the yellow/red status by getting the merge-base between the
current branch and its upstream; while we're rebasing, the current branch is
HEAD, so it tried to get the merge-base between HEAD and HEAD{u}, which doesn't
work. Fix this by passing the name of the checked-out branch separately.
2023-08-19 09:26:27 +02:00
Stefan Haller 9671f549a1 Fix the blue sha color of todo commits while rebasing
This broke with 5d8a85f7e7.
2023-08-19 09:24:00 +02:00
Stefan Haller 8f164f7bc5 Stop cycling hunks when reaching the end
Previously, when pressing right-arrow when the cursor is already in the last
hunk, it would jump back to the beginning of that hunk. This can be confusing if
the hunk is long, maybe the start of the hunk is already scrolled off the top of
the window, and then pressing right-arrow actually scrolls *backwards*, which is
counter-intuitive. It's better to do nothing in this case.

Same for left-arrow when the cursor is already in the first hunk, although here
the problem is not so severe (unless diff context was increased by a huge
amount, and the start of the first hunk is scrolled off the bottom of the
window).
2023-08-15 11:40:40 +02:00
Federico 0df5cb1286
Allow deleting remote tags/branches from local tag/branch views (#2738) 2023-08-10 17:39:26 +10:00
Jesse Duffield c43830b027
Support editing files in existing neovim instance (#2916) 2023-08-10 17:23:58 +10:00
Stefan Haller 73b68927af Fix bug in LineNumberOfLine
This fixes a regression that was introduced in 73c7dc9c5d.
2023-08-10 07:22:42 +02:00
Stefan Haller bf699d3a79 Add test case for LineNumberOfLine()
There's a bug in LineNumberOfLine, but the existing test coverage doesn't catch
it, as the only test case for this was one where oldStart and newStart were the
same for all hunks. Add a test case where newStart is different for one of the
hunks; this demonstrates a bug, where all expected results from index 12 on are
off by one.
2023-08-10 07:22:42 +02:00
Jesse Duffield 9c5eedf748 use 'suspend' instead of 'editInTerminal' internally
'suspend' is a more appropriate name, especially now that you can choose not to suspend despite
still being in a terminal
2023-08-09 22:03:58 +10:00
Jesse Duffield 9e7018db8a Honour editInTerminal value when opening a worktree folder
There was no good reason not to do this in the first place.
2023-08-09 21:00:27 +10:00
Jesse Duffield 8e7958f78b Fix seg-fault when opening submodule in nested folder 2023-08-07 23:57:28 +10:00
Jesse Duffield 595e28d335 Support bare worktrees where worktree does not have its own .git file
This was on oversight on my part: I assumed that the --work-tree arg was
always intended for use with linked worktrees which have a .git file
pointing back to the repo.

I'm honestly confused now: seems like there are three kinds of worktrees:
* the main worktree of a non-bare repo
* a linked worktree (with its own gitdir in the repo's worktrees/ dir)
* a random folder which you specify as a worktree with the --work-tree arg

I'm pretty sure the --work-tree arg is only intended to be used with this
third kind or workree
2023-08-07 22:40:53 +10:00
Jesse Duffield c92ed07082 Appease linter 2023-08-02 08:32:57 +10:00
Karl Heitmann 917cfd7586 Adds EditRebaseFromBaseCommit log message to i18n 2023-07-31 19:57:14 -04:00
Karl Heitmann b7ba06fa5b Moves log related translations into its own Tr.Log. namespace 2023-07-31 19:42:41 -04:00
Karl Heitmann 51e205ce11 Moves hard coded strings for LogCommand to i18n. 2023-07-31 19:35:55 -04:00
Stefan Haller d41a195ee6 Allow force-tagging if tag exists 2023-07-31 11:38:52 +02:00
Stefan Haller 66de981e91 Add a "Mark commit as base commit for rebase" command
This allows to do the equivalent of "git rebase --onto <target> <base>", by
first marking the <base> commit with the new command, and then selecting the
target branch and invoking the usual rebase command there.
2023-07-31 08:41:41 +02:00
Stefan Haller 4eb73393bb Don't show branch marker for head commit unless updateRefs config is on 2023-07-31 08:34:01 +02:00
Stefan Haller 0c07963a2e Store full sha in branch model
The model will be used for logic, so the full hash is needed there; a shortened
hash of 8 characters might be too short to be unique in very large repos. If
some view wants to display a shortened hash, it should truncate it at
presentation time.
2023-07-31 08:34:01 +02:00
Stefan Haller 092d5dd608 Add CheckedOutBranch to Model struct 2023-07-31 08:34:01 +02:00
Stefan Haller 8ab05d6834 Fix merge status of commits when update-ref command is present
Update-ref commands have an empty sha, and strings.HasPrefix returns true when
called with an empty second argument, so whenever an update-ref command is
present in a rebase, all commits from there on down were drawn with a green sha.
2023-07-31 08:28:03 +02:00
Stefan Haller 774df817fd Add tests for setCommitMergedStatuses
The test for update-ref shows demonstrates a problem. See next commit for the
fix.
2023-07-31 08:28:03 +02:00
Stefan Haller 18903a7dde Make setCommitMergedStatuses a non-member function
It doesn't depend on anything in CommitLoader, so it can be free-standing, and
that makes it easier to test (see next commit).
2023-07-31 08:28:03 +02:00
Jesse Duffield 975d2bedb6 Remove secureexec package
From the go 1.19 release notes:

Command and LookPath no longer allow results from a PATH search to be found relative to the current directory. This removes a common source of security problems but may also break existing programs that depend on using, say, exec.Command("prog") to run a binary named prog (or, on Windows, prog.exe) in the current directory. See the os/exec package documentation for information about how best to update such programs.
2023-07-30 19:59:51 +10:00
Jesse Duffield e33fe37a99 Standardise on using lo for slice functions
We've been sometimes using lo and sometimes using my slices package, and we need to pick one
for consistency. Lo is more extensive and better maintained so we're going with that.

My slices package was a superset of go's own slices package so in some places I've just used
the official one (the methods were just wrappers anyway).

I've also moved the remaining methods into the utils package.
2023-07-30 18:51:23 +10:00
Jesse Duffield f31e213edc rename files 2023-07-30 18:35:36 +10:00
Jesse Duffield 7b302d8c29 Write unit tests with the help of afero
Afero is a package that lets you mock out a filesystem with an in-memory filesystem.
It allows us to easily create the files required for a given test without worrying about
a cleanup step or different tests tripping on eachother when run in parallel.

Later on I'll standardise on using afero over the vanilla os package
2023-07-30 18:35:36 +10:00
Jesse Duffield b16bb409fc Use forward-slashes on windows
We want to be using forward slashes everywhere internally, so if we get a path from windows
we should immediately convert it to use forward slashes.

I'm leaving out the recent repos list because that would require a migration
2023-07-30 18:35:24 +10:00
Jesse Duffield 06be88aef7 Use fields rather than methods on worktrees
I would prefer to use methods to keep things immutable but I'd rather be consistent with the other
models and update them all at once
2023-07-30 18:35:24 +10:00
Jesse Duffield 4c5b1574f1 Centralise logic for obtaining repo paths
There are quite a few paths you might want to get e.g. the repo's path, the worktree's path,
the repo's git dir path, the worktree's git dir path. I want these all obtained once and
then used when needed rather than having to have IO whenever we need them. This is not so
much about reducing time spent on IO as it is about not having to care about errors every time
we want a path.
2023-07-30 18:35:24 +10:00
Jesse Duffield de57cfd6ff Remove IO logic from presentation code for worktrees
We're doing all the IO in our workers loader method so that we don't need to do any
in our presentation code
2023-07-30 18:35:24 +10:00
Jesse Duffield 2b24c15938 Add test for opening lazygit in the worktree of a bare repo 2023-07-30 18:35:23 +10:00
Jesse Duffield 0a410141ae Fix test by making branches appear deterministically
This fixes pkg/integration/tests/worktree/rebase.go which was failing on old git versions due to a difference in
order of branches that don't have recency values
2023-07-30 18:35:23 +10:00
Jesse Duffield b3060065d9 Support fastforwarding worktree 2023-07-30 18:35:23 +10:00
Jesse Duffield a313b16704 Add more worktree tests 2023-07-30 18:35:23 +10:00
Jesse Duffield b93b9dae88 Add worktree tests for removing/detaching 2023-07-30 18:35:23 +10:00
Jesse Duffield 277142fc4b Add worktree integration tests 2023-07-30 18:35:23 +10:00
Jesse Duffield cdfad864ae Remove worktree version guards
Our min required git version is 2.20 so there's no need to add guards
for worktrees because they were added in 2.5
2023-07-30 18:35:23 +10:00
Jesse Duffield fb4453c18a Fix unit tests 2023-07-30 18:35:23 +10:00
Jesse Duffield 81a9133261 Support older versions of git when fetching worktrees
Older versions of git don't support the -z flag in `git worktree list`.
So we're using newlines.

Also, we're not raising an error upon error because that triggers another refresh,
which gets us into an infinite loop
2023-07-30 18:35:23 +10:00
Jesse Duffield ca6f9c4155 Fix tests
Going and fixing up some submodule tests which were broken by bad assumptions with worktree code
2023-07-30 18:35:23 +10:00
Jesse Duffield eeec373728 Safer fetching of linked worktree paths 2023-07-30 18:35:23 +10:00
Jesse Duffield 3a7468ecac Support opening worktree in editor 2023-07-30 18:35:23 +10:00
Jesse Duffield 7b05dacb98 Properly render worktrees in files panel 2023-07-30 18:35:22 +10:00
Jesse Duffield b73efb2c22 Better logic for knowing which repo we're in 2023-07-30 18:35:22 +10:00
Jesse Duffield 3cd2d6fa5c Hide worktree functionality on old git versions 2023-07-30 18:35:22 +10:00
Jesse Duffield ec839e9e96 Associate branches with worktrees even when mid-rebase 2023-07-30 18:35:22 +10:00
Jesse Duffield 18ea68c23a Support creating worktrees from refs 2023-07-30 18:35:22 +10:00
Jesse Duffield ae0193698e Log when directory is changed 2023-07-30 18:35:22 +10:00
Jesse Duffield 6b4a638415 Handle deleting branch attached to worktree 2023-07-30 18:35:22 +10:00
Jesse Duffield 53f4ccb809 Move current worktree to top of list 2023-07-30 18:35:22 +10:00
Jesse Duffield c713d550c0 Improve name handling 2023-07-30 18:35:22 +10:00
Jesse Duffield 7682ec029b Update worktree model 2023-07-30 18:35:22 +10:00
Joel Baranick db02c13bf6 Address PR comments 2023-07-30 18:35:21 +10:00
Joel Baranick 1ce9a87544 Basic support for adding a worktree 2023-07-30 18:35:21 +10:00
Joel Baranick 54708233ac Improve worktree panel 2023-07-30 18:35:21 +10:00
Joel Baranick c679fd1924 Style missing worktree as red and display better error when trying to switch to them
Use a broken link icon for missing worktrees
2023-07-30 18:35:21 +10:00
Joel Baranick 9a79154d05 Hide worktrees in the worktree panel if they point at a non-existing filesystem location.
Remove unneeded check when filtering out branches from non-current worktrees from the branch panel.
Add link icon for linked worktrees
2023-07-30 18:35:21 +10:00
Joel Baranick afc4aedd4f Support for deleting a worktree 2023-07-30 18:35:21 +10:00
Joel Baranick f8ba899b87 Initial addition of support for worktrees 2023-07-30 18:35:21 +10:00
Stefan Haller f30e09856c Add bisect menu entry that lets you choose bisect terms
This can be useful if you want to find the commit that fixed a bug (you'd use
"broken/fixed" instead of "good/bad" in this case), or if you want to find the
commit that brought a big performance improvement (use "slow/fast"). It's pretty
mind-bending to have to use "good/bad" in these cases, and swap their meanings
in your head.

Thankfully, lazygit already had support for using custom terms during the bisect
(for the case that a bisect was started on the command-line, I suppose), so all
that's needed is adding a way to specify them in lazygit.
2023-07-29 11:59:58 +02:00
Jesse Duffield f17417219a
feat: add os.copyToClipboardCmd to allow for a custom command #1055 (#2784) 2023-07-29 19:35:52 +10:00
Red S d7f84aed8a feat: add os.copyToClipboardCmd to allow for a custom command
Issue #1055

test: CopyPatchToClipboard (temporary commit for review)
2023-07-29 19:09:59 +10:00
Jesse Duffield 429225da80 Support random order of command execution in unit tests
Now that we run code concurrently in our loaders, we need to handle that in our tests.
We could enforce a deterministic ordering by mocking waitgroup or something like that,
but I think it's fine to let our tests handle some randomness given that prod itself
will have that randomness.

I've removed the patch test file because it was clunky, not providing much value, and
it would have been hard to refactor to the new pattern
2023-07-29 12:36:17 +10:00
Jesse Duffield 272e021c08 Refactor reflog commit loader
No functional changes
2023-07-29 10:04:11 +10:00
Jesse Duffield 862ebd25cb Speed up remote loader
We're:
* using concurrency with wait groups
* avoiding regex
* processing lines of input as they come rather than storing everything in one string
* avoiding an inner loop by creating a mapping of remote names to branches
2023-07-29 10:04:11 +10:00
Jesse Duffield 5d8a85f7e7 Use wait groups to speed up commit loading
The speedup is most noticeable on first load, when we haven't yet fetched out main branches.
I saw a speedup from 105ms to 60ms. On subsequent loads the gain is more modest;
54ms to 40ms
2023-07-29 10:04:11 +10:00
Jesse Duffield 71cab4fadc Log duration of commands
This will help us diagnose performance issues
2023-07-29 09:39:22 +10:00
Jesse Duffield c4e27bf96c Revert "Fix flakey pull_merge_conflict test"
This reverts commit 90613056ce, or the part that removed
a goroutine at least.

Reverting because this has caused an infinite wait for push/pull on windows.
We'll need to find out why that happens separately
2023-07-24 21:12:03 +10:00
Stefan Haller c21633b1be Prompt for commit message when moving a custom patch to a new commit 2023-07-23 13:55:48 +02:00
Jesse Duffield 7807b40322 Better tag creation UX
Previously we used a single-line prompt for a tag annotation. Now we're using the commit message
prompt.

I've had to update other uses of that prompt to allow the summary and description labels to
be passed in
2023-07-22 14:36:35 +10:00
Jesse Duffield 3cee37388c Keep track of authors across local commits and branch commits for suggestions
Previously, we would only show the authors based on local commits, but sometimes you want to set a commit author
to that of a commit on another branch. Now, so long as you've viewed the branch's commits, the author will appear
as a suggestion.
2023-07-22 10:47:04 +10:00
Stefan Haller 39f3f150ed Fix crash when a background fetch prompts for credentials
This happens consistently for my when I close my MacBook's lid. It seems that
MacOS locks the user's keychain in this case, and since I have my keychain
provide the pass phrases for my ssh keys, fetching fails because it tries to
prompt me for a pass phrase.

This all worked correctly already, we have the FailOnCredentialRequest()
mechanism specifically for this situation, so all is great. The only problem was
that it was trying to pause the ongoing task while prompting the user for input;
but the task is nil for a background fetch (and should be).
2023-07-18 18:53:35 +02:00
Stefan Haller 6b769fb138 Fix populating the Commit.Tags field
We now store all tags in this field if there are several.
2023-07-15 13:07:02 +02:00
Stefan Haller cc835a813e Extend commit_loader test to show how the Tags field is populated
It shows that right now, we take only the first tag if there are multiple.
Judging from how the code is written, I'm not sure this was intentional.
2023-07-15 13:07:02 +02:00
Jesse Duffield 78bbdca757 Add test for cmd obj cloning 2023-07-15 11:05:43 +10:00
Scott Callaway 9617737352 config: rely on .gitconfig for verbose commit messages
As discussed in https://github.com/jesseduffield/lazygit/pull/2599, it
makes more sense to have the user specify whether they want verbose
commits from their own git config, rather than lazygit config.

This means that we can remove all the code (including test coverage)
associated with the custom verbose flag, and lazygit will just inherit
the .gitconfig settings automatically.
2023-07-14 07:56:09 +02:00
Stefan Haller 30ce7c8085 Replace uses of "git stash save" with "git stash push"
Save has been deprecated for a while, push is the recommended way to save a
stash. Push has been available since 2.13, so we can use it without problems.
2023-07-10 15:09:17 +02:00
Stefan Haller 1827380c69 Fix git stash calls for older git versions
Older git versions are pickier about parameter order: for "store", the sha
argument must come last, and for "save", the message must come last.
2023-07-10 15:09:17 +02:00
Stefan Haller cc316ab6de Fix interactive rebase with git 2.25.1 and earlier
The code in getHydratedRebasingCommits relied on the assumption that the
git-rebase-todo file contains full SHAs. This has only been true from 2.25.2 on,
before that it would contain abbreviated SHAs. Fix this by storing fullCommits
in a slice instead of a map, and using a linear search.
2023-07-10 13:42:35 +02:00
Jesse Duffield 16ed3c2377 Retry on index.lock error
I don't know why we're getting index.lock errors but they're impossile to stop
anyway given that other processes can be calling git commands. So we're retrying
a few times before re-raising. To do this we need to clone the command and the current
implementation for that is best-effort.

I do worry about the maintainability of that but we'll see how it goes.

Also, I thought you'd need to clone the task (if it exists) but now I think not;
as long as you don't call done twice on it you should be fine, and you shouldn't
be done'ing a task as part of running a command: that should happen higher up.
2023-07-10 19:13:18 +10:00
Jesse Duffield 90613056ce Fix flakey pull_merge_conflict test
It's not clear what was happening but it seemed like we sometimes weren't
fully writing to our stdout buffer (which is used for the error message)
even though we had returned from cmd.Wait().

Not sure what the cause was but removing an unnecessary goroutine fixed it.
2023-07-10 17:12:34 +10:00
Jesse Duffield 6b9390409e Use an interface for tasks instead of a concrete struct
By using an interface for tasks we can use a fake implementation in tests with extra methods
2023-07-10 17:12:21 +10:00
Jesse Duffield 8964cedf27 Use mutex on cached git config
This fixes a race condition caused by a concurrent map read and write
2023-07-09 21:30:19 +10:00
Jesse Duffield 14ecc15e71 Use first class task objects instead of global counter
The global counter approach is easy to understand but it's brittle and depends on implicit behaviour that is not very discoverable.

With a global counter, if any goroutine accidentally decrements the counter twice, we'll think lazygit is idle when it's actually busy.
Likewise if a goroutine accidentally increments the counter twice we'll think lazygit is busy when it's actually idle.
With the new approach we have a map of tasks where each task can either be busy or not. We create a new task and add it to the map
when we spawn a worker goroutine (among other things) and we remove it once the task is done.

The task can also be paused and continued for situations where we switch back and forth between running a program and asking for user
input.

In order for this to work with `git push` (and other commands that require credentials) we need to obtain the task from gocui when
we create the worker goroutine, and then pass it along to the commands package to pause/continue the task as required. This is
MUCH more discoverable than the old approach which just decremented and incremented the global counter from within the commands package,
but it's at the cost of expanding some function signatures (arguably a good thing).

Likewise, whenever you want to call WithWaitingStatus or WithLoaderPanel the callback will now have access to the task for pausing/
continuing. We only need to actually make use of this functionality in a couple of places so it's a high price to pay, but I don't
know if I want to introduce a WithWaitingStatusTask and WithLoaderPanelTask function (open to suggestions).
2023-07-09 21:30:19 +10:00
Jesse Duffield 26ca41a40e Handle pending actions properly in git commands that require credentials
I don't know if this is a hack or not: we run a git command and increment the pending action
count to 1 but at some point the command requests a username or password, so we need to prompt
the user to enter that. At that point we don't want to say that there is a pending action,
so we decrement the action count before prompting the user and then re-increment it again afterward.

Given that we panic when the counter goes below zero, it's important that it's not zero
when we run the git command (should be impossible anyway).

I toyed with a different approach using channels and a long-running goroutine that
handles all commands that request credentials but it feels over-engineered compared to this
commit's approach.
2023-07-08 22:54:52 +10:00
Jesse Duffield 1a36cb9f3f
View filtering (#2680) 2023-07-03 12:57:11 +10:00
Jesse Duffield 13326344f0 Support filtering files 2023-07-03 12:54:13 +10:00
Gustavo Krieger 9ae7710850 Use comment char config on interactive rebase
Co-authored-by: Stefan Haller <stefan@haller-berlin.de>
2023-07-02 02:07:32 -03:00
Gustavo Krieger 87fe30d50d Bump git-todo-parser 2023-07-02 02:07:32 -03:00
Stefan Haller a8aeadfdb7 Always show branch heads in diff pane
The first line of the diff pane would show branch heads (e.g.

  commit dd9100ccc8b69a8b14b21a84e34854b5acfb871a (mybranch, origin/mybranch)

only when a pager is used. The reason is that the default of the --decorate
option to git show is "auto", which means to show the decoration only when
output goes to a tty. Lazygit uses a pty only when a pager is used, so the
decoration wouldn't show when no pager is used.

Since the branch head annotation is useful and we always want to see it, force
it by explicitly passing --decorate.
2023-06-28 09:44:06 +02:00
Stefan Haller ff8bc91a8e Use remote upstreams of main branches to determine merged status of commits
This solves three problems:

1. When the local main branch is behind its upstream, the merged status of
   commits of a feature branch sitting on origin/main was not correct. This can
   easily happen when you rebase a branch onto origin/main instead of main, and
   don't bother keeping local main up to date.
2. It works when you don't have the main branch locally at all. This could
   happen when you check out a colleague's feature branch that goes off of
   "develop", but you don't have "develop" locally yourself because you normally
   only work on "main".
3. It also works when you work on a main branch itself, e.g. by committing to it
   directly, or by merging a branch locally. These local commits on a main
   branch would previously be shown in green instead of red; this broke with
   910a61dc46.
2023-06-26 09:02:46 +02:00
Stefan Haller 3928d0ebda Insert fake todo entry for a conflicting commit that is being applied
When stopping in a rebase because of a conflict, it is nice to see the commit
that git is trying to apply. Create a fake todo entry labelled "conflict" for
this, and show the "<-- YOU ARE HERE ---" string for that one (in red) instead
of for the real current head.
2023-06-22 18:57:58 +02:00
Stefan Haller 5c55ce6555 Better prompt for discarding old file changes
Lazygit knows what kind of file change this is, so there doesn't have to be any
"if" in the prompt text.
2023-06-07 12:47:03 +02:00
Jesse Duffield 1932c2366b Appease linter 2023-06-03 15:54:03 +10:00
Jesse Duffield a4db44bc3d show commits against branches 2023-06-01 19:21:24 +10:00
Stefan Haller 31a2ea1f19 Add --all to "git fetch" command when not fetching a specific remote 2023-06-01 10:13:14 +02:00
Stefan Haller 697157f5d5 Add tests for Fetch 2023-05-31 15:54:20 +02:00
Stefan Haller ee4b9d20b1 Extract a FetchCmdObj function so that we can test it
No change in behavior.
2023-05-31 15:54:20 +02:00
Stefan Haller a2bdab2135 Remove unused fetch options RemoteName and BranchName
These were never used, since there are separate functions for fetching a remote
and for fast-forwarding a branch.
2023-05-31 15:54:20 +02:00
Jesse Duffield 1f8e838052
Merge pull request #2656 from mazharz/gitlab-merge-request-url
Update gitlab merge request URL to match new routing
2023-05-23 22:54:57 +10:00
Jesse Duffield fb0931e1a1 Fix discard logic
Missed a spot a couple PR's ago. We had an integration test which caught this but which was skipped due
to index.lock file issues. The test was also broken for other reasons due to it not having been running
for a while, so I've fixed that up too.
2023-05-23 20:23:08 +10:00
Jesse Duffield 63dc07fded Construct arg vector manually rather than parse string
By constructing an arg vector manually, we no longer need to quote arguments

Mandate that args must be passed when building a command

Now you need to provide an args array when building a command.
There are a handful of places where we need to deal with a string,
such as with user-defined custom commands, and for those we now require
that at the callsite they use str.ToArgv to do that. I don't want
to provide a method out of the box for it because I want to discourage its
use.

For some reason we were invoking a command through a shell when amending a
commit, and I don't believe we needed to do that as there was nothing user-
supplied about the command. So I've switched to using a regular command out-
side the shell there
2023-05-23 19:49:19 +10:00
Mazhar Zandsalimi 59379b45da Update gitlab commit URL to match new routing 2023-05-22 07:39:47 +03:30
Mazhar Zandsalimi 2d4ca2b54f Update gitlab merge request URL to match new routing 2023-05-21 13:21:34 +03:30
Stefan Haller 3cddd7cfa5 Don't keep commits that become empty during a rebase
The only exception is when moving a custom patch for an entire commit to an
earlier commit; in this case the source commit becomes empty, but we want to
keep it, mainly for consistency with moving the patch to a later commit, which
behaves the same.

In all other cases where we rebase, it's confusing when empty commits are kept;
the most common example is rebasing a branch onto master, where master already
contains some of the commits of our branch. In this case we simply want to drop
these.
2023-05-20 21:10:03 +02:00
Jesse Duffield ee11046d35 Refactor interface for ApplyPatch 2023-05-20 20:54:39 +10:00
Jesse Duffield 25f8b0337e Add convenience builder for git commands 2023-05-20 20:54:24 +10:00
Jesse Duffield 63ddc52a6b Increase test coverage 2023-05-20 16:55:15 +10:00
Jesse Duffield d161afe37f Support ignoring whitespace on stash 2023-05-19 17:49:22 +02:00
Stefan Haller 46b93bba0e Add config git.mainBranches
It defaults to {"master", "main"}, but can be set to whatever branch names
are used as base branches, e.g. {"master", "devel", "v1.0-hotfixes"}. It is
used for color-coding the shas in the commit list, i.e. to decide whether
commits are green or yellow.
2023-05-16 13:20:03 +02:00
Stefan Haller 910a61dc46 Make "merged" take precedence over "unpushed"
Previously, when rebasing a branch onto a newer master, all commits from the
previous fork point up to its head were marked red (unpushed), including the
commits that are on master already. While this is technically correct from the
perspective of the current branch's upstream, it's not what most people expect,
intuitively; they want to see where the current branch starts, relative to
master. So all commits of master should be green, and then the commits of the
current branch in red.
2023-05-12 22:56:58 +02:00
Ryooooooga 30656b5ac6 chore(git_commands): support old git version (git rebase --empty=keep) 2023-05-02 16:27:32 +02:00
Jesse Duffield ee9ae8f07f
Merge pull request #2552 from stefanhaller/support-stacked-branches 2023-05-01 21:07:19 +10:00
Sean 49da7b482d Split commit message panel into commit summary and commit description panel
When we use the one panel for the entire commit message, its tricky to have a keybinding both for adding a newline and submitting.
By having two panels: one for the summary line and one for the description, we allow for 'enter' to submit the message when done from the summary panel,
and 'enter' to add a newline when done from the description panel. Alt-enter, for those who can use that key combo, also works for submitting the message
from the description panel. For those who can't use that key combo, and don't want to remap the keybinding, they can hit tab to go back to the summary panel
and then 'enter' to submit the message.

We have some awkwardness in that both contexts (i.e. panels) need to appear and disappear in tandem and we don't have a great way of handling that concept,
so we just push both contexts one after the other, and likewise remove both contexts when we escape.
2023-04-30 12:17:34 +10:00
Stefan Haller 3fe4db9316 Make RebaseCommands.AmendTo more robust
This fixes two problems with the "amend commit with staged changes" command:

1. Amending to a fixup commit didn't work (this would create a commmit with the
   title "fixup! fixup! original title" and keep that at the top of the branch)
2. Unrelated fixup commits would be squashed too.

The added integration test verifies that both of these problems are fixed.
2023-04-29 07:28:33 +02:00
Jesse Duffield 185bbf0c75 Refactor to tighten interface to lazygit daemon 2023-04-29 07:28:33 +02:00
Stefan Haller a8586ba57e Refactor: simplify PrepareInteractiveRebaseCommand API
Instead of passing a bunch of different options in
PrepareInteractiveRebaseCommandOpts, where it was unclear how they interact if
several are set, have only a single field "instruction" which can be set to one
of various different instructions.

The functionality of replacing the entire todo file with our own is no longer
available; it is only possible to prepend todos to the existing file.

Also, instead of using different env vars for the various rebase operations that
we want to tell the daemon to do, use a single one that contains a json-encoded
struct with all available instructions. This makes the protocol much clearer,
and makes it easier to extend in the future.
2023-04-29 07:28:33 +02:00
Stefan Haller dad7a70bf8 Implement moving commits up/down in terms of daemon 2023-04-29 07:28:33 +02:00
Stefan Haller 3791f0b2fa Implement "move patch to selected commit" in terms of daemon 2023-04-29 07:28:33 +02:00
Stefan Haller b8fbe9756e Implement squash, fixup, drop, and reword in terms of daemon 2023-04-29 07:28:33 +02:00
Stefan Haller ab25600ccb Extract EditRebaseTodo into a function in utils.rebaseTodo
We want to reuse it from the daemon code in the next commit.
2023-04-29 07:28:33 +02:00
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
Jesse Duffield 79dc1d9052
Merge pull request #2557 from noahziheng/feature/add-gitea-pr 2023-04-24 13:42:05 +10:00
Noah Gao bf3dd79b7a feat: add gitea to hosting service 2023-04-18 16:16:09 +00: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
Jesse Duffield 04e0a9bb45
Merge pull request #2523 from stefanhaller/editor-config 2023-04-13 21:22:17 +10:00
Stefan Haller e4e16fa38e Change OpenCommand to Open and OpenLinkCommand to OpenLink
We do this for consistency with the edit settings. The old names are kept as a
fallback for now.
2023-04-13 13:14:00 +02:00
Stefan Haller b7e029adc7 Don't set platform defaults on OSConfig struct immediately
Instead, query the platform defaults only if the config is empty. This will be
necessary later to distinguish an empty config from a default config, so that we
can give deprecation warnings.
2023-04-13 13:14:00 +02:00
Stefan Haller 08d679c3a8 Remove line number support for "open" command
The "open" command is supposed to behave in the same way as double-clicking a
file in the Finder/Explorer. The concept of jumping to a specific line in the
file doesn't make sense for this; use "edit" instead.
2023-04-13 13:14:00 +02: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
Stefan Haller 24de156592 Fix windows tests
Now that the tests run again, it turns out that they actually fail, so fix them.
2023-04-13 13:14:00 +02:00
Stefan Haller 8d3cce4a49 Rename test files so that test discovery works again
These files were renamed from os_windows_test.go to os_test_windows.go (etc.) in
95b2e9540a. Since then, the tests have no longer run, since go only looks for
tests in files ending with "test.go".

It isn't important that the file name ends with "_windows.go", since there are
already build constrains in the files themselves.
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
Andrew 298dae23e8 fix: generalize parsing of ssh git urls 2023-04-03 12:10:30 +10: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
Jesse Duffield 73c7dc9c5d refactor patch code 2023-03-19 16:30:39 +11:00
Jesse Duffield e6274af015
appease golangci-lint (#2512) 2023-03-19 11:20:29 +11:00
Luka Markušić 8dbd7d44ff
Fix checking for credentials performance (#2452)
Co-authored-by: Jesse Duffield <jessedduffield@gmail.com>
2023-03-19 11:08:54 +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
Jesse Duffield 0bda93d4c3 Add more unit tests 2023-03-08 09:19:23 +11:00
Stefan Haller 4bd1322941 Rename WillBeAppliedReverse to Reverse
This is the only "reverse"-related option that is left, so use a less clumsy
name for it.
2023-03-07 13:40:07 +01:00
Stefan Haller 45cf993982 Remove the PatchOptions.Reverse option
All callers pass false now (except for the tests, which we simply remove), so we
don't need the option any more.
2023-03-07 13:39:45 +01:00
Stefan Haller a68cd6af9c Concatenate patches to apply them all at once
This fixes the problem that patching would stop at the first file that has a
conflict. We always want to patch all files.

Also, it's faster for large patches, and the code is a little bit simpler too.
2023-03-07 09:49:34 +01:00
Stefan Haller 6bd1c1d068 Remove parameters that are no longer needed
All callers in this file now use reverseOnGenerate=false and
keepOriginalHeader=true, so hard-code that in the call to ModifiedPatchForLines
and get rid of the parameters.
2023-03-07 09:49:34 +01:00
Stefan Haller 5d692e8961 Remove the keepOriginalHeader retry loop
The loop is pointless for two reasons:
- git apply --3way has this fallback built in already. If it can't do a
  three-way merge, it will fall back to applying the patch normally.
- However, the only situation where it does this is when it can't do a 3-way
  merge at all because it can't find the necessary ancestor blob. This can only
  happen if you transfer a patch between different repos that don't have the
  same blobs available; we are applying the patch to the same repo that is was
  just generated from, so a 3-way merge is always possible. (Now that we fixed
  the bug in the previous commit, that is.)

But the retry loop is not only pointless, it was actually harmful, because when
a 3-way patch fails with a conflict, git will put conflict markers in the
patched file and then exit with a non-zero exit status. So the retry loop would
try to patch the already patched file again, and this almost certainly fails,
but with a cryptic error message such as "error: main.go: does not exist in
index".
2023-03-07 09:49:34 +01:00
Stefan Haller 9cc33c479b Use forward patches and --reverse flag for partial patches too
There's no reason to have two different ways of applying patches for whole-file
patches and partial patches; use --reverse for both. Not only does this simplify
the code a bit, but it fixes an actual problem: when reverseOnGenerate and
keepOriginalHeader are both true, the generated patch header is broken (the two
blobs in the line `index 6d1959b..6dc5f84 100644` are swapped). Git fails to do
a proper three-way merge in that case, as it expects the first of the two blobs
to be the common ancestor.

It would be possible to fix this by extending ModifiedPatchForLines to swap the
two blobs in this case; but this would prevent us from concatenating all patches
and apply them in one go, which we are going to do later in the branch.
2023-03-07 09:49:34 +01:00
Stefan Haller c79e360584 Add patch option WillBeAppliedReverse
It's not used yet, but covered with tests already.
2023-03-07 09:49:34 +01:00
Stefan Haller f76cc27956 Bundle the reverse and keepOriginalHeader flags into a PatchOptions struct
We are going to add one more flag in the next commit.

Note that we are not using the struct inside patch_manager.go; we keep passing
the individual flags there. The reason for this will become more obvious later
in this branch.
2023-03-07 09:49:34 +01: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 f7e8b2dd71 cleanup integration test code 2023-02-26 12:54:13 +11:00
Jesse Duffield db011d8e34 Improve staging panel integration tests 2023-02-25 11:35:41 +11: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 d8c7d47067
Merge pull request #2395 from stefanhaller/trailing-lf-when-copying-diff-lines 2023-01-29 14:19:29 +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
stk fc38e3b54d Don't omit final line feed when copying diff lines to clipboard 2023-01-26 10:30:05 +01:00
stk 93d845cb01 Cleanup: remove unused function RenderPlain 2023-01-26 10:30:05 +01: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
Bartłomiej Dach 1a1f042f49 Add credential prompts for U2F-backed SSH keys
The 8.2 release of OpenSSH added support for FIDO/U2F hardware
authenticators, which manifests in being able to create new types of SSH
key, named `ecdsa-sk` nad `ed25519-sk`. This is relevant to lazygit,
as those SSH keys can be used to authorise git operations over SSH, as
well as signing git commits. Actual code changes are required for
correct support, as the authentication process for these types of keys
is different than the process for types supported previously.

When an operation requiring credentials is initialised with a U2F
authenticator-backed key, the first prompt is:

	Enter PIN for ${key_type} key ${path_to_key}:

at which point the user is supposed to enter a numeric (and secret) PIN,
specific to the particular FIDO/U2F authenticator using which the SSH
keypair was generated. Upon entering the correct key, the user is
supposed to physically interact with the authenticator to confirm
presence. Sometimes this is accompanied by the following text prompt:

	Confirm user presence for key ${key_type} ${key_fingerprint}

This second prompt does not always occur and it is presumed that the
user will know to perform this step even if not prompted specifically.
At this stage some authenticator devices may also begin to blink a LED
to indicate that they're waiting for input.

To facilitate lazygit's interoperability with these types of keys, add
support for the first PIN prompt, which allows "fetch", "pull", and
"push" git operations to complete.
2022-11-30 13:34:32 +11: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
Ryooooooga a4239c7a37
fix: fix stash with empty message 2022-10-13 22:23:56 +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
Jesse Duffield fd66499c8f
Merge pull request #2167 from xiaoliwang/remove_deprecated 2022-09-23 23:01:40 -07:00
Ryooooooga 438038a4f1
fix(loaders/file.go): changed to ignore stderr when loading git status 2022-09-19 18:46:32 +09:00
TomCao New Macbook Pro 3d79c6a3d3 formatter 2022-09-17 15:10:41 -07: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
Jesse Duffield 74f9b8a3b4
Merge pull request #2143 from Abirdcfly/master 2022-08-31 22:42:32 -07:00
Abirdcfly d78d694959
chore: remove duplicate word in comments
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
2022-08-30 13:23:37 +08:00
Konstantin Mikhailov a67a08eeac Fix open commit in browser for some Gitlab repos 2022-08-24 11:23:02 +10:00
nullishamy 154bd975a6
Apply refactoring suggestions 2022-08-15 13:59:34 +01:00
Jesse Duffield 71a9389ca4
Merge pull request #2087 from xxdavid/bitbucket_custom_username 2022-08-07 13:01:04 +10:00
Jesse Duffield b77f3160f1
Merge pull request #2004 from mark2185/fix-add-to-gitignore-newline 2022-08-07 12:49:39 +10: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 7410acd1aa move merge conflicts code into controller 2022-08-07 11:16:03 +10:00
David Pavlík 4db22aec0e support custom SSH usernames on BitBucket, fixes #1890 2022-08-06 22:54:57 +02:00
Jesse Duffield 524bf83a4a refactor to only have one context per view 2022-08-06 13:49:11 +10:00
Luka Markušić fdf6a9cc2b Test appending to empty file 2022-08-04 13:52:04 +02:00
Luka Markušić 6160d85d4f Use tmpdir for tests 2022-08-03 14:06:12 +02:00
Luka Markušić 64224e7caa
Update pkg/commands/oscommands/os.go
Co-authored-by: Ryoga <eial5q265e5+github@gmail.com>
2022-08-03 13:57:26 +02:00
Luka Markušić d56bb0b8ef Fix the integration test 2022-08-03 07:55:51 +02:00
Luka Markušić d238d8952b Add AppendLineToFile tests 2022-08-03 07:55:51 +02:00
Luka Markušić 86d5654d20 Preserve trailing newline setting when adding to gitignore 2022-08-03 07:55:51 +02:00
Jesse Duffield 86ac309e08 add build info when building from source 2022-08-01 20:16:50 +10:00
Jesse Duffield a905165046 remove double negatives 2022-07-31 16:11:39 +10:00
Jesse Duffield 7077ea428f add optimistic rendering for staging and unstaging files 2022-07-31 14:34:57 +10:00
Jesse Duffield c087dca60a
Merge pull request #2027 from jesseduffield/gozes-jesse
Attempt at fixing CI
2022-07-05 19:37:09 +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 c9d891a913 better process killing 2022-06-18 13:39:22 +10:00
Francisco Miamoto d8dfed79b3 fix: use todo parser to properly read rebase todo file 2022-06-12 20:01:32 -03:00
Jesse Duffield 02c5559704 run integration tests in parallel and properly cache windows build 2022-06-11 13:06:29 +10:00
Jesse Duffield 9591cc381a support setting the author of a commit
update copy
2022-06-09 19:12:20 +10:00
Jesse Duffield f31dcd3091
Merge pull request #1930 from mark2185/feature/discard-staged-only 2022-05-15 20:33:25 +10:00
Jesse Duffield 8e7f6822fc
Merge pull request #1944 from Ryooooooga/feature/fix-ambiguous-refname 2022-05-15 19:45:30 +10:00
Ryooooooga 61970a4439
fix: fix ambiguous refname 2022-05-13 21:05:51 +09:00
Ryooooooga 490a964432
chore(loaders): add -c log.showSignature=false flag to the rebasing commit loader 2022-05-10 19:47:10 +09:00
Ryooooooga f789e21377
perf: improve loading speed of commits and reflog when log.showSignature=true 2022-05-10 19:47:07 +09:00
Luka Markušić ca191159f5 Discard staged changes only 2022-05-08 14:24:28 +02:00
Jesse Duffield e67fef776b add author email to commits 2022-05-08 14:26:18 +10: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
Jesse Duffield dfb293c985 better upstream changes presentation 2022-04-18 11:03:28 +10:00
Luka Markušić bd9daf80b7 Add integration tests 2022-04-17 11:08:36 +02:00
Ryooooooga b3e18bd258 fix(loaders/file.go): fix not to trim renamed file names 2022-04-15 08:58:49 +10: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
TheBlob42 bcc0466498 feat: pull request support for bitbucket server 2022-04-11 17:17:40 +10:00
Luka Markušić 6f7038c827 Add option to stash only unstaged files 2022-04-10 09:35:59 +02:00
Luka Markušić 58ed23a47a Make worktrees work 2022-04-09 09:53:03 +10:00
casswedson b7928042f0 chore: typo hunting ft. codespell 2022-04-06 08:52:41 +10:00
Ryooooooga 53257db99d fix: fix diff of renamed files 2022-04-06 08:26:13 +10:00
Ryooooooga 4835fc00b8 introduce Ref interface 2022-04-02 17:04:42 +11:00
Ryooooooga 30be50b641 add Commit.ParentRefName() 2022-04-02 17:04:42 +11: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
Ryooooooga 2fbb52fa2c chore: remove dead code 2022-04-02 08:48:38 +11:00
Jesse Duffield 7128d822cb show stdout in error message if stderr is blank 2022-03-27 14:58:20 +11:00
Luka Markušić 540edb0bf4 Add copy commit attributes option 2022-03-26 17:22:42 +11:00
Jesse Duffield f9979879a1 no more naked returns 2022-03-25 23:27:28 +11:00
Jesse Duffield cf74c2cf96 reorder 2022-03-24 20:14:41 +11:00
Jesse Duffield 43d3f2bcb6 refactor todo file generation 2022-03-24 20:14:41 +11:00
Jesse Duffield 99e55725fb simplify 2022-03-24 20:14:41 +11:00
Jesse Duffield 94a53484a1 would you believe that I'm adding even more generics 2022-03-24 20:14:41 +11:00
Jesse Duffield bf4f06ab4e more generics 2022-03-24 20:14:41 +11:00
Jesse Duffield eda8f4a5d4 lots more generics 2022-03-24 20:14:41 +11:00
Jesse Duffield c7a629c440 make more use of generics 2022-03-24 20:14:41 +11:00
Jesse Duffield dde30fa104 add gone branches status 2022-03-24 17:50:25 +11:00
Moritz Haase 8fb47fb7d6 pkg/commands: Don't duplicate line breaks when retrieving commit message
When using the "copy commit message to clipboard" action, the message will end
up in the clipboard with duplicate line breaks. The same issue also affects the
"Reword Commit" command. GetCommitMessage(), the function used to retrieve the
commit message first splits the output returned by git into separate lines -
without removing the line breaks. After removing the first line (which contains
the commit SHA), it joins the lines of the message itself back together - adding
a second set of line breaks along the way. Stop this from happening.

Fixes #1808.
2022-03-23 08:19:17 +11:00
Jesse Duffield a34bdf1a04 update linters 2022-03-19 12:12:57 +11:00
Jesse Duffield a3885e8ea3 abbrev all commits to length 40 for consistency 2022-03-17 19:13:40 +11:00
Jesse Duffield d991d74b06 add commit message controller 2022-03-17 19:13:40 +11:00
Jesse Duffield cd31a762b9 rename OSCommand field to os 2022-03-17 19:13:40 +11:00
Jesse Duffield 1dd7307fde start moving commit panel handlers into controller
more

and more

move rebase commit refreshing into existing abstraction

and more

and more

WIP

and more

handling clicks

properly fix merge conflicts

update cheatsheet

lots more preparation to start moving things into controllers

WIP

better typing

expand on remotes controller

moving more code into controllers
2022-03-17 19:13:40 +11:00
Jesse Duffield 28c9d85141 fix tests 2022-03-16 20:52:49 +11:00
tiwood f0d0d45ba7 refactor: 💡 Use new approach introduced via #1637
fix: 🐛 The root URI for Azure DevOps repositories contains _git

refactor so that we don't have conditional logic based on service definition

no need for this commend anymore

add comment

Fixed RegEx for HTTP remote git URL

Added Tests

pretty sure we can do this safely
2022-03-16 20:52:49 +11:00
Jesse Duffield f53b10072d open code in existing window 2022-03-16 19:55:58 +11:00
Jesse Duffield 11acac0091 more explicit 2022-03-16 19:55:58 +11:00
Luka Markušić 866f4b9f0e Support line offset for most common editors by default 2022-03-16 19:55:58 +11:00
Jesse Duffield bed185eb28 stop retrying due to index lock for now 2022-01-27 21:25:04 +11:00
Jesse Duffield 5a3f81d1f7 select current bisect commit even if bisect was started on another branch 2022-01-26 19:29:17 +11:00
Jesse Duffield 5e6e1617aa add another bisect integration test 2022-01-26 16:52:20 +11:00
Jesse Duffield ca7cfc3232 only show commits from start ref if bad commit is reachable from there 2022-01-26 16:52:20 +11:00
Jesse Duffield dc765c4166 add a file close that was missed 2022-01-26 14:50:47 +11:00
Jesse Duffield c8cc18920f improve merge conflict flow 2022-01-26 14:50:47 +11:00
Jesse Duffield ce3bcfe37c fix reflog failing to properly refresh 2022-01-26 10:58:33 +11:00
Mikael Elkiaer 874e230aef run go fmt 2022-01-25 23:23:55 +11:00
Mikael Elkiaer 4da5795ef1 fixed indentation by swapping spaces for tabs 2022-01-25 23:23:55 +11:00
Mikael Elkiaer 03c9acad26 add tests specific for URL escaping in PRs 2022-01-25 23:23:55 +11:00
Mikael Elkiaer d53322675d update unit tests not expecting url escaping 2022-01-25 23:23:55 +11:00