[Buildroot] [PATCH 1/3] support/download/git: log checked out sha1

Ricardo Martincoski ricardo.martincoski at datacom.ind.br
Tue Nov 1 19:33:52 UTC 2016


In preparation to have automated tests for this script, display the
checked out sha1 in the build log.

Signed-off-by: Ricardo Martincoski <ricardo.martincoski at datacom.ind.br>
---
Another solution would be to use an environment variable set by the test
to print that info, e.g. if [ "1" == "${GIT_DOWNLOAD_AUTOTEST}" ]; then
---
 support/download/git | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/support/download/git b/support/download/git
index 7921411..7c44c65 100755
--- a/support/download/git
+++ b/support/download/git
@@ -85,6 +85,12 @@ if [ ${recurse} -eq 1 ]; then
     _git submodule update --init --recursive
 fi
 
+# Log the sha1. It can be used for automated tests and debug.
+if [ -z ${verbose} ]; then
+    sha1=$(_git rev-parse HEAD)
+    printf "Checked out '%s'.\n" "${sha1}"
+fi
+
 # We do not need the .git dir; we keep other .git files, in case they
 # are the only files in their directory.
 rm -rf .git
-- 
2.9.3



More information about the buildroot mailing list