title: How to shallow clone a local git repository with a relative path?
body: <p>Shallow clones of local directories require <code>file://</code> as explained at: <a href="https://stackoverflow.com/questions/40383230/git-clone-warning-depth-is-ignored-in-local-clones-use-file-instead">git clone: warning: --depth is ignored in local clones; use file:// instead</a></p>
  
  <p>But how to use relative paths with that?</p>
  
  <p>E.g.: if I have a repo <code>myrepo</code> in the current directory, and then I do:</p>
  
  <pre><code>git clone --depth 1 file://mymodule mymodule2
  </code></pre>
  
  <p>then it fails with:</p>
  
  <pre><code>Cloning into 'mymodule2'...
  fatal: No path specified. See 'man git-pull' for valid url syntax
  </code></pre>
  
  <p>And if I try:</p>
  
  <pre><code>git clone --depth 1 file://./mymodule mymodule2
  </code></pre>
  
  <p>It fails with:</p>
  
  <pre><code>Cloning into 'mymodule2'...
  fatal: '/./mymodule' does not appear to be a git repository
  fatal: Could not read from remote repository.
  
  Please make sure you have the correct access rights
  and the repository exists.
  </code></pre>
  
  <p>The only workaround I could find was to convert it to an absolute path starting with <code>/</code>:</p>
  
  <pre><code>git clone --depth 1 "file://$(pwd)/mymodule" mymodule2
  </code></pre>
  
  <p>Is there a profound reason for this behavior, or it just buggy?</p>
  
  <p>Maybe file URIs simply don't support relative paths: </p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/7857416/file-uri-scheme-and-relative-files">File Uri Scheme and Relative Files</a></li>
  <li><a href="https://superuser.com/questions/210263/file-to-point-a-relative-file-to-current-directory">https://superuser.com/questions/210263/file-to-point-a-relative-file-to-current-directory</a></li>
  </ul>
  
  <p>git 2.14.1.</p>