From f1eb192e264a10ccbc5b303f72347a9c846965af Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Tue, 1 May 2018 10:44:09 +0200 Subject: [PATCH] download/git: add warning not to use our git cache We really want the user not to use our git cache manually, or their changes (committed or not) may eventually get lost. So, add a warning file, not unlike the one we put in the target/ directory, to warn the user not to use the git tree. Ideally, we would have carried this file in support/misc/, but the git backend does not have access to it: the working directory is somewhere unknown, and TOPDIR is not exported in the environment. So, we have to carry it in-line in the backend instead. Signed-off-by: "Yann E. MORIN" Cc: Maxime Hadjinlian Cc: Thomas Petazzoni Cc: Ricardo Martincoski Cc: Arnout Vandecappelle Reviewed-by: Ricardo Martincoski Tested-by: Ricardo Martincoski Signed-off-by: Thomas Petazzoni --- support/download/git | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/support/download/git b/support/download/git index bf05c595a5..3b5c8a6cfe 100755 --- a/support/download/git +++ b/support/download/git @@ -43,6 +43,24 @@ _git() { eval GIT_DIR="${git_cache}/.git" ${GIT} "${@}" } +# Create a warning file, that the user should not use the git cache. +# It's ours. Our precious. +cat <<-_EOF_ >"${dl_dir}/git.readme" + IMPORTANT NOTE! + + The git tree located in this directory is for the exclusive use + by Buildroot, which uses it as a local cache to reduce bandwidth + usage. + + Buildroot *will* trash any changes in that tree whenever it needs + to use it. Buildroot may even remove it in case it detects the + repository may have been damaged or corrupted. + + Do *not* work in that directory; your changes will eventually get + lost. Do *not* even use it as a remote, or as the source for new + worktrees; your commits will eventually get lost. +_EOF_ + # Initialise a repository in the git cache. If the repository already # existed, this is a noop, unless the repository was broken, in which # case this magically restores it to working conditions. In the latter -- 2.30.2