<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-add--interactive.perl, branch v2.13.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.13.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.13.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2017-04-20T04:37:17Z</updated>
<entry>
<title>Merge branch 'va/i18n-perl-scripts'</title>
<updated>2017-04-20T04:37:17Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-04-20T04:37:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=34130cc06b478d824cc428c33796f620dd0c7424'/>
<id>urn:sha1:34130cc06b478d824cc428c33796f620dd0c7424</id>
<content type='text'>
Message fix.

* va/i18n-perl-scripts:
  git-add--interactive.perl: add missing dot in a message
</content>
</entry>
<entry>
<title>git-add--interactive.perl: add missing dot in a message</title>
<updated>2017-04-14T01:01:15Z</updated>
<author>
<name>Ralf Thielow</name>
<email>ralf.thielow@gmail.com</email>
</author>
<published>2017-04-13T16:41:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0301f1fd92f4086a3557afa14f3e209787964b4d'/>
<id>urn:sha1:0301f1fd92f4086a3557afa14f3e209787964b4d</id>
<content type='text'>
One message appears twice in the translations and the only
difference is a dot at the end.  So add this dot to make
the messages being identical.

Signed-off-by: Ralf Thielow &lt;ralf.thielow@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/add-i-use-pathspecs'</title>
<updated>2017-03-17T20:50:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-03-17T20:50:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=153e0d762c15d8a85f0070cd01aff45f5c232e3f'/>
<id>urn:sha1:153e0d762c15d8a85f0070cd01aff45f5c232e3f</id>
<content type='text'>
"git add -p &lt;pathspec&gt;" unnecessarily expanded the pathspec to a
list of individual files that matches the pathspec by running "git
ls-files &lt;pathspec&gt;", before feeding it to "git diff-index" to see
which paths have changes, because historically the pathspec
language supported by "diff-index" was weaker.  These days they are
equivalent and there is no reason to internally expand it.  This
helps both performance and avoids command line argument limit on
some platforms.

* jk/add-i-use-pathspecs:
  add--interactive: do not expand pathspecs with ls-files
</content>
</entry>
<entry>
<title>add--interactive: do not expand pathspecs with ls-files</title>
<updated>2017-03-14T20:27:23Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2017-03-14T16:30:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7288e12cce5db87216eba16441a2c37206e5dcad'/>
<id>urn:sha1:7288e12cce5db87216eba16441a2c37206e5dcad</id>
<content type='text'>
When we want to get the list of modified files, we first
expand any user-provided pathspecs with "ls-files", and then
feed the resulting list of paths as arguments to
"diff-index" and "diff-files". If your pathspec expands into
a large number of paths, you may run into one of two
problems:

  1. The OS may complain about the size of the argument
     list, and refuse to run. For example:

       $ (ulimit -s 128 &amp;&amp; git add -p drivers)
       Can't exec "git": Argument list too long at .../git-add--interactive line 177.
       Died at .../git-add--interactive line 177.

     That's on the linux.git repository, which has about 20K
     files in the "drivers" directory (none of them modified
     in this case). The "ulimit -s" trick is necessary to
     show the problem on Linux even for such a gigantic set
     of paths. Other operating systems have much smaller
     limits (e.g., a real-world case was seen with only 5K
     files on OS X).

  2. Even when it does work, it's really slow. The pathspec
     code is not optimized for huge numbers of paths. Here's
     the same case without the ulimit:

       $ time git add -p drivers
       No changes.

       real	0m16.559s
       user	0m53.140s
       sys	0m0.220s

We can improve this by skipping "ls-files" completely, and
just feeding the original pathspecs to the diff commands.
This solution was discussed in 2010:

  http://public-inbox.org/git/20100105041438.GB12574@coredump.intra.peff.net/

but at the time the diff code's pathspecs were more
primitive than those used by ls-files (e.g., they did not
support globs). Making the change would have caused a
user-visible regression, so we didn't.

Since then, the pathspec code has been unified, and the diff
commands natively understand pathspecs like '*.c'.

This patch implements that solution. That skips the
argument-list limits, and the result runs much faster:

  $ time git add -p drivers
  No changes.

  real	0m0.149s
  user	0m0.116s
  sys	0m0.080s

There are two new tests. The first just exercises the
globbing behavior to confirm that we are not causing a
regression there. The second checks the actual argument
behavior using GIT_TRACE. We _could_ do it with the "ulimit
-s" trick, as above. But that would mean the test could only
run where "ulimit -s" works. And tests of that sort are
expensive, because we have to come up with enough files to
actually bust the limit (we can't just shrink the "128" down
infinitely, since it is also the in-program stack size).

Finally, two caveats and possibilities for future work:

  a. This fixes one argument-list expansion, but there may
     be others. In fact, it's very likely that if you run
     "git add -i" and select a large number of modified
     files that the script would try to feed them all to a
     single git command.

     In practice this is probably fine. The real issue here
     is that the argument list was growing with the _total_
     number of files, not the number of modified or selected
     files.

  b. If the repository contains filenames with literal wildcard
     characters (e.g., "foo*"), the original code expanded
     them via "ls-files" and then fed those wildcard names
     to "diff-index", which would have treated them as
     wildcards. This was a bug, which is now fixed (though
     unless you really go through some contortions with
     ":(literal)", it's likely that your original pathspec
     would match whatever the accidentally-expanded wildcard
     would anyway).

     So this takes us one step closer to working correctly
     with files whose names contain wildcard characters, but
     it's likely that others remain (e.g., if "git add -i"
     feeds the selected paths to "git add").

Reported-by: Wincent Colaiuta &lt;win@wincent.com&gt;
Reported-by: Mislav Marohnić &lt;mislav.marohnic@gmail.com&gt;
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>add--interactive: fix missing file prompt for patch mode with "-i"</title>
<updated>2017-03-02T18:10:38Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2017-03-02T09:48:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c852bd54bd87fdcdc825f5d45c26aa745be13ba6'/>
<id>urn:sha1:c852bd54bd87fdcdc825f5d45c26aa745be13ba6</id>
<content type='text'>
When invoked as "git add -i", each menu interactive menu
option prompts the user to select a list of files. This
includes the "patch" option, which gets the list before
starting the hunk-selection loop.

As "git add -p", it behaves differently, and jumps straight
to the hunk selection loop.

Since 0539d5e6d (i18n: add--interactive: mark patch prompt
for translation, 2016-12-14), the "add -i" case mistakenly
jumps to straight to the hunk-selection loop. Prior to that
commit the distinction between the two cases was managed by
the $patch_mode variable. That commit used $patch_mode for
something else, and moved the old meaning to the "$cmd"
variable.  But it forgot to update the $patch_mode check
inside patch_update_cmd() which controls the file-list
behavior.

The simplest fix would be to change that line to check $cmd.
But while we're here, let's use a less obscure name for this
flag: $patch_mode_only, a boolean which tells whether we are
in full-interactive mode or only in patch-mode.

Reported-by: Henrik Grubbström &lt;grubba@grubba.org&gt;
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>Merge branch 'rt/align-add-i-help-text'</title>
<updated>2017-02-24T18:48:08Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2017-02-24T18:48:08Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c0588fd61aa6da96824eec60719c505b66239dd6'/>
<id>urn:sha1:c0588fd61aa6da96824eec60719c505b66239dd6</id>
<content type='text'>
Doc update.

* rt/align-add-i-help-text:
  git add -i: replace \t with blanks in the help message
</content>
</entry>
<entry>
<title>git add -i: replace \t with blanks in the help message</title>
<updated>2017-02-22T20:51:00Z</updated>
<author>
<name>Ralf Thielow</name>
<email>ralf.thielow@gmail.com</email>
</author>
<published>2017-02-22T18:46:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e519eccdf45f3b36d9596f4db7474a596f9bc72f'/>
<id>urn:sha1:e519eccdf45f3b36d9596f4db7474a596f9bc72f</id>
<content type='text'>
Within the help message of 'git add -i', the 'diff' command uses one
tab character and blanks to create the space between the name and the
description while the others use blanks only.  So if the tab size is
not at 4 characters, this description will not be in range.
Replace the tab character with blanks.

Signed-off-by: Ralf Thielow &lt;ralf.thielow@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jc/retire-compaction-heuristics'</title>
<updated>2017-01-10T23:24:27Z</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://git.shady.money/git/commit/?id=2ced5f2c2ddcfe3a45d75ae1d552c11cad70236d'/>
<id>urn:sha1:2ced5f2c2ddcfe3a45d75ae1d552c11cad70236d</id>
<content type='text'>
"git diff" and its family had two experimental heuristics to shift
the contents of a hunk to make the patch easier to read.  One of
them turns out to be better than the other, so leave only the
"--indent-heuristic" option and remove the other one.

* jc/retire-compaction-heuristics:
  diff: retire "compaction" heuristics
</content>
</entry>
<entry>
<title>Merge branch 'va/i18n-perl-scripts'</title>
<updated>2016-12-27T08:11:40Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-12-27T08:11:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1d73f8e86d7b4d95e0b7ce53eec2a5f8114722ac'/>
<id>urn:sha1:1d73f8e86d7b4d95e0b7ce53eec2a5f8114722ac</id>
<content type='text'>
Porcelain scripts written in Perl are getting internationalized.

* va/i18n-perl-scripts:
  i18n: difftool: mark warnings for translation
  i18n: send-email: mark composing message for translation
  i18n: send-email: mark string with interpolation for translation
  i18n: send-email: mark warnings and errors for translation
  i18n: send-email: mark strings for translation
  i18n: add--interactive: mark status words for translation
  i18n: add--interactive: remove %patch_modes entries
  i18n: add--interactive: mark edit_hunk_manually message for translation
  i18n: add--interactive: i18n of help_patch_cmd
  i18n: add--interactive: mark patch prompt for translation
  i18n: add--interactive: mark plural strings
  i18n: clean.c: match string with git-add--interactive.perl
  i18n: add--interactive: mark strings with interpolation for translation
  i18n: add--interactive: mark simple here-documents for translation
  i18n: add--interactive: mark strings for translation
  Git.pm: add subroutines for commenting lines
</content>
</entry>
<entry>
<title>diff: retire "compaction" heuristics</title>
<updated>2016-12-23T20:32:22Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-12-23T20:32:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3cde4e02ee891bff53bac7f6a7d977f50418a4b5'/>
<id>urn:sha1:3cde4e02ee891bff53bac7f6a7d977f50418a4b5</id>
<content type='text'>
When a patch inserts a block of lines, whose last lines are the
same as the existing lines that appear before the inserted block,
"git diff" can choose any place between these existing lines as the
boundary between the pre-context and the added lines (adjusting the
end of the inserted block as appropriate) to come up with variants
of the same patch, and some variants are easier to read than others.

We have been trying to improve the choice of this boundary, and Git
2.11 shipped with an experimental "compaction-heuristic".  Since
then another attempt to improve the logic further resulted in a new
"indent-heuristic" logic.  It is agreed that the latter gives better
result overall, and the former outlived its usefulness.

Retire "compaction", and keep "indent" as an experimental feature.
The latter hopefully will be turned on by default in a future
release, but that should be done as a separate step.

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