* Re: [PATCH v4] log --graph: customize the graph lines with config log.graphColors
From: Duy Nguyen @ 2017-01-12 12:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Jeff King
In-Reply-To: <xmqqh958uoot.fsf@gitster.mtv.corp.google.com>
Just FYI. The broken internet cables in Vietnam seem to hit my ISP
really hard. It's nearly impossible to make a TCP connection. So I'm
basically off the grid, hopefully not longer than two weeks.
On 1/10/17, Junio C Hamano <gitster@pobox.com> wrote:
> Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
>
>> + end = string + strlen(string);
>> + while (start < end) {
>> + const char *comma = strchrnul(start, ',');
>> + char color[COLOR_MAXLEN];
>> +
>> + while (start < comma && isspace(*start))
>> + start++;
>> + if (start == comma) {
>> + start = comma + 1;
>> + continue;
>> + }
>> +
>> + if (!color_parse_mem(start, comma - start, color))
>
> So you skip the leading blanks but let color_parse_mem() trim the
> trailing blanks? It would work once the control reaches the loop,
> but wouldn't that miss
>
> git -c log.graphColors=' reset , blue, red' log --graph
>
> as "reset" is not
^ permalink raw reply
* git clone failing when used through bundler on Docker for Windows with a shared volume
From: Omar Qureshi @ 2017-01-12 12:11 UTC (permalink / raw)
To: git
Hi there, I'm not sure this is the best place for this, but, this
seems to be an issue with Git when used through Docker on Windows when
there is a shared volume.
The issue is documented at
https://github.com/bundler/bundler/issues/5322 and I've provided a git
repository that allows you to simulate the issue, for this the
requirements are Docker for Windows with the Docker client installed
on WSL as well as docker-compose installed via pip.
Docker for Windows will need to be configured to have a shared drive
Also, it makes no difference if a tag is provided or not
^ permalink raw reply
* Re: [PATCH 1/2] asciidoctor: fix user-manual to be built by `asciidoctor`
From: Johannes Schindelin @ 2017-01-12 11:15 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jeff King, git, 마누엘
In-Reply-To: <xmqqinpmpld0.fsf@gitster.mtv.corp.google.com>
Hi Junio,
On Tue, 10 Jan 2017, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
>
> > On Sat, Jan 07, 2017 at 02:03:30PM -0800, Junio C Hamano wrote:
> >
> >> Is that a longer way to say that the claim "... is designed as a
> >> book" is false?
> >>
> >> > So I dunno. I really do think "article" is conceptually the most
> >> > appropriate style, but I agree that there are some book-like things
> >> > (like appendices).
> >>
> >> ... Yeah, I should have read forward first before starting to insert
> >> my comments.
> >
> > To be honest, I'm not sure whether "book" versus "article" was really
> > considered in the original writing. I think we can call it whichever
> > produces the output we find most pleasing. I was mostly just pointing at
> > there are some tradeoffs in the end result in flipping the type.
>
> I understand.
>
> And I tend to agree that the silliness you observed (like a t-o-c
> for a one-section "chapter") is not quite welcome.
>
> For now I queued only 2/2 which looked good. I won't object if
> somebody else rerolls 1/2 to appease AsciiDoctor, but let's take an
> obviously good bit first.
For fun, I just reverted the article->book patch and I was greeted with
this:
-- snip --
ASCIIDOC user-manual.xml
asciidoctor: ERROR: user-manual.txt: line 44: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 477: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 477: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 477: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 1003: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 1003: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 1003: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 1003: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 1720: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 1720: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 1720: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 1720: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 1720: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 2462: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 2462: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 2462: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 2462: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 2814: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 2814: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 2814: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 2958: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 2958: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 2958: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 3514: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 3514: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 3514: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 3771: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 3771: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 3771: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 4147: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 4147: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 4147: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 4395: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 4395: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 4395: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 4401: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 4401: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 4636: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 4636: only book doctypes can
contain level 0 sections
asciidoctor: ERROR: user-manual.txt: line 4636: only book doctypes can
contain level 0 sections
-- snap --
It still builds, funnily enough, but the result is definitely worse on the
eyes. The page is *really* long, and structuring it into individual parts
does help the readability.
Compare for yourself: https://dscho.github.io/git/index.html (this will go
away at some point in the future, but I do not think there is a way for me
to send two 200+kB HTML files to the Git mailing list).
Ciao,
Dscho
P.S.: I also tried to use [glossary] and [appendix] as appropriate, but it
seems that AsciiDoc *insists* on level-2 sections in an appendix, while
AsciiDoctor *insists* on level-3 sections. In other words, the following
diff on top of my patch series yields the warning "asciidoc: WARNING:
user-manual.txt: line 4411: section title out of sequence: expect
ed level 2, got level 3" with AsciiDoc, while AsciiDoctor is totally
happy:
commit 900e193f15d5d2ef32285b1db9eb24c10710b7c1
Author: Johannes Schindelin <johannes.schindelin@gmx.de>
Date: Thu Jan 12 12:06:16 2017 +0100
fixup! asciidoctor: fix user-manual to be built by `asciidoctor`
diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
index bc29298678..c1ab6ce453 100644
--- a/Documentation/user-manual.txt
+++ b/Documentation/user-manual.txt
@@ -4392,25 +4392,23 @@ You see, Git is actually the best tool to find out
about the source of Git
itself!
[[glossary]]
+[glossary]
Git Glossary
============
-[[git-explained]]
-Git explained
--------------
-
include::glossary-content.txt[]
[[git-quick-start]]
-Appendix A: Git Quick Reference
-===============================
+[appendix]
+Git Quick Reference
+===================
This is a quick summary of the major commands; the previous chapters
explain how these work in more detail.
[[quick-creating-a-new-repository]]
Creating a new repository
--------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~
From a tarball:
@@ -4432,7 +4430,7 @@ $ cd project
[[managing-branches]]
Managing branches
------------------
+~~~~~~~~~~~~~~~~~
-----------------------------------------------
$ git branch # list all local branches in this repo
@@ -4497,7 +4495,7 @@ $ git branch -r # list all remote
branches
[[exploring-history]]
Exploring history
------------------
+~~~~~~~~~~~~~~~~~
-----------------------------------------------
$ gitk # visualize and browse history
@@ -4533,7 +4531,7 @@ $ git bisect bad # if this revision is bad.
[[making-changes]]
Making changes
---------------
+~~~~~~~~~~~~~~
Make sure Git knows who to blame:
@@ -4564,7 +4562,7 @@ $ git commit -a # use latest content of all
tracked files
[[merging]]
Merging
--------
+~~~~~~~
-----------------------------------------------
$ git merge test # merge branch "test" into the current branch
@@ -4575,7 +4573,7 @@ $ git pull . test # equivalent to git merge test
[[sharing-your-changes]]
Sharing your changes
---------------------
+~~~~~~~~~~~~~~~~~~~~
Importing or exporting patches:
@@ -4621,7 +4619,7 @@ $ git push example test
[[repository-maintenance]]
Repository maintenance
-----------------------
+~~~~~~~~~~~~~~~~~~~~~~
Check for corruption:
@@ -4637,12 +4635,9 @@ $ git gc
[[todo]]
-Appendix B: Notes and todo list for this manual
-===============================================
-
-[[todo-list]]
-Todo list
----------
+[appendix]
+Notes and todo list for this manual
+===================================
This is a work in progress.
^ permalink raw reply related
* [PATCH] imap-send.c: Avoid deprecated openssl 1.1.0 API
From: eroen @ 2017-01-12 10:42 UTC (permalink / raw)
To: git; +Cc: eroen
Library initialization functions are deprecated in openssl 1.1.0 API, as
initialization is handled by openssl internally.
Symbols for deprecated functions are not exported if openssl is built with
`--api=1.1 disable-deprecated`, so their use will cause a build failure.
Reported-by: Lars Wendler (Polynomial-C)
X-Gentoo-Bug: 592466
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=592466
---
imap-send.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/imap-send.c b/imap-send.c
index 5c7e27a89..98774360e 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -284,8 +284,10 @@ static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int ve
int ret;
X509 *cert;
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
SSL_library_init();
SSL_load_error_strings();
+#endif
meth = SSLv23_method();
if (!meth) {
--
2.11.0
^ permalink raw reply related
* Re: [PATCH 2/2] Use 'env' to find perl instead of fixed path
From: Johannes Schindelin @ 2017-01-12 10:21 UTC (permalink / raw)
To: Pat Pannuto; +Cc: Johannes Sixt, Junio C Hamano, git
In-Reply-To: <CAAnLKaGbf9-GAF19+61=7_RfCOBM0=Ounwf8KkL1jS6HX3pOag@mail.gmail.com>
Hi Pat,
On Thu, 12 Jan 2017, Pat Pannuto wrote:
> I'm not at all attached to changing all of them, just figured it made
> sense while I was here.
>
> Would a patch that changes only:
>
> git-add--interactive.perl | 2 +-
> git-archimport.perl | 2 +-
> git-cvsexportcommit.perl | 2 +-
> git-cvsimport.perl | 2 +-
> git-cvsserver.perl | 2 +-
> git-difftool.perl | 2 +-
> git-relink.perl | 2 +-
> git-send-email.perl | 2 +-
> git-svn.perl | 2 +-
>
> be more acceptable?
Unfortunately not. Take git-svn.perl for example, in particular in
conjunction with Git for Windows. git-svn requires the Subversion bindings
for Perl, and they are a *major* pain to build correctly (this is
frequently underestimated by users who complain about git-svn problems).
Allowing users to override the Perl path (even if it were possible, which
it is not, as Hannes Sixt pointed out in the mail you replied to) would
open Git for Windows for a metric ton of users complaining that their
git-svn does not work (when it is their fault, really, by overriding Perl
with their own preferred version that comes without Subversion bindings,
but how would they know).
So if this patch would make it into upstream Git, I would *have* to revert
it in Git for Windows, adding to my already considerable maintenance burden.
Ciao,
Johannes
^ permalink raw reply
* Re: [PATCH 0/5] extend git-describe pattern matching
From: Johannes Schindelin @ 2017-01-12 10:05 UTC (permalink / raw)
To: Jacob Keller; +Cc: git, Jacob Keller
In-Reply-To: <20170112001721.2534-1-jacob.e.keller@intel.com>
Hi Jake,
On Wed, 11 Jan 2017, Jacob Keller wrote:
> From: Jacob Keller <jacob.keller@gmail.com>
>
> Teach git describe and git name-rev the ability to match multiple
> patterns inclusively. Additionally, teach these commands to also accept
> negative patterns to discard any refs which match.
I like the idea, and I think this patch series is already in a pretty good
shape, offering a couple of comments as individual replies to the
respective patches.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH 3/5] name-rev: add support to discard refs by pattern match
From: Johannes Schindelin @ 2017-01-12 9:57 UTC (permalink / raw)
To: Jacob Keller; +Cc: git, Jacob Keller
In-Reply-To: <20170112001721.2534-4-jacob.e.keller@intel.com>
Hi Jake,
On Wed, 11 Jan 2017, Jacob Keller wrote:
> From: Jacob Keller <jacob.keller@gmail.com>
>
> Extend name-rev further to support matching refs by adding `--discard`
> patterns.
Same comment applies as for 5/5: `--exclude-refs` may be a better name
than `--discard`.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH 2/5] name-rev: extend --refs to accept multiple patterns
From: Johannes Schindelin @ 2017-01-12 9:56 UTC (permalink / raw)
To: Jacob Keller; +Cc: git, Jacob Keller
In-Reply-To: <20170112001721.2534-3-jacob.e.keller@intel.com>
Hi Jake,
On Wed, 11 Jan 2017, Jacob Keller wrote:
> diff --git a/t/t6007-rev-list-cherry-pick-file.sh b/t/t6007-rev-list-cherry-pick-file.sh
> index 1408b608eb03..d072ec43b016 100755
> --- a/t/t6007-rev-list-cherry-pick-file.sh
> +++ b/t/t6007-rev-list-cherry-pick-file.sh
> @@ -99,6 +99,36 @@ test_expect_success '--cherry-pick bar does not come up empty (II)' '
> test_cmp actual.named expect
> '
>
> +test_expect_success 'name-rev multiple --refs combine inclusive' '
> + git rev-list --left-right --cherry-pick F...E -- bar > actual &&
Our current coding style seems to skip the space between `>` and `actual`
(this applies to all redirections added in this patch).
> + git name-rev --stdin --name-only --refs="*tags/F" --refs="*tags/E" \
> + < actual > actual.named &&
> + test_cmp actual.named expect
> +'
> +
> +cat >expect <<EOF
> +<tags/F
> +$(git rev-list --left-right --right-only --cherry-pick F...E -- bar)
> +EOF
In the current revision of t6007, we seem to list the expected output
explicitly, i.e. *not* generating it dynamically.
If you *do* insist to generate the `expect` file dynamically, a better way
would be to include that generation in the `test_expect_success` code so
that errors in the call can be caught, too:
test_expect_success 'name-rev --refs excludes non-matched patterns' '
echo "<tags/F" >expect &&
git rev-list --left-right --right-only --cherry-pick F...E -- \
bar >>expect &&
[...]
However, if I was asked for my preference, I would suggest to specify the
`expect` contents explicitly, to document the expectation as of time of
writing. The reason: I debugged my share of test breakages and these
dynamically-generated `expect` files are the worst. When things break, you
have to dig *real* deep to figure out what is going wrong, as sometimes
the *generation of the `expect` file* regresses.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH 1/5] doc: add documentation for OPT_STRING_LIST
From: Johannes Schindelin @ 2017-01-12 9:47 UTC (permalink / raw)
To: Jacob Keller; +Cc: git, Jacob Keller
In-Reply-To: <20170112001721.2534-2-jacob.e.keller@intel.com>
Hi Jake,
On Wed, 11 Jan 2017, Jacob Keller wrote:
> diff --git a/Documentation/technical/api-parse-options.txt b/Documentation/technical/api-parse-options.txt
> index 27bd701c0d68..15e876e4c804 100644
> --- a/Documentation/technical/api-parse-options.txt
> +++ b/Documentation/technical/api-parse-options.txt
> @@ -168,6 +168,11 @@ There are some macros to easily define options:
> Introduce an option with string argument.
> The string argument is put into `str_var`.
>
> +`OPT_STRING_LIST(short, long, &list, arg_str, description)`::
> + Introduce an option with a string argument. Repeated invocations
> + accumulate into a list of strings. Reset and clear the list with
> + `--no-option`.
One suggestions: as the list parameter is not type-safe (apart from
checking that it can be cast to a `void *`), it would be good to mention
in the documentation that `list` must be of type `struct string_list`.
I was about to suggest that `--no-option` may be misleading, as the
command-line option is not really called `--option` in almost all cases,
but I see that the rest of that document uses that convention to refer to
the negated option already...
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH 5/5] describe: teach describe negative pattern matches
From: Johannes Schindelin @ 2017-01-12 9:42 UTC (permalink / raw)
To: Jacob Keller; +Cc: git, Jacob Keller
In-Reply-To: <20170112001721.2534-6-jacob.e.keller@intel.com>
Hi Jake,
On Wed, 11 Jan 2017, Jacob Keller wrote:
> From: Jacob Keller <jacob.keller@gmail.com>
>
> Teach git-describe the `--discard` option which will allow specifying
> a glob pattern of tags to ignore.
IMHO "discard" is the wrong word, it almost sounds as if the matching tags
would be *deleted*.
Maybe `--exclude` or `--unmatch` instead?
Ciao,
Dscho
^ permalink raw reply
* git fast-import crashing on big imports
From: Ulrich Spörlein @ 2017-01-12 8:21 UTC (permalink / raw)
To: git; +Cc: Ed Maste
Hey,
the FreeBSD svn2git conversion is crashing somewhat
non-deterministically during its long conversion process. From memory,
this was not as bad is it is with more recent versions of git (but I
can't be sure, really).
I have a dump file that you can grab at
http://scan.spoerlein.net/pub/freebsd-base.dump.xz (19G, 55G uncompressed)
that shows this problem after a couple of minutes of runtime. The caveat is
that for another member of the team on a different machine the crashes are on
different revisions.
Googling around I found two previous threads that were discussing
problems just like this (memory corruption, bad caching, etc)
https://www.spinics.net/lists/git/msg93598.html from 2009
and
http://git.661346.n2.nabble.com/long-fast-import-errors-out-quot-failed-to-apply-delta-quot-td6557884.html
from 2011
% git fast-import --stats < ../freebsd-base.dump
...
progress SVN r49318 branch master = :49869
progress SVN r49319 branch stable/3 = :49870
progress SVN r49320 branch master = :49871
error: failed to apply delta
error: bad offset for revindex
error: bad offset for revindex
error: bad offset for revindex
error: bad offset for revindex
error: bad offset for revindex
fatal: Can't load tree b35ae4e9c2a41677e84a3f14bed09f584c3ff25e
fast-import: dumping crash report to fast_import_crash_29613
fast-import crash report:
fast-import process: 29613
parent process : 29612
at 2017-01-11 19:33:37 +0000
fatal: Can't load tree b35ae4e9c2a41677e84a3f14bed09f584c3ff25e
git fsck shows a somewhat incomplete pack file (I guess that's expected if the
process dies mid-stream?)
% git fsck
Checking object directories: 100% (256/256), done.
error: failed to apply delta6/614500)
error: cannot unpack d1d7ee1f81c6767c5e0f75d14d400d7512a85a0f from ./objects/pack/pack-e28fcea43fc221d2ebe92857b484da58bb888237.pack at offset 122654805
error: failed to apply delta
error: failed to read delta base object d1d7ee1f81c6767c5e0f75d14d400d7512a85a0f at offset 122654805 from ./objects/pack/pack-e28fcea43fc221d2ebe92857b484da58bb888237.pack
error: cannot unpack 8523bde63ef34bef725347994fdaec996d756510 from ./objects/pack/pack-e28fcea43fc221d2ebe92857b484da58bb888237.pack at offset 122671596
error: failed to apply delta0/614500)
error: failed to read delta base object d1d7ee1f81c6767c5e0f75d14d400d7512a85a0f at offset 122654805 from ./objects/pack/pack-e28fcea43fc221d2ebe92857b484da58bb888237.pack
...
Any comments on whether the original problems from 2009 and 2011 were ever
fixed and committed?
Some more facts:
- git version 2.11.0
- I don't recall these sorts of crashes with a git from 2-3 years ago
- adding more checkpoints does help, but not fix the problem, it merely shifts
the crashes around to different revisions
- incremental runs of the conversion *will* complete most of the time, but
depending on how often checkpoints are used, I've seen it croak on specific
commits and not being able to progress further :(
Thanks for any pointers or things to try!
Cheers
Uli
^ permalink raw reply
* Re: [PATCH 0/2] Use env for all perl invocations
From: Junio C Hamano @ 2017-01-12 8:21 UTC (permalink / raw)
To: Pat Pannuto; +Cc: git
In-Reply-To: <CAAnLKaHrGkAkF+kZtrawDSkuhVkvvUZONp6PQj6=3AGoAwFxyw@mail.gmail.com>
Pat Pannuto <pat.pannuto@gmail.com> writes:
> It feels weird to me that the perl path is fixed at
> compile/install-time as opposed to run-time discovery -- this means
> users can't change their perl install without breaking git?
Among the software packages that use interpreters like perl, python,
ruby, etc., there are ones that seem to consider that it is a good
idea to let "#!/usr/bin/env $language" pick whatever variant
[*1*] of the $language that happens to be on end-user's $PATH.
Git does not subscribe to that thought, and it is done for very good
reasons.
When you take a popular $language used by many software packages, it
is more than likely that one particular end user uses more than one
such package written in the same $language. If one assumes that
there is one variant of $language such software packages can all
use, then $PATH can be tweaked so that the common variant and no
other variants of $language can be found and you are done.
However, that is too simplistic in real life. If you are using Git
(which wants Perl 5.8 or later with certain libs) and some other
software package that needs a much older Perl, there is no such
single variant that can be placed on end-user's $PATH. Only when
all the other software packages write their she-bang line without
"env" and instead point at the exact variant they need, Git can use
the "env" to rely on $PATH, but at that point, Git is being overly
arrogant. It insists to be special among packages that use the same
$language and wants the variant it needs to be on $PATH.
Git knows that the real-world is not simplistic. Git is not
arrogant, either. And that is why it does not use "#!/usr/bin/env".
[Footnote]
*1* Here a "variant" of a $language refers to a binary of one
particular version of the $language, together with libs and
extensions it uses that are installed on the system. You
apparently have two variants, one installed as /usr/bin/perl,
the other as /usr/local/bin/perl.
^ permalink raw reply
* [PATCH 2/2] mailinfo: Understand forwarded patches
From: Matthew Wilcox @ 2017-01-12 9:20 UTC (permalink / raw)
To: git; +Cc: Matthew Wilcox, Jonathan Tan
In-Reply-To: <1484212824-14108-1-git-send-email-mawilcox@linuxonhyperv.com>
From: Matthew Wilcox <mawilcox@microsoft.com>
Extend the --scissors mechanism to strip off the preamble created by
forwarding a patch. There are a couple of extra headers ("Sent" and
"To") added by forwarding, but other than that, the --scissors option
will now remove patches forwarded from Microsoft Outlook to a Linux
email account.
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
---
mailinfo.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/mailinfo.c b/mailinfo.c
index 2059704a8..fc1275532 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -332,7 +332,7 @@ static void cleanup_subject(struct mailinfo *mi, struct strbuf *subject)
#define MAX_HDR_PARSED 10
static const char *header[MAX_HDR_PARSED] = {
- "From","Subject","Date",
+ "From","Subject","Date","Sent","To",
};
static inline int cmp_header(const struct strbuf *line, const char *hdr)
@@ -685,6 +685,13 @@ static int is_scissors_line(const char *line)
c++;
continue;
}
+ if (!memcmp(c, "Original Message", 16)) {
+ in_perforation = 1;
+ perforation += 16;
+ scissors += 16;
+ c += 15;
+ continue;
+ }
in_perforation = 0;
}
--
2.11.0
^ permalink raw reply related
* [PATCH 1/2] mailinfo: Add support for keep_cr
From: Matthew Wilcox @ 2017-01-12 9:20 UTC (permalink / raw)
To: git; +Cc: Matthew Wilcox, Jonathan Tan
From: Matthew Wilcox <mawilcox@microsoft.com>
If you have a base-64 encoded patch with CRLF endings (as produced
by forwarding a patch from Outlook to a Linux machine, for example),
the keep_cr setting is not honoured because keep_cr is only passed
to mailsplit, which does not look through the encoding. The keep_cr
logic needs to be applied after the base64 decode. I copied that
logic to handle_filter(), and rather than add a new keep_cr parameter
to handle_filter, I opted to add keep_cr to struct mailinfo; it seemed
appropriate given use_scissors was already there.
Then I needed to initialise keep_cr in the struct mailinfo passed from
git-am, and rather than thread a 'keep_cr' parameter all the way through
to parse_mail(), I decided to add keep_cr to struct am_state, which let
it be removed as a parameter from five other functions.
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
---
builtin/am.c | 49 ++++++++++++++++++++++++-------------------------
mailinfo.c | 6 ++++++
mailinfo.h | 1 +
3 files changed, 31 insertions(+), 25 deletions(-)
diff --git a/builtin/am.c b/builtin/am.c
index 31fb60578..6cb6e6ca8 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -124,6 +124,7 @@ struct am_state {
int keep; /* enum keep_type */
int message_id;
int scissors; /* enum scissors_type */
+ int keep_cr;
struct argv_array git_apply_opts;
const char *resolvemsg;
int committer_date_is_author_date;
@@ -143,6 +144,7 @@ static void am_state_init(struct am_state *state, const char *dir)
memset(state, 0, sizeof(*state));
+ state->keep_cr = -1;
assert(dir);
state->dir = xstrdup(dir);
@@ -697,7 +699,7 @@ static int detect_patch_format(const char **paths)
* a mbox file or a Maildir. Returns 0 on success, -1 on failure.
*/
static int split_mail_mbox(struct am_state *state, const char **paths,
- int keep_cr, int mboxrd)
+ int mboxrd)
{
struct child_process cp = CHILD_PROCESS_INIT;
struct strbuf last = STRBUF_INIT;
@@ -707,7 +709,7 @@ static int split_mail_mbox(struct am_state *state, const char **paths,
argv_array_pushf(&cp.args, "-d%d", state->prec);
argv_array_pushf(&cp.args, "-o%s", state->dir);
argv_array_push(&cp.args, "-b");
- if (keep_cr)
+ if (state->keep_cr)
argv_array_push(&cp.args, "--keep-cr");
if (mboxrd)
argv_array_push(&cp.args, "--mboxrd");
@@ -737,7 +739,7 @@ typedef int (*mail_conv_fn)(FILE *out, FILE *in, int keep_cr);
* Returns 0 on success, -1 on failure.
*/
static int split_mail_conv(mail_conv_fn fn, struct am_state *state,
- const char **paths, int keep_cr)
+ const char **paths)
{
static const char *stdin_only[] = {"-", NULL};
int i;
@@ -766,7 +768,7 @@ static int split_mail_conv(mail_conv_fn fn, struct am_state *state,
return error_errno(_("could not open '%s' for writing"),
mail);
- ret = fn(out, in, keep_cr);
+ ret = fn(out, in, state->keep_cr);
fclose(out);
fclose(in);
@@ -826,8 +828,7 @@ static int stgit_patch_to_mail(FILE *out, FILE *in, int keep_cr)
*
* Returns 0 on success, -1 on failure.
*/
-static int split_mail_stgit_series(struct am_state *state, const char **paths,
- int keep_cr)
+static int split_mail_stgit_series(struct am_state *state, const char **paths)
{
const char *series_dir;
char *series_dir_buf;
@@ -857,7 +858,7 @@ static int split_mail_stgit_series(struct am_state *state, const char **paths,
strbuf_release(&sb);
free(series_dir_buf);
- ret = split_mail_conv(stgit_patch_to_mail, state, patches.argv, keep_cr);
+ ret = split_mail_conv(stgit_patch_to_mail, state, patches.argv);
argv_array_clear(&patches);
return ret;
@@ -937,30 +938,27 @@ static int hg_patch_to_mail(FILE *out, FILE *in, int keep_cr)
* state->cur will be set to the index of the first mail, and state->last will
* be set to the index of the last mail.
*
- * Set keep_cr to 0 to convert all lines ending with \r\n to end with \n, 1
- * to disable this behavior, -1 to use the default configured setting.
- *
* Returns 0 on success, -1 on failure.
*/
static int split_mail(struct am_state *state, enum patch_format patch_format,
- const char **paths, int keep_cr)
+ const char **paths)
{
- if (keep_cr < 0) {
- keep_cr = 0;
- git_config_get_bool("am.keepcr", &keep_cr);
+ if (state->keep_cr < 0) {
+ state->keep_cr = 0;
+ git_config_get_bool("am.keepcr", &state->keep_cr);
}
switch (patch_format) {
case PATCH_FORMAT_MBOX:
- return split_mail_mbox(state, paths, keep_cr, 0);
+ return split_mail_mbox(state, paths, 0);
case PATCH_FORMAT_STGIT:
- return split_mail_conv(stgit_patch_to_mail, state, paths, keep_cr);
+ return split_mail_conv(stgit_patch_to_mail, state, paths);
case PATCH_FORMAT_STGIT_SERIES:
- return split_mail_stgit_series(state, paths, keep_cr);
+ return split_mail_stgit_series(state, paths);
case PATCH_FORMAT_HG:
- return split_mail_conv(hg_patch_to_mail, state, paths, keep_cr);
+ return split_mail_conv(hg_patch_to_mail, state, paths);
case PATCH_FORMAT_MBOXRD:
- return split_mail_mbox(state, paths, keep_cr, 1);
+ return split_mail_mbox(state, paths, 1);
default:
die("BUG: invalid patch_format");
}
@@ -971,7 +969,7 @@ static int split_mail(struct am_state *state, enum patch_format patch_format,
* Setup a new am session for applying patches
*/
static void am_setup(struct am_state *state, enum patch_format patch_format,
- const char **paths, int keep_cr)
+ const char **paths)
{
struct object_id curr_head;
const char *str;
@@ -988,7 +986,7 @@ static void am_setup(struct am_state *state, enum patch_format patch_format,
if (mkdir(state->dir, 0777) < 0 && errno != EEXIST)
die_errno(_("failed to create directory '%s'"), state->dir);
- if (split_mail(state, patch_format, paths, keep_cr) < 0) {
+ if (split_mail(state, patch_format, paths) < 0) {
am_destroy(state);
die(_("Failed to split patches."));
}
@@ -1276,6 +1274,8 @@ static int parse_mail(struct am_state *state, const char *mail)
die("BUG: invalid value for state->scissors");
}
+ mi.keep_cr = state->keep_cr;
+
mi.input = fopen(mail, "r");
if (!mi.input)
die("could not open input");
@@ -2224,7 +2224,6 @@ int cmd_am(int argc, const char **argv, const char *prefix)
{
struct am_state state;
int binary = -1;
- int keep_cr = -1;
int patch_format = PATCH_FORMAT_UNKNOWN;
enum resume_mode resume = RESUME_FALSE;
int in_progress;
@@ -2254,10 +2253,10 @@ int cmd_am(int argc, const char **argv, const char *prefix)
N_("pass -b flag to git-mailinfo"), KEEP_NON_PATCH),
OPT_BOOL('m', "message-id", &state.message_id,
N_("pass -m flag to git-mailinfo")),
- { OPTION_SET_INT, 0, "keep-cr", &keep_cr, NULL,
+ { OPTION_SET_INT, 0, "keep-cr", &state.keep_cr, NULL,
N_("pass --keep-cr flag to git-mailsplit for mbox format"),
PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, 1},
- { OPTION_SET_INT, 0, "no-keep-cr", &keep_cr, NULL,
+ { OPTION_SET_INT, 0, "no-keep-cr", &state.keep_cr, NULL,
N_("do not pass --keep-cr flag to git-mailsplit independent of am.keepcr"),
PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, 0},
OPT_BOOL('c', "scissors", &state.scissors,
@@ -2392,7 +2391,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
argv_array_push(&paths, mkpath("%s/%s", prefix, argv[i]));
}
- am_setup(&state, patch_format, paths.argv, keep_cr);
+ am_setup(&state, patch_format, paths.argv);
argv_array_clear(&paths);
}
diff --git a/mailinfo.c b/mailinfo.c
index a489d9d0f..2059704a8 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -812,6 +812,12 @@ static void handle_patch(struct mailinfo *mi, const struct strbuf *line)
static void handle_filter(struct mailinfo *mi, struct strbuf *line)
{
+ if (!mi->keep_cr && line->len > 1 &&
+ line->buf[line->len - 1] == '\n' &&
+ line->buf[line->len - 2] == '\r') {
+ strbuf_setlen(line, line->len - 2);
+ strbuf_addch(line, '\n');
+ }
switch (mi->filter_stage) {
case 0:
if (!handle_commit_msg(mi, line))
diff --git a/mailinfo.h b/mailinfo.h
index 04a25351d..9fddcf684 100644
--- a/mailinfo.h
+++ b/mailinfo.h
@@ -12,6 +12,7 @@ struct mailinfo {
struct strbuf email;
int keep_subject;
int keep_non_patch_brackets_in_subject;
+ int keep_cr;
int add_message_id;
int use_scissors;
int use_inbody_headers;
--
2.11.0
^ permalink raw reply related
* Re: [PATCH 2/2] Use 'env' to find perl instead of fixed path
From: Pat Pannuto @ 2017-01-12 7:17 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Junio C Hamano, git
In-Reply-To: <6fe462dd-929a-671b-a210-36ee38e99115@kdbg.org>
I'm not at all attached to changing all of them, just figured it made
sense while I was here.
Would a patch that changes only:
git-add--interactive.perl | 2 +-
git-archimport.perl | 2 +-
git-cvsexportcommit.perl | 2 +-
git-cvsimport.perl | 2 +-
git-cvsserver.perl | 2 +-
git-difftool.perl | 2 +-
git-relink.perl | 2 +-
git-send-email.perl | 2 +-
git-svn.perl | 2 +-
be more acceptable?
On Thu, Jan 12, 2017 at 1:27 AM, Johannes Sixt <j6t@kdbg.org> wrote:
> Am 12.01.2017 um 06:51 schrieb Pat Pannuto:
>>
>> diff --git a/git-add--interactive.perl b/git-add--interactive.perl
>> index cf6fc926a..6d7b6c35d 100755
>> --- a/git-add--interactive.perl
>> +++ b/git-add--interactive.perl
>> @@ -1,4 +1,4 @@
>> -#!/usr/bin/perl
>> +#!/usr/bin/env perl
>
>
> This change, and all others that affect installed external git programs, is
> a no-go. On Windows, our execve emulation is not complete. It would invoke
> only `env` (looked up in PATH), but not pass 'perl' as argument.
>
> Sorry for the bad news.
>
> I would have suggested to set PERL_PATH in your config.mak, but that does
> not change the generated perl scripts, I think. Perhaps you should implement
> that?
>
> I'm not thrilled about your changes to the test scripts, but I do not expect
> that they break on Windows.
>
> -- Hannes
>
^ permalink raw reply
* Re: [PATCH 0/2] Use env for all perl invocations
From: Pat Pannuto @ 2017-01-12 7:13 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <xmqqa8awn6i6.fsf@gitster.mtv.corp.google.com>
[plain text re-send, sorry]
Interesting, I'm guessing this came from when git was installed (
https://github.com/Homebrew/homebrew-core/blob/master/Formula/git.rb#L50
), when the perl path was likely still /usr/bin/perl
It feels weird to me that the perl path is fixed at
compile/install-time as opposed to run-time discovery -- this means
users can't change their perl install without breaking git?
On Thu, Jan 12, 2017 at 1:21 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Pat Pannuto <pat.pannuto@gmail.com> writes:
>
>> I spent a little while debugging why git-format-patch refused to believe
>> that SSL support was installed (Can't locate Net/SMTP/SSL.pm in @INC...)
>> Turns out that it was installed for my system's preferred /usr/local/bin/perl,
>> but not for git-format-patch's hard-coded /usr/bin/perl; changing the shebang
>> allowed git format-patch to work as expected.
>
> Isn't that an indication that you are not building correctly?
> Perhaps
>
> $ git grep 'Define PERL_' Makefile
> $ make PERL_PATH=/usr/local/bin/perl
>
> would help?
^ permalink raw reply
* Re: [RFC PATCH 3/2] vreportf: add prefix to each line
From: Jeff King @ 2017-01-12 6:59 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <xmqqpojtmeld.fsf@gitster.mtv.corp.google.com>
On Wed, Jan 11, 2017 at 02:11:42PM -0800, Junio C Hamano wrote:
> > It's actually kind of ugly. For instance, a failing test in
> > t3600 now produces:
> >
> > error: the following files have staged content different from both the
> > error: file and the HEAD:
> > error: bar.txt
> > error: foo.txt
> > error: (use -f to force removal)
> >
> > which seems a bit aggressive.
>
> I agree that it is ugly, but one reason I was hoping to do this
> myself (or have somebody else do it by procrastinating) was that I
> thought it may help i18n. That is, for an original
>
> error(_("we found an error"))
>
> a .po file may translate the string to a multi-line string that has
> LFs in it and the output would look correct. The translator already
> can do so by indenting the second and subsequent lines by the same
> column-width as "error: " (or its translation in their language, if
> we are going to i18n these headers), but that (1) is extra work for
> them, and (2) makes it impossible to have the same message appear in
> different contexts (i.e. "error:" vs "warning:" that have different
> column-widths).
Yes, I agree that would be a functional benefit. I'm just hoping we can
do it in a way that is visually pleasing.
> > It also screws up messages which indent with tabs (the prefix eats
> > up some of the tabstop, making the indentation smaller).
>
> This is unavoidable and at the same time is a non-issue, isn't it?
> Messages that indent the second and subsequent lines with tabs are
> compensating the lack of the multi-line support of vreportf(), which
> this RFC patch fixes. They may need to be adjusted to the new world
> order, but that is a good thing. New multi-line messages no longer
> have to worry about the prefix that is added only to the first line
> when continuing the message to multiple lines.
I'm not so sure it is just about compensating. Look at the message
quoted above. The original looks like:
error: the following files have staged content different from both the
file and the HEAD:
bar.txt
foo.txt
(use -f to force removal)
The leading whitespace is visually separating the list of files, not
just from the line with "error:", but from the other lines.
Though I think if we replaced tabs with spaces in this instance, then
they would still be bumped relative to the rest of the text.
> > It may be possible to address some of that by using some
> > other kind of continuation marker (instead of just repeating
> > the prefix), and expanding initial tabs.
>
> Yes indeed. The "some other kind of continuation marker" could just
> be a run of spaces that fill the same column as the "error: " or
> other prefix given to the first line.
I tried that, along with several other variants, but it gets
confusing/ugly when mixed with indentation that is significant to the
line. For example, the t3600 message becomes:
error: the following files have staged content different from both the
file and the HEAD:
bar.txt
foo.txt
(use -f to force removal)
Which is arguably better than what we have now, but still looks pretty
bad to me.
I wonder if it would help for the marker to end in a non-whitespace
character. Like:
error: the following files have staged content different from both the
: file and the HEAD:
: bar.txt
: foo.txt
: (use -f to force removal)
or something. The ":" is a bit sparse looking. Maybe there are better
options. That does ruin line-by-line selection for cut-and-paste,
though.
So I dunno. I am open to ideas, but I didn't find one that I really
liked (this patch is actually a leftover from before Christmas, so I
don't even remember all the things I tried, just that I didn't like any
of them ;) ).
-Peff
^ permalink raw reply
* Re: [PATCH 2/2] Use 'env' to find perl instead of fixed path
From: Johannes Sixt @ 2017-01-12 6:27 UTC (permalink / raw)
To: Pat Pannuto; +Cc: gitster, git
In-Reply-To: <20170112055140.29877-3-pat.pannuto@gmail.com>
Am 12.01.2017 um 06:51 schrieb Pat Pannuto:
> diff --git a/git-add--interactive.perl b/git-add--interactive.perl
> index cf6fc926a..6d7b6c35d 100755
> --- a/git-add--interactive.perl
> +++ b/git-add--interactive.perl
> @@ -1,4 +1,4 @@
> -#!/usr/bin/perl
> +#!/usr/bin/env perl
This change, and all others that affect installed external git programs,
is a no-go. On Windows, our execve emulation is not complete. It would
invoke only `env` (looked up in PATH), but not pass 'perl' as argument.
Sorry for the bad news.
I would have suggested to set PERL_PATH in your config.mak, but that
does not change the generated perl scripts, I think. Perhaps you should
implement that?
I'm not thrilled about your changes to the test scripts, but I do not
expect that they break on Windows.
-- Hannes
^ permalink raw reply
* Re: [PATCH 0/2] Use env for all perl invocations
From: Junio C Hamano @ 2017-01-12 6:21 UTC (permalink / raw)
To: Pat Pannuto; +Cc: git
In-Reply-To: <20170112055140.29877-1-pat.pannuto@gmail.com>
Pat Pannuto <pat.pannuto@gmail.com> writes:
> I spent a little while debugging why git-format-patch refused to believe
> that SSL support was installed (Can't locate Net/SMTP/SSL.pm in @INC...)
> Turns out that it was installed for my system's preferred /usr/local/bin/perl,
> but not for git-format-patch's hard-coded /usr/bin/perl; changing the shebang
> allowed git format-patch to work as expected.
Isn't that an indication that you are not building correctly?
Perhaps
$ git grep 'Define PERL_' Makefile
$ make PERL_PATH=/usr/local/bin/perl
would help?
^ permalink raw reply
* [PATCH 2/2] Use 'env' to find perl instead of fixed path
From: Pat Pannuto @ 2017-01-12 5:51 UTC (permalink / raw)
To: gitster, git; +Cc: Pat Pannuto
In-Reply-To: <20170112055140.29877-1-pat.pannuto@gmail.com>
Depending on system configuration, /usr/bin/perl may not be the
preferred perl interpreter, use /usr/bin/env perl to invoke perl
instead to repsect user preferences.
In most cases this will not matter as any perl install will work,
but for applications such as git-format-patch, which may require
plugins such as Net/SMTP/SSL.pm to be installed, it is very confusing
when git fails to work after installation because it chose the
wrong perl installation.
This patch converts all shebangs to use env for consistency across
the project.
Signed-off-by: Pat Pannuto <pat.pannuto@gmail.com>
---
Documentation/build-docdep.perl | 2 +-
Documentation/cat-texi.perl | 2 +-
Documentation/cmd-list.perl | 2 +-
Documentation/fix-texi.perl | 2 +-
Documentation/lint-gitlink.perl | 2 +-
compat/vcbuild/scripts/clink.pl | 2 +-
compat/vcbuild/scripts/lib.pl | 2 +-
contrib/buildsystems/engine.pl | 2 +-
contrib/buildsystems/generate | 2 +-
contrib/buildsystems/parse.pl | 2 +-
contrib/contacts/git-contacts | 2 +-
contrib/credential/netrc/git-credential-netrc | 2 +-
contrib/credential/netrc/test.pl | 2 +-
contrib/diff-highlight/diff-highlight | 2 +-
contrib/examples/git-remote.perl | 2 +-
contrib/examples/git-rerere.perl | 2 +-
contrib/examples/git-svnimport.perl | 2 +-
contrib/fast-import/git-import.perl | 2 +-
contrib/fast-import/import-directories.perl | 2 +-
contrib/fast-import/import-tars.perl | 2 +-
contrib/hooks/setgitperms.perl | 2 +-
contrib/hooks/update-paranoid | 2 +-
contrib/long-running-filter/example.pl | 2 +-
contrib/mw-to-git/git-mw.perl | 2 +-
contrib/mw-to-git/git-remote-mediawiki.perl | 2 +-
contrib/mw-to-git/t/test-gitmw.pl | 2 +-
contrib/stats/mailmap.pl | 2 +-
contrib/stats/packinfo.pl | 2 +-
git-add--interactive.perl | 2 +-
git-archimport.perl | 2 +-
git-cvsexportcommit.perl | 2 +-
git-cvsimport.perl | 2 +-
git-cvsserver.perl | 2 +-
git-difftool.perl | 2 +-
git-relink.perl | 2 +-
git-send-email.perl | 2 +-
git-svn.perl | 2 +-
gitweb/gitweb.perl | 2 +-
t/Git-SVN/Utils/can_compress.t | 2 +-
t/Git-SVN/Utils/fatal.t | 2 +-
t/check-non-portable-shell.pl | 2 +-
t/gitweb-lib.sh | 2 +-
t/perf/aggregate.perl | 2 +-
t/perf/min_time.perl | 2 +-
t/t0202/test.pl | 2 +-
t/t4034/perl/post | 2 +-
t/t4034/perl/pre | 2 +-
t/t9000/test.pl | 2 +-
t/t9500-gitweb-standalone-no-errors.sh | 2 +-
t/t9700/test.pl | 2 +-
t/test-terminal.perl | 2 +-
51 files changed, 51 insertions(+), 51 deletions(-)
diff --git a/Documentation/build-docdep.perl b/Documentation/build-docdep.perl
index ba4205e03..dc50f21f3 100755
--- a/Documentation/build-docdep.perl
+++ b/Documentation/build-docdep.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
my %include = ();
my %included = ();
diff --git a/Documentation/cat-texi.perl b/Documentation/cat-texi.perl
index 1cd28b1b5..98dcc2c42 100755
--- a/Documentation/cat-texi.perl
+++ b/Documentation/cat-texi.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use warnings;
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index ba640a441..f440eebe3 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use warnings;
diff --git a/Documentation/fix-texi.perl b/Documentation/fix-texi.perl
index c247aece7..61287a0a9 100755
--- a/Documentation/fix-texi.perl
+++ b/Documentation/fix-texi.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use warnings;
diff --git a/Documentation/lint-gitlink.perl b/Documentation/lint-gitlink.perl
index 476cc30b8..3e4b00eda 100755
--- a/Documentation/lint-gitlink.perl
+++ b/Documentation/lint-gitlink.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use File::Find;
use Getopt::Long;
diff --git a/compat/vcbuild/scripts/clink.pl b/compat/vcbuild/scripts/clink.pl
index 46eb61c5c..857847703 100755
--- a/compat/vcbuild/scripts/clink.pl
+++ b/compat/vcbuild/scripts/clink.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
######################################################################
# Compiles or links files
#
diff --git a/compat/vcbuild/scripts/lib.pl b/compat/vcbuild/scripts/lib.pl
index e571b8470..9b43f1270 100755
--- a/compat/vcbuild/scripts/lib.pl
+++ b/compat/vcbuild/scripts/lib.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
######################################################################
# Libifies files on Windows
#
diff --git a/contrib/buildsystems/engine.pl b/contrib/buildsystems/engine.pl
index a173669ce..ace1fd4bf 100755
--- a/contrib/buildsystems/engine.pl
+++ b/contrib/buildsystems/engine.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
######################################################################
# Do not call this script directly!
#
diff --git a/contrib/buildsystems/generate b/contrib/buildsystems/generate
index 9af89454a..d6ce919cb 100755
--- a/contrib/buildsystems/generate
+++ b/contrib/buildsystems/generate
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
######################################################################
# Generate buildsystem files
#
diff --git a/contrib/buildsystems/parse.pl b/contrib/buildsystems/parse.pl
index 33ca89eb0..492acf447 100755
--- a/contrib/buildsystems/parse.pl
+++ b/contrib/buildsystems/parse.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
######################################################################
# Do not call this script directly!
#
diff --git a/contrib/contacts/git-contacts b/contrib/contacts/git-contacts
index dbe2abf27..70ec2039a 100755
--- a/contrib/contacts/git-contacts
+++ b/contrib/contacts/git-contacts
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# List people who might be interested in a patch. Useful as the argument to
# git-send-email --cc-cmd option, and in other situations.
diff --git a/contrib/credential/netrc/git-credential-netrc b/contrib/credential/netrc/git-credential-netrc
index 1571a7b26..ec8178f26 100755
--- a/contrib/credential/netrc/git-credential-netrc
+++ b/contrib/credential/netrc/git-credential-netrc
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/contrib/credential/netrc/test.pl b/contrib/credential/netrc/test.pl
index 169b6463c..6b44ba54d 100755
--- a/contrib/credential/netrc/test.pl
+++ b/contrib/credential/netrc/test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use warnings;
use strict;
diff --git a/contrib/diff-highlight/diff-highlight b/contrib/diff-highlight/diff-highlight
index 81bd8040e..ecf419542 100755
--- a/contrib/diff-highlight/diff-highlight
+++ b/contrib/diff-highlight/diff-highlight
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use 5.008;
use warnings FATAL => 'all';
diff --git a/contrib/examples/git-remote.perl b/contrib/examples/git-remote.perl
index 5bf3ffd4c..2c8f18a13 100755
--- a/contrib/examples/git-remote.perl
+++ b/contrib/examples/git-remote.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/contrib/examples/git-rerere.perl b/contrib/examples/git-rerere.perl
index 4f692091e..110c27f4f 100755
--- a/contrib/examples/git-rerere.perl
+++ b/contrib/examples/git-rerere.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
#
# REuse REcorded REsolve. This tool records a conflicted automerge
# result and its hand resolution, and helps to resolve future
diff --git a/contrib/examples/git-svnimport.perl b/contrib/examples/git-svnimport.perl
index c414f0d9c..d183a8d66 100755
--- a/contrib/examples/git-svnimport.perl
+++ b/contrib/examples/git-svnimport.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# This tool is copyright (c) 2005, Matthias Urlichs.
# It is released under the Gnu Public License, version 2.
diff --git a/contrib/fast-import/git-import.perl b/contrib/fast-import/git-import.perl
index 0891b9e36..440790523 100755
--- a/contrib/fast-import/git-import.perl
+++ b/contrib/fast-import/git-import.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
#
# Performs an initial import of a directory. This is the equivalent
# of doing 'git init; git add .; git commit'. It's a little slower,
diff --git a/contrib/fast-import/import-directories.perl b/contrib/fast-import/import-directories.perl
index 4dec1f18e..197307570 100755
--- a/contrib/fast-import/import-directories.perl
+++ b/contrib/fast-import/import-directories.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
#
# Copyright 2008-2009 Peter Krefting <peter@softwolves.pp.se>
#
diff --git a/contrib/fast-import/import-tars.perl b/contrib/fast-import/import-tars.perl
index d60b4315e..30f3ff384 100755
--- a/contrib/fast-import/import-tars.perl
+++ b/contrib/fast-import/import-tars.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
## tar archive frontend for git-fast-import
##
diff --git a/contrib/hooks/setgitperms.perl b/contrib/hooks/setgitperms.perl
index 2770a1b1d..18444e015 100755
--- a/contrib/hooks/setgitperms.perl
+++ b/contrib/hooks/setgitperms.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
#
# Copyright (c) 2006 Josh England
#
diff --git a/contrib/hooks/update-paranoid b/contrib/hooks/update-paranoid
index d18b317b2..95595acf5 100755
--- a/contrib/hooks/update-paranoid
+++ b/contrib/hooks/update-paranoid
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use strict;
use File::Spec;
diff --git a/contrib/long-running-filter/example.pl b/contrib/long-running-filter/example.pl
index a677569dd..0ca49e370 100755
--- a/contrib/long-running-filter/example.pl
+++ b/contrib/long-running-filter/example.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
#
# Example implementation for the Git filter protocol version 2
# See Documentation/gitattributes.txt, section "Filter Protocol"
diff --git a/contrib/mw-to-git/git-mw.perl b/contrib/mw-to-git/git-mw.perl
index 28df3ee32..50c0549b5 100755
--- a/contrib/mw-to-git/git-mw.perl
+++ b/contrib/mw-to-git/git-mw.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2013
# Benoit Person <benoit.person@ensimag.imag.fr>
diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl
index 41e74fba1..f8ce245cf 100755
--- a/contrib/mw-to-git/git-remote-mediawiki.perl
+++ b/contrib/mw-to-git/git-remote-mediawiki.perl
@@ -1,4 +1,4 @@
-#! /usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2011
# Jérémie Nikaes <jeremie.nikaes@ensimag.imag.fr>
diff --git a/contrib/mw-to-git/t/test-gitmw.pl b/contrib/mw-to-git/t/test-gitmw.pl
index 8d0e7c078..a8272d942 100755
--- a/contrib/mw-to-git/t/test-gitmw.pl
+++ b/contrib/mw-to-git/t/test-gitmw.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2012
# Charles Roussel <charles.roussel@ensimag.imag.fr>
# Simon Cathebras <simon.cathebras@ensimag.imag.fr>
diff --git a/contrib/stats/mailmap.pl b/contrib/stats/mailmap.pl
index 9513f5e35..469af8240 100755
--- a/contrib/stats/mailmap.pl
+++ b/contrib/stats/mailmap.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use warnings 'all';
use strict;
diff --git a/contrib/stats/packinfo.pl b/contrib/stats/packinfo.pl
index be188c0f1..51823ac94 100755
--- a/contrib/stats/packinfo.pl
+++ b/contrib/stats/packinfo.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
#
# This tool will print vaguely pretty information about a pack. It
# expects the output of "git verify-pack -v" as input on stdin.
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index cf6fc926a..6d7b6c35d 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use 5.008;
use strict;
diff --git a/git-archimport.perl b/git-archimport.perl
index 9cb123a07..bb423e781 100755
--- a/git-archimport.perl
+++ b/git-archimport.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
#
# This tool is copyright (c) 2005, Martin Langhoff.
# It is released under the Gnu Public License, version 2.
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index d13f02da9..c2ebfb59f 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use 5.008;
use strict;
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 1e4e65a45..5dcdd8106 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# This tool is copyright (c) 2005, Matthias Urlichs.
# It is released under the Gnu Public License, version 2.
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index d50c85ed7..3ae5e748b 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
####
#### This application is a CVS emulation layer for git.
diff --git a/git-difftool.perl b/git-difftool.perl
index df59bdfe9..a34d0f7fd 100755
--- a/git-difftool.perl
+++ b/git-difftool.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (c) 2009, 2010 David Aguilar
# Copyright (c) 2012 Tim Henigan
#
diff --git a/git-relink.perl b/git-relink.perl
index 236a3521a..b51348fa6 100755
--- a/git-relink.perl
+++ b/git-relink.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright 2005, Ryan Anderson <ryan@michonline.com>
# Distribution permitted under the GPL v2, as distributed
# by the Free Software Foundation.
diff --git a/git-send-email.perl b/git-send-email.perl
index 068d60b3e..678d823af 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
#
# Copyright 2002,2005 Greg Kroah-Hartman <greg@kroah.com>
# Copyright 2005 Ryan Anderson <ryan@michonline.com>
diff --git a/git-svn.perl b/git-svn.perl
index fa4236478..ae3991524 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Copyright (C) 2006, Eric Wong <normalperson@yhbt.net>
# License: GPL v2 or later
use 5.008;
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 7cf68f07b..d084360e6 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# gitweb - simple web interface to track changes in git repositories
#
diff --git a/t/Git-SVN/Utils/can_compress.t b/t/Git-SVN/Utils/can_compress.t
index d7b49b8d5..0cdedb25b 100755
--- a/t/Git-SVN/Utils/can_compress.t
+++ b/t/Git-SVN/Utils/can_compress.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/t/Git-SVN/Utils/fatal.t b/t/Git-SVN/Utils/fatal.t
index 49e143829..75aaf1633 100755
--- a/t/Git-SVN/Utils/fatal.t
+++ b/t/Git-SVN/Utils/fatal.t
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/t/check-non-portable-shell.pl b/t/check-non-portable-shell.pl
index b170cbc04..3c3e2e7d4 100755
--- a/t/check-non-portable-shell.pl
+++ b/t/check-non-portable-shell.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
# Test t0000..t9999.sh for non portable shell scripts
# This script can be called with one or more filenames as parameters
diff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh
index d5dab5a94..b23843ff4 100644
--- a/t/gitweb-lib.sh
+++ b/t/gitweb-lib.sh
@@ -7,7 +7,7 @@
gitweb_init () {
safe_pwd="$(perl -MPOSIX=getcwd -e 'print quotemeta(getcwd)')"
cat >gitweb_config.perl <<EOF
-#!/usr/bin/perl
+#!/usr/bin/env perl
# gitweb configuration for tests
diff --git a/t/perf/aggregate.perl b/t/perf/aggregate.perl
index 924b19dab..2c6278ca6 100755
--- a/t/perf/aggregate.perl
+++ b/t/perf/aggregate.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use lib '../../perl/blib/lib';
use strict;
diff --git a/t/perf/min_time.perl b/t/perf/min_time.perl
index c1a2717e0..2595eae61 100755
--- a/t/perf/min_time.perl
+++ b/t/perf/min_time.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
my $minrt = 1e100;
my $min;
diff --git a/t/t0202/test.pl b/t/t0202/test.pl
index 2cbf7b959..d8e967bbc 100755
--- a/t/t0202/test.pl
+++ b/t/t0202/test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use 5.008;
use lib (split(/:/, $ENV{GITPERLLIB}));
use strict;
diff --git a/t/t4034/perl/post b/t/t4034/perl/post
index e8b72ef5d..87500971d 100644
--- a/t/t4034/perl/post
+++ b/t/t4034/perl/post
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use strict;
diff --git a/t/t4034/perl/pre b/t/t4034/perl/pre
index f6610d37b..5ab5aa42f 100644
--- a/t/t4034/perl/pre
+++ b/t/t4034/perl/pre
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use strict;
diff --git a/t/t9000/test.pl b/t/t9000/test.pl
index dfeaa9c65..4e47f3887 100755
--- a/t/t9000/test.pl
+++ b/t/t9000/test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use lib (split(/:/, $ENV{GITPERLLIB}));
use 5.008;
diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh
index 6d06ed96c..d8b5622b5 100755
--- a/t/t9500-gitweb-standalone-no-errors.sh
+++ b/t/t9500-gitweb-standalone-no-errors.sh
@@ -712,7 +712,7 @@ test_expect_success HIGHLIGHT \
test_expect_success HIGHLIGHT \
'syntax highlighting (highlighter language autodetection)' \
'git config gitweb.highlight yes &&
- echo "#!/usr/bin/perl" > test &&
+ echo "#!/usr/bin/env perl" > test &&
git add test &&
git commit -m "Add test" &&
gitweb_run "p=.git;a=blob;f=test"'
diff --git a/t/t9700/test.pl b/t/t9700/test.pl
index 1b75c9196..c0be7e895 100755
--- a/t/t9700/test.pl
+++ b/t/t9700/test.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use lib (split(/:/, $ENV{GITPERLLIB}));
use 5.008;
diff --git a/t/test-terminal.perl b/t/test-terminal.perl
index 96b6a03e1..d1d40c0db 100755
--- a/t/test-terminal.perl
+++ b/t/test-terminal.perl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
use 5.008;
use strict;
use warnings;
--
2.11.0
^ permalink raw reply related
* [PATCH 0/2] Use env for all perl invocations
From: Pat Pannuto @ 2017-01-12 5:51 UTC (permalink / raw)
To: gitster, git; +Cc: Pat Pannuto
I spent a little while debugging why git-format-patch refused to believe
that SSL support was installed (Can't locate Net/SMTP/SSL.pm in @INC...)
Turns out that it was installed for my system's preferred /usr/local/bin/perl,
but not for git-format-patch's hard-coded /usr/bin/perl; changing the shebang
allowed git format-patch to work as expected.
This patch set converts all perl invocations in git to use env so that the
user-preferred perl interpreter is always used.
Pat Pannuto (2):
Convert all 'perl -w' to 'perl' + 'use warnings;'
Use 'env' to find perl instead of fixed path
Documentation/build-docdep.perl | 2 +-
Documentation/cat-texi.perl | 4 +++-
Documentation/cmd-list.perl | 4 +++-
Documentation/fix-texi.perl | 4 +++-
Documentation/lint-gitlink.perl | 2 +-
compat/vcbuild/scripts/clink.pl | 3 ++-
compat/vcbuild/scripts/lib.pl | 3 ++-
contrib/buildsystems/engine.pl | 3 ++-
contrib/buildsystems/generate | 3 ++-
contrib/buildsystems/parse.pl | 3 ++-
contrib/contacts/git-contacts | 2 +-
contrib/credential/netrc/git-credential-netrc | 2 +-
contrib/credential/netrc/test.pl | 2 +-
contrib/diff-highlight/diff-highlight | 2 +-
contrib/examples/git-remote.perl | 3 ++-
contrib/examples/git-rerere.perl | 2 +-
contrib/examples/git-svnimport.perl | 2 +-
contrib/fast-import/git-import.perl | 2 +-
contrib/fast-import/import-directories.perl | 2 +-
contrib/fast-import/import-tars.perl | 2 +-
contrib/hooks/setgitperms.perl | 2 +-
contrib/hooks/update-paranoid | 2 +-
contrib/long-running-filter/example.pl | 2 +-
contrib/mw-to-git/git-mw.perl | 2 +-
contrib/mw-to-git/git-remote-mediawiki.perl | 2 +-
contrib/mw-to-git/t/test-gitmw.pl | 5 ++++-
contrib/stats/mailmap.pl | 2 +-
contrib/stats/packinfo.pl | 2 +-
git-add--interactive.perl | 2 +-
git-archimport.perl | 2 +-
git-cvsexportcommit.perl | 2 +-
git-cvsimport.perl | 2 +-
git-cvsserver.perl | 2 +-
git-difftool.perl | 2 +-
git-relink.perl | 2 +-
git-send-email.perl | 2 +-
git-svn.perl | 2 +-
gitweb/gitweb.perl | 2 +-
t/Git-SVN/Utils/can_compress.t | 2 +-
t/Git-SVN/Utils/fatal.t | 2 +-
t/check-non-portable-shell.pl | 2 +-
t/gitweb-lib.sh | 2 +-
t/perf/aggregate.perl | 2 +-
t/perf/min_time.perl | 2 +-
t/t0202/test.pl | 2 +-
t/t4034/perl/post | 2 +-
t/t4034/perl/pre | 2 +-
t/t9000/test.pl | 2 +-
t/t9500-gitweb-standalone-no-errors.sh | 2 +-
t/t9700/test.pl | 2 +-
t/test-terminal.perl | 2 +-
51 files changed, 66 insertions(+), 51 deletions(-)
--
2.11.0
^ permalink raw reply
* [PATCH 1/2] Convert all 'perl -w' to 'perl' + 'use warnings;'
From: Pat Pannuto @ 2017-01-12 5:51 UTC (permalink / raw)
To: gitster, git; +Cc: Pat Pannuto
In-Reply-To: <20170112055140.29877-1-pat.pannuto@gmail.com>
This commit is in preparation for converting all shebangs to use 'env'
instead of a fixed perl path, which will not allow for arguments to 'perl'.
Signed-off-by: Pat Pannuto <pat.pannuto@gmail.com>
---
Documentation/cat-texi.perl | 4 +++-
Documentation/cmd-list.perl | 4 +++-
Documentation/fix-texi.perl | 4 +++-
compat/vcbuild/scripts/clink.pl | 3 ++-
compat/vcbuild/scripts/lib.pl | 3 ++-
contrib/buildsystems/engine.pl | 3 ++-
contrib/buildsystems/generate | 3 ++-
contrib/buildsystems/parse.pl | 3 ++-
contrib/examples/git-remote.perl | 3 ++-
contrib/mw-to-git/t/test-gitmw.pl | 5 ++++-
10 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/Documentation/cat-texi.perl b/Documentation/cat-texi.perl
index 87437f8a9..1cd28b1b5 100755
--- a/Documentation/cat-texi.perl
+++ b/Documentation/cat-texi.perl
@@ -1,4 +1,6 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
+
+use warnings;
my @menu = ();
my $output = $ARGV[0];
diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl
index 5aa73cfe4..ba640a441 100755
--- a/Documentation/cmd-list.perl
+++ b/Documentation/cmd-list.perl
@@ -1,4 +1,6 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
+
+use warnings;
use File::Compare qw(compare);
diff --git a/Documentation/fix-texi.perl b/Documentation/fix-texi.perl
index ff7d78f62..c247aece7 100755
--- a/Documentation/fix-texi.perl
+++ b/Documentation/fix-texi.perl
@@ -1,4 +1,6 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
+
+use warnings;
while (<>) {
if (/^\@setfilename/) {
diff --git a/compat/vcbuild/scripts/clink.pl b/compat/vcbuild/scripts/clink.pl
index a87d0da51..46eb61c5c 100755
--- a/compat/vcbuild/scripts/clink.pl
+++ b/compat/vcbuild/scripts/clink.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
######################################################################
# Compiles or links files
#
@@ -10,6 +10,7 @@
# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>
######################################################################
use strict;
+use warnings;
my @args = ();
my @cflags = ();
my $is_linking = 0;
diff --git a/compat/vcbuild/scripts/lib.pl b/compat/vcbuild/scripts/lib.pl
index d8054e469..e571b8470 100755
--- a/compat/vcbuild/scripts/lib.pl
+++ b/compat/vcbuild/scripts/lib.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
######################################################################
# Libifies files on Windows
#
@@ -10,6 +10,7 @@
# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>
######################################################################
use strict;
+use warnings;
my @args = ();
while (@ARGV) {
my $arg = shift @ARGV;
diff --git a/contrib/buildsystems/engine.pl b/contrib/buildsystems/engine.pl
index 23da787dc..a173669ce 100755
--- a/contrib/buildsystems/engine.pl
+++ b/contrib/buildsystems/engine.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
######################################################################
# Do not call this script directly!
#
@@ -8,6 +8,7 @@
# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>
######################################################################
use strict;
+use warnings;
use File::Basename;
use File::Spec;
use Cwd;
diff --git a/contrib/buildsystems/generate b/contrib/buildsystems/generate
index bc10f25ff..9af89454a 100755
--- a/contrib/buildsystems/generate
+++ b/contrib/buildsystems/generate
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
######################################################################
# Generate buildsystem files
#
@@ -19,6 +19,7 @@
# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>
######################################################################
use strict;
+use warnings;
use File::Basename;
use Cwd;
diff --git a/contrib/buildsystems/parse.pl b/contrib/buildsystems/parse.pl
index c9656ece9..33ca89eb0 100755
--- a/contrib/buildsystems/parse.pl
+++ b/contrib/buildsystems/parse.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
######################################################################
# Do not call this script directly!
#
@@ -8,6 +8,7 @@
# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>
######################################################################
use strict;
+use warnings;
use File::Basename;
use Cwd;
diff --git a/contrib/examples/git-remote.perl b/contrib/examples/git-remote.perl
index d42df7b41..5bf3ffd4c 100755
--- a/contrib/examples/git-remote.perl
+++ b/contrib/examples/git-remote.perl
@@ -1,6 +1,7 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
use strict;
+use warnings;
use Git;
my $git = Git->repository();
diff --git a/contrib/mw-to-git/t/test-gitmw.pl b/contrib/mw-to-git/t/test-gitmw.pl
index 0ff76259f..8d0e7c078 100755
--- a/contrib/mw-to-git/t/test-gitmw.pl
+++ b/contrib/mw-to-git/t/test-gitmw.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w -s
+#!/usr/bin/perl
# Copyright (C) 2012
# Charles Roussel <charles.roussel@ensimag.imag.fr>
# Simon Cathebras <simon.cathebras@ensimag.imag.fr>
@@ -22,6 +22,9 @@
# "edit_page"
# "getallpagename"
+use strict;
+use warnings;
+
use MediaWiki::API;
use Getopt::Long;
use encoding 'utf8';
--
2.11.0
^ permalink raw reply related
* Re: [ANNOUNCE] git-test: run automated tests against a range of Git commits
From: Michael Haggerty @ 2017-01-12 5:02 UTC (permalink / raw)
To: Jeff King; +Cc: git discussion list
In-Reply-To: <20170110093502.wbfgof55gdo6mtov@sigill.intra.peff.net>
On 01/10/2017 10:35 AM, Jeff King wrote:
> On Sun, Jan 08, 2017 at 10:52:25AM +0100, Michael Haggerty wrote:
>> [...]
Since my last email, I have implemented a bunch of what we discussed
[1]. Because of the new semantics, I also *renamed the main command* from
git test range [...]
to
git test run [...]
>> I'm thinking of maybe
>>
>> * If an argument matches `*..*`, pass it to `rev-list` (like now).
This was already implemented.
>> * Otherwise, treat each argument as a single commit/tree (i.e., pass it
>> to `rev-parse`).
This is now implemented, too. Plus, it is now allowed to specify
multiple commits and/or ranges in a single invocation.
>> * If no argument is specified, test `@{u}..` (assuming that an
>> upstream is configured). Though actually, this won't be as
>> convenient as it sounds, because (a) `git test` is often run
>> in a separate worktree, and (2) on errors, it currently leaves the
>> repository with a detached `HEAD`.
I decided that if no argument is specified, it makes more sense to test
HEAD if the working tree is clean, and the contents of the working tree
otherwise. In the latter case no results are stored to notes, but it is
still useful to be able to run a preconfigured test quickly while
working. These are both implemented.
>> * Support a `--stdin` option, to read a list of commits/trees to test
>> from standard input. By this mechanism, users could use arbitrary
>> `rev-list` commands to choose what to test.
This is now implemented, too.
> [...]
>> I think ideally `git notes add` would look for pre-existing notes, and:
>>
>> * If none are found, create an empty notes reference.
>>
>> * If pre-existing notes are found and there was no existing test with
>> that name, probably just leave the old notes in place.
>>
>> * If pre-existing notes are found and there was already a test with
>> that name but a different command, perhaps insist that the user
>> decide explicitly whether to forget the old results or continue using
>> them. This might help users avoid the mistake of re-using old results
>> even if they change the manner of testing.
>
> I'm not quite sure what you mean here. By "test" and "command", do you
> mean the test name that is used in the notes ref, and the command that
> it is defined as?
By "test", I mean a test as configured in `git-test` and referred to by
its name (e.g., in `--test=name`). Currently the only configuration for
a test is `test.<name>.command`, but I structured the namespace that way
to leave room to add more configuration in the future.
> In the notes-cache.c subsystem, the commit message stores a validity
> token which must match in order to use the cache. You could do something
> similar here (store the executed command in the commit message, and
> invalidate the cache the user has changed the command). The notes-cache
> stuff isn't available outside of the C code, though. You could either
> expose it, or just do something similar longhand.
>
> Thinking about it, though, I did notice that the tree sha1 is not the
> only input to the cache. Things like config.mak (not to mention the
> system itself) contribute to the test results. So no system will ever be
> perfect, and it seems like just making an easy way to force a retest (or
> just invalidate the whole cache) would be sufficient.
It's true that the tree and the test command are not the only inputs to
the testing machinery. I wasn't hoping to build a watertight system to
prevent accidental use of old results when `config.mak` or something
else in the environment has changed. I was only trying to give the user
a reminder that if they change the command, it's a good time to consider
whether the old results have to be invalidated.
I suppose if we wanted to make this system more watertight, we could let
the test configuration specify the names of other files on which its
results depend; for example,
test.default.command = make -j16 test
test.default.auxiliaryInput = config.mak
and include some kind of hash of the auxiliary inputs in a validity
token. But that feels like overkill.
> [...]
>> Yeah, this is awkward, not only because many people don't know what to
>> make of detached HEAD, but also because it makes it awkward in general
>> to use `git test` in your main working directory. I didn't model this
>> behavior on `git rebase --interactive`'s `edit` command, because I
>> rarely use that. But I can see how they would fit together pretty well
>> for people who like that workflow.
>
> Yeah, after sleeping on it, I think it's best if "git test" remains
> separate from that. It's primary function is to run the test, possibly
> serving up a cached answer. So it would be perfectly reasonable to do:
>
> git rebase -x 'git test range HEAD'
>
> to accomplish the interactive testing (though perhaps just "git test"
> would be a nice synonym for that).
That invocation can now be written `git test run`, which is a bit
shorter. There could be a special case that `git test` is shorthand for
`git test run`, but it quickly gets ambiguous if the user wants to start
adding any `run` arguments.
> And then "jump to a thing that I know is broken" becomes a separate
> action, whether you are using "git test" or not. I wonder if we could
> have:
>
> git rebase -e HEAD~2
>
> to do an interactive rebase, with "edit" for HEAD~2. I feel like
> somebody even proposed that at one point, but I don't think it got
> merged.
That sounds handy. (The GIT_EDITOR thing is pretty hacky.)
> And then "git test fix" basically becomes:
>
> git rebase -e "$(git test first-broken)"
>
> though I think you'd still want a shorthand for that.
There could be a `git test fix --rebase <range>` that does this. Plus my
preference, `git test fix --branch=fix <range>`, which creates a branch
named `fix` at the first broken commit and checks it out. (If the fix is
nontrivial, my next step is usually to `git imerge rebase` the original
branch onto the `fix` branch.)
>>> I think it should be possible to script the next steps, though.
>>> Something like like "git test fix foo", which would: [...]
>>
>> I think you would usually only want to mark only the *first* broken
>> commit as "edit", because often errors cascade to descendant commits.
>
> Yeah, I had a similar thought. OTOH, if you didn't say "--keep-going",
> you'd only have one breakage either way. [...]
True enough.
Thanks for all your feedback!
Michael
[1] https://github.com/mhagger/git-test
^ permalink raw reply
* [PATCH 1/5] doc: add documentation for OPT_STRING_LIST
From: Jacob Keller @ 2017-01-12 0:17 UTC (permalink / raw)
To: git; +Cc: Jacob Keller
In-Reply-To: <20170112001721.2534-1-jacob.e.keller@intel.com>
From: Jacob Keller <jacob.keller@gmail.com>
Commit c8ba16391655 ("parse-options: add OPT_STRING_LIST helper",
2011-06-09) added the OPT_STRING_LIST as a way to accumulate a repeated
list of strings. However, this was not documented in the
api-parse-options documentation. Add documentation now so that future
developers may learn of its existence.
Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
---
Documentation/technical/api-parse-options.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/technical/api-parse-options.txt b/Documentation/technical/api-parse-options.txt
index 27bd701c0d68..15e876e4c804 100644
--- a/Documentation/technical/api-parse-options.txt
+++ b/Documentation/technical/api-parse-options.txt
@@ -168,6 +168,11 @@ There are some macros to easily define options:
Introduce an option with string argument.
The string argument is put into `str_var`.
+`OPT_STRING_LIST(short, long, &list, arg_str, description)`::
+ Introduce an option with a string argument. Repeated invocations
+ accumulate into a list of strings. Reset and clear the list with
+ `--no-option`.
+
`OPT_INTEGER(short, long, &int_var, description)`::
Introduce an option with integer argument.
The integer is put into `int_var`.
--
2.11.0.403.g196674b8396b
^ permalink raw reply related
* [PATCH 3/5] name-rev: add support to discard refs by pattern match
From: Jacob Keller @ 2017-01-12 0:17 UTC (permalink / raw)
To: git; +Cc: Jacob Keller
In-Reply-To: <20170112001721.2534-1-jacob.e.keller@intel.com>
From: Jacob Keller <jacob.keller@gmail.com>
Extend name-rev further to support matching refs by adding `--discard`
patterns. These patterns will limit the scope of refs by discarding any
ref that matches at least one discard pattern. Checking the discard refs
shall happen first, before checking the include --refs patterns. This
will allow more flexibility to matching certain kinds of references.
Add tests and update Documentation for this change.
Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
---
Documentation/git-name-rev.txt | 7 +++++++
builtin/name-rev.c | 14 +++++++++++++-
t/t6007-rev-list-cherry-pick-file.sh | 7 +++++++
3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/Documentation/git-name-rev.txt b/Documentation/git-name-rev.txt
index 7433627db12d..9b46e5ea9aae 100644
--- a/Documentation/git-name-rev.txt
+++ b/Documentation/git-name-rev.txt
@@ -30,6 +30,13 @@ OPTIONS
given multiple times, use refs whose names match any of the given shell
patterns. Use `--no-refs` to clear any previous ref patterns given.
+--discard=<pattern>::
+ Do not use any ref whose name matches a given shell pattern. The
+ pattern can be one of branch name, tag name or fully qualified ref
+ name. If given multiple times, discard refs that match any of the given
+ shell patterns. Use `--no-discards` to clear the list of discard
+ patterns.
+
--all::
List all commits reachable from all refs
diff --git a/builtin/name-rev.c b/builtin/name-rev.c
index 000a2a700ed3..86479c17a7c9 100644
--- a/builtin/name-rev.c
+++ b/builtin/name-rev.c
@@ -109,6 +109,7 @@ struct name_ref_data {
int tags_only;
int name_only;
struct string_list ref_filters;
+ struct string_list discard_filters;
};
static struct tip_table {
@@ -150,6 +151,15 @@ static int name_ref(const char *path, const struct object_id *oid, int flags, vo
if (data->tags_only && !starts_with(path, "refs/tags/"))
return 0;
+ if (data->discard_filters.nr) {
+ struct string_list_item *item;
+
+ for_each_string_list_item(item, &data->discard_filters) {
+ if (subpath_matches(path, item->string) >= 0)
+ return 0;
+ }
+ }
+
if (data->ref_filters.nr) {
struct string_list_item *item;
int matched = 0;
@@ -323,12 +333,14 @@ int cmd_name_rev(int argc, const char **argv, const char *prefix)
{
struct object_array revs = OBJECT_ARRAY_INIT;
int all = 0, transform_stdin = 0, allow_undefined = 1, always = 0, peel_tag = 0;
- struct name_ref_data data = { 0, 0, STRING_LIST_INIT_NODUP };
+ struct name_ref_data data = { 0, 0, STRING_LIST_INIT_NODUP, STRING_LIST_INIT_NODUP };
struct option opts[] = {
OPT_BOOL(0, "name-only", &data.name_only, N_("print only names (no SHA-1)")),
OPT_BOOL(0, "tags", &data.tags_only, N_("only use tags to name the commits")),
OPT_STRING_LIST(0, "refs", &data.ref_filters, N_("pattern"),
N_("only use refs matching <pattern>")),
+ OPT_STRING_LIST(0, "discard", &data.discard_filters, N_("pattern"),
+ N_("ignore refs matching <pattern>")),
OPT_GROUP(""),
OPT_BOOL(0, "all", &all, N_("list all commits reachable from all refs")),
OPT_BOOL(0, "stdin", &transform_stdin, N_("read from stdin")),
diff --git a/t/t6007-rev-list-cherry-pick-file.sh b/t/t6007-rev-list-cherry-pick-file.sh
index d072ec43b016..8a4c35f6ffee 100755
--- a/t/t6007-rev-list-cherry-pick-file.sh
+++ b/t/t6007-rev-list-cherry-pick-file.sh
@@ -118,6 +118,13 @@ test_expect_success 'name-rev --refs excludes non-matched patterns' '
test_cmp actual.named expect
'
+test_expect_success 'name-rev --discard excludes matched patterns' '
+ git rev-list --left-right --cherry-pick F...E -- bar > actual &&
+ git name-rev --stdin --name-only --refs="*tags/*" --discard="*E" \
+ < actual > actual.named &&
+ test_cmp actual.named expect
+'
+
cat >expect <<EOF
$(git rev-list --left-right --cherry-pick F...E -- bar)
EOF
--
2.11.0.403.g196674b8396b
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox