<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/builtin/worktree.c, branch v2.26.1</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.26.1</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.26.1'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2020-02-24T21:05:07Z</updated>
<entry>
<title>worktree: don't allow "add" validation to be fooled by suffix matching</title>
<updated>2020-02-24T21:05:07Z</updated>
<author>
<name>Eric Sunshine</name>
<email>sunshine@sunshineco.com</email>
</author>
<published>2020-02-24T09:08:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=bb69b3b009c0093417942dba136b81fbf614c4ed'/>
<id>urn:sha1:bb69b3b009c0093417942dba136b81fbf614c4ed</id>
<content type='text'>
"git worktree add &lt;path&gt;" performs various checks before approving
&lt;path&gt; as a valid location for the new worktree. Aside from ensuring
that &lt;path&gt; does not already exist, one of the questions it asks is
whether &lt;path&gt; is already a registered worktree. To perform this check,
it queries find_worktree() and disallows the "add" operation if
find_worktree() finds a match for &lt;path&gt;. As a convenience, however,
find_worktree() casts an overly wide net to allow users to identify
worktrees by shorthand in order to keep typing to a minimum. For
instance, it performs suffix matching which, given subtrees "foo/bar"
and "foo/baz", can correctly select the latter when asked only for
"baz".

"add" validation knows the exact path it is interrogating, so this sort
of heuristic-based matching is, at best, questionable for this use-case
and, at worst, may may accidentally interpret &lt;path&gt; as matching an
existing worktree and incorrectly report it as already registered even
when it isn't. (In fact, validate_worktree_add() already contains a
special case to avoid accidentally matching against the main worktree,
precisely due to this problem.)

Avoid the problem of potential accidental matching against an existing
worktree by instead taking advantage of find_worktree_by_path() which
matches paths deterministically, without applying any sort of magic
shorthand matching performed by find_worktree().

Reported-by: Cameron Gunnin &lt;cameron.gunnin@synopsys.com&gt;
Signed-off-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'pb/no-recursive-reset-hard-in-worktree-add'</title>
<updated>2019-12-01T17:04:31Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-12-01T17:04:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=05fc6471e3668f17b665ec686d5629e92df917fa'/>
<id>urn:sha1:05fc6471e3668f17b665ec686d5629e92df917fa</id>
<content type='text'>
"git worktree add" internally calls "reset --hard" that should not
descend into submodules, even when submodule.recurse configuration
is set, but it was affected.  This has been corrected.

* pb/no-recursive-reset-hard-in-worktree-add:
  worktree: teach "add" to ignore submodule.recurse config
</content>
</entry>
<entry>
<title>worktree: teach "add" to ignore submodule.recurse config</title>
<updated>2019-10-30T00:57:15Z</updated>
<author>
<name>Philippe Blain</name>
<email>levraiphilippeblain@gmail.com</email>
</author>
<published>2019-10-27T17:16:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4782cf2ab686bacca8d2908319981ac27d54ca25'/>
<id>urn:sha1:4782cf2ab686bacca8d2908319981ac27d54ca25</id>
<content type='text'>
"worktree add" internally calls "reset --hard", but if
submodule.recurse is set, reset tries to recurse into
initialized submodules, which makes start_command try to
cd into non-existing submodule paths and die.

Fix that by making sure that the call to reset in "worktree add"
does not recurse.

Signed-off-by: Philippe Blain &lt;levraiphilippeblain@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/dedup-includes'</title>
<updated>2019-10-11T05:24:48Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-10-11T05:24:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a4c5d9f66eaab94c874cd59584c0ede44b6e80bc'/>
<id>urn:sha1:a4c5d9f66eaab94c874cd59584c0ede44b6e80bc</id>
<content type='text'>
Code cleanup.

* rs/dedup-includes:
  treewide: remove duplicate #include directives
</content>
</entry>
<entry>
<title>Merge branch 'bc/object-id-part17'</title>
<updated>2019-10-11T05:24:46Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-10-11T05:24:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=676278f8ea1b9bdd8f235eceb739d7aec4f0ed67'/>
<id>urn:sha1:676278f8ea1b9bdd8f235eceb739d7aec4f0ed67</id>
<content type='text'>
Preparation for SHA-256 upgrade continues.

* bc/object-id-part17: (26 commits)
  midx: switch to using the_hash_algo
  builtin/show-index: replace sha1_to_hex
  rerere: replace sha1_to_hex
  builtin/receive-pack: replace sha1_to_hex
  builtin/index-pack: replace sha1_to_hex
  packfile: replace sha1_to_hex
  wt-status: convert struct wt_status to object_id
  cache: remove null_sha1
  builtin/worktree: switch null_sha1 to null_oid
  builtin/repack: write object IDs of the proper length
  pack-write: use hash_to_hex when writing checksums
  sequencer: convert to use the_hash_algo
  bisect: switch to using the_hash_algo
  sha1-lookup: switch hard-coded constants to the_hash_algo
  config: use the_hash_algo in abbrev comparison
  combine-diff: replace GIT_SHA1_HEXSZ with the_hash_algo
  bundle: switch to use the_hash_algo
  connected: switch GIT_SHA1_HEXSZ to the_hash_algo
  show-index: switch hard-coded constants to the_hash_algo
  blame: remove needless comparison with GIT_SHA1_HEXSZ
  ...
</content>
</entry>
<entry>
<title>treewide: remove duplicate #include directives</title>
<updated>2019-10-03T23:16:00Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2019-10-03T12:18:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2fe44394c8852f7b2625c3d63e9f5d5ad9e9baa9'/>
<id>urn:sha1:2fe44394c8852f7b2625c3d63e9f5d5ad9e9baa9</id>
<content type='text'>
Found with "git grep '^#include ' '*.c' | sort | uniq -d".

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>builtin/worktree: switch null_sha1 to null_oid</title>
<updated>2019-08-19T22:04:59Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2019-08-18T20:04:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f6ca67d673c66e5c3988a18c2ec56b7fef9a23b6'/>
<id>urn:sha1:f6ca67d673c66e5c3988a18c2ec56b7fef9a23b6</id>
<content type='text'>
Switch the remaining use of null_sha1 to null_oid.

Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>worktree remove: clarify error message on dirty worktree</title>
<updated>2019-08-13T20:10:09Z</updated>
<author>
<name>SZEDER Gábor</name>
<email>szeder.dev@gmail.com</email>
</author>
<published>2019-08-13T18:02:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=507e5470a0e8be7e2a50a5ffe1f690d06dc00056'/>
<id>urn:sha1:507e5470a0e8be7e2a50a5ffe1f690d06dc00056</id>
<content type='text'>
To avoid data loss, 'git worktree remove' refuses to delete a worktree
if it's dirty or contains untracked files.  However, the error message
only mentions that the worktree "is dirty", even if the worktree in
question is in fact clean, but contains untracked files:

  $ git worktree add test-worktree
  Preparing worktree (new branch 'test-worktree')
  HEAD is now at aa53e60 Initial
  $ &gt;test-worktree/untracked-file
  $ git worktree remove test-worktree/
  fatal: 'test-worktree/' is dirty, use --force to delete it
  $ git -C test-worktree/ diff
  $ git -C test-worktree/ diff --cached
  $ # Huh?  Where are those dirty files?!

Clarify this error message to say that the worktree "contains modified
or untracked files".

Signed-off-by: SZEDER Gábor &lt;szeder.dev@gmail.com&gt;
Reviewed-by: Eric Sunshine &lt;sunshine@sunshineco.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'nd/worktree-name-sanitization'</title>
<updated>2019-06-13T20:19:40Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-06-13T20:19:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0d107b19890db191c9281bff67180389fb53df24'/>
<id>urn:sha1:0d107b19890db191c9281bff67180389fb53df24</id>
<content type='text'>
In recent versions of Git, per-worktree refs are exposed in
refs/worktrees/&lt;wtname&gt;/ hierarchy, which means that worktree names
must be a valid refname component.  The code now sanitizes the names
given to worktrees, to make sure these refs are well-formed.

* nd/worktree-name-sanitization:
  worktree add: sanitize worktree names
</content>
</entry>
<entry>
<title>worktree add: sanitize worktree names</title>
<updated>2019-05-15T04:56:43Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2019-03-08T09:28:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1de16aecf51daf5794aa074f6dd133e088a12690'/>
<id>urn:sha1:1de16aecf51daf5794aa074f6dd133e088a12690</id>
<content type='text'>
Worktree names are based on $(basename $GIT_WORK_TREE). They aren't
significant until 3a3b9d8cde (refs: new ref types to make per-worktree
refs visible to all worktrees - 2018-10-21), where worktree name could
be part of a refname and must follow refname rules.

Update 'worktree add' code to remove special characters to follow
these rules. In the future the user will be able to specify the
worktree name by themselves if they're not happy with this dumb
character substitution.

Reported-by: Konstantin Kharlamov &lt;hi-angel@yandex.ru&gt;
Helped-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Nguyễn Thái Ngọc Duy &lt;pclouds@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
