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

empy merge works on empty repo without --allow-empty #8416

Open
tkalir opened this issue Dec 12, 2024 · 3 comments
Open

empy merge works on empty repo without --allow-empty #8416

tkalir opened this issue Dec 12, 2024 · 3 comments

Comments

@tkalir
Copy link

tkalir commented Dec 12, 2024

while working on #7824 I noticed that it is possible, if main is empty, to:
create branch a from main
create branch b from main
make an empty commit to a
merge a to b without --allow-empty

It doesn't seem very important but for consistency I believe it should require --allow-empty or --force. It does require these flags if main is not empty.

If I understand correctly, it can be solved by adding a check in graveler\commited\manager.go:Merge if source metaRangeId == destination metaRangeId and require the flags in this case.

I can create a PR if you think it should be changed.

@arielshaqed
Copy link
Contributor

What does Git do in this case? When there is no clear preference, we should generally follow Git.

@tkalir
Copy link
Author

tkalir commented Dec 16, 2024

Good point. I checked and git does allow such a merge (without additional flags), whether main is empty or not. lakefs already doesn't follow git in that it requires --force when main is not empty.
So the question is whether it's better to be consistent with git in the case that main is empty, or being consistent with lakefs's behavior when it's not.

@arielshaqed
Copy link
Contributor

@ozkatz has a rule for lakeFS,

If there's no simple answer that's clearly correct, do what Git does.

The reasoning is that Git had been around for many more years, has more users, and if a user has any preconception about what should happen -it's probably been influenced by Git.

Given that it's not clearly wrong, let's do what Git does here.

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

No branches or pull requests

2 participants