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

import: No empty commits without --allow-empty #245

Merged
merged 3 commits into from
Sep 8, 2020
Merged

Conversation

craigds
Copy link
Member

@craigds craigds commented Sep 8, 2020

Description

This adds the --allow-empty option, which has the same meaning as
in commit and apply.

This behaviour mostly only affects --replace-existing,
since import will never produce an empty commit if you're not
replacing anything.

Because import uses fast-import, this was a little tricky. fast-import will happily do empty commits and there's no easy way to stop it from doing so.

So instead, I made fast-import use a temporary branch to do its importing on. Then afterwards I checked whether the commit was empty before updating the original branch ref to the new commit.

Related links:

#243 did the same thing for apply

Checklist:

  • Have you reviewed your own change?
  • Have you included test(s)?
  • Have you updated the changelog?

This adds the --allow-empty option, which has the same meaning as
in `commit` and `apply`.

This behaviour mostly only affects `--replace-existing`,
since `import` will never produce an empty commit if you're not
replacing anything.
@craigds craigds merged commit f5d2afd into master Sep 8, 2020
@craigds craigds deleted the no-empty-imports branch September 8, 2020 05:33
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.

2 participants