jordan_rose added inline comments.

================
Comment at: lib/Basic/CMakeLists.txt:27
+    STRING(REGEX REPLACE "\n" "" file_contents "${file_contents}")
+    if ("${file_contents}" MATCHES "^gitdir:")
+      # '.git' is indeed a link to the submodule's Git directory.
----------------
How about

```
if("${file_contents}" MATCHES "^gitdir: ([^\n]+)")
  set(git_path "${git_path}${CMAKE_MATCH_0}")
endif()
```

and then no stripping or replacing later at all? This admittedly doesn't handle 
some future submodule format that doesn't put `gitdir` on the first line, but 
neither does the code that's there.

(This also doesn't handle absolute path submodule references, but looking 
around a bit makes it sound like those aren't supposed to occur in practice and 
are considered bugs when git does generate them. I could be wrong about that 
though.)


https://reviews.llvm.org/D34955



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to