Skip to content
This repository has been archived by the owner. It is now read-only.

clang-format breaks symlinks #46992

Closed
stephenhines opened this issue Aug 4, 2020 · 3 comments
Closed

clang-format breaks symlinks #46992

stephenhines opened this issue Aug 4, 2020 · 3 comments

Comments

@stephenhines
Copy link

@stephenhines stephenhines commented Aug 4, 2020

Bugzilla Link 46992
Resolution FIXED
Resolved on May 11, 2021 20:50
Version unspecified
OS Linux
CC @pirama-arumuga-nainar

Extended Description

This comes from an Android bug about running clang-format on a symlinked file (in this case, one named DisplayId.h that is pointing to a different DisplayId.h).

diff --git a/libs/ui/include_vndk/ui/DisplayId.h b/libs/ui/include_vndk/ui/DisplayId.h
index 73c9fe8d689..ec31ce4a306 120000
--- a/libs/ui/include_vndk/ui/DisplayId.h
+++ b/libs/ui/include_vndk/ui/DisplayId.h
@@ -1 +1 @@
-../../include/ui/DisplayId.h
\ No newline at end of file
+../../ include / ui / DisplayId.h
\ No newline at end of file

Ideally, clang-format would detect that it is running on a symlink and not adjust the file at all.

@stephenhines
Copy link
Author

@stephenhines stephenhines commented Aug 4, 2020

Loading

@pirama-arumuga-nainar
Copy link

@pirama-arumuga-nainar pirama-arumuga-nainar commented May 5, 2021

To reproduce:

  1. create a symlink foo.h and commit it to a git project
  2. git-clang-format --diff --style file --extensions c,h,cc,cpp 85e55396aaa5ad5661232154f2ce778f4752b79f^ 85e55396aaa5ad5661232154f2ce778f4752b79f

This'd suggest a formatting change to the foo.h.

https://reviews.llvm.org/D101878 has a proposed fix.

Loading

@pirama-arumuga-nainar
Copy link

@pirama-arumuga-nainar pirama-arumuga-nainar commented May 12, 2021

Fixed by 0fd0a010a1ed2ce761d20bfc6378e5bbaa75c8de (https://reviews.llvm.org/D101878).

Loading

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants