Fix patching.sh to include untracked (new) files in patch #7979
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In patching.sh, execute
git add -N .
before executinggit diff
to present the state of the patch to the user, so that new, untracked files will be included in the diff.This appears to address the bug raised in Issue #7912.
If adding new files by way of a patch is truly to be discouraged a better solution might be to detect that a new file has been added, produce an error message explaining that new files should not be added via patch and possibly advising what should be done instead. Without this patch, any new files are not included in the patch as presented before the 'Are you happy with this patch?' prompt, but they are included in the produced patch, if the user responds 'yes'. It might be appropriate to prevent this. In any case, this would require a different change to patching.sh.
How Has This Been Tested?
I ran compile.sh with command uboot-patch, added a new configuration file and observed that the new file was presented in the patch displayed before the 'Are you happy with this patch?' prompt.
At the prompt I responded 'stop' and observed no errors.
I repeated the test, creating a different new file and observed that only this second new file appeared in the patch. The file added in the previous execution of compile.sh did not remain.
At the prompt I responded 'yes' and observed that the patch file was produced in output/patch, including diff for the new file.
Checklist:
Please delete options that are not relevant.