i18n: git-commit basic messages
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Feb 22, 2011 at 23:41 UTC
8a6179bcb6022c433ac87a01393155d64166eb7b
1 file changed
+59
-59
builtin/commit.c
+59
-59
@@ -243,7 +243,7 @@ static void add_remove_files(struct string_list *list)
243
244
if (!lstat(p->string, &st)) {
245
if (add_to_cache(p->string, &st, 0))
246
- die("updating files failed");
246
+ die(_("updating files failed"));
247
} else
248
remove_file_from_cache(p->string);
249
}
@@ -270,7 +270,7 @@ static void create_base_index(void)
270
opts.fn = oneway_merge;
271
tree = parse_tree_indirect(head_sha1);
272
if (!tree)
273
- die("failed to unpack HEAD tree object");
273
+ die(_("failed to unpack HEAD tree object"));
274
parse_tree(tree);
275
init_tree_desc(&t, tree->buffer, tree->size);
276
if (unpack_trees(1, &t, &opts))
@@ -298,9 +298,9 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
298
refresh_flags |= REFRESH_UNMERGED;
299
if (interactive) {
300
if (interactive_add(argc, argv, prefix) != 0)
301
- die("interactive add failed");
301
+ die(_("interactive add failed"));
302
if (read_cache_preload(NULL) < 0)
303
- die("index file corrupt");
303
+ die(_("index file corrupt"));
304
commit_style = COMMIT_AS_IS;
305
return get_index_file();
306
}
@@ -309,7 +309,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
309
pathspec = get_pathspec(prefix, argv);
310
311
if (read_cache_preload(pathspec) < 0)
312
- die("index file corrupt");
312
+ die(_("index file corrupt"));
313
314
/*
315
* Non partial, non as-is commit.
@@ -329,7 +329,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
329
refresh_cache_or_die(refresh_flags);
330
if (write_cache(fd, active_cache, active_nr) ||
331
close_lock_file(&index_lock))
332
- die("unable to write new_index file");
332
+ die(_("unable to write new_index file"));
333
commit_style = COMMIT_NORMAL;
334
return index_lock.filename;
335
}
@@ -349,7 +349,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
349
if (active_cache_changed) {
350
if (write_cache(fd, active_cache, active_nr) ||
351
commit_locked_index(&index_lock))
352
- die("unable to write new_index file");
352
+ die(_("unable to write new_index file"));
353
} else {
354
rollback_lock_file(&index_lock);
355
}
@@ -379,7 +379,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
379
commit_style = COMMIT_PARTIAL;
380
381
if (in_merge)
382
- die("cannot do a partial commit during a merge.");
382
+ die(_("cannot do a partial commit during a merge."));
383
384
memset(&partial, 0, sizeof(partial));
385
partial.strdup_strings = 1;
@@ -388,14 +388,14 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
388
389
discard_cache();
390
if (read_cache() < 0)
391
- die("cannot read the index");
391
+ die(_("cannot read the index"));
392
393
fd = hold_locked_index(&index_lock, 1);
394
add_remove_files(&partial);
395
refresh_cache(REFRESH_QUIET);
396
if (write_cache(fd, active_cache, active_nr) ||
397
close_lock_file(&index_lock))
398
- die("unable to write new_index file");
398
+ die(_("unable to write new_index file"));
399
400
fd = hold_lock_file_for_update(&false_lock,
401
git_path("next-index-%"PRIuMAX,
@@ -408,7 +408,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
408
409
if (write_cache(fd, active_cache, active_nr) ||
410
close_lock_file(&false_lock))
411
- die("unable to write temporary index file");
411
+ die(_("unable to write temporary index file"));
412
413
discard_cache();
414
read_cache_from(false_lock.filename);
@@ -455,7 +455,7 @@ static int is_a_merge(const unsigned char *sha1)
455
{
456
struct commit *commit = lookup_commit(sha1);
457
if (!commit || parse_commit(commit))
458
- die("could not parse HEAD commit");
458
+ die(_("could not parse HEAD commit"));
459
return !!(commit->parents && commit->parents->next);
460
}
461
@@ -474,13 +474,13 @@ static void determine_author_info(struct strbuf *author_ident)
474
475
a = strstr(use_message_buffer, "\nauthor ");
476
if (!a)
477
- die("invalid commit: %s", use_message);
477
+ die(_("invalid commit: %s"), use_message);
478
479
lb = strchrnul(a + strlen("\nauthor "), '<');
480
rb = strchrnul(lb, '>');
481
eol = strchrnul(rb, '\n');
482
if (!*lb || !*rb || !*eol)
483
- die("invalid commit: %s", use_message);
483
+ die(_("invalid commit: %s"), use_message);
484
485
if (lb == a + strlen("\nauthor "))
486
/* \nauthor <foo@example.com> */
@@ -498,7 +498,7 @@ static void determine_author_info(struct strbuf *author_ident)
498
const char *rb = strchr(force_author, '>');
499
500
if (!lb || !rb)
501
- die("malformed --author parameter");
501
+ die(_("malformed --author parameter"));
502
name = xstrndup(force_author, lb - force_author);
503
email = xstrndup(lb + 2, rb - (lb + 2));
504
}
@@ -554,7 +554,7 @@ static char *cut_ident_timestamp_part(char *string)
554
{
555
char *ket = strrchr(string, '>');
556
if (!ket || ket[1] != ' ')
557
- die("Malformed ident string: '%s'", string);
557
+ die(_("Malformed ident string: '%s'"), string);
558
*++ket = '\0';
559
return ket;
560
}
@@ -587,7 +587,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
587
struct commit *c;
588
c = lookup_commit_reference_by_name(squash_message);
589
if (!c)
590
- die("could not lookup commit %s", squash_message);
590
+ die(_("could not lookup commit %s"), squash_message);
591
ctx.output_encoding = get_commit_output_encoding();
592
format_commit_message(c, "squash! %s\n\n", &sb,
593
&ctx);
@@ -599,19 +599,19 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
599
hook_arg1 = "message";
600
} else if (logfile && !strcmp(logfile, "-")) {
601
if (isatty(0))
602
- fprintf(stderr, "(reading log message from standard input)\n");
602
+ fprintf(stderr, _("(reading log message from standard input)\n"));
603
if (strbuf_read(&sb, 0, 0) < 0)
604
- die_errno("could not read log from standard input");
604
+ die_errno(_("could not read log from standard input"));
605
hook_arg1 = "message";
606
} else if (logfile) {
607
if (strbuf_read_file(&sb, logfile, 0) < 0)
608
- die_errno("could not read log file '%s'",
608
+ die_errno(_("could not read log file '%s'"),
609
logfile);
610
hook_arg1 = "message";
611
} else if (use_message) {
612
buffer = strstr(use_message_buffer, "\n\n");
613
if (!buffer || buffer[2] == '\0')
614
- die("commit has empty message");
614
+ die(_("commit has empty message"));
615
strbuf_add(&sb, buffer + 2, strlen(buffer + 2));
616
hook_arg1 = "commit";
617
hook_arg2 = use_message;
@@ -620,22 +620,22 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
620
struct commit *commit;
621
commit = lookup_commit_reference_by_name(fixup_message);
622
if (!commit)
623
- die("could not lookup commit %s", fixup_message);
623
+ die(_("could not lookup commit %s"), fixup_message);
624
ctx.output_encoding = get_commit_output_encoding();
625
format_commit_message(commit, "fixup! %s\n\n",
626
&sb, &ctx);
627
hook_arg1 = "message";
628
} else if (!stat(git_path("MERGE_MSG"), &statbuf)) {
629
if (strbuf_read_file(&sb, git_path("MERGE_MSG"), 0) < 0)
630
- die_errno("could not read MERGE_MSG");
630
+ die_errno(_("could not read MERGE_MSG"));
631
hook_arg1 = "merge";
632
} else if (!stat(git_path("SQUASH_MSG"), &statbuf)) {
633
if (strbuf_read_file(&sb, git_path("SQUASH_MSG"), 0) < 0)
634
- die_errno("could not read SQUASH_MSG");
634
+ die_errno(_("could not read SQUASH_MSG"));
635
hook_arg1 = "squash";
636
} else if (template_file && !stat(template_file, &statbuf)) {
637
if (strbuf_read_file(&sb, template_file, 0) < 0)
638
- die_errno("could not read '%s'", template_file);
638
+ die_errno(_("could not read '%s'"), template_file);
639
hook_arg1 = "template";
640
}
641
@@ -658,7 +658,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
658
659
s->fp = fopen(git_path(commit_editmsg), "w");
660
if (s->fp == NULL)
661
- die_errno("could not open '%s'", git_path(commit_editmsg));
661
+ die_errno(_("could not open '%s'"), git_path(commit_editmsg));
662
663
if (cleanup_mode != CLEANUP_NONE)
664
stripspace(&sb, 0);
@@ -682,7 +682,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
682
}
683
684
if (fwrite(sb.buf, 1, sb.len, s->fp) < sb.len)
685
- die_errno("could not write commit template");
685
+ die_errno(_("could not write commit template"));
686
687
strbuf_release(&sb);
688
@@ -752,7 +752,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
752
const char *parent = "HEAD";
753
754
if (!active_nr && read_cache() < 0)
755
- die("Cannot read index");
755
+ die(_("Cannot read index"));
756
757
if (amend)
758
parent = "HEAD^1";
@@ -785,7 +785,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
785
active_cache_tree = cache_tree();
786
if (cache_tree_update(active_cache_tree,
787
active_cache, active_nr, 0, 0) < 0) {
788
- error("Error building trees");
788
+ error(_("Error building trees"));
789
return 0;
790
}
791
@@ -800,7 +800,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
800
snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file);
801
if (launch_editor(git_path(commit_editmsg), NULL, env)) {
802
fprintf(stderr,
803
- "Please supply the message using either -m or -F option.\n");
803
+ _("Please supply the message using either -m or -F option.\n"));
804
exit(1);
805
}
806
}
@@ -880,7 +880,7 @@ static const char *find_author_by_nickname(const char *name)
880
format_commit_message(commit, "%an <%ae>", &buf, &ctx);
881
return strbuf_detach(&buf, NULL);
882
}
883
- die("No existing author found with '%s'", name);
883
+ die(_("No existing author found with '%s'"), name);
884
}
885
886
@@ -895,7 +895,7 @@ static void handle_untracked_files_arg(struct wt_status *s)
895
else if (!strcmp(untracked_files_arg, "all"))
896
s->show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
897
else
898
- die("Invalid untracked files mode '%s'", untracked_files_arg);
898
+ die(_("Invalid untracked files mode '%s'"), untracked_files_arg);
899
}
900
901
static int parse_and_validate_options(int argc, const char *argv[],
@@ -912,7 +912,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
912
force_author = find_author_by_nickname(force_author);
913
914
if (force_author && renew_authorship)
915
- die("Using both --reset-author and --author does not make sense");
915
+ die(_("Using both --reset-author and --author does not make sense"));
916
917
if (logfile || message.len || use_message || fixup_message)
918
use_editor = 0;
@@ -926,7 +926,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
926
927
/* Sanity check options */
928
if (amend && initial_commit)
929
- die("You have nothing to amend.");
929
+ die(_("You have nothing to amend."));
930
if (amend && in_merge)
931
die("You are in the middle of a merge -- cannot amend.");
932
if (fixup_message && squash_message)
@@ -940,22 +940,22 @@ static int parse_and_validate_options(int argc, const char *argv[],
940
if (logfile)
941
f++;
942
if (f > 1)
943
- die("Only one of -c/-C/-F/--fixup can be used.");
943
+ die(_("Only one of -c/-C/-F/--fixup can be used."));
944
if (message.len && f > 0)
945
- die("Option -m cannot be combined with -c/-C/-F/--fixup.");
945
+ die((_("Option -m cannot be combined with -c/-C/-F/--fixup.")));
946
if (edit_message)
947
use_message = edit_message;
948
if (amend && !use_message && !fixup_message)
949
use_message = "HEAD";
950
if (!use_message && renew_authorship)
951
- die("--reset-author can be used only with -C, -c or --amend.");
951
+ die(_("--reset-author can be used only with -C, -c or --amend."));
952
if (use_message) {
953
const char *out_enc;
954
struct commit *commit;
955
956
commit = lookup_commit_reference_by_name(use_message);
957
if (!commit)
958
- die("could not lookup commit %s", use_message);
958
+ die(_("could not lookup commit %s"), use_message);
959
out_enc = get_commit_output_encoding();
960
use_message_buffer = logmsg_reencode(commit, out_enc);
961
@@ -970,13 +970,13 @@ static int parse_and_validate_options(int argc, const char *argv[],
970
}
971
972
if (!!also + !!only + !!all + !!interactive > 1)
973
- die("Only one of --include/--only/--all/--interactive can be used.");
973
+ die(_("Only one of --include/--only/--all/--interactive can be used."));
974
if (argc == 0 && (also || (only && !amend)))
975
- die("No paths with --include/--only does not make sense.");
975
+ die(_("No paths with --include/--only does not make sense."));
976
if (argc == 0 && only && amend)
977
- only_include_assumed = "Clever... amending the last one with dirty index.";
977
+ only_include_assumed = _("Clever... amending the last one with dirty index.");
978
if (argc > 0 && !also && !only)
979
- only_include_assumed = "Explicit paths specified without -i nor -o; assuming --only paths...";
979
+ only_include_assumed = _("Explicit paths specified without -i nor -o; assuming --only paths...");
980
if (!cleanup_arg || !strcmp(cleanup_arg, "default"))
981
cleanup_mode = use_editor ? CLEANUP_ALL : CLEANUP_SPACE;
982
else if (!strcmp(cleanup_arg, "verbatim"))
@@ -986,14 +986,14 @@ static int parse_and_validate_options(int argc, const char *argv[],
986
else if (!strcmp(cleanup_arg, "strip"))
987
cleanup_mode = CLEANUP_ALL;
988
else
989
- die("Invalid cleanup mode %s", cleanup_arg);
989
+ die(_("Invalid cleanup mode %s"), cleanup_arg);
990
991
handle_untracked_files_arg(s);
992
993
if (all && argc > 0)
994
- die("Paths with -a does not make sense.");
994
+ die(_("Paths with -a does not make sense."));
995
else if (interactive && argc > 0)
996
- die("Paths with --interactive does not make sense.");
996
+ die(_("Paths with --interactive does not make sense."));
997
998
if (null_termination && status_format == STATUS_FORMAT_LONG)
999
status_format = STATUS_FORMAT_PORCELAIN;
@@ -1074,7 +1074,7 @@ static int git_status_config(const char *k, const char *v, void *cb)
1074
else if (!strcmp(v, "all"))
1075
s->show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
1076
else
1077
- return error("Invalid untracked files mode '%s'", v);
1077
+ return error(_("Invalid untracked files mode '%s'"), v);
1078
return 0;
1079
}
1080
return git_diff_ui_config(k, v, NULL);
@@ -1180,9 +1180,9 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
1180
1181
commit = lookup_commit(sha1);
1182
if (!commit)
1183
- die("couldn't look up newly created commit");
1183
+ die(_("couldn't look up newly created commit"));
1184
if (!commit || parse_commit(commit))
1185
- die("could not parse newly created commit");
1185
+ die(_("could not parse newly created commit"));
1186
1187
strbuf_addstr(&format, "format:%h] %s");
1188
@@ -1336,7 +1336,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
1336
reflog_msg = "commit (amend)";
1337
commit = lookup_commit(head_sha1);
1338
if (!commit || parse_commit(commit))
1339
- die("could not parse HEAD commit");
1339
+ die(_("could not parse HEAD commit"));
1340
1341
for (c = commit->parents; c; c = c->next)
1342
pptr = &commit_list_insert(c->item, pptr)->next;
@@ -1349,19 +1349,19 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
1349
pptr = &commit_list_insert(lookup_commit(head_sha1), pptr)->next;
1350
fp = fopen(git_path("MERGE_HEAD"), "r");
1351
if (fp == NULL)
1352
- die_errno("could not open '%s' for reading",
1352
+ die_errno(_("could not open '%s' for reading"),
1353
git_path("MERGE_HEAD"));
1354
while (strbuf_getline(&m, fp, '\n') != EOF) {
1355
unsigned char sha1[20];
1356
if (get_sha1_hex(m.buf, sha1) < 0)
1357
- die("Corrupt MERGE_HEAD file (%s)", m.buf);
1357
+ die(_("Corrupt MERGE_HEAD file (%s)"), m.buf);
1358
pptr = &commit_list_insert(lookup_commit(sha1), pptr)->next;
1359
}
1360
fclose(fp);
1361
strbuf_release(&m);
1362
if (!stat(git_path("MERGE_MODE"), &statbuf)) {
1363
if (strbuf_read_file(&sb, git_path("MERGE_MODE"), 0) < 0)
1364
- die_errno("could not read MERGE_MODE");
1364
+ die_errno(_("could not read MERGE_MODE"));
1365
if (!strcmp(sb.buf, "no-ff"))
1366
allow_fast_forward = 0;
1367
}
@@ -1378,7 +1378,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
1378
if (strbuf_read_file(&sb, git_path(commit_editmsg), 0) < 0) {
1379
int saved_errno = errno;
1380
rollback_index_files();
1381
- die("could not read commit message: %s", strerror(saved_errno));
1381
+ die(_("could not read commit message: %s"), strerror(saved_errno));
1382
}
1383
1384
/* Truncate the message just before the diff, if any. */
@@ -1392,14 +1392,14 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
1392
stripspace(&sb, cleanup_mode == CLEANUP_ALL);
1393
if (message_is_empty(&sb) && !allow_empty_message) {
1394
rollback_index_files();
1395
- fprintf(stderr, "Aborting commit due to empty commit message.\n");
1395
+ fprintf(stderr, _("Aborting commit due to empty commit message.\n"));
1396
exit(1);
1397
}
1398
1399
if (commit_tree(sb.buf, active_cache_tree->sha1, parents, commit_sha1,
1400
author_ident.buf)) {
1401
rollback_index_files();
1402
- die("failed to write commit object");
1402
+ die(_("failed to write commit object"));
1403
}
1404
strbuf_release(&author_ident);
1405
@@ -1417,11 +1417,11 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
1417
1418
if (!ref_lock) {
1419
rollback_index_files();
1420
- die("cannot lock HEAD ref");
1420
+ die(_("cannot lock HEAD ref"));
1421
}
1422
if (write_ref_sha1(ref_lock, commit_sha1, sb.buf) < 0) {
1423
rollback_index_files();
1424
- die("cannot update HEAD ref");
1424
+ die(_("cannot update HEAD ref"));
1425
}
1426
1427
unlink(git_path("MERGE_HEAD"));
@@ -1430,9 +1430,9 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
1430
unlink(git_path("SQUASH_MSG"));
1431
1432
if (commit_index_files())
1433
- die ("Repository has been updated, but unable to write\n"
1433
+ die (_("Repository has been updated, but unable to write\n"
1434
"new_index file. Check that disk is not full or quota is\n"
1435
- "not exceeded, and then \"git reset HEAD\" to recover.");
1435
+ "not exceeded, and then \"git reset HEAD\" to recover."));
1436
1437
rerere(0);
1438
run_hook(get_index_file(), "post-commit", NULL);