From 72cdd8be10702ee852a1747f47875ed3ff71c2c7 Mon Sep 17 00:00:00 2001 From: hyokeun Date: Wed, 16 Aug 2017 19:50:41 +0900 Subject: [PATCH] Set proper git user while SR tagging from dashboard Change-Id: I57ca19a2210a04295051d3cbd872b1fbb3fb0047 --- job_add_git_tag.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/job_add_git_tag.py b/job_add_git_tag.py index 03a9e24..8a0e5f5 100644 --- a/job_add_git_tag.py +++ b/job_add_git_tag.py @@ -91,15 +91,6 @@ def main(): return 1 orig_git_user_email = out.strip() - # masquerade user name/ email - gitcmd = "git config user.name \"%s\"" % (event['tagger_username']) - if runner.show(gitcmd)[0] != 0: - raise Exception("failed to execute %s" % gitcmd) - - gitcmd = "git config user.email \"%s\"" % (event['tagger_useremail']) - if runner.show(gitcmd)[0] != 0: - raise Exception("failed to execute %s" % gitcmd) - os.environ["GIT_AUTHOR_EMAIL"] = event['tagger_useremail'] os.environ["GIT_AUTHOR_NAME"] = event['tagger_username'] @@ -123,6 +114,17 @@ def main(): mygit = Git(prjdir) + cur_dir = os.getcwd() + os.chdir(prjdir) + # masquerade user name/ email + gitcmd = "git config user.name \"%s\"" % (event['tagger_username']) + if runner.show(gitcmd)[0] != 0: + raise Exception("failed to execute %s" % gitcmd) + gitcmd = "git config user.email \"%s\"" % (event['tagger_useremail']) + if runner.show(gitcmd)[0] != 0: + raise Exception("failed to execute %s" % gitcmd) + os.chdir(cur_dir) + branches = mygit.branch_contains(commit) if event['branch'] not in branches: raise LocalError("commit %s is not in branch %s" % (commit, event['branch'])) -- 2.7.4