Commit Graph

300 Commits

Author SHA1 Message Date
estib
876817eaba Factor out the move_commit function
Move the `move_commit` function to a separate module.
Add some unit tests for testing whether the commit is locked.
2024-10-01 13:35:49 +02:00
Kiril Videlov
a2aafd919b Introduce PatchReference and a heads field on Branch
- The PatchReference type represents a "reference" that is entirely managed by GitButler. It can either point to a commit or a GitButler change (which itself points to a commit)
- The Branch type (as persisted in virtual_branches.toml) now has a `heads` fields with a list of PatchReferences. This list is not to be meant to be manipulated directly, but with the `Stack` trait
2024-09-28 12:34:29 +02:00
Caleb Owens
a468ec7783 Added the tests 2024-10-01 17:12:46 +02:00
Mattias Granlund
1cdc3b7110 Add patch series to vbranch API struct 2024-10-01 16:09:07 +02:00
Caleb Owens
d571ee2ddb Fix applying mergable branch 2024-10-01 13:32:48 +02:00
Kiril Videlov
3742349a22
Merge pull request #4999 from icorbrey-contrib/master
chore: Bump `git2-hooks`
2024-09-30 19:00:56 +02:00
Caleb Owens
3a921031d3 Remove erroniously preserved dbg statements 2024-09-30 18:08:23 +02:00
Isaac Corbrey
7045f1c365 chore: Bump git2-hooks 2024-09-30 11:54:34 -04:00
Kiril Videlov
9dde8e7f7e
Merge pull request #4995 from gitbutlerapp/Use-new-checkout_combined_trees-in-upstream-integration
Use the new checkout_combined_trees in upstream integration
2024-09-30 11:36:28 +02:00
Caleb Owens
dc45ab2aac Use the new checkout_combined_trees in upstream integration 2024-09-30 02:01:11 +02:00
Caleb Owens
c3f6db382a Add more tests to undo commit 2024-09-30 01:53:21 +02:00
Caleb Owens
87663bea2d Remove instances where add_all was used to get a tree of the current working directory 2024-09-29 23:39:23 +02:00
Caleb Owens
102b941d3e Use new git2 implementation 2024-09-29 23:18:07 +02:00
Caleb Owens
47a4fc03c7 Update testing framework 2024-09-29 20:23:23 +02:00
Caleb Owens
be1fc2cf7e Checkout trees after reordering (and make generic function for it) 2024-09-28 18:46:41 +02:00
Caleb Owens
7f348d8a6d Add tests for reordering commits 2024-09-28 17:50:32 +02:00
Caleb Owens
9cbebba5cf
Fix testcase for merge_vbranch_upstream_clean_rebase 2024-09-25 15:15:29 +02:00
Caleb Owens
8a84753e92
Merge branch 'master' into Testing-rebase 2024-09-24 20:00:38 +02:00
Caleb Owens
bbbf81c4c1 Start to introduce index resolution tests 2024-09-24 17:01:38 +02:00
Sebastian Thiel
fe7d5d92e7
add crate to keep gitoxide conversions to prevent duplication 2024-09-24 15:54:07 +02:00
Sebastian Thiel
ada4b17c47
Make sure test doesn't fail if the default branch isn't master.
Ideally repository creation is standardized to avoid these issues,
but for now this is just the minimal fix to make the test suite
work for me.
2024-09-24 11:08:10 +02:00
estib
7dbadb13a9 Get the upstream name from the pushed virtual branch
Once the push of a virtual branch succeeded, return the ref name and the remote name in order to correctly determine which branch name to create a PR from.
2024-09-16 18:15:06 +02:00
estib
184629d1d4 Create a method to find a commit by its ID
Find a commit in the repository by its ID
2024-09-18 16:46:16 +02:00
estib
d1c71898cc The edit branch should not be listed in the side bar
The `gitbutler/edit` branch should not be listed in the side bar of the application
2024-09-18 14:28:25 +02:00
Caleb Owens
2a3f0e8a04 Fix (some) wrong files displaying in edit mode 2024-09-17 14:31:58 +02:00
Caleb Owens
cc8d3f4810 Did shit good 2024-09-16 16:42:23 +02:00
Caleb Owens
4ff32885e4 Start using new rebasing code when applying branches 2024-09-13 12:34:21 +02:00
Caleb Owens
edd0cbe0e6 Rename unapplying 2024-09-13 16:58:42 +02:00
Caleb Owens
db992dedfa
Merge pull request #4869 from gitbutlerapp/update-api
Update api
2024-09-12 13:23:05 +02:00
Caleb Owens
932070ca1f
Read index 2024-09-12 13:03:04 +02:00
Caleb Owens
1389b9e465
A time before time 2024-09-12 12:46:36 +02:00
Kiril Videlov
63a8603054
fixes a bug where discarding deleted files doesnt work 2024-09-11 21:06:34 +02:00
Caleb Owens
aeea013ba0
Update base branch button feature flagged 2024-09-11 15:18:20 +02:00
Caleb Owens
6e7aefd5c3
Merge commiting 2024-09-11 14:47:36 +02:00
Caleb Owens
955c99e5d8
Rebasing working 2024-09-11 13:43:39 +02:00
Caleb Owens
191686ec4d
Ahhh, don't loose shit 2024-09-11 11:23:20 +02:00
Kiril Videlov
4ddc6a9a32
Merge pull request #4863 from gitbutlerapp/update-branch-repo-commit-removal
fix a bug where deleting a vbranch fails to update state
2024-09-10 17:32:02 +02:00
estib
f19c2158eb push_virtual_branch: Return the remote reference
Pushing a virtual branch also returns the branch refname
2024-09-10 11:12:30 +02:00
Kiril Videlov
310d4cf73a
fix a bug where deleting a vbranch fails to update state 2024-09-10 10:55:36 +02:00
Kiril Videlov
245c8dfd1c
Merge pull request #4841 from gitbutlerapp/workspace-migration-fix-branch
fixes a test that should be using writable fixture
2024-09-06 15:55:51 +02:00
Kiril Videlov
df4d6ac099
fixes a test that should be using writable fixture 2024-09-06 15:18:09 +02:00
Kiril Videlov
7693b7b9ac
removes the legacy bool indicatin a vbranch is applied 2024-09-06 15:16:20 +02:00
Kiril Videlov
95e946b8a1
Remove unnecessary VirtualBranchActions struct 2024-09-06 14:12:14 +02:00
Kiril Videlov
3899975d6c
remove useless credentials helper struct 2024-09-06 11:03:57 +02:00
Sebastian Thiel
50c75eef60 refactor backend of reset_files() to be more idiomatic
It also tries to use `Vec<PathBuf>` in the tauri interface, which is
still to be validated.
2024-09-04 08:43:24 +02:00
estib
34e102f336 Only discard the files changes inside the lane
When using the file context menu inside a given lane to discard the changes, only the changes to that file inside the lane should be discarded.
Any other changes to that same file that live in other lanes are kept
2024-09-03 11:34:19 +02:00
Mattias Granlund
260e81a94e Use simpler function for asserting workspace is open. 2024-09-02 20:53:19 +03:00
Mattias Granlund
a5962b7e46 Fix spelling mistakes 2024-09-02 20:53:19 +03:00
Mattias Granlund
85ebc4ea78 Add test to ensure old integration branch doesn't throw 2024-09-02 20:53:19 +03:00
Mattias Granlund
0db82ea38c Replace all relevant occurrences of integration with workspace 2024-09-02 20:53:19 +03:00
Mattias Granlund
9acab668cc Fix broken test
- make use of integration commit title constant
2024-09-02 20:53:19 +03:00
Mattias Granlund
f3e5228fed Update workspace commit message 2024-09-02 20:53:19 +03:00
Mattias Granlund
d217d96285 Add transition for integration commit detection 2024-09-02 20:53:19 +03:00
Mattias Granlund
5f9c2e5832 Rename gitbutler/integration -> gitbutler/workspace 2024-09-02 20:53:19 +03:00
Kiril Videlov
2c7773a6cd
Merge pull request #4793 from Byron/git2-to-gix
performance improvements and bug fixes
2024-08-30 12:53:26 +02:00
Kiril Videlov
af6fdc36a4
add api for updating change references 2024-08-30 12:38:50 +02:00
Sebastian Thiel
4d495cb3bc
Adjust integration check to also recognize by matching tree.
This is relevant when all commits are equal by tree, but seem changed
due to the added GitButler headers.

For added safety, we also compare by commit message, date and authors,
basically everything that isn't the headers.
2024-08-30 07:15:47 +02:00
Sebastian Thiel
4cafc909b0
Improve the clarity of performance logs 2024-08-30 07:15:47 +02:00
Sebastian Thiel
4ae354392b
Improve performance of list-local using git2. 2024-08-30 07:15:47 +02:00
Sebastian Thiel
36f23d529f
CLI with branch list-remotes to list remote branches 2024-08-30 07:15:46 +02:00
Sebastian Thiel
6a4849d090
refactor: avoid borrowed git2::Oid as it's a copy type.
Usually this makes the affected code simpler.
2024-08-30 07:15:46 +02:00
Sebastian Thiel
c81b140790
Assure the most-recent workspace head is used when emitting changed files.
The reason for this is that now the outcome of this can be re-used in `list_virtual_branches`,
which is sensitive to seeing the latest vbranch state which is not a given.

Calculating it makes sure there is no mismatch, and probably "can't be wrong".

Also note that `head_commit()` is still kept around as it's the idea to eventually
use it more.
2024-08-30 07:15:40 +02:00
Sebastian Thiel
a7b01bd641
Keep using get_workspace_head() when no cached result is used.
That way, the application will not run into unexpected cases.
2024-08-29 09:34:54 +02:00
Sebastian Thiel
79798c7407
Exclude big files when performing a worktree diff.
This was lost previously when switching it over to a read-only
implementation.
Implementing it with an ignore list will take time, 400ms in the GitLab
repository, but it's not slower than it was before and it is always
preferred to not dump objects into the ODB unnecessarily.
2024-08-29 09:31:59 +02:00
Sebastian Thiel
a0e236110a
refactor
- move `gix` repository extension to where it belongs more naturally.
- make sure that `get_wd_tree()` is named more closely to what it really
  does, and use it in more places.
2024-08-28 22:05:25 +02:00
Sebastian Thiel
751e091f6f
Reuse the worktree-diff during 'recalulate-everything'
It's used for emission of changed files, but also for listing
branch information.

Make sure we only run the worktree-status once to save time.

This also unifies the acquisition of the `HEAD^{commit}`,
which one day will be a natural feature once `gix::Repository`
is used.
2024-08-28 21:42:29 +02:00
Sebastian Thiel
7ce143954f
Do not dynamically calculate the head commit when listing virtual branches.
That way, the head is static which allows to re-use the worktree status across
multiple related calls.

Also, add a way to quickly get the `head_commit()` from a `git2::Repository`.

Note that this may cause breakage in the app, as now it will see the actual
head, not a computed one, but that should also help us to find places that
didn't properly update their state.
2024-08-28 21:16:43 +02:00
Sebastian Thiel
7e0878a14f
Use read-only worktree diff
The worktree diff is essentially a 'git status' with a given tree,
and that can be expressed with a diff of the workdir, the index and a tree.

This comes at the expense of not being able to control which file sizes are diffed.
2024-08-28 11:10:04 +02:00
Sebastian Thiel
dd724f310d
Also debug-trace information on list_virtual_branches calls.
This can be useful for those who seek extra information, and while it's
dominating refresh times.
2024-08-28 11:09:33 +02:00
Kiril Videlov
06f50b4531 Merge branch 'master' into branch-stacking-first-stab 2024-08-27 14:13:08 +02:00
Kiril Videlov
b943c35293
code review fixes 2024-08-27 14:05:27 +02:00
Caleb Owens
3fb5077c4a
Somethign somethign matchy matchy design 2024-08-27 13:05:27 +02:00
Caleb Owens
d2d3afbf2b
Added unstaged changes event 2024-08-27 13:05:07 +02:00
Sebastian Thiel
06edec70cb
reuse the commit-graph between runs
This time, it contains whole commits and only flags are reset
between runs. With this amount of re-use, it will manage
to rival `git2`.
2024-08-27 12:17:54 +02:00
Sebastian Thiel
b081a115c8
Offload commit-walk to the commit-thread
That way, it can leverage already held commit-objects, and be faster
in the absence of a commitgraph.
2024-08-27 09:20:07 +02:00
Kiril Videlov
4b5a8d14ef
add commands for pushing change references 2024-08-26 21:38:40 +02:00
Kiril Videlov
cef701796d
update the create reference method to take change id 2024-08-26 20:49:01 +02:00
Sebastian Thiel
82aa2d1760
use gix powered merge-base for performance and reduced memory consumption 2024-08-26 19:35:09 +02:00
Kiril Videlov
66257fba2f
rename reference module to change_reference 2024-08-26 19:15:58 +02:00
Kiril Videlov
89d1186b06
refactor this to be a ChangeReference
it turns out that a reference to a change_id is all that we need
2024-08-26 17:02:38 +02:00
Kiril Videlov
2ddb032ebf
show relevant commit refs if feature is toggled 2024-08-23 21:03:44 +02:00
Kiril Videlov
33e7d7b269
adds the ability to create branch refs from the UI 2024-08-23 18:07:24 +02:00
Sebastian Thiel
7ee0520ffb
Use latest rev_walk() based API.
It's a bit more intuitive than `id().ancestors()` when coming from `git2`.
2024-08-23 13:08:37 +02:00
Caleb Owens
ec7a38f538
Merge pull request #4717 from gitbutlerapp/Rebase-revolution
Rebase revolution
2024-08-22 18:28:49 +02:00
Caleb Owens
893b3fc499 Use a default variant on enum 2024-08-22 18:04:11 +02:00
Caleb Owens
c987629262 Add project specific setting and refactor 2024-08-22 17:57:03 +02:00
Caleb Owens
0603fd7457 Sure up behaviour with blank commits and reordering 2024-08-22 15:15:23 +02:00
Mattias Granlund
8a741bcf2e Delete entry from .toml file when branch is integrated
- virtual_branches.toml file was full of old entries
2024-08-22 13:46:55 +01:00
Sebastian Thiel
fcafaec2be
process merge-bases in the background
This way, only the first branch has to wait, all further branches will
likely have their merge-base already computed then.
2024-08-21 20:24:22 +02:00
Sebastian Thiel
bdd109047e
use latest gix APIs for more convenience and increased readability. 2024-08-21 19:28:12 +02:00
Sebastian Thiel
e78ef9b115
enable max performance to be competitive in object database access.
This is very relevant for tree-diffing performance, and more could be tuned
here like pack-cache sizes and object cache sizes.
2024-08-21 19:28:12 +02:00
Sebastian Thiel
66c747e611
somewhat fix the ODB performance bottleneck with better caching. 2024-08-21 19:28:12 +02:00
Sebastian Thiel
a2382bde74
Use gix to find branchs and get the local tracking branch 2024-08-21 19:28:12 +02:00
Sebastian Thiel
29ecbff318
Use gix for tree-tree-diff 2024-08-21 19:28:12 +02:00
Sebastian Thiel
0db0f1a86a
Use gix for simple ref-walk that won't go past the merge-base. 2024-08-21 19:28:12 +02:00
Sebastian Thiel
db600b48f9
add benchmark just for revwalking 2024-08-21 19:28:11 +02:00
Sebastian Thiel
42e4ab44f9
Make it more obvious where gitoxide repositories are used. 2024-08-21 19:28:11 +02:00
Sebastian Thiel
7362bab7aa
Assure we can use different merge bases when showing branch details.
Alternatively, correct the assumption that there is a difference.
2024-08-21 19:28:11 +02:00
Sebastian Thiel
07dc9efe02
add tests for get_branch_listing_details() 2024-08-21 19:28:11 +02:00
Sebastian Thiel
e26bf2f54a
add benchmarks for branch details 2024-08-21 19:28:09 +02:00