mirror of
https://github.com/flatcar/scripts.git
synced 2025-12-07 18:31:54 +01:00
cros_sdk: unify duplicate git calls for user commit info
No need to call `git var | sed` multiple times when we can call it once and then use bash string parsing routines to extract the relevant info. BUG=None TEST=delete .gitconfig in chroot; enter chroot; verify .gitconfig is up-to-date Change-Id: I900e4241a5c53bc46c90eb0f2a01152f4bfba577 Reviewed-on: http://gerrit.chromium.org/gerrit/8027 Commit-Ready: Mike Frysinger <vapier@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
parent
af7d5d11a5
commit
94717e3099
@ -302,13 +302,16 @@ function setup_env {
|
||||
ensure_mounted "${HOME}/.subversion" "--bind" "${TARGET}"
|
||||
fi
|
||||
|
||||
# Configure committer username and email in chroot .gitconfig
|
||||
# Configure committer username and email in chroot .gitconfig. Change
|
||||
# to the root directory first so that random $PWD/.git/config settings
|
||||
# do not get picked up. We want to stick to ~/.gitconfig only.
|
||||
ident=$(cd /; git var GIT_COMMITTER_IDENT || :)
|
||||
ident_name=${ident%% <*}
|
||||
ident_email=${ident%%>*}; ident_email=${ident_email##*<}
|
||||
git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \
|
||||
user.name "$(cd /tmp; git var GIT_COMMITTER_IDENT | \
|
||||
sed -e 's/ *<.*//')" || true
|
||||
user.name "${ident_name}" || true
|
||||
git config -f ${FLAGS_chroot}/home/${USER}/.gitconfig --replace-all \
|
||||
user.email "$(cd /tmp; git var GIT_COMMITTER_IDENT | \
|
||||
sed -e 's/.*<\([^>]*\)>.*/\1/')" || true
|
||||
user.email "${ident_email}" || true
|
||||
|
||||
# Copy ~/.gdata_cred.txt to chroot if it exists. This file contains
|
||||
# credentials for reading/writing Google Docs on chromium.org.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user