Does -local really do anything when used with git clone [path]?

According to the output, the git help clone

parameter --local

performs the following actions:

   --local, -l
       When the repository to clone from is on a local machine, this flag bypasses the normal "Git
       aware" transport mechanism and clones the repository by making a copy of HEAD and everything
       under objects and refs directories. The files under .git/objects/ directory are hardlinked to
       save space when possible.

       If the repository is specified as a local path (e.g., /path/to/repo), this is the default, and
       --local is essentially a no-op. If the repository is specified as a URL, then this flag is
       ignored (and we never use the local optimizations). Specifying --no-local will override the
       default when /path/to/repo is given, using the regular Git transport instead.

      

If I am reading this correctly, the second paragraph says that this setting will be enabled by default when a local path is given, and will be ignored whenever the given path is not local. So what's the point? How can this ever have any effect? Is this basically a missing stub for compatibility with older versions of git when it did something?

+3


source to share


1 answer


This is an overlooked technical detail - how options are implemented --no-X

. Instead of defining, only --no-local

an option exists --local

that is noop but has a version --no-*

. The same (although not mentioned in the help) you can run git clone --checkout ...

, but it won't have any effect, because the clone checks by default.



PS: it wasn't the default a while ago , so using it made sense.

+4


source







All Articles