Git development
 help / color / mirror / Atom feed
* Re: [PATCH v2 20/25] sequencer: left-trim lines read from the script
From: Junio C Hamano @ 2016-09-12 15:42 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git, Jakub Narębski, Johannes Sixt
In-Reply-To: <alpine.DEB.2.20.1609121019290.129229@virtualbox>

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

>> I do not offhand see why we want to be lenient here,
>> especially only to the left.
>
> Postel's Law.

How would that compare/relate to yagni, though?

^ permalink raw reply

* Re: [PATCH 04/13] i18n: blame: mark error messages for translation
From: Junio C Hamano @ 2016-09-12 15:40 UTC (permalink / raw)
  To: Jean-Noël AVILA
  Cc: Vasco Almeida, git, Jiang Xin,
	Ævar Arnfjörð Bjarmason
In-Reply-To: <2532042.KMOOJ8STkh@cayenne>

Jean-Noël AVILA <jn.avila@free.fr> writes:

>> @@ -2820,7 +2820,7 @@ 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(_("file %s has only %lu lines"), path, lno);
>
> Here a plural version is needed.

Good eyes, like this?

 builtin/blame.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/builtin/blame.c b/builtin/blame.c
index 3fee197..cb12085 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -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)

^ permalink raw reply related

* Re: [PATCH] gpg-interface: reflect stderr to stderr
From: Michael J Gruber @ 2016-09-12 13:39 UTC (permalink / raw)
  To: Junio C Hamano, Jeff King; +Cc: Johannes Schindelin, git
In-Reply-To: <xmqqzinidqfi.fsf@gitster.mtv.corp.google.com>

Junio C Hamano venit, vidit, dixit 08.09.2016 23:36:
> Jeff King <peff@peff.net> writes:
> 
>>> Even though this patch is fixing only one of the two issues, I am
>>> tempted to say that we should queue it for now, as it does so
>>> without breaking a bigger gain made by the original, i.e. we learn
>>> the status of verification in a way the authors of GPG wants us to,
>>> while somebody figuires out what the best way is to show the prompt
>>> to the console on Windows.
>>
>> That's OK by me, but I don't know if we can put off the "best way to
>> show the prompt" fix. It seems like a pretty serious regression for
>> people on Windows.
> 
> Yes, I am not saying that it is OK to keep Windows users broken.
> 
> As I understand what Dscho said correctly, his users are covered by
> a reversion of the "read the GPG status correctly" patch, i.e. with
> a different trade-off between the correctness of GPG status vs
> usability of the prompt, he will ship with Git for Windows, and that
> stop-gap measure will last only until developers who can do Windows
> (which excludes you, me, and Michael it seems) comes up with a
> solution that satisfies both.

Unfortunately "I can't do Windows". Also, I'm not sure "I can do pipes",
but it's really the ifdeffing that keeps me from even trying: Nothing is
gained for Windows users if I extend the Linux code to use an extra file
handle for status-fd - which would be the clean and correct solution,
but which would need to be implemented twice.

> I consider that an approach that is perfectly fine.

As a side note, I'm wondering why MSYS-gpg version 1 is bundled with
non-MSYS-git. It's an honest question - there must be good reasons for
that, and git should work with gpg 1, 2 (maybe) and 2.1, of course. I'm
just trying to understand the situation, and the question goes both ways:

- some Windows user(s) in the Github issue apparantly had wrong
assumptions about which gpg they're using (via git) - why bundle it at all?

- If bundling it to get a known working setup, why not gpg 2(.1) which
runs gpg-agent automatically, giving a more Windows-like experience for
the passphrase-prompt?

On Fedora, with some things still requiring gpg 1, gpg 2.1 installed in
parallel, things can become confusing quickly because  of the 1-time
1-way migration of the secret key store. It's probably the same on
Windows with those two gpg's used in parallel (and probably answers my
second question).

Michael

^ permalink raw reply

* Re: Git Miniconference at Plumbers
From: Jon Loeliger @ 2016-09-12 13:32 UTC (permalink / raw)
  To: Jeff King; +Cc: git
In-Reply-To: <20160912004233.qh6uf35v5ylrboz6@sigill.intra.peff.net>

So, like, Jeff King said:
> On Tue, Sep 06, 2016 at 12:42:04PM -0500, Jon Loeliger wrote:
> 
> > I have recently been enlisted by folks at the Linux Foundation to
> > help run a Miniconference on Git at the Plumbers Conference [*]
> > this fall.
> 
> I see the conference runs for 4 days; I assume the Git portion will just
> be one day.

Yes, and yes.  Likely even "a half day".

> Do you know yet which day?

No.  Sorry.

> -Peff

jdl

^ permalink raw reply

* Gitattributes file is not respected when switching between branches
From: Виталий Ищенко @ 2016-09-12 12:55 UTC (permalink / raw)
  To: git

Good day

I faced following issue with gitattributes file (at least eol setting)
when was trying to force `lf` mode on windows.

We have 2 branches: master & dev. With master set as HEAD in repository

I've added `.gitattributes` with following content to `dev` branch

```
* text eol=lf
```

Now when you clone this repo on other machine and checkout dev branch,
eol setting is not respected.
As a workaround you can rm all files except .git folder and do hard reset.

Issue is reproducible on windows & unix versions. Test repo can be
found on github
https://github.com/betalb/gitattributes-issue

master branch - one file without gitattributes
feature-branch - .gitattributes added with eol=lf
unix-feature-branch - .gitattributes added with eol=crlf

Thanks,
Vitalii

^ permalink raw reply

* Re: [PATCH v2 09/14] i18n: notes: mark error messages for translation
From: Jean-Noël Avila @ 2016-09-12 12:23 UTC (permalink / raw)
  To: Vasco Almeida, git
  Cc: Jiang Xin, Ævar Arnfjörð Bjarmason, Junio C Hamano
In-Reply-To: <1473679802-31381-9-git-send-email-vascomalmeida@sapo.pt>

Le 12/09/2016 à 13:29, Vasco Almeida a écrit :
> Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
> ---
>  builtin/notes.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/builtin/notes.c b/builtin/notes.c
> index f848b89..abacae2 100644
> --- a/builtin/notes.c
> +++ b/builtin/notes.c
> @@ -340,7 +340,7 @@ 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/)",
> +		die(_("Refusing to %s notes in %s (outside of refs/notes/)"),
>  		    subcommand, ref);
>  	return t;
>  }

Not sure this one will be easy to localize. The verb is passed as a
parameter : see line 366 "list", line 426 "add", line 517 "copy", line
658 "show", line 816 "merge", line 908 "remove" or line 595 with argv[0].

If all the verbs are real subcommands, then the translators should be
warned that this is some english twisting, but that they need to refer
to the subcommand on the command line.

Otherwise,

Acked-by: Jean-Noël Avila <jean-noel.avila@free.fr>

JN

^ permalink raw reply

* Re: [PATCH v2 12/14] i18n: show-branch: mark error messages for translation
From: Jean-Noël Avila @ 2016-09-12 12:12 UTC (permalink / raw)
  To: Vasco Almeida, git
  Cc: Jiang Xin, Ævar Arnfjörð Bjarmason, Junio C Hamano
In-Reply-To: <1473679802-31381-12-git-send-email-vascomalmeida@sapo.pt>

Le 12/09/2016 à 13:30, Vasco Almeida a écrit :
>  		if (MAX_REVS < reflog)
> -			die("Only %d entries can be shown at one time.",
> +			die("only %d entries can be shown at one time.",
>  			    MAX_REVS);

Wouldn't you i18n this one too, with plural form?


JN

^ permalink raw reply

* Re: [PATCH v7 10/10] convert: add filter.<driver>.process option
From: Lars Schneider @ 2016-09-12  9:49 UTC (permalink / raw)
  To: Torsten Bögershausen
  Cc: Git Mailing List, peff, gitster, sbeller, Johannes.Schindelin,
	jnareb, mlbright, jacob.keller
In-Reply-To: <20160910062919.GB11001@tb-raspi>


> On 10 Sep 2016, at 08:29, Torsten Bögershausen <tboegi@web.de> wrote:
> 
> On Thu, Sep 08, 2016 at 08:21:32PM +0200, larsxschneider@gmail.com wrote:
> []
>> +packet:          git> git-filter-client
>> +packet:          git> version=2
>> +packet:          git> version=42
>> +packet:          git> 0000
>> +packet:          git< git-filter-server
>> +packet:          git< version=2
>> +packet:          git> clean=true
>> +packet:          git> smudge=true
>> +packet:          git> not-yet-invented=true
>> +packet:          git> 0000
>> +packet:          git< clean=true
>> +packet:          git< smudge=true
>> +packet:          git< 0000
> 
> It's probalby only me who has difficulties to distinguish
> '>' from '<'.

I see what you mean. However, this format is used with "GIT_TRACE_PACKET"
as well and therefore I would prefer to keep it.


> packet:          git> git-filter-client
> packet:          git> version=2
> packet:          git> version=42
> packet:          git> 0000
> packet:       filter> git-filter-server
> packet:       filter> version=2
> 
> (Otherwise the dialoge description is nice)

Thanks!


>> +------------------------
>> +Supported filter capabilities in version 2 are "clean" and
>> +"smudge".
>> +
>> +Afterwards Git sends a list of "key=value" pairs terminated with
>> +a flush packet. The list will contain at least the filter command
>> +(based on the supported capabilities) and the pathname of the file
>> +to filter relative to the repository root. Right after these packets
>> +Git sends the content split in zero or more pkt-line packets and a
>> +flush packet to terminate content.
>> +------------------------
>> +packet:          git> command=smudge\n
>> +packet:          git> pathname=path/testfile.dat\n
> 
> How do we send pathnames the have '\n' ?
> Not really recommended, but allowed.
> And here I am a little bit lost, is each of the lines packed into
> a pkt-line ?
> command=smudge is packet as pkt-line and pathname= is packed into
> another one ? (The we don't need the '\n' at all)

Every line is a dedicated packet. That's why '\n' in a path name would
not be a problem as the receiver is expected to read the entire packet
when parsing the value (and the receiver knows the packet length, too).

The '\n' at the end is required by the pkt-line format:
"A non-binary line SHOULD BE terminated by an LF..."
(see protocol-common.txt)


> Or go both lines into one pkt-line (thats what I think), then
> we don't need the '\n' afther the pathname.

No (see above).


> And in this case the pathname is always the last element, and a '\n'
> may occur in the pathname, since we know the length of the packet
> we know how long the pathname must be.
> 
> 
> [...]
>> 
>> +In case the filter cannot or does not want to process the content,
> 
> Does not want ? 
> I can see something like "I read through the file, there is nothing
> to do. So Git, I don't send anything back, you know where the file is.

That's right. Isn't that covered with "does not want"?


>> +it is expected to respond with an "error" status. Depending on the
>> +`filter.<driver>.required` flag Git will interpret that as error
>> +but it will not stop or restart the filter process.
>> +------------------------
>> +packet:          git< status=error\n
>> +packet:          git< 0000
>> +------------------------
>> +
>> +If the filter experiences an error during processing, then it can
>> +send the status "error" after the content was (partially or
>> +completely) sent. Depending on the `filter.<driver>.required` flag
>> +Git will interpret that as error but it will not stop or restart the
>> +filter process.
>> +------------------------
>> +packet:          git< status=success\n
>> +packet:          git< 0000
>> +packet:          git< HALF_WRITTEN_ERRONEOUS_CONTENT
>> +packet:          git< 0000
>> +packet:          git< status=error\n
>> +packet:          git< 0000
>> +------------------------
>> +
>> +If the filter dies during the communication or does not adhere to
>> +the protocol then Git will stop the filter process and restart it
> 
> My personal comment:
> When a filter is mis-behaving, Git should say so loud and clear, and
> die(). 
> The filter process can be left running, so that it can be debugged.

In the current implementation Git would die already if the filter is 
"required". In this particular case we *could* die, too. However, 
I would prefer to keep it as is because I think the users of a 
"non-required" filter do not expect Git to die if there is *any* 
problem with the filter.


> Here I stopped the review for a moment, 
> I still think that Git shouldn't kill anything, because we loose
> the ability to debug these processes.

Based on my experience debugging the filter in this state is hard
anyways. I think a user would rather try to reproduce the problem
and run Git with the "GIT_TRACE_PACKET" flag enabled for debugging.


Thanks,
Lars

^ permalink raw reply

* Re: [PATCH v7 03/10] pkt-line: add packet_write_fmt_gently()
From: Lars Schneider @ 2016-09-12  9:22 UTC (permalink / raw)
  To: Stefan Beller
  Cc: git@vger.kernel.org, Jeff King, Junio C Hamano,
	Johannes Schindelin, Jakub Narębski, Martin-Louis Bright,
	Torsten Bögershausen, Jacob Keller
In-Reply-To: <CAGZ79kZaRdJqbjfacdxT5eqOaK-RObJo+AddZ8heaU-KzWCOwQ@mail.gmail.com>


> On 11 Sep 2016, at 18:01, Stefan Beller <sbeller@google.com> wrote:
> 
> On Sun, Sep 11, 2016 at 4:36 AM, Lars Schneider
> <larsxschneider@gmail.com> wrote:
> 
>>> 
>>>   call check_pipe from write_or_die here instead of
>>>   reproducing that function?
>> [...]
> 
>> Maybe it would be more suitable to move check_pipe to
>> run-command.h/c?
> 
> That's certainly possible.
> I don't have a strong opinion, where the code actually
> resides, but I do have a strong-ish opinion on code
> duplication. ;)

OK, then I will move check_pipe() to run-command.

Thanks,
Lars


^ permalink raw reply

* Re: [PATCH v2 07/14] i18n: merge-recursive: mark error messages for translation
From: Jean-Noël Avila @ 2016-09-12 11:47 UTC (permalink / raw)
  To: Vasco Almeida, git
  Cc: Jiang Xin, Ævar Arnfjörð Bjarmason,
	Jean-Noël AVILA, Junio C Hamano
In-Reply-To: <1473679802-31381-7-git-send-email-vascomalmeida@sapo.pt>

Hi,

Le 12/09/2016 à 13:29, Vasco Almeida a écrit :
> -			warning("Cannot handle more than %d bases. "
> -				"Ignoring %s.",
> +			warning(_("cannot handle more than %d bases. "
> +				  "Ignoring %s."),
>  				(int)ARRAY_SIZE(bases)-1, argv[i]);
>  	}

This one is also missing the plural form.

Thanks,

JN

^ permalink raw reply

* [PATCH v2 14/14] i18n: show-branch: mark plural strings for translation
From: Vasco Almeida @ 2016-09-12 11:30 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 | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index 6bf82cd..5905ca1 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,10 @@ 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))
 		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 v2 13/14] i18n: update-index: mark warnings for translation
From: Vasco Almeida @ 2016-09-12 11:30 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 v2 11/14] i18n: receive-pack: mark messages for translation
From: Vasco Almeida @ 2016-09-12 11:29 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 v2 12/14] i18n: show-branch: mark error messages for translation
From: Vasco Almeida @ 2016-09-12 11:30 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 | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index 2566935..6bf82cd 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.",
+			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 v2 09/14] i18n: notes: mark error messages for translation
From: Vasco Almeida @ 2016-09-12 11:29 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 | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/builtin/notes.c b/builtin/notes.c
index f848b89..abacae2 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -340,7 +340,7 @@ 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/)",
+		die(_("Refusing to %s notes in %s (outside of refs/notes/)"),
 		    subcommand, ref);
 	return t;
 }
@@ -680,11 +680,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 +704,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 +721,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 v2 08/14] i18n: merge-recursive: mark verbose message for translation
From: Vasco Almeida @ 2016-09-12 11:29 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 0bc88a7..1c21802 100644
--- a/builtin/merge-recursive.c
+++ b/builtin/merge-recursive.c
@@ -71,7 +71,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 v2 07/14] i18n: merge-recursive: mark error messages for translation
From: Vasco Almeida @ 2016-09-12 11:29 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 | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c
index fd2c455..0bc88a7 100644
--- a/builtin/merge-recursive.c
+++ b/builtin/merge-recursive.c
@@ -42,30 +42,30 @@ 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(_("cannot handle more than %d bases. "
+				  "Ignoring %s."),
 				(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 v2 05/14] i18n: branch: mark option description for translation
From: Vasco Almeida @ 2016-09-12 11:29 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 v2 03/14] i18n: apply: mark info messages for translation
From: Vasco Almeida @ 2016-09-12 11:29 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 v2 04/14] i18n: blame: mark error messages for translation
From: Vasco Almeida @ 2016-09-12 11:29 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 v2 02/14] i18n: apply: mark error messages for translation
From: Vasco Almeida @ 2016-09-12 11:29 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

* [PATCH v2 01/14] i18n: apply: mark plural string for translation
From: Vasco Almeida @ 2016-09-12 11:29 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_().

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
---
 builtin/apply.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/builtin/apply.c b/builtin/apply.c
index 1a488f9..ef03c74 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -4768,10 +4768,12 @@ static int apply_all_patches(struct apply_state *state,
 			       state->whitespace_error),
 			    state->whitespace_error);
 		if (state->applied_after_fixing_ws && state->apply)
-			warning("%d line%s applied after"
-				" fixing whitespace errors.",
-				state->applied_after_fixing_ws,
-				state->applied_after_fixing_ws == 1 ? "" : "s");
+			warning(Q_("%d line applied after"
+				   " fixing whitespace errors.",
+				   "%d lines applied after"
+				   " fixing whitespace errors.",
+				   state->applied_after_fixing_ws),
+				state->applied_after_fixing_ws);
 		else if (state->whitespace_error)
 			warning(Q_("%d line adds whitespace errors.",
 				   "%d lines add whitespace errors.",
-- 
2.7.4


^ permalink raw reply related

* [PATCH] Do not record unstaged deleted file upon recursive merge if file was moved outside of working tree with enabled sparse-checkout.
From: Mikhail Filippov @ 2016-09-12 11:24 UTC (permalink / raw)
  To: git; +Cc: Mikhail Filippov

It's a very unexpected behaviour when a user sees a deleted file after a merge with enabled sparse-checkout. Moreover, when the user resolves merge conflicts and commits the changes with the command "git commit -am xxx", a repository can be broken because all the moved files will be deleted. Finally, it's really hard to find a user who deleted these files because "git log file" doesn't show any merge commits by default. I'm not sure that my fix is correct but I checked all tests and I didn't find a better way to prevent files deleting.
---
 merge-recursive.c                    |  9 +++++---
 t/t6042-merge-rename-corner-cases.sh | 41 ++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 3 deletions(-)

diff --git a/merge-recursive.c b/merge-recursive.c
index e349126..25dc701 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1724,9 +1724,12 @@ static int merge_content(struct merge_options *o,
 		 */
 		path_renamed_outside_HEAD = !path2 || !strcmp(path, path2);
 		if (!path_renamed_outside_HEAD) {
-			add_cacheinfo(o, mfi.mode, &mfi.oid, path,
-				      0, (!o->call_depth), 0);
-			return mfi.clean;
+			struct stat st;
+			if (lstat(path, &st) == 0) {
+				add_cacheinfo(o, mfi.mode, &mfi.oid, path,
+					      0, (!o->call_depth), 0);
+				return mfi.clean;
+			}
 		}
 	} else
 		output(o, 2, _("Auto-merging %s"), path);
diff --git a/t/t6042-merge-rename-corner-cases.sh b/t/t6042-merge-rename-corner-cases.sh
index 411550d..5d84418 100755
--- a/t/t6042-merge-rename-corner-cases.sh
+++ b/t/t6042-merge-rename-corner-cases.sh
@@ -575,4 +575,45 @@ test_expect_success 'rename/rename/add-dest merge still knows about conflicting
 	test ! -f c
 '
 
+test_expect_success 'move file/sparse-checkout/merge should not delete moved file' '
+	git rm -rf . &&
+	git clean -fdqx &&
+	rm -rf .git &&
+	git init &&
+
+	echo output >.gitignore &&
+	echo .gitignore >>.gitignore &&
+
+	echo b1 >b1 &&
+	git add b1 &&
+	git commit -m b1 &&
+
+	mkdir excluded &&
+	echo problem >excluded/to-be-moved.txt &&
+	git add excluded/to-be-moved.txt &&
+	git commit -m to-be-moved &&
+	git tag split_point &&
+
+	echo b2 >b2 &&
+	git add b2 &&
+	git commit -m b2 &&
+	git tag b2 &&
+
+	git reset --hard split_point &&
+
+	git mv excluded/to-be-moved.txt excluded/moved.txt &&
+	git commit -m move &&
+	git tag b1 &&
+
+	git config core.sparsecheckout true &&
+	echo "/*" >.git/info/sparse-checkout &&
+	echo "!excluded/" >>.git/info/sparse-checkout &&
+	git read-tree -mu HEAD &&
+
+	git merge -m merge b2 &&
+
+	git status >output &&
+	test_i18ngrep "nothing to commit" output
+'
+
 test_done
-- 
2.7.4 (Apple Git-66)


^ permalink raw reply related

* [PATCH v2 10/14] notes: lowercase first word of error messages
From: Vasco Almeida @ 2016-09-12 11:29 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 abacae2..14488ba 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;
 		}
@@ -340,7 +340,7 @@ 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/)"),
+		die(_("refusing to %s notes in %s (outside of refs/notes/)"),
 		    subcommand, ref);
 	return t;
 }
@@ -367,13 +367,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);
@@ -422,7 +422,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);
@@ -508,12 +508,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);
@@ -532,7 +532,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;
 	}
@@ -591,7 +591,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);
@@ -654,13 +654,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};
@@ -680,11 +680,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 +704,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 +721,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));
@@ -794,7 +794,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"));
@@ -818,7 +818,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 {
@@ -855,10 +855,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 "
@@ -1014,7 +1014,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 v2 06/14] i18n: config: mark error message for translation
From: Vasco Almeida @ 2016-09-12 11:29 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


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox