Skip to content

Commit

Permalink
fixed paths
Browse files Browse the repository at this point in the history
  • Loading branch information
dyldonahue committed Sep 5, 2024
1 parent caececa commit a058755
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions clang_restage.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,29 @@ def restage_files(files):
print("No files to restage.")

def main():

current_directory = os.getcwd()

# Get a list of staged files
staged_files = get_staged_files()

# Run clang-format on staged files
result = subprocess.run(['clang-format', '--style=file', '-i'] + staged_files,

if "bedded" in current_directory:
result = subprocess.run(['clang-format', '--style=file:clang-format', '-i'] + staged_files,
capture_output=True, text=True)
else:

clang_format_path = os.path.join(current_directory, 'Drivers', 'Embedded-Base', 'clang-format')
result = subprocess.run(['clang-format', f'--style=file:{clang_format_path}', '-i'] + staged_files,
capture_output=True, text=True)

if result.returncode == 0:
print("clang-format passed. Restaging files.")
restage_files(staged_files)
else:
print("clang-format failed. Please fix the issues and commit again.(Most likely, just try commiting again)")
print(current_directory)
print(f"clang-format failed. Please fix the issues and commit again.(Most likely, just try commiting again) {clang_format_path}")
sys.exit(1)

if __name__ == '__main__':
Expand Down

0 comments on commit a058755

Please sign in to comment.