Re: [RFC PATCH] commit -v: strip diffs and submodule shortlogs from the commit message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> I found this hard to parse, I think because of the "keeping" (why would
> I not keep it?), and because you are talking about lines above and
> below. It is not as accurate to say:
>
>   # ------------------ >8 --------------------
>   # Everything below this line will be removed.
>
> because it is technically the line above that is the cutoff. But I think
> the meaning is clear, and it is simpler to parse.
>
> I do think it would be simpler with a single line. I know handling the
> i18n was a question there, but I think we should be fine as long as we
> check for the exact bytes we wrote. Surely gettext can do something
> like:
>
>   magic = _("# Everything below this line will be removed");
>   fprintf(fh, "%s", magic);
>   ...
>   p = strstr(magic);
>
> I don't know what guarantees on string lifetime gettext gives us, but
> the worst case is that we simply strdup the result.
>
> I suppose it's possible that the translated string could have utf8 with
> multiple representations, and the user's editor normalizes the text in a
> different way than we wrote it when it saves the result. I don't know if
> that is worth caring about or not; it seems kind of insane.

I agree with your rewording suggestion.  It might make it even more
robust to do something like

    const char cut_here[] = "# --- cut here --- >8 --- cut here ---";

    fprintf(fh, "%s\n", cut_here);
    fputs(_("# Everything below this line will be removed\n"), fh);
    ...
    p = strstr(cut_here);

i.e. a real marker line that will never be translated, with an
explanation immediately below that can be translated.


--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]