summaryrefslogtreecommitdiff
path: root/sha1-name.c
diff options
context:
space:
mode:
Diffstat (limited to 'sha1-name.c')
-rw-r--r--sha1-name.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/sha1-name.c b/sha1-name.c
index 200eb37..f2e24ea 100644
--- a/sha1-name.c
+++ b/sha1-name.c
@@ -908,26 +908,21 @@ static int get_oid_basic(struct repository *r, const char *str, int len,
real_ref, flags, at_time, nth, oid, NULL,
&co_time, &co_tz, &co_cnt)) {
if (!len) {
- if (starts_with(real_ref, "refs/heads/")) {
- str = real_ref + 11;
- len = strlen(real_ref + 11);
- } else {
- /* detached HEAD */
+ if (!skip_prefix(real_ref, "refs/heads/", &str))
str = "HEAD";
- len = 4;
- }
+ len = strlen(str);
}
if (at_time) {
if (!(flags & GET_OID_QUIETLY)) {
- warning("Log for '%.*s' only goes "
- "back to %s.", len, str,
+ warning(_("log for '%.*s' only goes back to %s"),
+ len, str,
show_date(co_time, co_tz, DATE_MODE(RFC2822)));
}
} else {
if (flags & GET_OID_QUIETLY) {
exit(128);
}
- die("Log for '%.*s' only has %d entries.",
+ die(_("log for '%.*s' only has %d entries"),
len, str, co_cnt);
}
}
@@ -1692,14 +1687,14 @@ static void diagnose_invalid_oid_path(struct repository *r,
prefix = "";
if (file_exists(filename))
- die("Path '%s' exists on disk, but not in '%.*s'.",
+ die(_("path '%s' exists on disk, but not in '%.*s'"),
filename, object_name_len, object_name);
if (is_missing_file_error(errno)) {
char *fullname = xstrfmt("%s%s", prefix, filename);
if (!get_tree_entry(r, tree_oid, fullname, &oid, &mode)) {
- die("Path '%s' exists, but not '%s'.\n"
- "Did you mean '%.*s:%s' aka '%.*s:./%s'?",
+ die(_("path '%s' exists, but not '%s'\n"
+ "hint: Did you mean '%.*s:%s' aka '%.*s:./%s'?"),
fullname,
filename,
object_name_len, object_name,
@@ -1707,7 +1702,7 @@ static void diagnose_invalid_oid_path(struct repository *r,
object_name_len, object_name,
filename);
}
- die("Path '%s' does not exist in '%.*s'",
+ die(_("path '%s' does not exist in '%.*s'"),
filename, object_name_len, object_name);
}
}
@@ -1735,8 +1730,8 @@ static void diagnose_invalid_index_path(struct repository *r,
ce = istate->cache[pos];
if (ce_namelen(ce) == namelen &&
!memcmp(ce->name, filename, namelen))
- die("Path '%s' is in the index, but not at stage %d.\n"
- "Did you mean ':%d:%s'?",
+ die(_("path '%s' is in the index, but not at stage %d\n"
+ "hint: Did you mean ':%d:%s'?"),
filename, stage,
ce_stage(ce), filename);
}
@@ -1751,17 +1746,17 @@ static void diagnose_invalid_index_path(struct repository *r,
ce = istate->cache[pos];
if (ce_namelen(ce) == fullname.len &&
!memcmp(ce->name, fullname.buf, fullname.len))
- die("Path '%s' is in the index, but not '%s'.\n"
- "Did you mean ':%d:%s' aka ':%d:./%s'?",
+ die(_("path '%s' is in the index, but not '%s'\n"
+ "hint: Did you mean ':%d:%s' aka ':%d:./%s'?"),
fullname.buf, filename,
ce_stage(ce), fullname.buf,
ce_stage(ce), filename);
}
if (repo_file_exists(r, filename))
- die("Path '%s' exists on disk, but not in the index.", filename);
+ die(_("path '%s' exists on disk, but not in the index"), filename);
if (is_missing_file_error(errno))
- die("Path '%s' does not exist (neither on disk nor in the index).",
+ die(_("path '%s' does not exist (neither on disk nor in the index)"),
filename);
strbuf_release(&fullname);
@@ -1774,7 +1769,7 @@ static char *resolve_relative_path(struct repository *r, const char *rel)
return NULL;
if (r != the_repository || !is_inside_work_tree())
- die("relative path syntax can't be used outside working tree.");
+ die(_("relative path syntax can't be used outside working tree"));
/* die() inside prefix_path() if resolved path is outside worktree */
return prefix_path(startup_info->prefix,
@@ -1912,7 +1907,7 @@ static enum get_oid_result get_oid_with_context_1(struct repository *repo,
return ret;
} else {
if (only_to_die)
- die("Invalid object name '%.*s'.", len, name);
+ die(_("invalid object name '%.*s'."), len, name);
}
}
return ret;