check-style: fix "fatal: not a git repository: /place/sandbox-data/tasks/0/2/882869720/ClickHouse/.git/modules/contrib/AMQP-CPP" error

check-style uses "git status" to see changed ya.make files.

However it seems that that the sources was cloned some ancient git
version, likely <2.8, since there was a bug, that has been fixed in 2.8
[1]:

    " * A partial rewrite of "git submodule" in the 2.7 timeframe changed
        the way the gitdir: pointer in the submodules point at the real
        repository location to use absolute paths by accident.  This has
        been corrected."

  [1]: cf11a67975/Documentation/RelNotes/2.8.3.txt (L33-L36)
This commit is contained in:
Azat Khuzhin 2021-01-29 23:20:57 +03:00
parent 480c75bacf
commit 7d9c892e60

View File

@ -107,7 +107,23 @@ find $ROOT_PATH -not -path $ROOT_PATH'/docker*' -not -path $ROOT_PATH'/contrib*'
# Check that ya.make files are auto-generated
"$ROOT_PATH"/utils/generate-ya-make/generate-ya-make.sh
git status -uno | grep ya.make && echo "ya.make files should be generated with utils/generate-ya-make/generate-ya-make.sh"
# FIXME: apparently sandbox (don't confuse it with docker) cloning sources
# using some ancient git version, <2.8, that contains one bug for submodules
# initialization [1]:
#
# " * A partial rewrite of "git submodule" in the 2.7 timeframe changed
# the way the gitdir: pointer in the submodules point at the real
# repository location to use absolute paths by accident. This has
# been corrected."
#
# [1]: https://github.com/git/git/blob/cf11a67975b057a144618badf16dc4e3d25b9407/Documentation/RelNotes/2.8.3.txt#L33-L36
#
# Due to which "git status" will report the following error:
#
# fatal: not a git repository: /place/sandbox-data/tasks/0/2/882869720/ClickHouse/.git/modules/contrib/AMQP-CPP
#
# Anyway this check does not requires any submodule traverse, so it is fine to ignore those errors.
git status -uno 2> >(grep "fatal: not a git repository: /place/sandbox-data/tasks/.*/ClickHouse/\\.git/modules/contrib") | grep ya.make && echo "ya.make files should be generated with utils/generate-ya-make/generate-ya-make.sh"
# Check that every header file has #pragma once in first line
find $ROOT_PATH/{src,programs,utils} -name '*.h' |