From 442b38033a08ec607a5e8605be872ca45f5ee29f Mon Sep 17 00:00:00 2001 From: sarpadi Date: Mon, 23 Sep 2019 15:43:17 +0300 Subject: [PATCH] sys_id: added catch to git status check made error checking more general --- projects/scripts/adi_board.tcl | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/projects/scripts/adi_board.tcl b/projects/scripts/adi_board.tcl index f8f151156..60f76308b 100644 --- a/projects/scripts/adi_board.tcl +++ b/projects/scripts/adi_board.tcl @@ -856,21 +856,19 @@ proc hexstr_flip {str} { proc sysid_gen_sys_init_file {custom_string} { # git sha - set no_git_err "fatal: not a git repository" - if {[catch {exec git rev-parse HEAD} gitsha_string]} { - if [expr [string match *$no_git_err* $gitsha_string] == 1] { - set gitsha_string 0 - } + if {[catch {exec git rev-parse HEAD} gitsha_string] != 0} { + set gitsha_string 0 } set gitsha_hex [hexstr_flip [stringtohex $gitsha_string 44]] #git clean set git_clean_string "f" if {$gitsha_string != 0} { - set git_status [exec git status .] - if [expr [string match *modified* $git_status] == 0] { + if {[catch {exec git status .} gitstat_string] == 0} { + if [expr [string match *modified $gitstat_string] == 0] { set git_clean_string "t" } + } } set git_clean_hex [hexstr_flip [stringtohex $git_clean_string 4]]