<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git.c, branch v2.12.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://www.git.shady.money/git/atom?h=v2.12.3</id>
<link rel='self' href='https://www.git.shady.money/git/atom?h=v2.12.3'/>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/'/>
<updated>2017-02-03T19:25:18Z</updated>
<entry>
<title>Merge branch 'sb/unpack-trees-super-prefix'</title>
<updated>2017-02-03T19:25:18Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-02-03T19:25:18Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=2243d229f75be41318db8798fc90399dd6dedb42'/>
<id>urn:sha1:2243d229f75be41318db8798fc90399dd6dedb42</id>
<content type='text'>
"git read-tree" and its underlying unpack_trees() machinery learned
to report problematic paths prefixed with the --super-prefix option.

* sb/unpack-trees-super-prefix:
  unpack-trees: support super-prefix option
  t1001: modernize style
  t1000: modernize style
  read-tree: use OPT_BOOL instead of OPT_SET_INT
</content>
</entry>
<entry>
<title>Merge branch 'js/difftool-builtin'</title>
<updated>2017-01-31T21:15:00Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-01-31T21:15:00Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=b7786bb4b09463641f3e39eca18aefc630ee4f38'/>
<id>urn:sha1:b7786bb4b09463641f3e39eca18aefc630ee4f38</id>
<content type='text'>
Rewrite a scripted porcelain "git difftool" in C.

* js/difftool-builtin:
  difftool: hack around -Wzero-length-format warning
  difftool: retire the scripted version
  difftool: implement the functionality in the builtin
  difftool: add a skeleton for the upcoming builtin
</content>
</entry>
<entry>
<title>unpack-trees: support super-prefix option</title>
<updated>2017-01-25T20:33:33Z</updated>
<author>
<name>Stefan Beller</name>
<email>sbeller@google.com</email>
</author>
<published>2017-01-18T01:05:20Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=3d415425c7b6ca0d2243a4589672369e7a02fc2c'/>
<id>urn:sha1:3d415425c7b6ca0d2243a4589672369e7a02fc2c</id>
<content type='text'>
In the future we want to support working tree operations within submodules,
e.g. "git checkout --recurse-submodules", which will update the submodule
to the commit as recorded in its superproject. In the submodule the
unpack-tree operation is carried out as usual, but the reporting to the
user needs to prefix any path with the superproject. The mechanism for
this is the super-prefix. (see 74866d757, git: make super-prefix option)

Add support for the super-prefix option for commands that unpack trees
by wrapping any path output in unpacking trees in the newly introduced
super_prefixed function. This new function prefixes any path with the
super-prefix if there is one.  Assuming the submodule case doesn't happen
in the majority of the cases, we'd want to have a fast behavior for no
super prefix, i.e. no reallocation/copying, but just returning path.

Another aspect of introducing the `super_prefixed` function is to consider
who owns the memory and if this is the right place where the path gets
modified. As the super prefix ought to change the output behavior only and
not the actual unpack tree part, it is fine to be that late in the line.
As we get passed in 'const char *path', we cannot change the path itself,
which means in case of a super prefix we have to copy over the path.
We need two static buffers in that function as the error messages
contain at most two paths.

For testing purposes enable it in read-tree, which has no output
of paths other than an unpack-trees.c. These are all converted in
this patch.

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>difftool: retire the scripted version</title>
<updated>2017-01-19T21:23:43Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2017-01-19T20:30:40Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=019678d6b1f83419cdc35e3d455175adce3a379c'/>
<id>urn:sha1:019678d6b1f83419cdc35e3d455175adce3a379c</id>
<content type='text'>
It served its purpose, but now we have a builtin difftool. Time for the
Perl script to enjoy Florida.

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 'jk/execv-dashed-external'</title>
<updated>2017-01-18T23:12:16Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-01-18T23:12:16Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=5918bdcf26030a2540ac25d5b8cbee82fad219fc'/>
<id>urn:sha1:5918bdcf26030a2540ac25d5b8cbee82fad219fc</id>
<content type='text'>
Typing ^C to pager, which usually does not kill it, killed Git and
took the pager down as a collateral damage in certain process-tree
structure.  This has been fixed.

* jk/execv-dashed-external:
  execv_dashed_external: wait for child on signal death
  execv_dashed_external: stop exiting with negative code
  execv_dashed_external: use child_process struct
</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://www.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>difftool: add a skeleton for the upcoming builtin</title>
<updated>2017-01-17T21:32:47Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2017-01-17T15:54:57Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=be8a90e59ce4c7603207a8255284fdbbffff1a2e'/>
<id>urn:sha1:be8a90e59ce4c7603207a8255284fdbbffff1a2e</id>
<content type='text'>
This adds a builtin difftool that still falls back to the legacy Perl
version, which has been renamed to `legacy-difftool`.

The idea is that the new, experimental, builtin difftool immediately hands
off to the legacy difftool for now, unless the config variable
difftool.useBuiltin is set to true.

This feature flag will be used in the upcoming Git for Windows v2.11.0
release, to allow early testers to opt-in to use the builtin difftool and
flesh out any bugs.

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 'sb/submodule-embed-gitdir'</title>
<updated>2017-01-10T23:24:28Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-01-10T23:24:27Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=da2b74eeec0b12d7b20d34a5e284295f81ad40a8'/>
<id>urn:sha1:da2b74eeec0b12d7b20d34a5e284295f81ad40a8</id>
<content type='text'>
A new submodule helper "git submodule embedgitdirs" to make it
easier to move embedded .git/ directory for submodules in a
superproject to .git/modules/ (and point the latter with the former
that is turned into a "gitdir:" file) has been added.

* sb/submodule-embed-gitdir:
  worktree: initialize return value for submodule_uses_worktrees
  submodule: add absorb-git-dir function
  move connect_work_tree_and_git_dir to dir.h
  worktree: check if a submodule uses worktrees
  test-lib-functions.sh: teach test_commit -C &lt;dir&gt;
  submodule helper: support super prefix
  submodule: use absolute path for computing relative path connecting
</content>
</entry>
<entry>
<title>execv_dashed_external: wait for child on signal death</title>
<updated>2017-01-09T21:41:40Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2017-01-07T01:22:23Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=46df6906f3aaf74dafe2026b028c8c5c1a0d5f58'/>
<id>urn:sha1:46df6906f3aaf74dafe2026b028c8c5c1a0d5f58</id>
<content type='text'>
When you hit ^C to interrupt a git command going to a pager,
this usually leaves the pager running. But when a dashed
external is in use, the pager ends up in a funny state and
quits (but only after eating one more character from the
terminal!). This fixes it.

Explaining the reason will require a little background.

When git runs a pager, it's important for the git process to
hang around and wait for the pager to finish, even though it
has no more data to feed it. This is because git spawns the
pager as a child, and thus the git process is the session
leader on the terminal. After it dies, the pager will finish
its current read from the terminal (eating the one
character), and then get EIO trying to read again.

When you hit ^C, that sends SIGINT to git and to the pager,
and it's a similar situation.  The pager ignores it, but the
git process needs to hang around until the pager is done. We
addressed that long ago in a3da882120 (pager: do
wait_for_pager on signal death, 2009-01-22).

But when you have a dashed external (or an alias pointing to
a builtin, which will re-exec git for the builtin), there's
an extra process in the mix. For instance, running:

  $ git -c alias.l=log l

will end up with a process tree like:

  git (parent)
    \
     git-log (child)
      \
       less (pager)

If you hit ^C, SIGINT goes to all of them. The pager ignores
it, and the child git process will end up in wait_for_pager().
But the parent git process will die, and the usual EIO
trouble happens.

So we really want the parent git process to wait_for_pager(),
but of course it doesn't know anything about the pager at
all, since it was started by the child.  However, we can
have it wait on the git-log child, which in turn is waiting
on the pager. And that's what this patch does.

There are a few design decisions here worth explaining:

  1. The new feature is attached to run-command's
     clean_on_exit feature. Partly this is convenience,
     since that feature already has a signal handler that
     deals with child cleanup.

     But it's also a meaningful connection. The main reason
     that dashed externals use clean_on_exit is to bind the
     two processes together. If somebody kills the parent
     with a signal, we propagate that to the child (in this
     instance with SIGINT, we do propagate but it doesn't
     matter because the original signal went to the whole
     process group). Likewise, we do not want the parent
     to go away until the child has done so.

     In a traditional Unix world, we'd probably accomplish
     this binding by just having the parent execve() the
     child directly. But since that doesn't work on Windows,
     everything goes through run_command's more spawn-like
     interface.

  2. We do _not_ automatically waitpid() on any
     clean_on_exit children. For dashed externals this makes
     sense; we know that the parent is doing nothing but
     waiting for the child to exit anyway. But with other
     children, it's possible that the child, after getting
     the signal, could be waiting on the parent to do
     something (like closing a descriptor). If we were to
     wait on such a child, we'd end up in a deadlock. So
     this errs on the side of caution, and lets callers
     enable the feature explicitly.

  3. When we send children the cleanup signal, we send all
     the signals first, before waiting on any children. This
     is to avoid the case where one child might be waiting
     on another one to exit, causing a deadlock. We inform
     all of them that it's time to die before reaping any.

     In practice, there is only ever one dashed external run
     from a given process, so this doesn't matter much now.
     But it future-proofs us if other callers start using
     the wait_after_clean mechanism.

There's no automated test here, because it would end up racy
and unportable. But it's easy to reproduce the situation by
running the log command given above and hitting ^C.

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>execv_dashed_external: stop exiting with negative code</title>
<updated>2017-01-09T21:41:35Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2017-01-07T01:17:48Z</published>
<link rel='alternate' type='text/html' href='https://www.git.shady.money/git/commit/?id=246f0edec0b789ccfeebcf7fef85417b7cb04425'/>
<id>urn:sha1:246f0edec0b789ccfeebcf7fef85417b7cb04425</id>
<content type='text'>
When we try to exec a git sub-command, we pass along the
status code from run_command(). But that may return -1 if we
ran into an error with pipe() or execve(). This tends to
work (and end up as 255 due to twos-complement wraparound
and truncation), but in general it's probably a good idea to
avoid negative exit codes for portability.

We can easily translate to the normal generic "128" code we
get when syscalls cause us to die.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
