77448b40c1fe draft — Jelmer Vernooij 3 years ago
Revert "Make local path argument to clone.py optional."

This reverts commit 8ba850c0690d4a9fbf0479f52653a59a499df85f.
1 files changed, 8 insertions(+), 24 deletions(-)

M examples/clone.py
M examples/clone.py +8 -24
@@ 1,34 1,18 @@ 
-"""Clone.
-
-This trivial script demonstrates how to clone or lock a remote repository.
-
-Example usage:
-  1. python examples/clone.py git://github.com/jelmer/dulwich
-  2. python examples/clone.py git://github.com/jelmer/dulwich.git dulwich
-"""
-
+#!/usr/bin/python
+# This trivial script demonstrates how to clone a remote repository.
+#
+# Example usage:
+#  python examples/clone.py git://github.com/jelmer/dulwich dulwich-clone
 
 import sys
-
-from os.path import basename
-
 from getopt import getopt
-
 from dulwich import porcelain
 
-
-_, args = getopt(sys.argv, "", [])
-
+opts, args = getopt(sys.argv, "", [])
+opts = dict(opts)
 
 if len(args) < 2:
     print("usage: %s host:path path" % (args[0], ))
     sys.exit(1)
 
-elif len(args) < 3:
-    target_path = basename(args[1].split(":")[-1])
-    if target_path[-4:] == ".git":
-        target_path = target_path[:-4]
-else:
-    target_path = args[2]
-
-porcelain.clone(args[1], target_path)
+porcelain.clone(args[1], args[2])