Merge branch 'bugfix/crlf_auto_conversion' into 'master'

Convert CRLF (Windows line endings) to LF (Unix style), add CI check

See merge request idf/esp-idf!2119
This commit is contained in:
Ivan Grokhotkov
2018-07-13 11:44:57 +08:00
119 changed files with 43973 additions and 43934 deletions

View File

@@ -431,6 +431,20 @@ check_doc_links:
- cd docs
- make linkcheck
check_line_endings:
stage: deploy
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG
tags:
- build
except:
- master
- /^release\/v/
- /^v\d+\.\d+(\.\d+)?($|-)/
dependencies: []
before_script: *do_nothing_before
script:
- tools/ci/check-line-endings.sh ${IDF_PATH}
check_commit_msg:
stage: deploy
image: $CI_DOCKER_REGISTRY/esp32-ci-env$BOT_DOCKER_IMAGE_TAG

View File

@@ -1,4 +1,4 @@
// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.

View File

@@ -1,4 +1,4 @@
About
About
=====
This is documentation of `ESP-IDF <https://github.com/espressif/esp-idf>`_, the framework to develop applications for `ESP32 <https://espressif.com/en/products/hardware/esp32/overview>`_ chip by `Espressif <https://espressif.com>`_.

View File

@@ -158,6 +158,21 @@ Although not directly related to formatting, here are a few notes about using co
}
Line Endings
^^^^^^^^^^^^
Commits should only contain files with LF (Unix style) endings.
Windows users can configure git to check out CRLF (Windows style) endings locally and commit LF endings by setting the ``core.autocrlf`` setting. `Github has a document about setting this option <github-line-endings>`. However because MSYS2 uses Unix-style line endings, it is often easier to configure your text editor to use LF (Unix style) endings when editing ESP-IDF source files.
If you accidentally have some commits in your branch that add LF endings, you can convert them to Unix by running this command in an MSYS2 or Unix terminal (change directory to the IDF working directory and check the correct branch is currently checked out, beforehand)::
git rebase --exec 'git diff-tree --no-commit-id --name-only -r HEAD | xargs dos2unix && git commit -a --amend --no-edit --allow-empty' master
(Note that this line rebases on master, change the branch name at the end to rebase on another branch.)
For updating a single commit, it's possible to run ``dos2unix FILENAME`` and then run ``git commit --amend``
Formatting your code
^^^^^^^^^^^^^^^^^^^^

View File

@@ -1,4 +1,4 @@
*************************************
*************************************
Standard Setup of Toolchain for Linux
*************************************
:link_to_translation:`zh_CN:[中文]`

14
tools/ci/check-line-endings.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/sh
if ! [ -z "$1" ]; then
cd "$1"
fi
echo "Checking for Windows line endings in `pwd`"
if git ls-tree --name-only -r HEAD | xargs file -N | grep CRLF; then
echo "Some files have CRLF (Windows-style) line endings. Please convert to LF (Unix-style). git can be configured to do this automatically."
exit 1
fi
exit 0

View File

@@ -14,6 +14,7 @@ docs/gen-kconfig-doc.py
tools/ci/apply_bot_filter.py
tools/ci/build_examples.sh
tools/ci/check-executable.sh
tools/ci/check-line-endings.sh
tools/ci/checkout_project_ref.py
tools/ci/get-full-sources.sh
tools/ci/mirror-submodule-update.sh

View File

@@ -1,5 +1,4 @@
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x33 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
@@ -63,15 +62,12 @@ D (291) heap_init: New heap initialised at 0x3ffe0440
D (301) heap_init: New heap initialised at 0x3ffe4350
D (311) intr_alloc: Connected src 16 to int 12 (cpu 0)
D (311) hello_world: debug1
W (311) hello_world: warning1
V (321) hello_world: verbose1
E (321) hello_world: error1
I (321) hello_world: info1
regular printf
D (331) another_world: another debug
I (331) example: Periodic timer called, time since boot: 507065 us
V (341) another_world: another verbose another very long
W (341) another_world: another warning very long
@@ -82,7 +78,6 @@ V (351) another_world: another verbose

D (361) hello_world: debug2
W (371) hello_world: warning2
V (371) hello_world: verbose2
E (371) hello_world: error2
I (381) hello_world: info2