-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Root cause:
Using temp file will mess up clang-format IncludeCategories rules for .h
Description:
In clang-format, IncludeCategories will automatically set the filename.h to the highest priority, which mean it will put it at the first of the include block:
The main header for a source file automatically gets category 0. so that it is generally kept at the beginning of the #includes link
But, our hook using the temp file to compare with the source file, causing this rule not work, hence given a no-fix loop for this situation:
Report by the clang-format
$ clang-format this_is_the_actual_filename.c
#ifdef FOOBAR
#include "this_is_the_actual_filename.h"
#include "xxx.h"
#include "xxx.h"
#include "xxx.h"
#include <xxx.h>
#include <xxx.h>
Report by the hook
--- .merge_file_Zzz17X 2019-09-26 21:39:09.606926346 +0800
+++ /tmp/.merge_file_Zzz17X.I2ISWZ 2019-09-26 21:39:09.650259682 +0800
@@ -1,8 +1,8 @@
#ifdef FOOBAR
-#include "this_is_the_actual_filename.h"
#include "xxx.h"
#include "xxx.h"
#include "xxx.h"
+#include "this_is_the_actual_filename.h"
#include <xxx.h>
#include <xxx.h>
Metadata
Metadata
Assignees
Labels
No labels