* [PATCH 11/13] i18n: receive-pack: mark messages for translation
From: Vasco Almeida @ 2016-09-07 14:49 UTC (permalink / raw)
To: git; +Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason
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 011db00..79839d0 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -775,47 +775,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 13/13] i18n: update-index: mark warning for translation
From: Vasco Almeida @ 2016-09-07 14:49 UTC (permalink / raw)
To: git; +Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason
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 12/13] i18n: show-branch: mark error messages for translation
From: Vasco Almeida @ 2016-09-07 14:49 UTC (permalink / raw)
To: git; +Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason
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..8a5097d 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -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) {
@@ -826,12 +826,12 @@ 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(_("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 09/13] i18n: notes: mark error messages for translation
From: Vasco Almeida @ 2016-09-07 14:49 UTC (permalink / raw)
To: git; +Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason
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 13/13] i18n: update-index: mark warnings for translation
From: Vasco Almeida @ 2016-09-07 14:49 UTC (permalink / raw)
To: git; +Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason
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 10/13] notes: lowercase first word of error messages
From: Vasco Almeida @ 2016-09-07 14:49 UTC (permalink / raw)
To: git; +Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason
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 08/13] i18n: merge-recursive: mark verbose message for translation
From: Vasco Almeida @ 2016-09-07 14:49 UTC (permalink / raw)
To: git; +Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason
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 06/13] i18n: config: mark error message for translation
From: Vasco Almeida @ 2016-09-07 14:49 UTC (permalink / raw)
To: git; +Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason
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 07/13] i18n: merge-recursive: mark error messages for translation
From: Vasco Almeida @ 2016-09-07 14:49 UTC (permalink / raw)
To: git; +Cc: Vasco Almeida, Jiang Xin, Ævar Arnfjörð Bjarmason
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 0/5] Fix version sort prerelease reordering bug
From: SZEDER Gábor @ 2016-09-07 15:12 UTC (permalink / raw)
To: Jeff King, Junio C Hamano
Cc: Leho Kraav, Nguyễn Thái Ngọc Duy, git,
SZEDER Gábor
In-Reply-To: <20160906214550.Horde.ducOghtmsQb9pQ6lixxddVz@webmail.informatik.kit.edu>
(Sorry for double post, forgot to Cc: the mailing list...)
This series fixes a bug, where version sort with prerelease reordering
puts tagnames in the wrong order, when the common part of two compared
tagnames ends with the leading character(s) of one or more configured
prerelease suffixes. More details in the final patch.
The first two patches are test cleanups, the first is an independent
"while at it", but the second one touches tests that are modified by
later patches of this series. The rest is rather straightforward: add
failing tests, do some refactoring, and finally fix the bug.
SZEDER Gábor (5):
t7004-tag: delete unnecessary tags with test_when_finished
t7004-tag: use test_config helper
t7004-tag: add version sort tests to show prerelease reordering issues
versioncmp: pass full tagnames to swap_prereleases()
versioncmp: cope with common leading parts in
versionsort.prereleaseSuffix
t/t7004-tag.sh | 83 ++++++++++++++++++++++++++++++++++++++++------------------
versioncmp.c | 46 +++++++++++++++++++++-----------
2 files changed, 87 insertions(+), 42 deletions(-)
--
2.10.0.74.g6632b1b
^ permalink raw reply
* [PATCH 1/5] t7004-tag: delete unnecessary tags with test_when_finished
From: SZEDER Gábor @ 2016-09-07 15:12 UTC (permalink / raw)
To: Jeff King, Junio C Hamano
Cc: Leho Kraav, Nguyễn Thái Ngọc Duy, git,
SZEDER Gábor
In-Reply-To: <20160907151251.30978-1-szeder@ira.uka.de>
The '--force is moot with a non-existing tag name' test creates two
new tags, which are then deleted right after the test is finished,
outside the test_expect_success block, allowing 'git tag -d's output to
pollute the test output.
Use test_when_finished to delete those tags.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
t/t7004-tag.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 8b0f71a2ac15..396cffeeb5ad 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -122,11 +122,11 @@ test_expect_success '--force can create a tag with the name of one existing' '
tag_exists mytag'
test_expect_success '--force is moot with a non-existing tag name' '
+ test_when_finished git tag -d newtag forcetag &&
git tag newtag >expect &&
git tag --force forcetag >actual &&
test_cmp expect actual
'
-git tag -d newtag forcetag
# deleting tags:
--
2.10.0.74.g6632b1b
^ permalink raw reply related
* [PATCH 2/5] t7004-tag: use test_config helper
From: SZEDER Gábor @ 2016-09-07 15:12 UTC (permalink / raw)
To: Jeff King, Junio C Hamano
Cc: Leho Kraav, Nguyễn Thái Ngọc Duy, git,
SZEDER Gábor
In-Reply-To: <20160907151251.30978-1-szeder@ira.uka.de>
... instead of setting and then manually unsetting configuration
variables, on one occasion even outside the test_expect_success block.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
t/t7004-tag.sh | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 396cffeeb5ad..920a1b4b2e58 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -297,11 +297,9 @@ EOF
'
test_expect_success 'listing tags in column with column.*' '
- git config column.tag row &&
- git config column.ui dense &&
+ test_config column.tag row &&
+ test_config column.ui dense &&
COLUMNS=40 git tag -l >actual &&
- git config --unset column.ui &&
- git config --unset column.tag &&
cat >expected <<\EOF &&
a1 aa1 cba t210 t211
v0.2.1 v1.0 v1.0.1 v1.1.3
@@ -314,9 +312,8 @@ test_expect_success 'listing tag with -n --column should fail' '
'
test_expect_success 'listing tags -n in column with column.ui ignored' '
- git config column.ui "row dense" &&
+ test_config column.ui "row dense" &&
COLUMNS=40 git tag -l -n >actual &&
- git config --unset column.ui &&
cat >expected <<\EOF &&
a1 Foo
aa1 Foo
@@ -1200,11 +1197,10 @@ test_expect_success GPG,RFC1991 \
'
# try to sign with bad user.signingkey
-git config user.signingkey BobTheMouse
test_expect_success GPG \
'git tag -s fails if gpg is misconfigured (bad key)' \
- 'test_must_fail git tag -s -m tail tag-gpg-failure'
-git config --unset user.signingkey
+ 'test_config user.signingkey BobTheMouse &&
+ test_must_fail git tag -s -m tail tag-gpg-failure'
# try to produce invalid signature
test_expect_success GPG \
@@ -1484,7 +1480,7 @@ test_expect_success 'reverse lexical sort' '
'
test_expect_success 'configured lexical sort' '
- git config tag.sort "v:refname" &&
+ test_config tag.sort "v:refname" &&
git tag -l "foo*" >actual &&
cat >expect <<-\EOF &&
foo1.3
@@ -1495,6 +1491,7 @@ test_expect_success 'configured lexical sort' '
'
test_expect_success 'option override configured sort' '
+ test_config tag.sort "v:refname" &&
git tag -l --sort=-refname "foo*" >actual &&
cat >expect <<-\EOF &&
foo1.6
@@ -1509,13 +1506,12 @@ test_expect_success 'invalid sort parameter on command line' '
'
test_expect_success 'invalid sort parameter in configuratoin' '
- git config tag.sort "v:notvalid" &&
+ test_config tag.sort "v:notvalid" &&
test_must_fail git tag -l "foo*"
'
test_expect_success 'version sort with prerelease reordering' '
- git config --unset tag.sort &&
- git config versionsort.prereleaseSuffix -rc &&
+ test_config versionsort.prereleaseSuffix -rc &&
git tag foo1.6-rc1 &&
git tag foo1.6-rc2 &&
git tag -l --sort=version:refname "foo*" >actual &&
@@ -1530,6 +1526,7 @@ test_expect_success 'version sort with prerelease reordering' '
'
test_expect_success 'reverse version sort with prerelease reordering' '
+ test_config versionsort.prereleaseSuffix -rc &&
git tag -l --sort=-version:refname "foo*" >actual &&
cat >expect <<-\EOF &&
foo1.10
--
2.10.0.74.g6632b1b
^ permalink raw reply related
* [PATCH 4/5] versioncmp: pass full tagnames to swap_prereleases()
From: SZEDER Gábor @ 2016-09-07 15:12 UTC (permalink / raw)
To: Jeff King, Junio C Hamano
Cc: Leho Kraav, Nguyễn Thái Ngọc Duy, git,
SZEDER Gábor
In-Reply-To: <20160907151251.30978-1-szeder@ira.uka.de>
The swap_prereleases() helper function is responsible for finding
configured prerelease suffixes in a pair of tagnames to be compared,
but this function currently only gets to see only the parts of those
two tagnames starting at the first different character. To fix some
issues related to multiple prerelease suffixes starting with the same
leading character(s), this helper function must see the preceeding
matching characters as well.
In preparation for the fix in the following patch, refactor
swap_prereleases() and its caller to pass two full tagnames and an
additional offset indicating the position of the first different
character.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
versioncmp.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/versioncmp.c b/versioncmp.c
index 80bfd109fa12..fed02d2a2878 100644
--- a/versioncmp.c
+++ b/versioncmp.c
@@ -25,32 +25,31 @@ static const struct string_list *prereleases;
static int initialized;
/*
- * p1 and p2 point to the first different character in two strings. If
- * either p1 or p2 starts with a prerelease suffix, it will be forced
- * to be on top.
+ * off is the offset of the first different character in the two strings
+ * s1 and s2. If either s1 or s2 contains a prerelease suffix starting
+ * at that offset, it will be forced to be on top.
*
- * If both p1 and p2 start with (different) suffix, the order is
- * determined by config file.
+ * If both s1 and s2 contain a (different) suffix at that position, the
+ * order is determined by config file.
*
- * Note that we don't have to deal with the situation when both p1 and
- * p2 start with the same suffix because the common part is already
+ * Note that we don't have to deal with the situation when both s1 and
+ * s2 contain the same suffix because the common part is already
* consumed by the caller.
*
* Return non-zero if *diff contains the return value for versioncmp()
*/
-static int swap_prereleases(const void *p1_,
- const void *p2_,
+static int swap_prereleases(const char *s1,
+ const char *s2,
+ int off,
int *diff)
{
- const char *p1 = p1_;
- const char *p2 = p2_;
int i, i1 = -1, i2 = -1;
for (i = 0; i < prereleases->nr; i++) {
const char *suffix = prereleases->items[i].string;
- if (i1 == -1 && starts_with(p1, suffix))
+ if (i1 == -1 && starts_with(s1 + off, suffix))
i1 = i;
- if (i2 == -1 && starts_with(p2, suffix))
+ if (i2 == -1 && starts_with(s2 + off, suffix))
i2 = i;
}
if (i1 == -1 && i2 == -1)
@@ -121,7 +120,8 @@ int versioncmp(const char *s1, const char *s2)
initialized = 1;
prereleases = git_config_get_value_multi("versionsort.prereleasesuffix");
}
- if (prereleases && swap_prereleases(p1 - 1, p2 - 1, &diff))
+ if (prereleases && swap_prereleases(s1, s2, (const char *) p1 - s1 - 1,
+ &diff))
return diff;
state = result_type[state * 3 + (((c2 == '0') + (isdigit (c2) != 0)))];
--
2.10.0.74.g6632b1b
^ permalink raw reply related
* [PATCH 3/5] t7004-tag: add version sort tests to show prerelease reordering issues
From: SZEDER Gábor @ 2016-09-07 15:12 UTC (permalink / raw)
To: Jeff King, Junio C Hamano
Cc: Leho Kraav, Nguyễn Thái Ngọc Duy, git,
SZEDER Gábor
In-Reply-To: <20160907151251.30978-1-szeder@ira.uka.de>
Version sort with prerelease reordering sometimes puts tagnames in the
wrong order, when the common part of two compared tagnames ends with
the leading character(s) of one or more configured prerelease
suffixes. Add tests that demonstrate these issues.
The unrelated '--format should list tags as per format given' test
later uses tags matching the same prefix as the version sort tests,
thus was affected by the new tags added for the new tests in this
patch. Change that test to perform its checks on a different set of
tags.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
t/t7004-tag.sh | 62 +++++++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 48 insertions(+), 14 deletions(-)
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 920a1b4b2e58..d69ac4940388 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -1511,14 +1511,14 @@ test_expect_success 'invalid sort parameter in configuratoin' '
'
test_expect_success 'version sort with prerelease reordering' '
- test_config versionsort.prereleaseSuffix -rc &&
- git tag foo1.6-rc1 &&
- git tag foo1.6-rc2 &&
+ test_config versionsort.prereleaseSuffix -beta &&
+ git tag foo1.6-beta1 &&
+ git tag foo1.6-beta2 &&
git tag -l --sort=version:refname "foo*" >actual &&
cat >expect <<-\EOF &&
foo1.3
- foo1.6-rc1
- foo1.6-rc2
+ foo1.6-beta1
+ foo1.6-beta2
foo1.6
foo1.10
EOF
@@ -1526,18 +1526,54 @@ test_expect_success 'version sort with prerelease reordering' '
'
test_expect_success 'reverse version sort with prerelease reordering' '
- test_config versionsort.prereleaseSuffix -rc &&
+ test_config versionsort.prereleaseSuffix -beta &&
git tag -l --sort=-version:refname "foo*" >actual &&
cat >expect <<-\EOF &&
foo1.10
foo1.6
- foo1.6-rc2
- foo1.6-rc1
+ foo1.6-beta2
+ foo1.6-beta1
foo1.3
EOF
test_cmp expect actual
'
+test_expect_failure 'version sort with prerelease reordering and common leading character' '
+ test_config versionsort.prereleaseSuffix -beta &&
+ git tag foo1.6-after1 &&
+ git tag -l --sort=version:refname "foo*" >actual &&
+ cat >expect <<-\EOF &&
+ foo1.3
+ foo1.6-beta1
+ foo1.6-beta2
+ foo1.6
+ foo1.6-after1
+ foo1.10
+ EOF
+ test_cmp expect actual
+'
+
+# Capitalization of suffixes is important here, because "-RC" would normally
+# be sorted before "-beta" and the config settings should override that.
+test_expect_failure 'version sort with prerelease reordering, multiple suffixes and common leading character' '
+ test_config versionsort.prereleaseSuffix -beta &&
+ git config --add versionsort.prereleaseSuffix -RC &&
+ git tag foo1.6-RC1 &&
+ git tag foo1.6-RC2 &&
+ git tag -l --sort=version:refname "foo*" >actual &&
+ cat >expect <<-\EOF &&
+ foo1.3
+ foo1.6-beta1
+ foo1.6-beta2
+ foo1.6-RC1
+ foo1.6-RC2
+ foo1.6
+ foo1.6-after1
+ foo1.10
+ EOF
+ test_cmp expect actual
+'
+
run_with_limited_stack () {
(ulimit -s 128 && "$@")
}
@@ -1566,13 +1602,11 @@ EOF"
test_expect_success '--format should list tags as per format given' '
cat >expect <<-\EOF &&
- refname : refs/tags/foo1.10
- refname : refs/tags/foo1.3
- refname : refs/tags/foo1.6
- refname : refs/tags/foo1.6-rc1
- refname : refs/tags/foo1.6-rc2
+ refname : refs/tags/v1.0
+ refname : refs/tags/v1.0.1
+ refname : refs/tags/v1.1.3
EOF
- git tag -l --format="refname : %(refname)" "foo*" >actual &&
+ git tag -l --format="refname : %(refname)" "v1*" >actual &&
test_cmp expect actual
'
--
2.10.0.74.g6632b1b
^ permalink raw reply related
* [PATCH 5/5] versioncmp: cope with common leading parts in versionsort.prereleaseSuffix
From: SZEDER Gábor @ 2016-09-07 15:12 UTC (permalink / raw)
To: Jeff King, Junio C Hamano
Cc: Leho Kraav, Nguyễn Thái Ngọc Duy, git,
SZEDER Gábor
In-Reply-To: <20160907151251.30978-1-szeder@ira.uka.de>
Version sort with prerelease reordering sometimes puts tagnames in the
wrong order, when the common part of two compared tagnames ends with
the leading character(s) of one or more configured prerelease
suffixes.
$ git config --get-all versionsort.prereleaseSuffix
-beta
$ git tag -l --sort=version:refname v2.1.*
v2.1.0-beta-2
v2.1.0-beta-3
v2.1.0
v2.1.0-RC1
v2.1.0-RC2
v2.1.0-beta-1
v2.1.1
v2.1.2
The reason is that when comparing a pair of tagnames, first
versioncmp() looks for the first different character in a pair of
tagnames, and then the swap_prereleases() helper function checks for
prerelease suffixes _starting at_ that character. Thus, when in the
above example the sorting algorithm happens to compare the tagnames
"v2.1.0-beta-1" and "v2.1.0-RC2", swap_prereleases() will try to match
the suffix "-beta" against "beta-1" to no avail, and the two tagnames
erroneously end up being ordered lexicographically.
To fix this issue change swap_prereleases() to look for configured
prerelease suffixes containing that first different character.
Reported-by: Leho Kraav <leho@conversionready.com>
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
t/t7004-tag.sh | 4 ++--
versioncmp.c | 24 +++++++++++++++++++-----
2 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index d69ac4940388..f0cfe1fa3d8b 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -1538,7 +1538,7 @@ test_expect_success 'reverse version sort with prerelease reordering' '
test_cmp expect actual
'
-test_expect_failure 'version sort with prerelease reordering and common leading character' '
+test_expect_success 'version sort with prerelease reordering and common leading character' '
test_config versionsort.prereleaseSuffix -beta &&
git tag foo1.6-after1 &&
git tag -l --sort=version:refname "foo*" >actual &&
@@ -1555,7 +1555,7 @@ test_expect_failure 'version sort with prerelease reordering and common leading
# Capitalization of suffixes is important here, because "-RC" would normally
# be sorted before "-beta" and the config settings should override that.
-test_expect_failure 'version sort with prerelease reordering, multiple suffixes and common leading character' '
+test_expect_success 'version sort with prerelease reordering, multiple suffixes and common leading character' '
test_config versionsort.prereleaseSuffix -beta &&
git config --add versionsort.prereleaseSuffix -RC &&
git tag foo1.6-RC1 &&
diff --git a/versioncmp.c b/versioncmp.c
index fed02d2a2878..87b49a622423 100644
--- a/versioncmp.c
+++ b/versioncmp.c
@@ -27,7 +27,8 @@ static int initialized;
/*
* off is the offset of the first different character in the two strings
* s1 and s2. If either s1 or s2 contains a prerelease suffix starting
- * at that offset, it will be forced to be on top.
+ * at that offset or the character at that offset is part of a
+ * prerelease suffix, then that string will be forced to be on top.
*
* If both s1 and s2 contain a (different) suffix at that position, the
* order is determined by config file.
@@ -47,10 +48,23 @@ static int swap_prereleases(const char *s1,
for (i = 0; i < prereleases->nr; i++) {
const char *suffix = prereleases->items[i].string;
- if (i1 == -1 && starts_with(s1 + off, suffix))
- i1 = i;
- if (i2 == -1 && starts_with(s2 + off, suffix))
- i2 = i;
+ int j, start, suffix_len = strlen(suffix);
+ if (suffix_len < off)
+ start = off - suffix_len + 1;
+ else
+ start = 0;
+ for (j = start; j <= off; j++) {
+ if (i1 == -1 && starts_with(s1 + j, suffix)) {
+ i1 = i;
+ break;
+ }
+ }
+ for (j = start; j <= off; j++) {
+ if (i2 == -1 && starts_with(s2 + j, suffix)) {
+ i2 = i;
+ break;
+ }
+ }
}
if (i1 == -1 && i2 == -1)
return 0;
--
2.10.0.74.g6632b1b
^ permalink raw reply related
* Re: Bug? ran into a "fatal" using interactive rebase
From: Johannes Schindelin @ 2016-09-07 15:19 UTC (permalink / raw)
To: Ralf Thielow; +Cc: git, Junio C Hamano
In-Reply-To: <CAN0XMO+ZOV3M02wJ_=oMPbN4ch-=7gA_pXEegfHApvSNeOu3KA@mail.gmail.com>
Hi Ralf,
On Tue, 6 Sep 2016, Ralf Thielow wrote:
> today I accidentally triggered a "fatal" using interactive rebase.
>
> If you edit the instruction sheet after 'rebase -i' and add an unknown
> command, Git stops because it doesn't know the command.
> That's fine, however, now we are in a state where 'git status' fails with
>
> interactive rebase in progress; onto 311f279
> fatal: Could not open file .git/rebase-merge/done for reading: No such
> file or directory
There was some discussion revolving around this (IIRC Matthieu was
involved, hence I Cc:ed him) and I was under the impression that we fixed
the status code not to assume the presence of the "done" file.
Apparently I was wrong...
So, something like this should help (if you are interested in seeing this
patch included, please run with it, as I am running short on time):
-- snipsnap --
diff --git a/wt-status.c b/wt-status.c
index 6225a2d..8e4d999 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -1072,14 +1072,17 @@ static void abbrev_sha1_in_line(struct strbuf *line)
strbuf_list_free(split);
}
-static void read_rebase_todolist(const char *fname, struct string_list *lines)
+static void read_rebase_todolist(const char *fname, struct string_list *lines, int gently)
{
struct strbuf line = STRBUF_INIT;
FILE *f = fopen(git_path("%s", fname), "r");
- if (!f)
+ if (!f) {
+ if (gently)
+ return;
die_errno("Could not open file %s for reading",
git_path("%s", fname));
+ }
while (!strbuf_getline_lf(&line, f)) {
if (line.len && line.buf[0] == comment_line_char)
continue;
@@ -1102,8 +1105,8 @@ static void show_rebase_information(struct wt_status *s,
struct string_list have_done = STRING_LIST_INIT_DUP;
struct string_list yet_to_do = STRING_LIST_INIT_DUP;
- read_rebase_todolist("rebase-merge/done", &have_done);
- read_rebase_todolist("rebase-merge/git-rebase-todo",
&yet_to_do);
+ read_rebase_todolist("rebase-merge/done", &have_done, 1);
+ read_rebase_todolist("rebase-merge/git-rebase-todo", &yet_to_do, 0);
if (have_done.nr == 0)
status_printf_ln(s, color, _("No commands done."));
^ permalink raw reply related
* Re: [PATCH 5/5] versioncmp: cope with common leading parts in versionsort.prereleaseSuffix
From: SZEDER Gábor @ 2016-09-07 15:48 UTC (permalink / raw)
To: Jeff King, Junio C Hamano
Cc: Leho Kraav, Nguyễn Thái Ngọc Duy, git
In-Reply-To: <20160907151251.30978-6-szeder@ira.uka.de>
Quoting SZEDER Gábor <szeder@ira.uka.de>:
> Version sort with prerelease reordering sometimes puts tagnames in the
> wrong order, when the common part of two compared tagnames ends with
> the leading character(s) of one or more configured prerelease
> suffixes.
>
> $ git config --get-all versionsort.prereleaseSuffix
> -beta
> $ git tag -l --sort=version:refname v2.1.*
> v2.1.0-beta-2
> v2.1.0-beta-3
> v2.1.0
> v2.1.0-RC1
> v2.1.0-RC2
> v2.1.0-beta-1
> v2.1.1
> v2.1.2
>
> The reason is that when comparing a pair of tagnames, first
> versioncmp() looks for the first different character in a pair of
> tagnames, and then the swap_prereleases() helper function checks for
> prerelease suffixes _starting at_ that character. Thus, when in the
> above example the sorting algorithm happens to compare the tagnames
> "v2.1.0-beta-1" and "v2.1.0-RC2", swap_prereleases() will try to match
> the suffix "-beta" against "beta-1" to no avail, and the two tagnames
> erroneously end up being ordered lexicographically.
>
> To fix this issue change swap_prereleases() to look for configured
> prerelease suffixes containing that first different character.
Now, while I believe this is the right thing to do to fix this bug,
there is a corner case, where multiple configured prerelease suffixes
might match the same tagname:
$ git config --get-all versionsort.prereleaseSuffix
-bar
-baz
-foo-bar
$ ~/src/git/git tag -l --sort=version:refname
v1.0-foo-bar
v1.0-foo-baz
I.e. when comparing these two tags, both "-bar" and "-foo-bar" would
match "v1.0-foo-bar", and as "-bar" comes first in the config file,
it wins, and "v1.0-foo-bar" is ordered first. An argument could be
made to prefer longer matches, in which case "v1.0-foo-bar" would be
ordered according to "-foo-bar", i.e. as second. However, I don't
know what that argument could be, to me neither behavior is better
than the other, but the implementation of the "longest match counts"
would certainly be more complicated.
The argument I would make is that this is a pathological corner case
that doesn't worth worrying about.
Best,
Gábor
^ permalink raw reply
* Re: format-patch base-commit: moving to above the patch?
From: Junio C Hamano @ 2016-09-07 16:06 UTC (permalink / raw)
To: Josh Triplett; +Cc: git
In-Reply-To: <20160901152912.uhxapgd3isdjc4mn@x>
Josh Triplett <josh@joshtriplett.org> writes:
> Currently, format-patch puts base-commit and prerequisite-patch-id
> information below the patch, and below the email signature. Most mail
> clients automatically trim everything below the signature marker as
> unimportant when quoting a mail for a reply, which would make it
> difficult for someone to reply, quote the base-commit, and say something
> like "I don't have this commit, where did it come from?" or "Can you
> please rebase this on ...".
>
> Might it make sense to move this information adjacent to the diffstat,
> instead? Or, at least, above the email signature?
I personally feel that it would be annoying to have them near
diffstat, especially given that unbounded many prereq patches can be
listed. It would not be too bad to flip the order between the call
to print_signature() and print_bases(), though. The extent of the
change needed to (note: not even compile-tested) does does not look
too bad, either.
I did not carefully think what the right adjustment for the MIME
case is, though.
I would expect some tests that expect the current order of the tail
end of the output to break, which you would need to adjust. And if
there is no such test right now, you should add one, as your inquiry
and this patch _sets_ a concrete expectation as to what should come
before the signature line, which future updates should not break.
builtin/log.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/log.c b/builtin/log.c
index 92dc34d..d69d5e6 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -1042,7 +1042,6 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
diff_flush(&opts);
fprintf(rev->diffopt.file, "\n");
- print_signature(rev->diffopt.file);
}
static const char *clean_message_id(const char *msg_id)
@@ -1720,6 +1719,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
make_cover_letter(&rev, use_stdout,
origin, nr, list, branch_name, quiet);
print_bases(&bases, rev.diffopt.file);
+ print_signature(rev.diffopt.file);
total++;
start_number--;
}
@@ -1779,13 +1779,13 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
if (!use_stdout)
rev.shown_one = 0;
if (shown) {
+ print_bases(&bases, rev.diffopt.file);
if (rev.mime_boundary)
fprintf(rev.diffopt.file, "\n--%s%s--\n\n\n",
mime_boundary_leader,
rev.mime_boundary);
else
print_signature(rev.diffopt.file);
- print_bases(&bases, rev.diffopt.file);
}
if (!use_stdout)
fclose(rev.diffopt.file);
^ permalink raw reply related
* Re: A note from the maintainer
From: Junio C Hamano @ 2016-09-07 16:16 UTC (permalink / raw)
To: Jakub Narębski; +Cc: git
In-Reply-To: <77c9288d-4b4d-fda8-a1eb-dab4b5056b1d@gmail.com>
Jakub Narębski <jnareb@gmail.com> writes:
> W dniu 03.09.2016 o 04:17, Junio C Hamano pisze:
>
>> Please remember to always state
>>
>> - what you wanted to achieve;
>>
>> - what you did (the version of git and the command sequence to reproduce
>> the behavior);
>
> I wonder if it be worth adding to not use aliases (or expand them). I have
> seen quite a few such questions on StackOverflow...
- how others can reproduce what you did (the version of git and
the command sequence);
perhaps?
>>
>> - what you saw happen (X above);
>>
>> - what you expected to see (Y above); and
>>
>> - how the last two are different.
^ permalink raw reply
* Re: [PATCH] xdiff: remove unneeded declarations
From: Junio C Hamano @ 2016-09-07 16:40 UTC (permalink / raw)
To: Stefan Beller; +Cc: git
In-Reply-To: <20160903031648.14465-1-sbeller@google.com>
Stefan Beller <sbeller@google.com> writes:
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> xdiff/xemit.c | 9 ---------
> 1 file changed, 9 deletions(-)
>
> diff --git a/xdiff/xemit.c b/xdiff/xemit.c
> index 49aa16f..b52b4b9 100644
> --- a/xdiff/xemit.c
> +++ b/xdiff/xemit.c
> @@ -22,15 +22,6 @@
>
> #include "xinclude.h"
>
> -
> -
> -
> -static long xdl_get_rec(xdfile_t *xdf, long ri, char const **rec);
> -static int xdl_emit_record(xdfile_t *xdf, long ri, char const *pre, xdemitcb_t *ecb);
> -
> -
> -
> -
> static long xdl_get_rec(xdfile_t *xdf, long ri, char const **rec) {
>
> *rec = xdf->recs[ri]->ptr;
Thanks.
^ permalink raw reply
* Re: [PATCH 1/4] add: document the chmod option
From: Junio C Hamano @ 2016-09-07 16:44 UTC (permalink / raw)
To: Thomas Gummerer
Cc: Johannes Schindelin, Jeff King, Jan Keromnes, git,
Ingo Brückl, Edward Thomson
In-Reply-To: <20160905192202.GB8254@hank>
Thomas Gummerer <t.gummerer@gmail.com> writes:
> Ugh, thanks for catching. I'll wait a few days for more comments and
> address it in a re-roll.
Thanks for starting this. I agree with you and Peff that running
"chmod" on the resulting index after other "add" operations took
place is the right approach, as we want to flip the executable bit
for paths that hasn't otherwise changed.
^ permalink raw reply
* Re: [PATCH v2 1/2] tests: move test_lazy_prereq JGIT to test-lib.sh
From: Junio C Hamano @ 2016-09-07 16:47 UTC (permalink / raw)
To: Jonathan Tan; +Cc: git, jrnieder, spearce, sbeller, peff
In-Reply-To: <360866f27d0bfcefca99b79c33daa9df2b82cee9.1472853827.git.jonathantanmy@google.com>
Jonathan Tan <jonathantanmy@google.com> writes:
> This enables JGIT to be used as a prereq in invocations of
> test_expect_success (and other functions) in other test scripts.
>
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
> t/t5310-pack-bitmaps.sh | 4 ----
> t/test-lib.sh | 4 ++++
> 2 files changed, 4 insertions(+), 4 deletions(-)
Makes sense. Thanks.
^ permalink raw reply
* Re: format-patch base-commit: moving to above the patch?
From: Josh Triplett @ 2016-09-07 17:00 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <xmqqh99rpud4.fsf@gitster.mtv.corp.google.com>
On Wed, Sep 07, 2016 at 09:06:31AM -0700, Junio C Hamano wrote:
> Josh Triplett <josh@joshtriplett.org> writes:
>
> > Currently, format-patch puts base-commit and prerequisite-patch-id
> > information below the patch, and below the email signature. Most mail
> > clients automatically trim everything below the signature marker as
> > unimportant when quoting a mail for a reply, which would make it
> > difficult for someone to reply, quote the base-commit, and say something
> > like "I don't have this commit, where did it come from?" or "Can you
> > please rebase this on ...".
> >
> > Might it make sense to move this information adjacent to the diffstat,
> > instead? Or, at least, above the email signature?
>
> I personally feel that it would be annoying to have them near
> diffstat, especially given that unbounded many prereq patches can be
> listed. It would not be too bad to flip the order between the call
> to print_signature() and print_bases(), though.
I can live with that; having it above the signature was a much bigger
concern for me than moving it above the patch.
> The extent of the change needed to (note: not even compile-tested)
> does does not look too bad, either.
>
> I did not carefully think what the right adjustment for the MIME
> case is, though.
Seems plausible to me.
> I would expect some tests that expect the current order of the tail
> end of the output to break, which you would need to adjust. And if
> there is no such test right now, you should add one, as your inquiry
> and this patch _sets_ a concrete expectation as to what should come
> before the signature line, which future updates should not break.
I can do that; arguably we should also have a test that nothing *except*
the git version appears after the signature line.
>
> builtin/log.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/log.c b/builtin/log.c
> index 92dc34d..d69d5e6 100644
> --- a/builtin/log.c
> +++ b/builtin/log.c
> @@ -1042,7 +1042,6 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
> diff_flush(&opts);
>
> fprintf(rev->diffopt.file, "\n");
> - print_signature(rev->diffopt.file);
> }
>
> static const char *clean_message_id(const char *msg_id)
> @@ -1720,6 +1719,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
> make_cover_letter(&rev, use_stdout,
> origin, nr, list, branch_name, quiet);
> print_bases(&bases, rev.diffopt.file);
> + print_signature(rev.diffopt.file);
> total++;
> start_number--;
> }
> @@ -1779,13 +1779,13 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
> if (!use_stdout)
> rev.shown_one = 0;
> if (shown) {
> + print_bases(&bases, rev.diffopt.file);
> if (rev.mime_boundary)
> fprintf(rev.diffopt.file, "\n--%s%s--\n\n\n",
> mime_boundary_leader,
> rev.mime_boundary);
> else
> print_signature(rev.diffopt.file);
> - print_bases(&bases, rev.diffopt.file);
> }
> if (!use_stdout)
> fclose(rev.diffopt.file);
^ permalink raw reply
* Re: Bug? ran into a "fatal" using interactive rebase
From: Ralf Thielow @ 2016-09-07 17:02 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, Junio C Hamano
In-Reply-To: <alpine.DEB.2.20.1609071714540.129229@virtualbox>
2016-09-07 17:19 GMT+02:00 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
>
> So, something like this should help (if you are interested in seeing this
> patch included, please run with it, as I am running short on time):
>
> -- snipsnap --
> diff --git a/wt-status.c b/wt-status.c
> index 6225a2d..8e4d999 100644
> --- a/wt-status.c
> +++ b/wt-status.c
> @@ -1072,14 +1072,17 @@ static void abbrev_sha1_in_line(struct strbuf *line)
> strbuf_list_free(split);
> }
>
> -static void read_rebase_todolist(const char *fname, struct string_list *lines)
> +static void read_rebase_todolist(const char *fname, struct string_list *lines, int gently)
> {
> struct strbuf line = STRBUF_INIT;
> FILE *f = fopen(git_path("%s", fname), "r");
>
> - if (!f)
> + if (!f) {
> + if (gently)
> + return;
> die_errno("Could not open file %s for reading",
> git_path("%s", fname));
> + }
> while (!strbuf_getline_lf(&line, f)) {
> if (line.len && line.buf[0] == comment_line_char)
> continue;
> @@ -1102,8 +1105,8 @@ static void show_rebase_information(struct wt_status *s,
> struct string_list have_done = STRING_LIST_INIT_DUP;
> struct string_list yet_to_do = STRING_LIST_INIT_DUP;
>
> - read_rebase_todolist("rebase-merge/done", &have_done);
> - read_rebase_todolist("rebase-merge/git-rebase-todo",
> &yet_to_do);
> + read_rebase_todolist("rebase-merge/done", &have_done, 1);
> + read_rebase_todolist("rebase-merge/git-rebase-todo", &yet_to_do, 0);
>
> if (have_done.nr == 0)
> status_printf_ln(s, color, _("No commands done."));
>
>
That works for me. Thanks.
^ permalink raw reply
* Re: [PATCH v2 2/2] connect: advertized capability is not a ref
From: Junio C Hamano @ 2016-09-07 17:02 UTC (permalink / raw)
To: Jonathan Tan; +Cc: git, jrnieder, spearce, sbeller, peff
In-Reply-To: <174c8ca6638f1cd3145a628925e65655b56af366.1472853827.git.jonathantanmy@google.com>
Jonathan Tan <jonathantanmy@google.com> writes:
> Git advertises the same capabilities^{} ref in its ref advertisement for push
> but since it never remembered to do so for fetch, the client forgot to handle
> this case. Handle it.
> ...
> In this aspect, JGit is compliant with the specification in pack-protocol.txt.
I agree with Peff that the above explanation distorts the history.
It should be reworded.
I do not have an issue with being more lenient to what JGit servers
have been doing for a few years, though.
> Because git client versions without this fix are expected to exist in the wild
> for a while, we should not change the server to always send the capabilities^{}
> line when there are no refs to advertise yet. A transition will take multiple
> steps:
>
> 1. This patch, which updates the client
>
> 2. Update pack-protocol to clarify that both server behaviors must be
> tolerated.
>
> 3. Add a configuration variable to allow git upload-pack to advertise
> capabilities when there are no refs to advertise. Leave it disabled
> by default since git clients can't be counted on to have this patch (1)
> yet.
>
> 4. After a year or so, flip the default for that server configuration
> variable to true.
The above assumes it is an unconditionally good thing to send
capabilities^{}; I do not think we established that in this
discussion, and more importantly, this client-side change is a good
thing to do regardless of the outcome of the discussion.
I'd suggest dropping everything below "Because Git client versions
without...".
> diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh
> index 819b9dd..2de52f5 100755
> --- a/t/t5512-ls-remote.sh
> +++ b/t/t5512-ls-remote.sh
> @@ -207,5 +207,44 @@ test_expect_success 'ls-remote --symref omits filtered-out matches' '
> test_cmp expect actual
> '
>
> +test_lazy_prereq GIT_DAEMON '
> + test_tristate GIT_TEST_GIT_DAEMON &&
> + test "$GIT_TEST_GIT_DAEMON" != false
> +'
> +
> +JGIT_DAEMON_PORT=${JGIT_DAEMON_PORT-${this_test#t}}
Shouldn't this be inside the next expect_success?
> +# This test spawns a daemon, so run it only if the user would be OK with
> +# testing with git-daemon.
> +test_expect_success PIPE,JGIT,GIT_DAEMON 'indicate no refs in standards-compliant empty remote' '
> + JGIT_DAEMON_PID= &&
> + git init --bare empty.git &&
> + touch empty.git/git-daemon-export-ok &&
To make it clear that the existence of the file is the thing you
care the most, not that the file having a recent timestamp:
>empty.git/git-daemon-export-ok &&
> + mkfifo jgit_daemon_output &&
> + {
> + jgit daemon --port="$JGIT_DAEMON_PORT" . >jgit_daemon_output &
> + JGIT_DAEMON_PID=$!
> + } &&
> + test_when_finished kill "$JGIT_DAEMON_PID" &&
> + {
> + read line &&
> + case $line in
> + Exporting*)
> + ;;
> + *)
> + echo "Expected: Exporting" &&
> + false;;
> + esac &&
> + read line &&
> + case $line in
> + "Listening on"*)
> + ;;
> + *)
> + echo "Expected: Listening on" &&
> + false;;
> + esac
OK, so this is a nice way to wait until the daemon becomes ready to
serve.
> + } <jgit_daemon_output &&
An in-code comment that explains what the significance of "2" here
# --exit-code asks the command to exit with 2 when no
# matching refs are found.
would be nice.
> + test_expect_code 2 git ls-remote --exit-code git://localhost:$JGIT_DAEMON_PORT/empty.git
> +'
Thanks.
^ permalink raw reply
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