diff mbox

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

Message ID 20161101193354.8716-1-ricardo.martincoski@datacom.ind.br
State Changes Requested
Headers show

Commit Message

Ricardo Martincoski Nov. 1, 2016, 7:33 p.m. UTC
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@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(+)

Comments

Arnout Vandecappelle Nov. 5, 2016, 9:50 p.m. UTC | #1
On 01-11-16 20:33, Ricardo Martincoski wrote:
> 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@datacom.ind.br>

Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tested-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

> ---
> 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

 It's quite weird to check that verbose is empty, but that's how the variable is
defined... Perhaps s/verbose/quiet/ would be a good idea...

 Regards,
 Arnout


> +    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
>
Ricardo Martincoski Nov. 6, 2016, 11:17 p.m. UTC | #2
Arnout,

Thank you for reviewing this series.

On Sat, Nov 05, 2016 at 07:50 PM, Arnout Vandecappelle wrote:

[snip]
>> +if [ -z ${verbose} ]; then
> 
>  It's quite weird to check that verbose is empty, but that's how the variable is
> defined... Perhaps s/verbose/quiet/ would be a good idea...

OK, makes sense. I can send a followup patch.

Regards,
Ricardo
diff mbox

Patch

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