Thread (16 messages) 16 messages, 3 authors, 2019-12-09

Re: [PATCH v2 1/2] rebase: refactor dwim_ref_or_die from merge-base.c

From: Alex Torok <hidden>
Date: 2019-12-06 13:13:29

On Thu, Dec 5, 2019 at 8:23 PM Denton Liu [off-list ref] wrote:
The remaining paragraphs shouldn't end up going into the commit message
since they're more like "notes to reviewers". You should place these
notes under the `---` below so that they won't end up in the final
commit message.
Thank you for the info! I'll keep that in mind for my next patch submission.
quoted
+void dwim_ref_or_die(const char *str, int len, char **ref)
+{
+     struct object_id discard;
+     switch (dwim_ref(str, len, &discard, ref)) {
+     case 0:
+             die("No such ref: '%s'", str);
I see that this code is copied so I'm fine with leaving it as is. But if
you need to do any rerolls, it would be nice to, as a prepatory step,
introduce a patch which 1. marks these strings for translation and 2.
lowercases the first letter of the sentence which is the convention for
messages that are seen by the end-user.

Perhaps:

        die(_("no such ref: '%s'"), str);
Sounds good! I'll add a patch to the end of this series that addresses
these strings not being translated.

Thank you for your feedback.
~Alex
quoted
+     case 1:
+             break; /* good */
+     default:
+             die("Ambiguous refname: '%s'", str);
Same comment here.

Thanks,

Denton
quoted
+     }
+}
+
+
 int expand_ref(struct repository *repo, const char *str, int len,
             struct object_id *oid, char **ref)
 {
diff --git a/refs.h b/refs.h
index 730d05ad91..a961662382 100644
--- a/refs.h
+++ b/refs.h
@@ -154,6 +154,7 @@ int repo_dwim_log(struct repository *r, const char *str, int len, struct object_
 int dwim_ref(const char *str, int len, struct object_id *oid, char **ref);
 int dwim_log(const char *str, int len, struct object_id *oid, char **ref);

+void dwim_ref_or_die(const char *str, int len, char **ref);
 /*
  * A ref_transaction represents a collection of reference updates that
  * should succeed or fail together.
--
2.17.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help