mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
ci: Ignore uncrustify calls resulting in unsuccessful return codes
If for some reason uncrustify gets angry at our file and indent on/off marks, it will result in an error code other than 0. Since in those cases there is no output to diff with, we misinterpret those situations as "the whole file should be deleted", which is far from it. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1970>
This commit is contained in:
parent
117027d9fd
commit
3caa5fea3c
@ -75,7 +75,11 @@ def reformat_chunks(chunks, rewrite):
|
|||||||
tmp = create_temp_file(chunk['file'], chunk['start'], chunk['end'])
|
tmp = create_temp_file(chunk['file'], chunk['start'], chunk['end'])
|
||||||
|
|
||||||
# uncrustify chunk
|
# uncrustify chunk
|
||||||
proc = subprocess.Popen(["uncrustify", "-c", uncrustify_cfg, "-f", tmp.name], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
|
proc = subprocess.Popen(["uncrustify", "-c", uncrustify_cfg, "-f", tmp.name], stdout=subprocess.PIPE)
|
||||||
|
proc.wait()
|
||||||
|
if proc.returncode != 0:
|
||||||
|
continue
|
||||||
|
|
||||||
reindented = proc.stdout.readlines()
|
reindented = proc.stdout.readlines()
|
||||||
tmp.close()
|
tmp.close()
|
||||||
|
|
||||||
@ -128,7 +132,7 @@ if dry_run is not True and rewrite is True:
|
|||||||
proc = subprocess.Popen(["git", "commit", "--all", "--amend", "-C", "HEAD"], stdout=subprocess.DEVNULL)
|
proc = subprocess.Popen(["git", "commit", "--all", "--amend", "-C", "HEAD"], stdout=subprocess.DEVNULL)
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
elif dry_run is True and changed is True:
|
elif dry_run is True and changed is True:
|
||||||
print ("\nIssue the following command in your local tree to apply the suggested changes (needs uncrustify installed):\n\n $ git rebase origin/master --exec \"./check-style.py -r\" \n")
|
print ("\nIssue the following command in your local tree to apply the suggested changes (needs uncrustify installed):\n\n $ git rebase origin/main --exec \"./check-style.py -r\" \n")
|
||||||
os._exit(-1)
|
os._exit(-1)
|
||||||
|
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user