File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,8 @@ def die_if_not_valid_git_repo():
8282
8383def _default_email ():
8484 try :
85- return subprocess .check_output (["git" , "config" , "kaclone.email" ])
85+ kac_email = subprocess .check_output (["git" , "config" , "kaclone.email" ])
86+ return kac_email .rstrip ()
8687 except subprocess .CalledProcessError :
8788 return os .environ ['USER' ] + "@" + DEFAULT_EMAIL_DOMAIN
8889
@@ -209,7 +210,7 @@ def _chomp(s, sep):
209210def _cli_process_current_dir (cli_args ):
210211 die_if_not_valid_git_repo ()
211212 if not cli_args .no_email :
212- set_email ()
213+ set_email (args . email )
213214 if not cli_args .no_lint :
214215 install_commit_linter ()
215216 if not cli_args .no_msg :
@@ -232,6 +233,10 @@ if __name__ == '__main__':
232233 # TODO(mroth): allow --repair to take an optional target
233234 _cli_process_current_dir (args )
234235 else :
236+ if not args .src :
237+ parser .print_help ()
238+ sys .exit (0 )
239+
235240 _dst = _clone_repo (args .src , args .dst , args .quiet )
236241 logging .info (
237242 "Configuring your cloned git repository with KA defaults..."
Original file line number Diff line number Diff line change @@ -47,3 +47,16 @@ design decision, so those config files can continue to be updated as they have
4747in the past, and existing global configurations will work-- hence better reverse
4848compatibility. Also, the user can find them to manually modify somewhere they
4949might expect if they are old-school. )
50+
51+
52+ Regression test: providing -- email at command line should always have
53+ precedence over any default email guesses:
54+
55+ $ ka-clone $ REPO repowithcustomemail -- email= me@ you . com -- no-lint -- no-gitconfig -- no-msg
56+ Cloning into ' repowithcustomemail' ...
57+ .* (re )
58+ done .
59+ Configuring your cloned git repository with KA defaults...
60+ -> Set user. email to me@ you . com
61+ $ cd repowithcustomemail && git config -- local user. email
62+ me@ you . com
You can’t perform that action at this time.
0 commit comments