Merge "pylint: say what you're missing."
diff --git a/pre-upload.py b/pre-upload.py
index 80473c1..fffc03c 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -394,8 +394,8 @@
         opts.dir = os.path.dirname(os.path.abspath(git_dir))
     elif not os.path.isdir(opts.dir):
         parser.error('Invalid dir: %s' % opts.dir)
-    elif not os.path.isdir(os.path.join(opts.dir, '.git')):
-        parser.error('Not a git directory: %s' % opts.dir)
+    elif not rh.git.is_git_repository(opts.dir):
+        parser.error('Not a git repository: %s' % opts.dir)
 
     # Identify the project if it wasn't specified; this _requires_ the repo
     # tool to be installed and for the project to be part of a repo checkout.
diff --git a/rh/git.py b/rh/git.py
index 5ce6c31..196fc69 100644
--- a/rh/git.py
+++ b/rh/git.py
@@ -197,3 +197,10 @@
             raise ValueError('Could not locate .repo in %s' % orig_path)
 
     return path
+
+
+def is_git_repository(path):
+    """Returns True if the path is a valid git repository."""
+    cmd = ['git', 'rev-parse', '--resolve-git-dir', os.path.join(path, '.git')]
+    result = rh.utils.run_command(cmd, quiet=True, error_code_ok=True)
+    return result.returncode == 0