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

Add copy commit attributes option #1833

Merged
merged 5 commits into from
Mar 26, 2022
Merged

Add copy commit attributes option #1833

merged 5 commits into from
Mar 26, 2022

Conversation

mark2185
Copy link
Collaborator

I managed to close #1774 by accidentally overwriting the upstream with the wrong branch.

@mark2185
Copy link
Collaborator Author

What should I do about the conflict in the auto-generated file?

@jesseduffield
Copy link
Owner

@mark2185 whenever I get conflicts in those I just arbitrarily resolve the conflicts (picking any hunk) and then re-generate the file

Copy link
Owner

@jesseduffield jesseduffield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one! Left some feedback

pkg/commands/git_commands/commit.go Outdated Show resolved Hide resolved
pkg/i18n/english.go Outdated Show resolved Hide resolved
pkg/config/user_config.go Show resolved Hide resolved
pkg/i18n/english.go Outdated Show resolved Hide resolved
@mark2185
Copy link
Collaborator Author

@mark2185 whenever I get conflicts in those I just arbitrarily resolve the conflicts (picking any hunk) and then re-generate the file

I'm not even sure why it's conflicting, judging by the diff, only 1 line was added. But when I click resolve conflicts on github, it's an entirely different conflict. What gives?

@jesseduffield
Copy link
Owner

@mark2185 not sure, I guess it's up to git to decide whether there's a conflict there

@mark2185
Copy link
Collaborator Author

@mark2185 not sure, I guess it's up to git to decide whether there's a conflict there

It would seem I branched off at an earlier point in time than current master. Should be all good now.

@jesseduffield
Copy link
Owner

jesseduffield commented Mar 25, 2022

Nice work @mark2185 . I've just done some local testing and I see that we're able to bring up the clipboard menu in the 'local' commits context, but not the reflog context or the sub-commits context. I think it might be a little confusing being able to press <c-o> for copying the clipboard item directly in those other two contexts but not being able to open the menu.

I think we need to add a 'controller factory' which adds the keybinding to each of the three contexts.

In pkg/gui/controllers.go we go:

	for _, context := range []controllers.Commitish{
		gui.State.Contexts.LocalCommits,
		gui.State.Contexts.ReflogCommits,
		gui.State.Contexts.SubCommits,
		gui.State.Contexts.Stash,
	} {
		controllers.AttachControllers(context, commitishControllerFactory.Create(context))
	}

that factory is defined in pkg/gui/controllers/commitish_controller.go. So we'd want to have another factory which does a similar thing. The idea is that you can define keybindings that apply to each context, so long as the context satisfies some interface. In our case we'd want to have a GetSelected method in our interface which returns a pointer to a commit. Given that we already have our commit-based contexts with that method they should automatically satisfy the interface.

What do you reckon?

@mark2185
Copy link
Collaborator Author

I think it might be a little confusing being able to press for copying the clipboard item directly in those other two contexts but not being able to open the menu.

Definitely.

What do you reckon?

I'll give it a shot and let you know how's it going! Thanks for all the assistance, it makes contributing much easier :D
I know you're going out of your way so I just wanted to let you know it's appreciated :)

@jesseduffield
Copy link
Owner

The feeling's mutual, you're making a big impact with all these contributions :)

@jesseduffield
Copy link
Owner

As discussed on slack, the wording of the controller factories (and the existence of said factories) was a little hard to follow, so I've refactored some things to make that a little more readable. At any rate I'll merge this PR now that tests are all green. Great work as usual :)

@jesseduffield jesseduffield merged commit e039429 into jesseduffield:master Mar 26, 2022
@mark2185 mark2185 deleted the feature/copy-commit-url branch March 26, 2022 13:10
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