Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch popup #303

Merged
merged 25 commits into from
Oct 9, 2020
Merged

Branch popup #303

merged 25 commits into from
Oct 9, 2020

Conversation

WizardOhio24
Copy link
Contributor

Implements a branch popup which can be accessed by pressing 'b' in the status tab.
branch_popup
A new branch can be created by pressing 'c' while the branch popup is open and a branch can be checked out by selecting the branch and pressing enter.

This does currently work but it is still a work in progress.

Linked to #91.

@WizardOhio24
Copy link
Contributor Author

This is now complete, bar that getting the branches is currently sync and should probably be async or cached (so the calls are currently inefficient). I'm not sure about the async stuff so it might take a bit of time to work out.
Also, the styling will be added after #289 is merged as the text will have to be changed to Span and Spans.

asyncgit/src/sync/branch.rs Outdated Show resolved Hide resolved
asyncgit/src/sync/branch.rs Outdated Show resolved Hide resolved
src/app.rs Outdated Show resolved Hide resolved
src/components/select_branch.rs Outdated Show resolved Hide resolved
src/components/select_branch.rs Outdated Show resolved Hide resolved
src/components/select_branch.rs Outdated Show resolved Hide resolved
@extrawurst

This comment has been minimized.

@extrawurst
Copy link
Owner

@WizardOhio24 where are we on this one? since you are already working on the next PR :D

@WizardOhio24
Copy link
Contributor Author

I'm still working on this, I was just waiting for tui to be bumped so the styles could be fixed/implemented.

@WizardOhio24 WizardOhio24 changed the title WIP: Branch popup Branch popup Oct 8, 2020
@WizardOhio24
Copy link
Contributor Author

This currently has a thing(bug?) where it automatically stages all files which have been changed, this isn't a bug, but I don't think it's what the user would expect. Otherwise this is complete, I think.

@extrawurst
Copy link
Owner

This currently has a thing(bug?) where it automatically stages all files which have been changed, this isn't a bug, but I don't think it's what the user would expect. Otherwise this is complete, I think.

How do regular git GUIs handle it when you switch branches while having file changes in the working dir?

@extrawurst
Copy link
Owner

How about refusing to switch branches if you have uncommitted changes?

@WizardOhio24
Copy link
Contributor Author

I think it's a bug, it stages and unstages changes which do and undo each other, I'll try to do it the same way git does a checkout.

@extrawurst
Copy link
Owner

@WizardOhio24 libgit2 is very mature, I would be surprised if switching-branches has such a significant bug. if so we should create an issue

@WizardOhio24
Copy link
Contributor Author

It's not a bug with libgit2, I meant the way you would do it in git (e.g git checkout master) is not the same as the way it is done in libgit2, or, at least, the equivalent commands don't reach the same result. I was unsure if there was a bug with my implementation or if this is just what happens when you checkout branches, but I think my implementation is incorrect.

@extrawurst

This comment has been minimized.

@WizardOhio24
Copy link
Contributor Author

Everything should work now. The checkout displays an error message if there is uncommitted changes on the current branch, as you suggested (and the way git does it (I think)). I'm not sure how long the branch names need to be so I've made them cutoff at 15 characters, the commit hash and message take up the remaining space.

@extrawurst

This comment has been minimized.

@WizardOhio24

This comment has been minimized.

@extrawurst
Copy link
Owner

@WizardOhio24 nope, tried that

@extrawurst
Copy link
Owner

looks like we need more unit tests

@WizardOhio24

This comment has been minimized.

@extrawurst

This comment has been minimized.

@WizardOhio24
Copy link
Contributor Author

Fixed, it was not ignoring files in .gitignore

@extrawurst
Copy link
Owner

@WizardOhio24 any idea why the last commits do net get run in CI anymore?

@WizardOhio24
Copy link
Contributor Author

See https://www.githubstatus.com/, I think.

@extrawurst
Copy link
Owner

@WizardOhio24 are you going to write some tests for checkout_branch and get_branches_to_display ?

@extrawurst extrawurst merged commit 94bbf3c into extrawurst:master Oct 9, 2020
@extrawurst
Copy link
Owner

@WizardOhio24 lets create a followup PR with some tests, I want to get this out for other to play around with. thanks for all the work you put into this❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants