diff options
Diffstat (limited to 'builtin/notes.c')
| -rw-r--r-- | builtin/notes.c | 42 | 
1 files changed, 22 insertions, 20 deletions
diff --git a/builtin/notes.c b/builtin/notes.c index ed6f2222f4..f848b89692 100644 --- a/builtin/notes.c +++ b/builtin/notes.c @@ -91,7 +91,7 @@ static const char * const git_notes_get_ref_usage[] = {  };  static const char note_template[] = -	"\nWrite/edit the notes for the following object:\n"; +	N_("Write/edit the notes for the following object:");  struct note_data {  	int given; @@ -179,7 +179,8 @@ static void prepare_note_data(const unsigned char *object, struct note_data *d,  			copy_obj_to_fd(fd, old_note);  		strbuf_addch(&buf, '\n'); -		strbuf_add_commented_lines(&buf, note_template, strlen(note_template)); +		strbuf_add_commented_lines(&buf, "\n", strlen("\n")); +		strbuf_add_commented_lines(&buf, _(note_template), strlen(_(note_template)));  		strbuf_addch(&buf, '\n');  		write_or_die(fd, buf.buf, buf.len); @@ -744,13 +745,14 @@ static int merge_commit(struct notes_merge_options *o)  static int git_config_get_notes_strategy(const char *key,  					 enum notes_merge_strategy *strategy)  { -	const char *value; +	char *value; -	if (git_config_get_string_const(key, &value)) +	if (git_config_get_string(key, &value))  		return 1;  	if (parse_notes_merge_strategy(value, strategy)) -		git_die_config(key, "unknown notes merge strategy %s", value); +		git_die_config(key, _("unknown notes merge strategy %s"), value); +	free(value);  	return 0;  } @@ -787,15 +789,15 @@ static int merge(int argc, const char **argv, const char *prefix)  	if (strategy || do_commit + do_abort == 0)  		do_merge = 1;  	if (do_merge + do_commit + do_abort != 1) { -		error("cannot mix --commit, --abort or -s/--strategy"); +		error(_("cannot mix --commit, --abort or -s/--strategy"));  		usage_with_options(git_notes_merge_usage, options);  	}  	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"); +		error(_("too many parameters"));  		usage_with_options(git_notes_merge_usage, options);  	} @@ -816,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 { @@ -846,21 +848,21 @@ static int merge(int argc, const char **argv, const char *prefix)  		update_ref(msg.buf, default_notes_ref(), result_sha1, NULL,  			   0, UPDATE_REFS_DIE_ON_ERR);  	else { /* Merge has unresolved conflicts */ -		char *existing; +		const struct worktree *wt;  		/* Update .git/NOTES_MERGE_PARTIAL with partial merge result */  		update_ref(msg.buf, "NOTES_MERGE_PARTIAL", result_sha1, NULL,  			   0, UPDATE_REFS_DIE_ON_ERR);  		/* Store ref-to-be-updated into .git/NOTES_MERGE_REF */ -		existing = find_shared_symref("NOTES_MERGE_REF", default_notes_ref()); -		if (existing) +		wt = find_shared_symref("NOTES_MERGE_REF", default_notes_ref()); +		if (wt)  			die(_("A notes merge into %s is already in-progress at %s"), -			    default_notes_ref(), existing); +			    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 " -		       "abort the merge with 'git notes merge --abort'.\n", +		printf(_("Automatic notes merge failed. Fix conflicts in %s and " +			 "commit the result with 'git notes merge --commit', or " +			 "abort the merge with 'git notes merge --abort'.\n"),  		       git_path(NOTES_MERGE_WORKTREE));  	} @@ -933,8 +935,8 @@ static int prune(int argc, const char **argv, const char *prefix)  	struct notes_tree *t;  	int show_only = 0, verbose = 0;  	struct option options[] = { -		OPT__DRY_RUN(&show_only, "do not remove, show only"), -		OPT__VERBOSE(&verbose, "report pruned notes"), +		OPT__DRY_RUN(&show_only, N_("do not remove, show only")), +		OPT__VERBOSE(&verbose, N_("report pruned notes")),  		OPT_END()  	}; @@ -963,7 +965,7 @@ static int get_ref(int argc, const char **argv, const char *prefix)  			     git_notes_get_ref_usage, 0);  	if (argc) { -		error("too many parameters"); +		error(_("too many parameters"));  		usage_with_options(git_notes_get_ref_usage, options);  	}  | 
