-
Notifications
You must be signed in to change notification settings - Fork 10
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
CFE-4081: Fixed commiting of changes made by set-input #144
Conversation
Should fail until I fix the bug. Signed-off-by: Ole Herman Schumacher Elgesem <ole.elgesem@northern.tech>
Signed-off-by: Ole Herman Schumacher Elgesem <ole.elgesem@northern.tech>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
git diff --exit-code --staged | ||
|
||
# Error if there are uncommited changes (to tracked files): | ||
git diff --exit-code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like these checks should be in a nicely-named function in some shared bash source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, good idea
old_data = read_json(path) | ||
if old_data == data: | ||
log.debug("Input data for '%s' unchanged, nothing to write / commit" % name) | ||
return 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should, ideally, be done before the more expensive checks/comparison above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking it makes sense to always do the expensive checks (validation), even if the (potentially bad) data is already there.
if config.get("git", False): | ||
git_commit( | ||
"Set the input for module '%s'" % name, | ||
edit_commit_msg=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No interactivity here and prompting the user if they want to modify the commit message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I am submitting some changes which should explain / clear this up. (In a follow-up).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WIP: #145
More work remains to fix committing in
cfbs add
.