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

Feature request: Add --skip-empty to DOLT_COMMIT() #5678

Closed
jacobATcertifiedfoodDotinfo opened this issue Apr 2, 2023 · 4 comments · Fixed by #6086
Closed

Feature request: Add --skip-empty to DOLT_COMMIT() #5678

jacobATcertifiedfoodDotinfo opened this issue Apr 2, 2023 · 4 comments · Fixed by #6086
Assignees

Comments

@jacobATcertifiedfoodDotinfo
Copy link

https://docs.dolthub.com/sql-reference/version-control/dolt-sql-procedures#dolt_commit

Please add an option similar to

--allow-empty: Allow recording a commit that has the exact same data as its sole parent. This is usually a mistake, so it is disabled by default. This option bypasses that safety.

The new --skip-empty option covers a different use case, because I want to commit ONLY if there is something to commit. I do NOT want to get an error like Error 1105 (HY000): nothing to commit.

@timsehn timsehn added the enhancement New feature or request label Apr 3, 2023
@timsehn
Copy link
Sponsor Contributor

timsehn commented May 10, 2023

There's no Git equivalent of this.

https://git-scm.com/docs/git-commit

I assume you want this for the programmatic use case. You don't want to check that something is changed in the working set before issuing the commit command.

@jacobATcertifiedfoodDotinfo
Copy link
Author

Yes, correct.
Currently, here is a snippet:

		_, err = txClient.ExecContext(ctx, commitCmd)
		if err != nil {
			if !strings.Contains(err.Error(), "nothing to commit") {
				return nil, err
			}
		}

I don't want to have to check for this error

@fulghum
Copy link
Contributor

fulghum commented Jun 6, 2023

Hey @jacobATcertifiedfoodDotinfo, thank you for this great feature request! 🙏 I've just merged in PR #6086, which adds support for the new --skip-empty flag to dolt commit on the CLI and dolt_commit() in SQL. This will go out in the next release, later this week.

Let us know if you have any more feedback on anything we can do to make Dolt work better for you!

@fulghum
Copy link
Contributor

fulghum commented Jun 6, 2023

And... it's released now! You can find it in Dolt version 1.3.0 or higher.

Kelley12 added a commit to Kelley12/docs that referenced this issue Jun 21, 2023
In Dolt #6086 a new option `--skip-empty` was added to the dolt_commit procedure as requested in dolthub/dolt#5678
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants