From 5e50058a81fc5b65f2ac3186d42cb5e0a33ce7d8 Mon Sep 17 00:00:00 2001 From: litingt Date: Thu, 26 Jun 2014 21:05:33 -0700 Subject: [PATCH] add commit file judge --- xCAT-server/share/xcat/tools/xCATreg | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xCAT-server/share/xcat/tools/xCATreg b/xCAT-server/share/xcat/tools/xCATreg index 22bedc753..5d0f384db 100755 --- a/xCAT-server/share/xcat/tools/xCATreg +++ b/xCAT-server/share/xcat/tools/xCATreg @@ -697,16 +697,23 @@ sub git_update { $res = system("git log $lastcommit..master --pretty=format:\"%cn %ce %H %s %ad\" >$commitlog1"); if ($res != 0){ + print "Execute ..master failed\n"; $commitinfo="get commit information failed\n"; send_msg(0, "get commit information failed"); exit; }else{ - $commitinfo=`cat $commitlog1`; + print "get commit log $commitlog1\n"; + if (-f $commitlog1 and -z _) + { + $commitinfo="No code updates\n"; + }else{ + $commitinfo=`cat $commitlog1`; + } } } #get the lastest commit number and save it in the file for next usage - $res = system("git log -n 1|grep -i commit|awk '{print \$2}' >$lastcommitfile"); + $res = system("git log -n 1|awk 'NR==1'|awk '{print \$2}' >$lastcommitfile"); if ($res != 0){ send_msg(0, "get latest commit number failed"); exit;