<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/worktree.c, branch v2.12.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.12.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.12.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2017-03-08T22:38:41Z</updated>
<entry>
<title>real_pathdup(): fix callsites that wanted it to die on error</title>
<updated>2017-03-08T22:38:41Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2017-03-08T15:43:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ce83eadd9a2c63db6263df91933da1b1b865d26a'/>
<id>urn:sha1:ce83eadd9a2c63db6263df91933da1b1b865d26a</id>
<content type='text'>
In 4ac9006f832 (real_path: have callers use real_pathdup and
strbuf_realpath, 2016-12-12), we changed the xstrdup(real_path())
pattern to use real_pathdup() directly.

The problem with this change is that real_path() calls
strbuf_realpath() with die_on_error = 1 while real_pathdup() calls
it with die_on_error = 0. Meaning that in cases where real_path()
causes Git to die() with an error message, real_pathdup() is silent
and returns NULL instead.

The callers, however, are ill-prepared for that change, as they expect
the return value to be non-NULL (and otherwise the function died
with an appropriate error message).

Fix this by extending real_pathdup()'s signature to accept the
die_on_error flag and simply pass it through to strbuf_realpath(),
and then adjust all callers after a careful audit whether they would
handle NULLs well.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/absolute-pathdup'</title>
<updated>2017-02-02T21:36:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-02-02T21:36:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6f1c08bdb75b37ad30103f0f12339780fdc004e2'/>
<id>urn:sha1:6f1c08bdb75b37ad30103f0f12339780fdc004e2</id>
<content type='text'>
Code cleanup.

* rs/absolute-pathdup:
  use absolute_pathdup()
  abspath: add absolute_pathdup()
</content>
</entry>
<entry>
<title>use absolute_pathdup()</title>
<updated>2017-01-27T18:18:15Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2017-01-26T17:54:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0aaad415bcbdd7ccdfbb27eafb2f5926540455fa'/>
<id>urn:sha1:0aaad415bcbdd7ccdfbb27eafb2f5926540455fa</id>
<content type='text'>
Apply the semantic patch for converting callers that duplicate the
result of absolute_path() to call absolute_pathdup() instead, which
avoids an extra string copy to a static buffer.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'bw/grep-recurse-submodules'</title>
<updated>2017-01-18T23:12:11Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-01-18T23:12:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=55d128ae06b7b82f867961b677984620612a201c'/>
<id>urn:sha1:55d128ae06b7b82f867961b677984620612a201c</id>
<content type='text'>
"git grep" has been taught to optionally recurse into submodules.

* bw/grep-recurse-submodules:
  grep: search history of moved submodules
  grep: enable recurse-submodules to work on &lt;tree&gt; objects
  grep: optionally recurse into submodules
  grep: add submodules as a grep source type
  submodules: load gitmodules file from commit sha1
  submodules: add helper to determine if a submodule is initialized
  submodules: add helper to determine if a submodule is populated
  real_path: canonicalize directory separators in root parts
  real_path: have callers use real_pathdup and strbuf_realpath
  real_path: create real_pathdup
  real_path: convert real_path_internal to strbuf_realpath
  real_path: resolve symlinks by hand
</content>
</entry>
<entry>
<title>worktree: initialize return value for submodule_uses_worktrees</title>
<updated>2016-12-27T21:59:49Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2016-12-27T17:50:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7c4be458b1c7ba81b0cc63d76a144261eb2395be'/>
<id>urn:sha1:7c4be458b1c7ba81b0cc63d76a144261eb2395be</id>
<content type='text'>
When the worktrees directory is empty, the `ret` will be returned
uninitialized. Fix it by initializing the value.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>real_path: have callers use real_pathdup and strbuf_realpath</title>
<updated>2016-12-12T23:22:32Z</updated>
<author>
<name>Brandon Williams</name>
<email>bmwill@google.com</email>
</author>
<published>2016-12-12T18:16:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4ac9006f832d98ca1f25d956e12f3ff79e0d25bc'/>
<id>urn:sha1:4ac9006f832d98ca1f25d956e12f3ff79e0d25bc</id>
<content type='text'>
Migrate callers of real_path() who duplicate the retern value to use
real_pathdup or strbuf_realpath.

Signed-off-by: Brandon Williams &lt;bmwill@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>worktree: check if a submodule uses worktrees</title>
<updated>2016-12-12T23:15:07Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2016-12-12T19:04:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1a248cf21d450eb911d01a89c84412c2da365e66'/>
<id>urn:sha1:1a248cf21d450eb911d01a89c84412c2da365e66</id>
<content type='text'>
In a later patch we want to move around the the git directory of
a submodule. Both submodules as well as worktrees are involved in
placing git directories at unusual places, so their functionality
may collide. To react appropriately to situations where worktrees
in submodules are in use, offer a new function to query the
a submodule if it uses the worktree feature.

An earlier approach:
  "Implement submodule_get_worktrees and just count them", however:
  This can be done cheaply (both in new code to write as well as run time)
  by obtaining the list of worktrees based off that submodules git
  directory. However as we have loaded the variables for the current
  repository, the values in the submodule worktree
  can be wrong, e.g.
  * core.ignorecase may differ between these two repositories
  * the ref resolution is broken (refs/heads/branch in the submodule
    resolves to the sha1 value of the `branch` in the current repository
    that may not exist or have another sha1)

The implementation here is just checking for any files in
$GIT_COMMON_DIR/worktrees for the submodule, which ought to be sufficient
if the submodule is using the current repository format, which we also
check.

Signed-off-by: Stefan Beller &lt;sbeller@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>worktree list: keep the list sorted</title>
<updated>2016-11-28T21:18:51Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2016-11-28T09:36:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4df1d4d4666eb26b420d5b386010470729846b8c'/>
<id>urn:sha1:4df1d4d4666eb26b420d5b386010470729846b8c</id>
<content type='text'>
It makes it easier to write tests for. But it should also be good for
the user since locating a worktree by eye would be easier once they
notice this.

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>
<entry>
<title>worktree.c: get_worktrees() takes a new flag argument</title>
<updated>2016-11-28T21:18:51Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2016-11-28T09:36:55Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4fff1ef7ffe0e370459242cf08c51177eeb4181f'/>
<id>urn:sha1:4fff1ef7ffe0e370459242cf08c51177eeb4181f</id>
<content type='text'>
This is another no-op patch, in preparation for get_worktrees() to do
optional things, like sorting.

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>
<entry>
<title>get_worktrees() must return main worktree as first item even on error</title>
<updated>2016-11-28T21:18:51Z</updated>
<author>
<name>Nguyễn Thái Ngọc Duy</name>
<email>pclouds@gmail.com</email>
</author>
<published>2016-11-28T09:36:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a234563a3b329c8513fabbe9d8f9435987f10eb6'/>
<id>urn:sha1:a234563a3b329c8513fabbe9d8f9435987f10eb6</id>
<content type='text'>
This is required by git-worktree.txt, stating that the main worktree is
the first line (especially in --porcelain mode when we can't just change
behavior at will).

There's only one case when get_worktrees() may skip main worktree, when
parse_ref() fails. Update the code so that we keep first item as main
worktree and return something sensible in this case:

 - In user-friendly mode, since we're not constraint by anything,
   returning "(error)" should do the job (we already show "(detached
   HEAD)" which is not machine-friendly). Actually errors should be
   printed on stderr by parse_ref() (*)

 - In plumbing mode, we do not show neither 'bare', 'detached' or
   'branch ...', which is possible by the format description if I read
   it right.

Careful readers may realize that when the local variable "head_ref" in
get_main_worktree() is emptied, add_head_info() will do nothing to
wt-&gt;head_sha1. But that's ok because head_sha1 is zero-ized in the
previous patch.

(*) Well, it does not. But it's supposed to be a stop gap implementation
    until we can reuse refs code to parse "ref: " stuff in HEAD, from
    resolve_refs_unsafe(). Now may be the time since refs refactoring is
    mostly done.

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>
