Reputation: 30277
I am using indent
to format code in a c project of mine: https://github.com/eantoranz/gitmod/ (v0.11)
If you take code and run make format
, it will apply a change (using linux
format):
$ git diff
$ make format
indent -l120 -linux src/gitmod/*.c src/include/*.h src/include/gitmod/*.h src/tests/unit_tests/*.c src/tests/unit_tests/*.h
find ./ -name '*~' -delete
$ git diff
diff --git a/src/gitmod/thread.c b/src/gitmod/thread.c
index 8211b61..1ef7d1d 100644
--- a/src/gitmod/thread.c
+++ b/src/gitmod/thread.c
@@ -19,7 +19,7 @@ static void *thread_task(void *params)
gitmod_thread *gitmod_thread_create(gitmod_info *info, void (*task)(gitmod_thread *), int delay)
{
- if (!info)
+ if(!info)
return NULL;
gitmod_thread *thread = calloc(1, sizeof(gitmod_thread));
if (thread) {
But you run it again, and the change is taken back.:
$ make format
indent -l120 -linux src/gitmod/*.c src/include/*.h src/include/gitmod/*.h src/tests/unit_tests/*.c src/tests/unit_tests/*.h
find ./ -name '*~' -delete
$ git diff
$
Line of code with the problem: https://www.github.com/eantoranz/gitmod/blob/v0.11/src/gitmod/thread.c#L22
Makefile target:
format:
indent -l120 -linux src/gitmod/*.c src/include/*.h src/include/gitmod/*.h src/tests/unit_tests/*.c src/tests/unit_tests/*.h
find ./ -name '*~' -delete
It can be seen over here: https://github.com/eantoranz/gitmod/blob/v0.11/Makefile#L49
What can I do in the indent call to avoid this problem?
Side note: What tools do you use for the same task?
Upvotes: 0
Views: 61