diff options
author | Leandro Lucarella <leandro.lucarella@sociomantic.com> | 2014-07-24 18:27:24 +0200 |
---|---|---|
committer | Mihails Strasuns <mihails.strasuns@sociomantic.com> | 2014-09-25 22:42:13 +0200 |
commit | 53bb36e69ebabd42e097928000ca78028467ccc5 (patch) | |
tree | f20acdc3995d7b775cb2803a523f086ee5b46092 | |
parent | 7aac4b2d76c4c2524a606aa7781d8351eeb44ec8 (diff) |
setup: Warn the user if not in a git repo
When --global or --system is not used, the `setup` command should be ran
from a git repository, so the options can be stored in that particular
project's config. This commit improves the error message provided to the
user when this is not the case.
Fixes #100.
-rwxr-xr-x | git-hub | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -678,6 +678,15 @@ class SetupCmd (object): scopes=['user', 'repo']) set_config = lambda k, v: git_config(k, value=v, opts=args.opts) + + try: + if '--system' not in args.opts and \ + '--global' not in args.opts: + git('rev-parse --git-dir') + except GitError as error: + errf(error.output) + die("Maybe you want to use --global or --system?") + set_config('username', username) set_config('oauthtoken', auth['token']) if args.baseurl is not None: |