sys_id: added catch to git status check

made error checking more general
main
sarpadi 2019-09-23 15:43:17 +03:00 committed by sarpadi
parent 447434ace0
commit 442b38033a
1 changed files with 5 additions and 7 deletions

View File

@ -856,22 +856,20 @@ proc hexstr_flip {str} {
proc sysid_gen_sys_init_file {custom_string} { proc sysid_gen_sys_init_file {custom_string} {
# git sha # git sha
set no_git_err "fatal: not a git repository" if {[catch {exec git rev-parse HEAD} gitsha_string] != 0} {
if {[catch {exec git rev-parse HEAD} gitsha_string]} {
if [expr [string match *$no_git_err* $gitsha_string] == 1] {
set gitsha_string 0 set gitsha_string 0
} }
}
set gitsha_hex [hexstr_flip [stringtohex $gitsha_string 44]] set gitsha_hex [hexstr_flip [stringtohex $gitsha_string 44]]
#git clean #git clean
set git_clean_string "f" set git_clean_string "f"
if {$gitsha_string != 0} { if {$gitsha_string != 0} {
set git_status [exec git status .] if {[catch {exec git status .} gitstat_string] == 0} {
if [expr [string match *modified* $git_status] == 0] { if [expr [string match *modified $gitstat_string] == 0] {
set git_clean_string "t" set git_clean_string "t"
} }
} }
}
set git_clean_hex [hexstr_flip [stringtohex $git_clean_string 4]] set git_clean_hex [hexstr_flip [stringtohex $git_clean_string 4]]
# vadj check # vadj check