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

fix: New branch dropzone only accepts uncommited files #5177

Merged
merged 1 commit into from
Oct 16, 2024
Merged

Conversation

estib-vega
Copy link
Contributor

@estib-vega estib-vega commented Oct 16, 2024

When creating a brand new branch, don't let committed files or hunks create new branches

Issues

As seen in #4951

When creating a brand new branch, don't let commited files or hunks create new branches
Copy link

vercel bot commented Oct 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
gitbutler-web ⬜️ Ignored (Inspect) Visit Preview Oct 16, 2024 5:48pm

Comment on lines 18 to 20
if (data instanceof DraggableFile)
return !data.isCommitted && !data.files.some((f) => f.locked);
if (data instanceof DraggableHunk) return !data.isCommitted && !data.hunk.locked;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we de'morgan this and say

		if (data instanceof DraggableFile)
			return !(data.isCommitted || data.files.some((f) => f.locked));
		if (data instanceof DraggableHunk) return !(data.isCommitted || data.hunk.locked);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure thing!

Copy link
Contributor

@Caleb-T-Owens Caleb-T-Owens left a comment

Choose a reason for hiding this comment

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

Other than a very small nitpick which you can feel free to ignore, Looks good to me. Thanks for closing that one up.

@estib-vega estib-vega force-pushed the branch branch 2 times, most recently from 533bdb1 to 73f8133 Compare October 16, 2024 17:47
@estib-vega estib-vega merged commit 08b29a7 into master Oct 16, 2024
14 checks passed
@estib-vega estib-vega deleted the branch branch October 16, 2024 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants