Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
KWSys
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kevin Fitch
KWSys
Commits
d22c2743
Commit
d22c2743
authored
7 years ago
by
Brad King
Browse files
Options
Downloads
Patches
Plain Diff
clang-format.bash: Use Git attributes to mark files for formatting
parent
6365886c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitattributes
+1
-1
1 addition, 1 deletion
.gitattributes
clang-format.bash
+11
-10
11 additions, 10 deletions
clang-format.bash
with
12 additions
and
11 deletions
.gitattributes
+
1
−
1
View file @
d22c2743
...
...
@@ -3,7 +3,7 @@
.hooks* export-ignore
# Custom attribute to mark sources as using our C code style.
[attr]our-c-style whitespace=tab-in-indent
[attr]our-c-style whitespace=tab-in-indent
format.clang-format
/GitSetup export-ignore
/*.sh export-ignore eol=lf
...
...
This diff is collapsed.
Click to expand it.
clang-format.bash
+
11
−
10
View file @
d22c2743
#!/usr/bin/env bash
#=============================================================================
# Copyright 2015-201
6
Kitware, Inc.
# Copyright 2015-201
7
Kitware, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
...
...
@@ -106,17 +106,18 @@ case "$mode" in
*
)
die
"invalid mode:
$mode
"
;;
esac
# Filter sources to which our style should apply.
list_cfg_files
()
{
$git_ls
-z
--
'*.c.in'
'*.h.in'
'*.hxx.in'
}
list_all_files
()
{
$git_ls
-z
--
'*.c'
'*.c.in'
'*.cxx'
'*.h'
'*.h.in'
'*.hxx'
'*.hxx.in'
# List files as selected above.
list_files
()
{
$git_ls
|
# Select sources with our attribute.
git check-attr
--stdin
format.clang-format |
sed
-n
'/: format\.clang-format: set$/ {s/:[^:]*:[^:]*$//p}'
}
# Transform configured sources to protect @SYMBOLS@.
list_
cfg_
files | xargs
-
0
-r
sed
-i
's/@\(KWSYS_[A-Z0-9_]\+\)@/x\1x/g'
list_files | xargs
-
d
'\n'
sed
-i
's/@\(KWSYS_[A-Z0-9_]\+\)@/x\1x/g'
# Update sources in-place.
list_
all_
files | xargs
-
0
"
$clang_format
"
-i
list_files | xargs
-
d
'\n'
"
$clang_format
"
-i
# Transform configured sources to restore @SYMBOLS@.
list_
cfg_
files | xargs
-
0
-r
sed
-i
's/x\(KWSYS_[A-Z0-9_]\+\)x/@\1@/g'
list_files | xargs
-
d
'\n'
sed
-i
's/x\(KWSYS_[A-Z0-9_]\+\)x/@\1@/g'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment