<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/builtin/clone.c, branch v2.6.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.6.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.6.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2015-08-19T21:48:56Z</updated>
<entry>
<title>Merge branch 'jk/git-path'</title>
<updated>2015-08-19T21:48:56Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-08-19T21:48:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8c9155e031869293b99531a25b585e49f74beaba'/>
<id>urn:sha1:8c9155e031869293b99531a25b585e49f74beaba</id>
<content type='text'>
git_path() and mkpath() are handy helper functions but it is easy
to misuse, as the callers need to be careful to keep the number of
active results below 4.  Their uses have been reduced.

* jk/git-path:
  memoize common git-path "constant" files
  get_repo_path: refactor path-allocation
  find_hook: keep our own static buffer
  refs.c: remove_empty_directories can take a strbuf
  refs.c: avoid git_path assignment in lock_ref_sha1_basic
  refs.c: avoid repeated git_path calls in rename_tmp_log
  refs.c: simplify strbufs in reflog setup and writing
  path.c: drop git_path_submodule
  refs.c: remove extra git_path calls from read_loose_refs
  remote.c: drop extraneous local variable from migrate_file
  prefer mkpathdup to mkpath in assignments
  prefer git_pathdup to git_path in some possibly-dangerous cases
  add_to_alternates_file: don't add duplicate entries
  t5700: modernize style
  cache.h: complete set of git_path_submodule helpers
  cache.h: clarify documentation for git_path, et al
</content>
</entry>
<entry>
<title>Merge branch 'ps/guess-repo-name-at-root'</title>
<updated>2015-08-19T21:48:54Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-08-19T21:48:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4bfab58ce2d47cef9236571cb1451bf3b62241c1'/>
<id>urn:sha1:4bfab58ce2d47cef9236571cb1451bf3b62241c1</id>
<content type='text'>
"git clone $URL", when cloning from a site whose sole purpose is to
host a single repository (hence, no path after &lt;scheme&gt;://&lt;site&gt;/),
tried to use the site name as the new repository name, but did not
remove username or password when &lt;site&gt; part was of the form
&lt;user&gt;@&lt;pass&gt;:&lt;host&gt;.  The code is taught to redact these.

* ps/guess-repo-name-at-root:
  clone: abort if no dir name could be guessed
  clone: do not use port number as dir name
  clone: do not include authentication data in guessed dir
</content>
</entry>
<entry>
<title>Merge branch 'jk/guess-repo-name-regression-fix'</title>
<updated>2015-08-19T21:48:54Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-08-19T21:48:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8259da5ea3d993aa8b783a5039f5a78d86312c65'/>
<id>urn:sha1:8259da5ea3d993aa8b783a5039f5a78d86312c65</id>
<content type='text'>
"git clone $URL" in recent releases of Git contains a regression in
the code that invents a new repository name incorrectly based on
the $URL.  This has been corrected.

* jk/guess-repo-name-regression-fix:
  clone: use computed length in guess_dir_name
  clone: add tests for output directory
</content>
</entry>
<entry>
<title>get_repo_path: refactor path-allocation</title>
<updated>2015-08-10T22:37:14Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-08-10T09:37:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0ea68e429647cc5400fe8fa257056083b0a6459d'/>
<id>urn:sha1:0ea68e429647cc5400fe8fa257056083b0a6459d</id>
<content type='text'>
The get_repo_path function calls mkpath() and then does some
non-trivial operations on it, like calling
is_git_directory() and read_gitfile(). These are actually
OK (they do not use more pathname static buffers
themselves), but it takes a fair bit of work to verify.

Let's use our own strbuf to store the path, and we can
simply reuse it for each iteration of the loop (we can even
avoid rewriting the beginning part, since we are trying a
series of suffixes).

To make the strbuf cleanup easier, we split out a thin
wrapper. As a bonus, this wrapper can factor out the
canonicalization that happens in all of the early-return
code paths.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>clone: abort if no dir name could be guessed</title>
<updated>2015-08-10T18:02:11Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2015-08-10T15:48:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=adef9561f0c8cf2c974d78adac0ae236e159e49f'/>
<id>urn:sha1:adef9561f0c8cf2c974d78adac0ae236e159e49f</id>
<content type='text'>
Due to various components of the URI being stripped off it may
happen that we fail to guess a directory name. We currently error
out with a message that it is impossible to create the working
tree '' in such cases. Instead, error out early with a sensible
error message hinting that a directory name should be specified
manually on the command line.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>clone: do not use port number as dir name</title>
<updated>2015-08-10T18:02:07Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2015-08-10T15:48:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=92722efec01f67a54b68c83fcbc3cd65f9fbb7b8'/>
<id>urn:sha1:92722efec01f67a54b68c83fcbc3cd65f9fbb7b8</id>
<content type='text'>
If the URI contains a port number and the URI's path component is
empty we fail to guess a sensible directory name. E.g. cloning a
repository 'ssh://example.com:2222/' we guess a directory name
'2222' where we would want the hostname only, e.g. 'example.com'.

We need to take care to not drop trailing port-like numbers in
certain cases. E.g. when cloning a repository 'foo/bar:2222.git'
we want to guess the directory name '2222' instead of 'bar'.
Thus, we have to first check the stripped URI for path separators
and only strip port numbers if there are path separators present.
This heuristic breaks when cloning a repository 'bar:2222.git',
though.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>clone: do not include authentication data in guessed dir</title>
<updated>2015-08-10T18:01:08Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2015-08-10T15:48:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e895986727dfc4105c497132540dafa8ed51ec0a'/>
<id>urn:sha1:e895986727dfc4105c497132540dafa8ed51ec0a</id>
<content type='text'>
If the URI contains authentication data and the URI's path
component is empty, we fail to guess a sensible directory name.
E.g. cloning a repository 'ssh://user:password@example.com/' we
guess a directory name 'password@example.com' where we would want
the hostname only, e.g. 'example.com'.

The naive way of just adding '@' as a path separator would break
cloning repositories like 'foo/bar@baz.git' (which would
currently become 'bar@baz' but would then become 'baz' only).
Instead fix this by first dropping the scheme and then greedily
scanning for an '@' sign until we find the first path separator.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>clone: use computed length in guess_dir_name</title>
<updated>2015-08-10T18:01:05Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-08-10T15:48:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=db2e220447f7b02278d64417c8f05f73710f5b8b'/>
<id>urn:sha1:db2e220447f7b02278d64417c8f05f73710f5b8b</id>
<content type='text'>
Commit 7e837c6 (clone: simplify string handling in
guess_dir_name(), 2015-07-09) changed clone to use
strip_suffix instead of hand-rolled pointer manipulation.
However, strip_suffix will strip from the end of a
NUL-terminated string, and we may have already stripped some
characters (like directory separators, or "/.git"). This
leads to commands like:

  git clone host:foo.git/

failing to strip the ".git".

We must instead convert our pointer arithmetic into a
computed length and feed that to strip_suffix_mem, which will
then reduce the length further for us.

It would be nicer if we could drop the pointer manipulation
entirely, and just continually strip using strip_suffix. But
that doesn't quite work for two reasons:

  1. The early suffixes we're stripping are not constant; we
     need to look for is_dir_sep, which could be one of
     several characters.

  2. Mid-way through the stripping we compute the pointer
     "start", which shows us the beginning of the pathname.
     Which really give us two lengths to work with: the
     offset from the start of the string, and from the start
     of the path. By using pointers for the early part, we
     can just compute the length from "start" when we need
     it.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Acked-by: Sebastian Schuberth &lt;sschuberth@gmail.com&gt;
Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'mh/init-delete-refs-api'</title>
<updated>2015-08-03T18:01:17Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-08-03T18:01:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=be9cb560e31c76c00760dadb151b5e3059970586'/>
<id>urn:sha1:be9cb560e31c76c00760dadb151b5e3059970586</id>
<content type='text'>
Clean up refs API and make "git clone" less intimate with the
implementation detail.

* mh/init-delete-refs-api:
  delete_ref(): use the usual convention for old_sha1
  cmd_update_ref(): make logic more straightforward
  update_ref(): don't read old reference value before delete
  check_branch_commit(): make first parameter const
  refs.h: add some parameter names to function declarations
  refs: move the remaining ref module declarations to refs.h
  initial_ref_transaction_commit(): check for ref D/F conflicts
  initial_ref_transaction_commit(): check for duplicate refs
  refs: remove some functions from the module's public interface
  initial_ref_transaction_commit(): function for initial ref creation
  repack_without_refs(): make function private
  prune_refs(): use delete_refs()
  prune_remote(): use delete_refs()
  delete_refs(): bail early if the packed-refs file cannot be rewritten
  delete_refs(): make error message more generic
  delete_refs(): new function for the refs API
  delete_ref(): handle special case more explicitly
  remove_branches(): remove temporary
  delete_ref(): move declaration to refs.h
</content>
</entry>
<entry>
<title>Merge branch 'ss/clone-guess-dir-name-simplify'</title>
<updated>2015-07-13T21:00:28Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-07-13T21:00:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=721f5bb8968ed6a6ec126fe28f679c17a6998e87'/>
<id>urn:sha1:721f5bb8968ed6a6ec126fe28f679c17a6998e87</id>
<content type='text'>
Code simplification.

* ss/clone-guess-dir-name-simplify:
  clone: simplify string handling in guess_dir_name()
</content>
</entry>
</feed>
