* Re: [wishlist?] make submodule commands robust to having non-submodule Subprojects
From: Yaroslav Halchenko @ 2016-09-15 18:12 UTC (permalink / raw)
To: git@vger.kernel.org
In-Reply-To: <xmqqwpidniry.fsf@gitster.mtv.corp.google.com>
On Thu, 15 Sep 2016, Junio C Hamano wrote:
> >> which then stops without even looking at other submodules.
> >> I think it would be more logical to make it a 'warning:' not a 'fatal:' and
> >> proceed.
> Making "git submodule" listing to continue from that point may be
> one thing, but do we have a sensible way in "git submodule add" to
> allow the user to recover from this condition? That is, "git add"
> is a right way to tell the core level that there is a gitlink, but
> as Yaroslav correctly observed in the early part of his message,
> having that gitlink alone is not good enough for the world view of
> "git submodule" that sits at higher-layer. And the usual way to
> tell the submodule layer that there is a submodule is with "git
> submodule add", but
> $ git init top
> $ cd top
> $ git commit --allow-empty -m 'initial in top'
> $ git init sub
> $ git -C sub commit --allow-empty -m 'initial in sub'
> $ git add sub
> $ git submodule
> fatal: no submodule mapping found in .gitmodules for path 'sub'
> $ git submodule add ./sub sub
> 'sub' already exists in the index
> $ git submodule add -f ./sub sub
> 'sub' already exists in the index
FWIW
I could have sworn that I have tried to 'submodule add' it and it
worked... but pragmatically I just did edit .gitmodules, added the
record for it, committed it, and then iirc git submodule update --init
which seemed to make git happy... FTR:
$> git submodule add ./sub ./sub
'sub' already exists in the index
$> git submodule add ./sub/ ./sub/
'sub' already exists in the index
$> vim .gitmodules
$> git add .gitmodules
cached/staged changes:
.gitmodules | 4 ++++
sub | 1 +
$> git submodule update --init
Submodule 'sub' (/tmp/111/top/sub) registered for path 'sub'
cached/staged changes:
.gitmodules | 4 ++++
sub | 1 +
$> git commit -m 'added finally'
[master aa6d912] added finally
2 files changed, 5 insertions(+)
create mode 100644 .gitmodules
create mode 160000 sub
$> git submodule
6f574b298ef51aebd36daafad450a3e38802ca03 sub (heads/master)
> I highly suspect that the user will then get stuck at this point,
> after trying to "submodule add" and then even attempting to force
> it.
> I think that is a more pressing thing to address. Once we make it
> easier for the user to bring a half-initialized submodule properly
> into the world view of the submodule subsystem, we would have to
> worry about the reported failure case even less and you do not need
> to pile on workaround options to let things continue in a state that
> is half-broken (that is, in a state that is perfectly sane to the
> core layer, but is not liked by the submodule layer).
do you foresee any unpleasant side-effects from above manual editing
.gitmodules/submodule update --init ?
--
Yaroslav O. Halchenko
Center for Open Neuroscience http://centerforopenneuroscience.org
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834 Fax: +1 (603) 646-1419
WWW: http://www.linkedin.com/in/yarik
^ permalink raw reply
* Re: [wishlist?] make submodule commands robust to having non-submodule Subprojects
From: Junio C Hamano @ 2016-09-15 18:02 UTC (permalink / raw)
To: Stefan Beller; +Cc: Yaroslav Halchenko, git@vger.kernel.org
In-Reply-To: <CAGZ79kZLdsKcf0t=dDB24VVe+V=uqQCW_VNQwSJ638m5Keu2nQ@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
> On Thu, Sep 15, 2016 at 6:02 AM, Yaroslav Halchenko <yoh@onerussian.com> wrote:
>>
>> If e.g. you just 'git add' a subdirectory which is a git repository, git
>> adds it as a subproject but doesn't initiate any entry in .gitmodules
>> since it is the job done by submodule and git core itself is
>> agnostic of those beasts.
>> ...
>> $> git submodule
>> cc6a09ac06c13cf06b4f4c8b54cda9a535e4e385 ds000001 (2.0.0+4)
>> 0a9f3b66e06a2137311a537b7377c336f1fb30ad ds000002 (1.0.0-3-g0a9f3b6)
>> 9da7e4f4221699915645ac2003298c6aba2db109 ds000003 (1.1.0+4)
>> fe16cacb5cb9b4d53c50e498298fab182500e147 ds000005 (2.0.0+3)
>> 6898d99ff3ba26880183ed3672a458a7fcde1737 ds000006 (2.0.0+2)
>> bbd10f634fe87e9d5853df3a891edbdb18cda7f9 ds000007 (2.0.0+3)
>> 138e6730193c0585a69b8baf5b9d7a4439e83ecc ds000008 (2.0.0+2)
>> ddf3a4cf7ce51a01a664e6faff4b8334b8414b1f ds000009 (2.0.1+1)
>> 7fa73b4df8166dba950c7dc07c3f8cdd50fca313 ds000011 (1.0.0-5-g7fa73b4)
>> fatal: no submodule mapping found in .gitmodules for path 'ds000017
>>
>> which then stops without even looking at other submodules.
>>
>> I think it would be more logical to make it a 'warning:' not a 'fatal:' and
>> proceed.
Making "git submodule" listing to continue from that point may be
one thing, but do we have a sensible way in "git submodule add" to
allow the user to recover from this condition? That is, "git add"
is a right way to tell the core level that there is a gitlink, but
as Yaroslav correctly observed in the early part of his message,
having that gitlink alone is not good enough for the world view of
"git submodule" that sits at higher-layer. And the usual way to
tell the submodule layer that there is a submodule is with "git
submodule add", but
$ git init top
$ cd top
$ git commit --allow-empty -m 'initial in top'
$ git init sub
$ git -C sub commit --allow-empty -m 'initial in sub'
$ git add sub
$ git submodule
fatal: no submodule mapping found in .gitmodules for path 'sub'
$ git submodule add ./sub sub
'sub' already exists in the index
$ git submodule add -f ./sub sub
'sub' already exists in the index
I highly suspect that the user will then get stuck at this point,
after trying to "submodule add" and then even attempting to force
it.
I think that is a more pressing thing to address. Once we make it
easier for the user to bring a half-initialized submodule properly
into the world view of the submodule subsystem, we would have to
worry about the reported failure case even less and you do not need
to pile on workaround options to let things continue in a state that
is half-broken (that is, in a state that is perfectly sane to the
core layer, but is not liked by the submodule layer).
^ permalink raw reply
* Re: git add --intent-to-add silently creates empty commits
From: Junio C Hamano @ 2016-09-15 17:48 UTC (permalink / raw)
To: Aviv Eyal, Nguyễn Thái Ngọc Duy; +Cc: git
In-Reply-To: <CAGHT48L2s_nf-oSGPKrOB7uo5UAkCScNh+Ju5xH1dE5DFVnHwA@mail.gmail.com>
Aviv Eyal <avivey@gmail.com> writes:
> Using `git add -N` allows creating of empty commits:
>
> git init test && cd test
> echo text > file
> git add --intent-to-add file
> git commit -m 'Empty commit'
> echo $? # prints 0
> ...
> I'd expect `git commit` to error out instead of producing an empty commit.
>
> I've seen this with git 2.8.1 and 2.10.0.129.g35f6318
I think I've seen this reported some time ago.
https://public-inbox.org/git/%3CCACsJy8A8-RgpYxYsJBaLrMia7D3DfQPr4cxASNsaLyCnmgm3ZQ@mail.gmail.com%3E/
I do not offhand recall what happend to the topic after that.
^ permalink raw reply
* Re: [PATCH] object: measure time needed for resolving hash collisions
From: Junio C Hamano @ 2016-09-15 17:45 UTC (permalink / raw)
To: Jeff King; +Cc: Stefan Beller, git
In-Reply-To: <20160915064701.c4ishixuynbzpgwx@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Measuring _just_ the collisions is more like the patch below. In my
> measurements it's more like 30ms, compared to 10s for all of the
> hashcmps.
>
> So we really aren't dealing with collisions, but rather just verifying
> that our hash landed at the right spot. And _any_ data structure is
> going to have to do that.
The reverse side of the coin may be if we can shrink the hashtable
smaller and load it more heavily without sacrificing performance by
making the necessary "have we landed at the right spot" check cheap
enough, I guess.
^ permalink raw reply
* Re: Tracking down a segfault in delta_base_cache
From: Junio C Hamano @ 2016-09-15 17:34 UTC (permalink / raw)
To: Jonathon Mah; +Cc: Jeff King, git
In-Reply-To: <6FA0A47C-61CB-4602-8629-46448E582292@jonathonmah.com>
Jonathon Mah <me@jonathonmah.com> writes:
>> On 2016-09-14, at 17:56, Jeff King <peff@peff.net> wrote:
>>
>> Have you tried with the patch in:
>>
>> http://public-inbox.org/git/20160912164616.vg33kldazuthff3d@sigill.intra.peff.net/
> All the examples I've tried work when I use that. Thanks!
Peff, thanks for a quick suggestion and Jonathon, thanks for a quick
confirmation.
^ permalink raw reply
* Re: [wishlist?] make submodule commands robust to having non-submodule Subprojects
From: Stefan Beller @ 2016-09-15 17:29 UTC (permalink / raw)
To: Yaroslav Halchenko; +Cc: git@vger.kernel.org
In-Reply-To: <20160915164035.GL9830@onerussian.com>
On Thu, Sep 15, 2016 at 9:40 AM, Yaroslav Halchenko <yoh@onerussian.com> wrote:
>
> On Thu, 15 Sep 2016, Stefan Beller wrote:
>
>> > I think it would be more logical to make it a 'warning:' not a 'fatal:' and
>> > proceed.
>
>> So maybe we would want to introduce a switch
>> `--existing-but-unconfigure-gitlinks=(warn|ignore)`
>> as well as
>> `git config submodule.existing-but-unconfigured (warn|ignore)`
>> for a more permanent solution?
>
> possibly ignorant question: is gitlink === Subproject or a
> Subproject is a kinda of a gitlink and there are other gitlinks which
> aren't Subprojects? ;)
>
gitlink is the internal name (just like a file is called blob, or a directory is
called tree; there is no file system equivalent for e.g. commits, or
gitlinks)
gitlinks as a basic building block only points at a sha1 to be part of
the repository.
Submodules use gitlinks to point at (usually) different projects, e.g.
a library.
Subprojects in Git is a loose term, it could mean submodule or part of your
repo merged in via the git-subtree command. Or a sub project can
be just a loose repository inside your repository.
gitlinks do not necessarily need to track other projects; it's "just a pointer"
to a specific version of a repository.
So to come back to your question: yeah In that response I meant
submodule==gitlink, though naming the internal data structure to be
more explicit. (What if we invent a new way to do submodules not
using gitlinks? Then that config option may be less confusing and
backwards compatible. That is unlikely though. So I guess we'll settle
with a different name)
^ permalink raw reply
* Re: [PATCH] Move format-patch base commit and prerequisites before email signature
From: Junio C Hamano @ 2016-09-15 17:06 UTC (permalink / raw)
To: Josh Triplett; +Cc: Jeff King, git
In-Reply-To: <20160914235231.GA12672@cloud>
Josh Triplett <josh@joshtriplett.org> writes:
> I'd suggest squashing in an *additional* patch to the testsuite to
> ensure the presence of the blank line:
Thanks, will do.
> diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
> index 535857e..8d90a6e 100755
> --- a/t/t4014-format-patch.sh
> +++ b/t/t4014-format-patch.sh
> @@ -1515,8 +1515,9 @@ test_expect_success 'format-patch -o overrides format.outputDirectory' '
>
> test_expect_success 'format-patch --base' '
> git checkout side &&
> - git format-patch --stdout --base=HEAD~3 -1 | tail -n 6 >actual &&
> - echo "base-commit: $(git rev-parse HEAD~3)" >expected &&
> + git format-patch --stdout --base=HEAD~3 -1 | tail -n 7 >actual &&
> + echo >expected &&
> + echo "base-commit: $(git rev-parse HEAD~3)" >>expected &&
> echo "prerequisite-patch-id: $(git show --patch HEAD~2 | git patch-id --stable | awk "{print \$1}")" >>expected &&
> echo "prerequisite-patch-id: $(git show --patch HEAD~1 | git patch-id --stable | awk "{print \$1}")" >>expected &&
> signature >> expected &&
^ permalink raw reply
* Re: [wishlist?] make submodule commands robust to having non-submodule Subprojects
From: Yaroslav Halchenko @ 2016-09-15 16:40 UTC (permalink / raw)
To: git@vger.kernel.org
In-Reply-To: <CAGZ79kZLdsKcf0t=dDB24VVe+V=uqQCW_VNQwSJ638m5Keu2nQ@mail.gmail.com>
On Thu, 15 Sep 2016, Stefan Beller wrote:
> > I think it would be more logical to make it a 'warning:' not a 'fatal:' and
> > proceed.
> So maybe we would want to introduce a switch
> `--existing-but-unconfigure-gitlinks=(warn|ignore)`
> as well as
> `git config submodule.existing-but-unconfigured (warn|ignore)`
> for a more permanent solution?
possibly ignorant question: is gitlink === Subproject or a
Subproject is a kinda of a gitlink and there are other gitlinks which
aren't Subprojects? ;)
--
Yaroslav O. Halchenko
Center for Open Neuroscience http://centerforopenneuroscience.org
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834 Fax: +1 (603) 646-1419
WWW: http://www.linkedin.com/in/yarik
^ permalink raw reply
* Re: [PATCH] object: measure time needed for resolving hash collisions
From: Stefan Beller @ 2016-09-15 16:26 UTC (permalink / raw)
To: Jeff King; +Cc: git@vger.kernel.org
In-Reply-To: <20160915064701.c4ishixuynbzpgwx@sigill.intra.peff.net>
On Wed, Sep 14, 2016 at 11:47 PM, Jeff King <peff@peff.net> wrote:
> On Wed, Sep 14, 2016 at 07:01:41PM -0700, Stefan Beller wrote:
>
>> According to Jeff, sending patches that don't get accepted is the new hype!
>
> It is what all the cool kids are doing. Unfortunately, it does not save
> you from nitpicky reviews...;)
>
>> first = i = hash_obj(sha1, obj_hash_size);
>> + clock_gettime(CLOCK_MONOTONIC, &time1);
>> while ((obj = obj_hash[i]) != NULL) {
>> if (!hashcmp(sha1, obj->oid.hash))
>> break;
>> @@ -98,6 +131,9 @@ struct object *lookup_object(const unsigned char *sha1)
>> if (i == obj_hash_size)
>> i = 0;
>> }
>> + clock_gettime(CLOCK_MONOTONIC, &time2);
>> + diff(&time1, &time2, &t_diff);
>> + add_time_to(&caching, &t_diff);
>> if (obj && i != first) {
>
> I don't think this is actually measuring the time spent on collisions.
> It's measuring the time we spend in hashcmp(), but that includes the
> non-collision case where we find it in the first hashcmp.
Right. I measured all lookup times, i.e. this function accounts for
1/3 of the run
time.
>
> Measuring _just_ the collisions is more like the patch below. In my
> measurements it's more like 30ms, compared to 10s for all of the
> hashcmps.
So off by a few orders of magnitude, i.e. we don't have to worry about
the time spent in resolving collisions.
>
> So we really aren't dealing with collisions, but rather just verifying
> that our hash landed at the right spot. And _any_ data structure is
> going to have to do that. If you want to make it faster, I'd try
> optimizing hashcmp (and you can see why the critbit tree was slower; if
> we spend so much time just on hashcmp() to make sure we're at the right
> key, then making that slower with a bunch of branching is not going to
> help).
>
> I notice we still open-code hashcmp. I get a slight speedup by switching
> it to memcmp(). About 2.5%, which is similar to what I showed in
>
> http://public-inbox.org/git/20130318073229.GA5551@sigill.intra.peff.net/
>
> a few years ago (though it's more pronounced as a portion of the whole
> now, because we've optimized some of the other bits).
>
> The main driver there was memcmp() improvements that went into glibc
> 2.13 several years ago. It might be time to start assuming that memcmp()
> beats our open-coded loop.
http://stackoverflow.com/questions/21106801/why-is-memcmp-so-much-faster-than-a-for-loop-check
seems to agree with you; so I'd think I'll agree with switching over.
>
> It may also be possible to really micro-optimize it on some platforms,
> because we know the size in advance (I'd kind of expect the compiler to
> do that, but if we're ending up in glibc memcmp then it sounds like it
> is not the case).
That stackoverflow link suggests that glibc already has microoptimisations
for a variety of platforms.
>
> -Peff
^ permalink raw reply
* Re: [wishlist?] make submodule commands robust to having non-submodule Subprojects
From: Stefan Beller @ 2016-09-15 16:05 UTC (permalink / raw)
To: Yaroslav Halchenko; +Cc: git@vger.kernel.org
In-Reply-To: <20160915130233.GC9833@onerussian.com>
On Thu, Sep 15, 2016 at 6:02 AM, Yaroslav Halchenko <yoh@onerussian.com> wrote:
> NB echos some questions of mine a few days back on IRC about Subprojects
> and submodules
>
> If e.g. you just 'git add' a subdirectory which is a git repository, git
> adds it as a subproject but doesn't initiate any entry in .gitmodules
> since it is the job done by submodule and git core itself is
> agnostic of those beasts.
>
> But having then this "Subproject"s which aren't registered as submodules
> (and I haven't found any other use for them besides being a submodule)
> brakes "git submodule" commands, e.g.
>
> $> git submodule
> cc6a09ac06c13cf06b4f4c8b54cda9a535e4e385 ds000001 (2.0.0+4)
> 0a9f3b66e06a2137311a537b7377c336f1fb30ad ds000002 (1.0.0-3-g0a9f3b6)
> 9da7e4f4221699915645ac2003298c6aba2db109 ds000003 (1.1.0+4)
> fe16cacb5cb9b4d53c50e498298fab182500e147 ds000005 (2.0.0+3)
> 6898d99ff3ba26880183ed3672a458a7fcde1737 ds000006 (2.0.0+2)
> bbd10f634fe87e9d5853df3a891edbdb18cda7f9 ds000007 (2.0.0+3)
> 138e6730193c0585a69b8baf5b9d7a4439e83ecc ds000008 (2.0.0+2)
> ddf3a4cf7ce51a01a664e6faff4b8334b8414b1f ds000009 (2.0.1+1)
> 7fa73b4df8166dba950c7dc07c3f8cdd50fca313 ds000011 (1.0.0-5-g7fa73b4)
> fatal: no submodule mapping found in .gitmodules for path 'ds000017
>
> which then stops without even looking at other submodules.
>
> I think it would be more logical to make it a 'warning:' not a 'fatal:' and
> proceed.
So maybe we would want to introduce a switch
`--existing-but-unconfigure-gitlinks=(warn|ignore)`
as well as
`git config submodule.existing-but-unconfigured (warn|ignore)`
for a more permanent solution?
>
> Thank you for consideration
> --
> Yaroslav O. Halchenko
> Center for Open Neuroscience http://centerforopenneuroscience.org
> Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
> Phone: +1 (603) 646-9834 Fax: +1 (603) 646-1419
> WWW: http://www.linkedin.com/in/yarik
^ permalink raw reply
* Re: Tracking down a segfault in delta_base_cache
From: Jonathon Mah @ 2016-09-15 15:42 UTC (permalink / raw)
To: Jeff King; +Cc: git
In-Reply-To: <20160915005640.3ui4qfmiqjz2lsov@sigill.intra.peff.net>
> On 2016-09-14, at 17:56, Jeff King <peff@peff.net> wrote:
>
> On Wed, Sep 14, 2016 at 05:42:29PM -0700, Jonathon Mah wrote:
>
>> Hi git, I've been seeing git segfault over the past few days. I'm on Mac OS X 10.12, 64-bit, compiling with clang (Apple LLVM version 8.0.0 (clang-800.0.40)).
>> [...]
>> Bisect says:
>>
>> 8261e1f139db3f8aa6f9fd7d98c876cbeb0f927c is the first bad commit
>> commit 8261e1f139db3f8aa6f9fd7d98c876cbeb0f927c
>> Author: Jeff King <peff@peff.net>
>> Date: Mon Aug 22 18:00:07 2016 -0400
>>
>> delta_base_cache: use hashmap.h
>
> Have you tried with the patch in:
>
> http://public-inbox.org/git/20160912164616.vg33kldazuthff3d@sigill.intra.peff.net/
>
> ?
All the examples I've tried work when I use that. Thanks!
>> $ lldb /Users/jmah/Documents/Streams/git/git-log -- -u
>> (lldb) target create "/Users/jmah/Documents/Streams/git/git-log"
>> Current executable set to '/Users/jmah/Documents/Streams/git/git-log' (x86_64).
>> (lldb) settings set -- target.run-args "-u"
>> (lldb) process launch -o /dev/null
>> Process 92815 launched: '/Users/jmah/Documents/Streams/git/git-log' (x86_64)
>> Process 92815 stopped
>> * thread #1: tid = 0x1c30677, 0x00000001001bba80 git-log`release_delta_base_cache(ent=0xffffffffffffffd0) + 16 at sha1_file.c:2171, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x10)
>> frame #0: 0x00000001001bba80 git-log`release_delta_base_cache(ent=0xffffffffffffffd0) + 16 at sha1_file.c:2171
>> 2168
>> 2169 static inline void release_delta_base_cache(struct delta_base_cache_entry *ent)
>> 2170 {
>> -> 2171 free(ent->data);
>> 2172 detach_delta_base_cache_entry(ent);
>
> The problems I saw with valgrind weren't here, but would explain this.
> We free() the previous node, then walk forward from its "next" pointer.
> On my Linux box, that happens to work, but we could be feeding total
> junk to the list pointer, which would meant ent->data is junk, and
> free() notices.
>
> -Peff
^ permalink raw reply
* Re: [RFC] extending pathspec support to submodules
From: Brandon Williams @ 2016-09-15 15:26 UTC (permalink / raw)
To: Heiko Voigt; +Cc: git, pclouds, Jens Lehmann, Stefan Beller
In-Reply-To: <20160915115752.GA37903@book.hvoigt.net>
On Thu, Sep 15, 2016 at 4:57 AM, Heiko Voigt <hvoigt@hvoigt.net> wrote:
>
> The problem when you do that is that the child is not aware that it is
> actually run as a submodule process. E.g.
>
> git grep --recurse-submodules foobar -- sub/dir/a
>
> would report back matches in 'dir/a' instead of 'sub/dir/a'. From the
> users perspective this will be confusing since she started the grep in
> the superproject.
>
> So what I would suggest is that we make the childs aware of the fact
> that they are called from a superproject by passing a prefix when
> calling it. E.g. like this
>
> git grep --submodule-prefix=sub foobar -- sub/dir/a
>
> Whether we pass the full or stripped path is now a matter of taste or
> ease of implementation, since we could either preprend or strip it in
> the child. But the important difference is that we have information
> about the original path.
>
> Another approach could, of course, be to omit passing the prefix and
> parse the output of the child and try to substitute, paths but that
> seems quite error prone to me.
>
> Cheers Heiko
You're right that seems like the best course of action and it already falls
inline with what I did with a first patch to ls-files to support submodules.
In that patch I did exactly as you suggest and pass in the prefix to the
submodule and make the child responsible for prepending the prefix to all of
its output. This way we can simply pass through the whole pathspec (as apposed
to my original idea of stripping the prefix off the pathspec prior to passing
it to the child...which can get complicated with wild characters) to the
childprocess and when checking if a file matches the pathspec we can check if
the prefix + file path matches.
-Brandon
^ permalink raw reply
* [PATCH v3 13/14] i18n: show-branch: mark plural strings for translation
From: Vasco Almeida @ 2016-09-15 14:59 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA, Junio C Hamano
In-Reply-To: <1473259758-11836-1-git-send-email-vascomalmeida@sapo.pt>
Mark plural string for translation using Q_().
Although we already know that the plural sentence is always used in the
English source, other languages have complex plural rules they must
comply according to the value of MAX_REVS.
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
builtin/show-branch.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index 5809371..623ca56 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -373,8 +373,9 @@ static int append_ref(const char *refname, const struct object_id *oid,
return 0;
}
if (MAX_REVS <= ref_name_cnt) {
- warning("ignoring %s; cannot handle more than %d refs",
- refname, MAX_REVS);
+ warning(Q_("ignoring %s; cannot handle more than %d ref",
+ "ignoring %s; cannot handle more than %d refs",
+ MAX_REVS), refname, MAX_REVS);
return 0;
}
ref_name[ref_name_cnt++] = xstrdup(refname);
@@ -731,8 +732,9 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
die(_("--reflog option needs one branch name"));
if (MAX_REVS < reflog)
- die("Only %d entries can be shown at one time.",
- MAX_REVS);
+ die(Q_("only %d entry can be shown at one time.",
+ "only %d entries can be shown at one time.",
+ MAX_REVS), MAX_REVS);
if (!dwim_ref(*av, strlen(*av), oid.hash, &ref))
die(_("no such ref %s"), *av);
@@ -826,7 +828,9 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
unsigned int flag = 1u << (num_rev + REV_SHIFT);
if (MAX_REVS <= num_rev)
- die("cannot handle more than %d revs.", MAX_REVS);
+ die(Q_("cannot handle more than %d rev.",
+ "cannot handle more than %d revs.",
+ MAX_REVS), MAX_REVS);
if (get_sha1(ref_name[num_rev], revkey.hash))
die(_("'%s' is not a valid ref."), ref_name[num_rev]);
commit = lookup_commit_reference(revkey.hash);
--
2.7.4
^ permalink raw reply related
* [PATCH v3 14/14] i18n: update-index: mark warnings for translation
From: Vasco Almeida @ 2016-09-15 14:59 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA, Junio C Hamano
In-Reply-To: <1473259758-11836-1-git-send-email-vascomalmeida@sapo.pt>
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
builtin/update-index.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/builtin/update-index.c b/builtin/update-index.c
index ba04b19..7a17ce1 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -1127,9 +1127,9 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
break;
case UC_DISABLE:
if (git_config_get_untracked_cache() == 1)
- warning("core.untrackedCache is set to true; "
- "remove or change it, if you really want to "
- "disable the untracked cache");
+ warning(_("core.untrackedCache is set to true; "
+ "remove or change it, if you really want to "
+ "disable the untracked cache"));
remove_untracked_cache(&the_index);
report(_("Untracked cache disabled"));
break;
@@ -1139,9 +1139,9 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
case UC_ENABLE:
case UC_FORCE:
if (git_config_get_untracked_cache() == 0)
- warning("core.untrackedCache is set to false; "
- "remove or change it, if you really want to "
- "enable the untracked cache");
+ warning(_("core.untrackedCache is set to false; "
+ "remove or change it, if you really want to "
+ "enable the untracked cache"));
add_untracked_cache(&the_index);
report(_("Untracked cache enabled for '%s'"), get_git_work_tree());
break;
--
2.7.4
^ permalink raw reply related
* [PATCH v3 12/14] i18n: show-branch: mark error messages for translation
From: Vasco Almeida @ 2016-09-15 14:59 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA, Junio C Hamano
In-Reply-To: <1473259758-11836-1-git-send-email-vascomalmeida@sapo.pt>
Lowercase some messages first word to match style of the others.
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
builtin/show-branch.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index 2566935..5809371 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -538,7 +538,7 @@ static void append_one_rev(const char *av)
for_each_ref(append_matching_ref, NULL);
if (saved_matches == ref_name_cnt &&
ref_name_cnt < MAX_REVS)
- error("no matching refs with %s", av);
+ error(_("no matching refs with %s"), av);
if (saved_matches + 1 < ref_name_cnt)
sort_ref_range(saved_matches, ref_name_cnt);
return;
@@ -701,8 +701,8 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
*
* Also --all and --remotes do not make sense either.
*/
- die("--reflog is incompatible with --all, --remotes, "
- "--independent or --merge-base");
+ die(_("--reflog is incompatible with --all, --remotes, "
+ "--independent or --merge-base"));
}
/* If nothing is specified, show all branches by default */
@@ -725,16 +725,16 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
av = fake_av;
ac = 1;
if (!*av)
- die("no branches given, and HEAD is not valid");
+ die(_("no branches given, and HEAD is not valid"));
}
if (ac != 1)
- die("--reflog option needs one branch name");
+ die(_("--reflog option needs one branch name"));
if (MAX_REVS < reflog)
die("Only %d entries can be shown at one time.",
MAX_REVS);
if (!dwim_ref(*av, strlen(*av), oid.hash, &ref))
- die("No such ref %s", *av);
+ die(_("no such ref %s"), *av);
/* Has the base been specified? */
if (reflog_base) {
@@ -828,10 +828,10 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
if (MAX_REVS <= num_rev)
die("cannot handle more than %d revs.", MAX_REVS);
if (get_sha1(ref_name[num_rev], revkey.hash))
- die("'%s' is not a valid ref.", ref_name[num_rev]);
+ die(_("'%s' is not a valid ref."), ref_name[num_rev]);
commit = lookup_commit_reference(revkey.hash);
if (!commit)
- die("cannot find commit %s (%s)",
+ die(_("cannot find commit %s (%s)"),
ref_name[num_rev], oid_to_hex(&revkey));
parse_commit(commit);
mark_seen(commit, &seen);
--
2.7.4
^ permalink raw reply related
* [PATCH v3 10/14] notes: lowercase first word of error messages
From: Vasco Almeida @ 2016-09-15 14:59 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA, Junio C Hamano
In-Reply-To: <1473259758-11836-1-git-send-email-vascomalmeida@sapo.pt>
Follow the usual case style.
Update one test to reflect these changes.
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
builtin/notes.c | 64 ++++++++++++++++++++--------------------
t/t3320-notes-merge-worktrees.sh | 2 +-
2 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/builtin/notes.c b/builtin/notes.c
index 229ad6d..5248a9b 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -191,7 +191,7 @@ static void prepare_note_data(const unsigned char *object, struct note_data *d,
strbuf_reset(&d->buf);
if (launch_editor(d->edit_path, &d->buf, NULL)) {
- die(_("Please supply the note contents using either -m or -F option"));
+ die(_("please supply the note contents using either -m or -F option"));
}
strbuf_stripspace(&d->buf, 1);
}
@@ -202,7 +202,7 @@ static void write_note_data(struct note_data *d, unsigned char *sha1)
if (write_sha1_file(d->buf.buf, d->buf.len, blob_type, sha1)) {
error(_("unable to write note object"));
if (d->edit_path)
- error(_("The note contents have been left in %s"),
+ error(_("the note contents have been left in %s"),
d->edit_path);
exit(128);
}
@@ -251,14 +251,14 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)
strbuf_addch(&d->buf, '\n');
if (get_sha1(arg, object))
- die(_("Failed to resolve '%s' as a valid ref."), arg);
+ die(_("failed to resolve '%s' as a valid ref."), arg);
if (!(buf = read_sha1_file(object, &type, &len))) {
free(buf);
- die(_("Failed to read object '%s'."), arg);
+ die(_("failed to read object '%s'."), arg);
}
if (type != OBJ_BLOB) {
free(buf);
- die(_("Cannot read note data from non-blob object '%s'."), arg);
+ die(_("cannot read note data from non-blob object '%s'."), arg);
}
strbuf_add(&d->buf, buf, len);
free(buf);
@@ -298,13 +298,13 @@ static int notes_copy_from_stdin(int force, const char *rewrite_cmd)
split = strbuf_split(&buf, ' ');
if (!split[0] || !split[1])
- die(_("Malformed input line: '%s'."), buf.buf);
+ die(_("malformed input line: '%s'."), buf.buf);
strbuf_rtrim(split[0]);
strbuf_rtrim(split[1]);
if (get_sha1(split[0]->buf, from_obj))
- die(_("Failed to resolve '%s' as a valid ref."), split[0]->buf);
+ die(_("failed to resolve '%s' as a valid ref."), split[0]->buf);
if (get_sha1(split[1]->buf, to_obj))
- die(_("Failed to resolve '%s' as a valid ref."), split[1]->buf);
+ die(_("failed to resolve '%s' as a valid ref."), split[1]->buf);
if (rewrite_cmd)
err = copy_note_for_rewrite(c, from_obj, to_obj);
@@ -313,7 +313,7 @@ static int notes_copy_from_stdin(int force, const char *rewrite_cmd)
combine_notes_overwrite);
if (err) {
- error(_("Failed to copy notes from '%s' to '%s'"),
+ error(_("failed to copy notes from '%s' to '%s'"),
split[0]->buf, split[1]->buf);
ret = 1;
}
@@ -342,7 +342,7 @@ static struct notes_tree *init_notes_check(const char *subcommand,
if (!starts_with(ref, "refs/notes/"))
/* TRANSLATORS: the first %s will be replaced by a
git notes command: 'add', 'merge', 'remove', etc.*/
- die(_("Refusing to %s notes in %s (outside of refs/notes/)"),
+ die(_("refusing to %s notes in %s (outside of refs/notes/)"),
subcommand, ref);
return t;
}
@@ -369,13 +369,13 @@ static int list(int argc, const char **argv, const char *prefix)
t = init_notes_check("list", 0);
if (argc) {
if (get_sha1(argv[0], object))
- die(_("Failed to resolve '%s' as a valid ref."), argv[0]);
+ die(_("failed to resolve '%s' as a valid ref."), argv[0]);
note = get_note(t, object);
if (note) {
puts(sha1_to_hex(note));
retval = 0;
} else
- retval = error(_("No note found for object %s."),
+ retval = error(_("no note found for object %s."),
sha1_to_hex(object));
} else
retval = for_each_note(t, 0, list_each_note, NULL);
@@ -424,7 +424,7 @@ static int add(int argc, const char **argv, const char *prefix)
object_ref = argc > 1 ? argv[1] : "HEAD";
if (get_sha1(object_ref, object))
- die(_("Failed to resolve '%s' as a valid ref."), object_ref);
+ die(_("failed to resolve '%s' as a valid ref."), object_ref);
t = init_notes_check("add", NOTES_INIT_WRITABLE);
note = get_note(t, object);
@@ -510,12 +510,12 @@ static int copy(int argc, const char **argv, const char *prefix)
}
if (get_sha1(argv[0], from_obj))
- die(_("Failed to resolve '%s' as a valid ref."), argv[0]);
+ die(_("failed to resolve '%s' as a valid ref."), argv[0]);
object_ref = 1 < argc ? argv[1] : "HEAD";
if (get_sha1(object_ref, object))
- die(_("Failed to resolve '%s' as a valid ref."), object_ref);
+ die(_("failed to resolve '%s' as a valid ref."), object_ref);
t = init_notes_check("copy", NOTES_INIT_WRITABLE);
note = get_note(t, object);
@@ -534,7 +534,7 @@ static int copy(int argc, const char **argv, const char *prefix)
from_note = get_note(t, from_obj);
if (!from_note) {
- retval = error(_("Missing notes on source object %s. Cannot "
+ retval = error(_("missing notes on source object %s. Cannot "
"copy."), sha1_to_hex(from_obj));
goto out;
}
@@ -593,7 +593,7 @@ static int append_edit(int argc, const char **argv, const char *prefix)
object_ref = 1 < argc ? argv[1] : "HEAD";
if (get_sha1(object_ref, object))
- die(_("Failed to resolve '%s' as a valid ref."), object_ref);
+ die(_("failed to resolve '%s' as a valid ref."), object_ref);
t = init_notes_check(argv[0], NOTES_INIT_WRITABLE);
note = get_note(t, object);
@@ -656,13 +656,13 @@ static int show(int argc, const char **argv, const char *prefix)
object_ref = argc ? argv[0] : "HEAD";
if (get_sha1(object_ref, object))
- die(_("Failed to resolve '%s' as a valid ref."), object_ref);
+ die(_("failed to resolve '%s' as a valid ref."), object_ref);
t = init_notes_check("show", 0);
note = get_note(t, object);
if (!note)
- retval = error(_("No note found for object %s."),
+ retval = error(_("no note found for object %s."),
sha1_to_hex(object));
else {
const char *show_args[3] = {"show", sha1_to_hex(note), NULL};
@@ -682,11 +682,11 @@ static int merge_abort(struct notes_merge_options *o)
*/
if (delete_ref("NOTES_MERGE_PARTIAL", NULL, 0))
- ret += error(_("Failed to delete ref NOTES_MERGE_PARTIAL"));
+ ret += error(_("failed to delete ref NOTES_MERGE_PARTIAL"));
if (delete_ref("NOTES_MERGE_REF", NULL, REF_NODEREF))
- ret += error(_("Failed to delete ref NOTES_MERGE_REF"));
+ ret += error(_("failed to delete ref NOTES_MERGE_REF"));
if (notes_merge_abort(o))
- ret += error(_("Failed to remove 'git notes merge' worktree"));
+ ret += error(_("failed to remove 'git notes merge' worktree"));
return ret;
}
@@ -706,11 +706,11 @@ static int merge_commit(struct notes_merge_options *o)
*/
if (get_sha1("NOTES_MERGE_PARTIAL", sha1))
- die(_("Failed to read ref NOTES_MERGE_PARTIAL"));
+ die(_("failed to read ref NOTES_MERGE_PARTIAL"));
else if (!(partial = lookup_commit_reference(sha1)))
- die(_("Could not find commit from NOTES_MERGE_PARTIAL."));
+ die(_("could not find commit from NOTES_MERGE_PARTIAL."));
else if (parse_commit(partial))
- die(_("Could not parse commit from NOTES_MERGE_PARTIAL."));
+ die(_("could not parse commit from NOTES_MERGE_PARTIAL."));
if (partial->parents)
hashcpy(parent_sha1, partial->parents->item->object.oid.hash);
@@ -723,10 +723,10 @@ static int merge_commit(struct notes_merge_options *o)
o->local_ref = local_ref_to_free =
resolve_refdup("NOTES_MERGE_REF", 0, sha1, NULL);
if (!o->local_ref)
- die(_("Failed to resolve NOTES_MERGE_REF"));
+ die(_("failed to resolve NOTES_MERGE_REF"));
if (notes_merge_commit(o, t, partial, sha1))
- die(_("Failed to finalize notes merge"));
+ die(_("failed to finalize notes merge"));
/* Reuse existing commit message in reflog message */
memset(&pretty_ctx, 0, sizeof(pretty_ctx));
@@ -796,7 +796,7 @@ static int merge(int argc, const char **argv, const char *prefix)
}
if (do_merge && argc != 1) {
- error(_("Must specify a notes ref to merge"));
+ error(_("must specify a notes ref to merge"));
usage_with_options(git_notes_merge_usage, options);
} else if (!do_merge && argc) {
error(_("too many parameters"));
@@ -820,7 +820,7 @@ static int merge(int argc, const char **argv, const char *prefix)
if (strategy) {
if (parse_notes_merge_strategy(strategy, &o.strategy)) {
- error(_("Unknown -s/--strategy: %s"), strategy);
+ error(_("unknown -s/--strategy: %s"), strategy);
usage_with_options(git_notes_merge_usage, options);
}
} else {
@@ -857,10 +857,10 @@ static int merge(int argc, const char **argv, const char *prefix)
/* Store ref-to-be-updated into .git/NOTES_MERGE_REF */
wt = find_shared_symref("NOTES_MERGE_REF", default_notes_ref());
if (wt)
- die(_("A notes merge into %s is already in-progress at %s"),
+ die(_("a notes merge into %s is already in-progress at %s"),
default_notes_ref(), wt->path);
if (create_symref("NOTES_MERGE_REF", default_notes_ref(), NULL))
- die(_("Failed to store link to current notes ref (%s)"),
+ die(_("failed to store link to current notes ref (%s)"),
default_notes_ref());
printf(_("Automatic notes merge failed. Fix conflicts in %s and "
"commit the result with 'git notes merge --commit', or "
@@ -1016,7 +1016,7 @@ int cmd_notes(int argc, const char **argv, const char *prefix)
else if (!strcmp(argv[0], "get-ref"))
result = get_ref(argc, argv, prefix);
else {
- result = error(_("Unknown subcommand: %s"), argv[0]);
+ result = error(_("unknown subcommand: %s"), argv[0]);
usage_with_options(git_notes_usage, options);
}
diff --git a/t/t3320-notes-merge-worktrees.sh b/t/t3320-notes-merge-worktrees.sh
index 6e05115..b9c3bc2 100755
--- a/t/t3320-notes-merge-worktrees.sh
+++ b/t/t3320-notes-merge-worktrees.sh
@@ -52,7 +52,7 @@ test_expect_success 'merge z into y while mid-merge in another workdir fails' '
cd worktree &&
git config core.notesRef refs/notes/y &&
test_must_fail git notes merge z 2>err &&
- test_i18ngrep "A notes merge into refs/notes/y is already in-progress at" err
+ test_i18ngrep "a notes merge into refs/notes/y is already in-progress at" err
) &&
test_path_is_missing .git/worktrees/worktree/NOTES_MERGE_REF
'
--
2.7.4
^ permalink raw reply related
* [PATCH v3 11/14] i18n: receive-pack: mark messages for translation
From: Vasco Almeida @ 2016-09-15 14:59 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA, Junio C Hamano
In-Reply-To: <1473259758-11836-1-git-send-email-vascomalmeida@sapo.pt>
Mark messages refuse_unconfigured_deny_msg and
refuse_unconfigured_deny_delete_current_msg for translation.
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
builtin/receive-pack.c | 58 ++++++++++++++++++++++----------------------------
1 file changed, 25 insertions(+), 33 deletions(-)
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index f1ce05c..896b16f 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -781,47 +781,39 @@ static int is_ref_checked_out(const char *ref)
return !strcmp(head_name, ref);
}
-static char *refuse_unconfigured_deny_msg[] = {
- "By default, updating the current branch in a non-bare repository",
- "is denied, because it will make the index and work tree inconsistent",
- "with what you pushed, and will require 'git reset --hard' to match",
- "the work tree to HEAD.",
- "",
- "You can set 'receive.denyCurrentBranch' configuration variable to",
- "'ignore' or 'warn' in the remote repository to allow pushing into",
- "its current branch; however, this is not recommended unless you",
- "arranged to update its work tree to match what you pushed in some",
- "other way.",
- "",
- "To squelch this message and still keep the default behaviour, set",
- "'receive.denyCurrentBranch' configuration variable to 'refuse'."
-};
+static char *refuse_unconfigured_deny_msg =
+ N_("By default, updating the current branch in a non-bare repository\n"
+ "is denied, because it will make the index and work tree inconsistent\n"
+ "with what you pushed, and will require 'git reset --hard' to match\n"
+ "the work tree to HEAD.\n"
+ "\n"
+ "You can set 'receive.denyCurrentBranch' configuration variable to\n"
+ "'ignore' or 'warn' in the remote repository to allow pushing into\n"
+ "its current branch; however, this is not recommended unless you\n"
+ "arranged to update its work tree to match what you pushed in some\n"
+ "other way.\n"
+ "\n"
+ "To squelch this message and still keep the default behaviour, set\n"
+ "'receive.denyCurrentBranch' configuration variable to 'refuse'.");
static void refuse_unconfigured_deny(void)
{
- int i;
- for (i = 0; i < ARRAY_SIZE(refuse_unconfigured_deny_msg); i++)
- rp_error("%s", refuse_unconfigured_deny_msg[i]);
+ rp_error("%s", _(refuse_unconfigured_deny_msg));
}
-static char *refuse_unconfigured_deny_delete_current_msg[] = {
- "By default, deleting the current branch is denied, because the next",
- "'git clone' won't result in any file checked out, causing confusion.",
- "",
- "You can set 'receive.denyDeleteCurrent' configuration variable to",
- "'warn' or 'ignore' in the remote repository to allow deleting the",
- "current branch, with or without a warning message.",
- "",
- "To squelch this message, you can set it to 'refuse'."
-};
+static char *refuse_unconfigured_deny_delete_current_msg =
+ N_("By default, deleting the current branch is denied, because the next\n"
+ "'git clone' won't result in any file checked out, causing confusion.\n"
+ "\n"
+ "You can set 'receive.denyDeleteCurrent' configuration variable to\n"
+ "'warn' or 'ignore' in the remote repository to allow deleting the\n"
+ "current branch, with or without a warning message.\n"
+ "\n"
+ "To squelch this message, you can set it to 'refuse'.");
static void refuse_unconfigured_deny_delete_current(void)
{
- int i;
- for (i = 0;
- i < ARRAY_SIZE(refuse_unconfigured_deny_delete_current_msg);
- i++)
- rp_error("%s", refuse_unconfigured_deny_delete_current_msg[i]);
+ rp_error("%s", _(refuse_unconfigured_deny_delete_current_msg));
}
static int command_singleton_iterator(void *cb_data, unsigned char sha1[20]);
--
2.7.4
^ permalink raw reply related
* [PATCH v3 09/14] i18n: notes: mark error messages for translation
From: Vasco Almeida @ 2016-09-15 14:59 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA, Junio C Hamano
In-Reply-To: <1473259758-11836-1-git-send-email-vascomalmeida@sapo.pt>
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
builtin/notes.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/builtin/notes.c b/builtin/notes.c
index f848b89..229ad6d 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -340,7 +340,9 @@ static struct notes_tree *init_notes_check(const char *subcommand,
ref = (flags & NOTES_INIT_WRITABLE) ? t->update_ref : t->ref;
if (!starts_with(ref, "refs/notes/"))
- die("Refusing to %s notes in %s (outside of refs/notes/)",
+ /* TRANSLATORS: the first %s will be replaced by a
+ git notes command: 'add', 'merge', 'remove', etc.*/
+ die(_("Refusing to %s notes in %s (outside of refs/notes/)"),
subcommand, ref);
return t;
}
@@ -680,11 +682,11 @@ static int merge_abort(struct notes_merge_options *o)
*/
if (delete_ref("NOTES_MERGE_PARTIAL", NULL, 0))
- ret += error("Failed to delete ref NOTES_MERGE_PARTIAL");
+ ret += error(_("Failed to delete ref NOTES_MERGE_PARTIAL"));
if (delete_ref("NOTES_MERGE_REF", NULL, REF_NODEREF))
- ret += error("Failed to delete ref NOTES_MERGE_REF");
+ ret += error(_("Failed to delete ref NOTES_MERGE_REF"));
if (notes_merge_abort(o))
- ret += error("Failed to remove 'git notes merge' worktree");
+ ret += error(_("Failed to remove 'git notes merge' worktree"));
return ret;
}
@@ -704,11 +706,11 @@ static int merge_commit(struct notes_merge_options *o)
*/
if (get_sha1("NOTES_MERGE_PARTIAL", sha1))
- die("Failed to read ref NOTES_MERGE_PARTIAL");
+ die(_("Failed to read ref NOTES_MERGE_PARTIAL"));
else if (!(partial = lookup_commit_reference(sha1)))
- die("Could not find commit from NOTES_MERGE_PARTIAL.");
+ die(_("Could not find commit from NOTES_MERGE_PARTIAL."));
else if (parse_commit(partial))
- die("Could not parse commit from NOTES_MERGE_PARTIAL.");
+ die(_("Could not parse commit from NOTES_MERGE_PARTIAL."));
if (partial->parents)
hashcpy(parent_sha1, partial->parents->item->object.oid.hash);
@@ -721,10 +723,10 @@ static int merge_commit(struct notes_merge_options *o)
o->local_ref = local_ref_to_free =
resolve_refdup("NOTES_MERGE_REF", 0, sha1, NULL);
if (!o->local_ref)
- die("Failed to resolve NOTES_MERGE_REF");
+ die(_("Failed to resolve NOTES_MERGE_REF"));
if (notes_merge_commit(o, t, partial, sha1))
- die("Failed to finalize notes merge");
+ die(_("Failed to finalize notes merge"));
/* Reuse existing commit message in reflog message */
memset(&pretty_ctx, 0, sizeof(pretty_ctx));
--
2.7.4
^ permalink raw reply related
* [PATCH v3 08/14] i18n: merge-recursive: mark verbose message for translation
From: Vasco Almeida @ 2016-09-15 14:59 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA, Junio C Hamano
In-Reply-To: <1473259758-11836-1-git-send-email-vascomalmeida@sapo.pt>
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
builtin/merge-recursive.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c
index 3b09610..0dd9021 100644
--- a/builtin/merge-recursive.c
+++ b/builtin/merge-recursive.c
@@ -74,7 +74,7 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix)
o.branch2 = better_branch_name(o.branch2);
if (o.verbosity >= 3)
- printf("Merging %s with %s\n", o.branch1, o.branch2);
+ printf(_("Merging %s with %s\n"), o.branch1, o.branch2);
failed = merge_recursive_generic(&o, &h1, &h2, bases_count, bases, &result);
if (failed < 0)
--
2.7.4
^ permalink raw reply related
* [PATCH v3 07/14] i18n: merge-recursive: mark error messages for translation
From: Vasco Almeida @ 2016-09-15 14:59 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA, Junio C Hamano
In-Reply-To: <1473259758-11836-1-git-send-email-vascomalmeida@sapo.pt>
Lowercase first word of such error messages following the usual style.
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
builtin/merge-recursive.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c
index fd2c455..3b09610 100644
--- a/builtin/merge-recursive.c
+++ b/builtin/merge-recursive.c
@@ -42,30 +42,33 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix)
if (!arg[2])
break;
if (parse_merge_opt(&o, arg + 2))
- die("Unknown option %s", arg);
+ die(_("unknown option %s"), arg);
continue;
}
if (bases_count < ARRAY_SIZE(bases)-1) {
struct object_id *oid = xmalloc(sizeof(struct object_id));
if (get_oid(argv[i], oid))
- die("Could not parse object '%s'", argv[i]);
+ die(_("could not parse object '%s'"), argv[i]);
bases[bases_count++] = oid;
}
else
- warning("Cannot handle more than %d bases. "
- "Ignoring %s.",
+ warning(Q_("cannot handle more than %d base. "
+ "Ignoring %s.",
+ "cannot handle more than %d bases. "
+ "Ignoring %s.",
+ (int)ARRAY_SIZE(bases)-1),
(int)ARRAY_SIZE(bases)-1, argv[i]);
}
if (argc - i != 3) /* "--" "<head>" "<remote>" */
- die("Not handling anything other than two heads merge.");
+ die(_("not handling anything other than two heads merge."));
o.branch1 = argv[++i];
o.branch2 = argv[++i];
if (get_oid(o.branch1, &h1))
- die("Could not resolve ref '%s'", o.branch1);
+ die(_("could not resolve ref '%s'"), o.branch1);
if (get_oid(o.branch2, &h2))
- die("Could not resolve ref '%s'", o.branch2);
+ die(_("could not resolve ref '%s'"), o.branch2);
o.branch1 = better_branch_name(o.branch1);
o.branch2 = better_branch_name(o.branch2);
--
2.7.4
^ permalink raw reply related
* [PATCH v3 06/14] i18n: config: mark error message for translation
From: Vasco Almeida @ 2016-09-15 14:59 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA, Junio C Hamano
In-Reply-To: <1473259758-11836-1-git-send-email-vascomalmeida@sapo.pt>
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
builtin/config.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/config.c b/builtin/config.c
index 6cbf733..05843a0 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -622,8 +622,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)
value = normalize_value(argv[0], argv[1]);
ret = git_config_set_in_file_gently(given_config_source.file, argv[0], value);
if (ret == CONFIG_NOTHING_SET)
- error("cannot overwrite multiple values with a single value\n"
- " Use a regexp, --add or --replace-all to change %s.", argv[0]);
+ error(_("cannot overwrite multiple values with a single value\n"
+ " Use a regexp, --add or --replace-all to change %s."), argv[0]);
return ret;
}
else if (actions == ACTION_SET_ALL) {
--
2.7.4
^ permalink raw reply related
* [PATCH v3 05/14] i18n: branch: mark option description for translation
From: Vasco Almeida @ 2016-09-15 14:58 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA, Junio C Hamano
In-Reply-To: <1473259758-11836-1-git-send-email-vascomalmeida@sapo.pt>
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
builtin/branch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index 7df0543..d5d93a8 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -657,7 +657,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
OPT_SET_INT( 0, "set-upstream", &track, N_("change upstream info"),
BRANCH_TRACK_OVERRIDE),
OPT_STRING('u', "set-upstream-to", &new_upstream, N_("upstream"), N_("change the upstream info")),
- OPT_BOOL(0, "unset-upstream", &unset_upstream, "Unset the upstream info"),
+ OPT_BOOL(0, "unset-upstream", &unset_upstream, N_("Unset the upstream info")),
OPT__COLOR(&branch_use_color, N_("use colored output")),
OPT_SET_INT('r', "remotes", &filter.kind, N_("act on remote-tracking branches"),
FILTER_REFS_REMOTES),
--
2.7.4
^ permalink raw reply related
* [PATCH v3 04/14] i18n: blame: mark error messages for translation
From: Vasco Almeida @ 2016-09-15 14:58 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA, Junio C Hamano
In-Reply-To: <1473259758-11836-1-git-send-email-vascomalmeida@sapo.pt>
Mark error messages for translation passed to die() function.
Change "Cannot" to lowercase following the usual style.
Reflect changes to test by using test_i18ngrep.
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
builtin/blame.c | 18 ++++++++++--------
t/t8003-blame-corner-cases.sh | 4 ++--
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/builtin/blame.c b/builtin/blame.c
index a5bbf91..27aea79 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -2601,7 +2601,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
if (incremental || (output_option & OUTPUT_PORCELAIN)) {
if (show_progress > 0)
- die("--progress can't be used with --incremental or porcelain formats");
+ die(_("--progress can't be used with --incremental or porcelain formats"));
show_progress = 0;
} else if (show_progress < 0)
show_progress = isatty(2);
@@ -2727,7 +2727,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
sb.commits.compare = compare_commits_by_commit_date;
}
else if (contents_from)
- die("--contents and --reverse do not blend well.");
+ die(_("--contents and --reverse do not blend well."));
else {
final_commit_name = prepare_initial(&sb);
sb.commits.compare = compare_commits_by_reverse_commit_date;
@@ -2747,12 +2747,12 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
add_pending_object(&revs, &(sb.final->object), ":");
}
else if (contents_from)
- die("Cannot use --contents with final commit object name");
+ die(_("cannot use --contents with final commit object name"));
if (reverse && revs.first_parent_only) {
final_commit = find_single_final(sb.revs, NULL);
if (!final_commit)
- die("--reverse and --first-parent together require specified latest commit");
+ die(_("--reverse and --first-parent together require specified latest commit"));
}
/*
@@ -2779,7 +2779,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
}
if (oidcmp(&c->object.oid, &sb.final->object.oid))
- die("--reverse --first-parent together require range along first-parent chain");
+ die(_("--reverse --first-parent together require range along first-parent chain"));
}
if (is_null_oid(&sb.final->object.oid)) {
@@ -2790,7 +2790,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
else {
o = get_origin(&sb, sb.final, path);
if (fill_blob_sha1_and_mode(o))
- die("no such path %s in %s", path, final_commit_name);
+ die(_("no such path %s in %s"), path, final_commit_name);
if (DIFF_OPT_TST(&sb.revs->diffopt, ALLOW_TEXTCONV) &&
textconv_object(path, o->mode, o->blob_sha1, 1, (char **) &sb.final_buf,
@@ -2801,7 +2801,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
&sb.final_buf_size);
if (!sb.final_buf)
- die("Cannot read blob %s for path %s",
+ die(_("cannot read blob %s for path %s"),
sha1_to_hex(o->blob_sha1),
path);
}
@@ -2820,7 +2820,9 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
&bottom, &top, sb.path))
usage(blame_usage);
if (lno < top || ((lno || bottom) && lno < bottom))
- die("file %s has only %lu lines", path, lno);
+ die(Q_("file %s has only %lu line",
+ "file %s has only %lu lines",
+ lno), path, lno);
if (bottom < 1)
bottom = 1;
if (top < 1)
diff --git a/t/t8003-blame-corner-cases.sh b/t/t8003-blame-corner-cases.sh
index e48370d..661f9d4 100755
--- a/t/t8003-blame-corner-cases.sh
+++ b/t/t8003-blame-corner-cases.sh
@@ -212,12 +212,12 @@ EOF
test_expect_success 'blame -L with invalid start' '
test_must_fail git blame -L5 tres 2>errors &&
- grep "has only 2 lines" errors
+ test_i18ngrep "has only 2 lines" errors
'
test_expect_success 'blame -L with invalid end' '
test_must_fail git blame -L1,5 tres 2>errors &&
- grep "has only 2 lines" errors
+ test_i18ngrep "has only 2 lines" errors
'
test_expect_success 'blame parses <end> part of -L' '
--
2.7.4
^ permalink raw reply related
* [PATCH v3 03/14] i18n: apply: mark info messages for translation
From: Vasco Almeida @ 2016-09-15 14:58 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA, Junio C Hamano
In-Reply-To: <1473259758-11836-1-git-send-email-vascomalmeida@sapo.pt>
Mark messages for translation printed to stderr.
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
builtin/apply.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index ef2c084..43ab7c5 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -3525,7 +3525,7 @@ static int try_threeway(struct apply_state *state,
read_blob_object(&buf, pre_sha1, patch->old_mode))
return error(_("repository lacks the necessary blob to fall back on 3-way merge."));
- fprintf(stderr, "Falling back to three-way merge...\n");
+ fprintf(stderr, _("Falling back to three-way merge...\n"));
img = strbuf_detach(&buf, &len);
prepare_image(&tmp_image, img, len, 1);
@@ -3555,7 +3555,7 @@ static int try_threeway(struct apply_state *state,
status = three_way_merge(image, patch->new_name,
pre_sha1, our_sha1, post_sha1);
if (status < 0) {
- fprintf(stderr, "Failed to fall back on three-way merge...\n");
+ fprintf(stderr, _("Failed to fall back on three-way merge...\n"));
return status;
}
@@ -3567,9 +3567,9 @@ static int try_threeway(struct apply_state *state,
hashcpy(patch->threeway_stage[0].hash, pre_sha1);
hashcpy(patch->threeway_stage[1].hash, our_sha1);
hashcpy(patch->threeway_stage[2].hash, post_sha1);
- fprintf(stderr, "Applied patch to '%s' with conflicts.\n", patch->new_name);
+ fprintf(stderr, _("Applied patch to '%s' with conflicts.\n"), patch->new_name);
} else {
- fprintf(stderr, "Applied patch to '%s' cleanly.\n", patch->new_name);
+ fprintf(stderr, _("Applied patch to '%s' cleanly.\n"), patch->new_name);
}
return 0;
}
--
2.7.4
^ permalink raw reply related
* [PATCH v3 02/14] i18n: apply: mark error messages for translation
From: Vasco Almeida @ 2016-09-15 14:58 UTC (permalink / raw)
To: git
Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason,
Jean-Noël AVILA, Junio C Hamano
In-Reply-To: <1473259758-11836-1-git-send-email-vascomalmeida@sapo.pt>
Mark error messages for translation passed to error() and die()
functions.
Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
builtin/apply.c | 46 +++++++++++++++++++++++-----------------------
1 file changed, 23 insertions(+), 23 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index ef03c74..ef2c084 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -3065,8 +3065,8 @@ static int apply_binary_fragment(struct apply_state *state,
/* Binary patch is irreversible without the optional second hunk */
if (state->apply_in_reverse) {
if (!fragment->next)
- return error("cannot reverse-apply a binary patch "
- "without the reverse hunk to '%s'",
+ return error(_("cannot reverse-apply a binary patch "
+ "without the reverse hunk to '%s'"),
patch->new_name
? patch->new_name : patch->old_name);
fragment = fragment->next;
@@ -3111,8 +3111,8 @@ static int apply_binary(struct apply_state *state,
strlen(patch->new_sha1_prefix) != 40 ||
get_sha1_hex(patch->old_sha1_prefix, sha1) ||
get_sha1_hex(patch->new_sha1_prefix, sha1))
- return error("cannot apply binary patch to '%s' "
- "without full index line", name);
+ return error(_("cannot apply binary patch to '%s' "
+ "without full index line"), name);
if (patch->old_name) {
/*
@@ -3121,16 +3121,16 @@ static int apply_binary(struct apply_state *state,
*/
hash_sha1_file(img->buf, img->len, blob_type, sha1);
if (strcmp(sha1_to_hex(sha1), patch->old_sha1_prefix))
- return error("the patch applies to '%s' (%s), "
- "which does not match the "
- "current contents.",
+ return error(_("the patch applies to '%s' (%s), "
+ "which does not match the "
+ "current contents."),
name, sha1_to_hex(sha1));
}
else {
/* Otherwise, the old one must be empty. */
if (img->len)
- return error("the patch applies to an empty "
- "'%s' but it is not empty", name);
+ return error(_("the patch applies to an empty "
+ "'%s' but it is not empty"), name);
}
get_sha1_hex(patch->new_sha1_prefix, sha1);
@@ -3147,8 +3147,8 @@ static int apply_binary(struct apply_state *state,
result = read_sha1_file(sha1, &type, &size);
if (!result)
- return error("the necessary postimage %s for "
- "'%s' cannot be read",
+ return error(_("the necessary postimage %s for "
+ "'%s' cannot be read"),
patch->new_sha1_prefix, name);
clear_image(img);
img->buf = result;
@@ -3523,7 +3523,7 @@ static int try_threeway(struct apply_state *state,
write_sha1_file("", 0, blob_type, pre_sha1);
else if (get_sha1(patch->old_sha1_prefix, pre_sha1) ||
read_blob_object(&buf, pre_sha1, patch->old_mode))
- return error("repository lacks the necessary blob to fall back on 3-way merge.");
+ return error(_("repository lacks the necessary blob to fall back on 3-way merge."));
fprintf(stderr, "Falling back to three-way merge...\n");
@@ -3541,11 +3541,11 @@ static int try_threeway(struct apply_state *state,
/* our_sha1[] is ours */
if (patch->is_new) {
if (load_current(state, &tmp_image, patch))
- return error("cannot read the current contents of '%s'",
+ return error(_("cannot read the current contents of '%s'"),
patch->new_name);
} else {
if (load_preimage(state, &tmp_image, patch, st, ce))
- return error("cannot read the current contents of '%s'",
+ return error(_("cannot read the current contents of '%s'"),
patch->old_name);
}
write_sha1_file(tmp_image.buf, tmp_image.len, blob_type, our_sha1);
@@ -4020,29 +4020,29 @@ static void build_fake_ancestor(struct patch *list, const char *filename)
if (!preimage_sha1_in_gitlink_patch(patch, sha1))
; /* ok, the textual part looks sane */
else
- die("sha1 information is lacking or useless for submodule %s",
+ die(_("sha1 information is lacking or useless for submodule %s"),
name);
} else if (!get_sha1_blob(patch->old_sha1_prefix, sha1)) {
; /* ok */
} else if (!patch->lines_added && !patch->lines_deleted) {
/* mode-only change: update the current */
if (get_current_sha1(patch->old_name, sha1))
- die("mode change for %s, which is not "
- "in current HEAD", name);
+ die(_("mode change for %s, which is not "
+ "in current HEAD"), name);
} else
- die("sha1 information is lacking or useless "
- "(%s).", name);
+ die(_("sha1 information is lacking or useless "
+ "(%s)."), name);
ce = make_cache_entry(patch->old_mode, sha1, name, 0, 0);
if (!ce)
die(_("make_cache_entry failed for path '%s'"), name);
if (add_index_entry(&result, ce, ADD_CACHE_OK_TO_ADD))
- die ("Could not add %s to temporary index", name);
+ die(_("Could not add %s to temporary index"), name);
}
hold_lock_file_for_update(&lock, filename, LOCK_DIE_ON_ERROR);
if (write_locked_index(&result, &lock, COMMIT_LOCK))
- die ("Could not write temporary index to %s", filename);
+ die(_("Could not write temporary index to %s"), filename);
discard_index(&result);
}
@@ -4693,9 +4693,9 @@ static void check_apply_state(struct apply_state *state, int force_apply)
int is_not_gitdir = !startup_info->have_repository;
if (state->apply_with_reject && state->threeway)
- die("--reject and --3way cannot be used together.");
+ die(_("--reject and --3way cannot be used together."));
if (state->cached && state->threeway)
- die("--cached and --3way cannot be used together.");
+ die(_("--cached and --3way cannot be used together."));
if (state->threeway) {
if (is_not_gitdir)
die(_("--3way outside a repository"));
--
2.7.4
^ 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