Permalink
Browse files

allow for an empty configuration file

add a mechanism to comment out config lines

Signed-off-by: Christopher Hall <hsw@openmoko.com>
  • Loading branch information...
1 parent fd9d269 commit 2cb2dfe522d80b57d607553fbaa09a26e224f420 @hxw committed Nov 6, 2012
Showing with 23 additions and 8 deletions.
  1. +7 −7 gitconfig
  2. +16 −1 install.sh
View
@@ -1,8 +1,8 @@
# .gitconfig
[user]
- email = @EMAIL@
- name = @NAME@
+@HAVE_EMAIL@ email = @EMAIL@
+@HAVE_NAME@ name = @NAME@
[alias]
ci = commit --signoff
@@ -32,7 +32,7 @@
lola = log --graph --pretty=format:'%C(bold red)%h%Creset -%C(bold yellow)%d%Creset %s %C(bold green)(%cr) %C(bold ul blue)%an%Creset' --abbrev-commit --date=relative --all
l10 = !git --no-pager log --graph --pretty=format:'%C(bold red)%h%Creset -%C(bold yellow)%d%Creset %s %C(bold green)(%cr) %C(bold ul blue)%an%Creset' --abbrev-commit --date=relative -10 && echo
- ll = !git --no-pager log --graph --pretty=format:'%C(bold red)%h%Creset -%C(bold yellow)%d%Creset %s %C(bold green)(%cr) %C(bold ul blue)%an%Creset' --abbrev-commit --date=relative --all --max-count=$(tput lines) | head -n $(expr $(tput lines) - 5)
+ ll = !git --no-pager log --graph --pretty=format:'%C(bold red)%h%Creset -%C(bold yellow)%d%Creset %s %C(bold green)(%cr) %C(bold ul blue)%an%Creset' --abbrev-commit --date=relative --all --max-count=$(tput lines) | head -n $(expr $(tput lines) - 5) && echo
# git-svn commands
# ================
@@ -92,7 +92,7 @@
fp = format-patch -C
# sm = send-email --compose --no-chain-reply-to --suppress-from --to list@project.tld 00*.patch
- sm = send-email --compose --no-chain-reply-to --suppress-from --bcc @EMAIL@
+@HAVE_EMAIL@ sm = send-email --compose --no-chain-reply-to --suppress-from --bcc @EMAIL@
[sendemail]
@@ -101,7 +101,7 @@
# aliasfiletype
# to = devel@lists.openmoko.org
# cccmd
- bcc = @EMAIL@
+@HAVE_EMAIL@ bcc = @EMAIL@
chainreplyto = false
# smtpserver = <smtp>
# smtpuser = <user>
@@ -167,6 +167,6 @@
color = auto
[core]
- excludesfile = @HOME@.git-global-ignore
- attributesfile = @HOME@.git-global-attributes
+@HAVE_HOME@ excludesfile = @HOME@.git-global-ignore
+@HAVE_HOME@ attributesfile = @HOME@.git-global-attributes
# autocrlf = input
View
@@ -141,12 +141,27 @@ then
echo 'name='"'"${name}"'" >> "${config}"
fi
+# set to an '#' if do not have the item
+# to allow commenting out lines in scripts
+have_home=
+have_name=
+have_email=
+[ -z "${prefix}" ] && have_home='#'
+[ -z "${name}" ] && have_name='#' && name='Full Name'
+[ -z "${email}" ] && have_email='#' && email='root@localhost'
+
# use sed to substitute som @VAR@ by values saved in ${config}
for f in ${list_sed}
do
d="${prefix}/.${f}"
echo Substitute ${f} to ${d}
- sed "s,@HOME@,${prefix}/,g;s/@EMAIL@/${email}/g;s/@NAME@/${name}/g;" "${src}/${f}" > "${d}"
+ sed "s,@HOME@,${prefix}/,g;
+ s,@HAVE_HOME@,${have_home},g;
+ s/@EMAIL@/${email}/g;
+ s/@HAVE_EMAIL@/${have_email}/g;
+ s/@NAME@/${name}/g;
+ s/@HAVE_NAME@/${have_name}/g;
+ " "${src}/${f}" > "${d}"
done
# file that are just copied

0 comments on commit 2cb2dfe

Please sign in to comment.