From: crouzet Date: Mon, 5 Jul 2021 12:52:19 +0000 (+0200) Subject: evite de dater avec touch, si le git clone a échoué X-Git-Tag: V9_9_0~26^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?p=tools%2Fsat.git;a=commitdiff_plain;h=d10e050a2b8a2392db55366d74017ed36fbf9f15 evite de dater avec touch, si le git clone a échoué --- diff --git a/src/system.py b/src/system.py index b7cc6c2..c54452b 100644 --- a/src/system.py +++ b/src/system.py @@ -98,7 +98,9 @@ def git_extract(from_what, tag, git_options, where, logger, environment=None): cmd = r""" set -x git clone %(git_options)s %(remote)s %(where)s -touch -d "$(git --git-dir=%(where_git)s log -1 --format=date_format)" %(where)s +res=$? +if [ $res -eq 0 ]; then touch -d "$(git --git-dir=%(where_git)s log -1 --format=date_format)" %(where)s;fi +exit $res """ cmd = cmd % {'git_options': git_options, 'remote': from_what, 'tag': tag, 'where': str(where), 'where_git': where_git} else: @@ -115,7 +117,7 @@ git clone %(git_options)s %(remote)s %(where)s && \ git --git-dir=%(where_git)s --work-tree=%(where)s checkout %(tag)s res=$? git --git-dir=%(where_git)s status|grep HEAD -if [ $? -ne 0 ]; then touch -d "$(git --git-dir=%(where_git)s log -1 --format=date_format)" %(where)s;fi +if [ $res -eq 0 -a $? -ne 0 ]; then touch -d "$(git --git-dir=%(where_git)s log -1 --format=date_format)" %(where)s;fi exit $res """ cmd = cmd % {'git_options': git_options,