diff --git a/python/git-init/git-init.py b/python/git-init/git-init.py index d73b4ac6..b4ab27ab 100755 --- a/python/git-init/git-init.py +++ b/python/git-init/git-init.py @@ -61,6 +61,12 @@ def getHostname(repository): parser.add_argument("checkout", help="The branch/commit id/tag to checkout", type=str) args = parser.parse_args() +# Check if directory is empty, don't clone if it isn't +if os.path.isdir(args.directory): + if len(os.listdir(args.directory)) > 0: + sys.stdout.write("Clone directory is not empty. Continue without cloning." + NL) + exit(0) + # Set up git credential helper code = runProcess(["git", "config", "--global", "credential.helper", "store"]) if code != 0: