From: Nicolas Sebrecht <nicolas.s.dev@gmx.fr>
To: Junio C Hamano <gitster@pobox.com>
Cc: Nicolas Sebrecht <nicolas.s.dev@gmx.fr>,
Nanako Shiraishi <nanako3@lavabit.com>,
Thell Fowler <git@tbfowler.name>,
git@vger.kernel.org, Johannes.Schindelin@gmx.de
Subject: [PATCH] Re: Teach mailinfo to ignore everything before -- >8 -- mark
Date: Wed, 26 Aug 2009 05:54:01 +0200 [thread overview]
Message-ID: <20090826035401.GJ3526@vidovic> (raw)
In-Reply-To: <7vvdkbl4ul.fsf@alter.siamese.dyndns.org>
The 25/08/09, Junio C Hamano wrote:
> What I meant was that I would not want to spend any more of _my_ time on
> the definition of the scissors for now. That means spending or wasting
> time on improving the 'pu' patch myself, or looking at others patch to
> find flaws in them.
>
> Of course, as the maintainer, I would need to look at proposals to improve
> or fix bugs in the code before the series hits the master, but I would
> give zero priority to the patches that change the definition at least for
> now to give myself time to work on more useful things.
Ok, thank you.
> I think --ignore-scissors is a good thing to add, regardless of what the
> definition of scissors should be. So your patch should definitely be
> separated into two parts.
Could find it at the end of the mails.
> > #include "builtin.h"
> > #include "utf8.h"
> > #include "strbuf.h"
> > +#include "git-compat-util.h"
>
> Inclusion of builtin.h is designed to be enough. What do you need this
> for?
It is for the warning() call
warning("scissors line found, will skip text above");
I've added. That said, moving this declaration to builtin.h could be a
good idea. Hint?
> > @@ -715,51 +717,63 @@ static inline int patchbreak(const struct strbuf *line)
> > if (isspace(buf[i])) {
> > + if (scissors_dashes_seen)
> > + mark_end = i;
>
> I think you do not want this part, and then you won't have to trim
> trailing whitespaces from mark_end later.
Good eyes.
> > + /*
> > + * The mark is 8 charaters long and contains at least one dash and
> > + * either a ">8" or "<8". Check if the last mark in the line
> > + * matches the first mark found without worrying about what could
> > + * be between them. Only one mark in the whole line is permitted.
> > + */
>
> This definition makes "- 8<" a scissors.
Yes. Instead of looking for dashes alone, I will give a try to something
like
if (!scissors_dashes_seen)
mark_start = i;
if (i + 1 < len) {
if (!memcmp(buf + i, ">8", 2) || !memcmp(buf + i, "8<", 2))) {
scissors_dashes_seen |= 02;
i++;
mark_end = i;
continue;
else if (!memcmp(buf + i "--", 2) {
scissors_dashes_seen |= 04;
i++;
mark_end = i;
continue;
}
}
if (i + 2 < len)
if (!memcmp(buf + i + 1, "- -", 3) {
scissors_dashes_seen |= 04;
i += 2;
mark_end = i;
continue;
}
if (buf[i] == '-') {
mark_end = i;
scissors_dashes_seen |= 01;
continue;
}
break;
}
if (scissors_dashes_seen == 07) {
...
> it does not allow
>
> "-- 8< -- please cut here -- 8< -- --"
Actually, I believe this one should really not be a scissors line. If we
accept some random dashes around markers it will break the definition of
the mark itself.
As I said, I'd rather rules easy to define over others because if the
end-user scissors line doesn't work, he can refer to the documentation...
> nor
>
> "-- 8< -- -- please cut here -- -- 8< --"
>
> nor
>
> "-- 8< -- -- please cut here -- -- >8 --"
...and symmetrical markers make sense to the user. Will add this.
> > + if (!ignore_scissors) {
> > + if (is_scissors_line(line)) {
> > + warning("scissors line found, will skip text above");
> > ...
> > + return 0;
>
> Don't re-indent like this. Just do:
>
> if (!ignore_scissors && is_scissors_line(line)) {
> ...
> }
Does the compilers (or a standard) assure that the members are evaluated
in the left-right order?
Otherwise, we may call is_scissors_line() where not needed.
--
Nicolas Sebrecht
next prev parent reply other threads:[~2009-08-26 3:54 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-04 23:33 Help/Advice needed on diff bug in xutils.c Thell Fowler
2009-08-05 20:45 ` Johannes Schindelin
2009-08-10 18:54 ` Thell Fowler
2009-08-12 0:47 ` [PATCH/RFC] Add diff tests for trailing-space and now newline Thell Fowler
2009-08-19 23:05 ` [PATCH 0/6 RFC] Series to correct xutils incomplete line handling Thell Fowler
2009-08-21 17:39 ` Thell Fowler
2009-08-21 22:16 ` Alex Riesen
2009-08-22 4:23 ` Thell Fowler
[not found] ` <cover.1250719760.git.git@tbfowler.name>
2009-08-19 23:06 ` [PATCH 1/6] Add supplemental test for trailing-whitespace on incomplete lines Thell Fowler
2009-08-19 23:06 ` [PATCH 2/6] Make xdl_hash_record_with_whitespace ignore eof Thell Fowler
2009-08-19 23:07 ` [PATCH 3/6] Make diff -w handle trailing-spaces on incomplete lines Thell Fowler
2009-08-20 23:09 ` Thell Fowler
2009-08-19 23:07 ` [PATCH 4/6] Make diff -b " Thell Fowler
2009-08-19 23:08 ` [PATCH 5/6] Make diff --ignore-space-at-eol handle " Thell Fowler
2009-08-19 23:09 ` [PATCH 6/6] Add diff tests for trailing-space on " Thell Fowler
2009-08-23 3:47 ` [PATCH-v2/RFC 0/6] improvements for trailing-space processing " Thell Fowler
2009-08-23 3:49 ` [PATCH-v2/RFC 1/6] Add supplemental test for trailing-whitespace " Thell Fowler
2009-08-23 3:49 ` [PATCH-v2/RFC 2/6] xutils: fix hash with whitespace on incomplete line Thell Fowler
2009-08-23 7:51 ` Junio C Hamano
2009-08-23 17:02 ` Thell Fowler
2009-08-23 3:49 ` [PATCH-v2/RFC 3/6] xutils: fix ignore-all-space " Thell Fowler
2009-08-23 7:57 ` Junio C Hamano
2009-08-23 8:18 ` Nanako Shiraishi
2009-08-23 8:56 ` Junio C Hamano
2009-08-23 21:07 ` Nanako Shiraishi
2009-08-23 21:14 ` Junio C Hamano
2009-08-23 22:13 ` Thell Fowler
2009-08-23 22:30 ` Junio C Hamano
2009-08-24 4:16 ` [PATCH] Teach mailinfo to ignore everything before -- >8 -- mark Nicolas Sebrecht
2009-08-24 4:51 ` Junio C Hamano
2009-08-24 5:36 ` Junio C Hamano
2009-08-24 6:21 ` [PATCH] " Nicolas Sebrecht
2009-08-24 6:58 ` Junio C Hamano
2009-08-24 7:31 ` Nicolas Sebrecht
2009-08-24 14:02 ` Don Zickus
2009-08-24 21:48 ` Junio C Hamano
2009-08-24 5:16 ` [PATCH] " Nanako Shiraishi
2009-08-24 7:17 ` [PATCH] " Nicolas Sebrecht
2009-08-24 7:24 ` Nicolas Sebrecht
2009-08-24 22:17 ` Junio C Hamano
2009-08-25 16:18 ` Nicolas Sebrecht
2009-08-26 1:51 ` Junio C Hamano
[not found] ` <20090826110332.6117@nanako3.lavabit.com>
2009-08-26 2:20 ` Junio C Hamano
2009-08-26 3:03 ` Junio C Hamano
2009-08-26 5:02 ` Nicolas Sebrecht
2009-08-26 8:57 ` Jakub Narebski
2009-08-26 9:00 ` Johannes Schindelin
2009-08-27 5:46 ` Junio C Hamano
2009-08-27 10:49 ` Johannes Schindelin
2009-08-26 9:03 ` Junio C Hamano
2009-08-26 3:54 ` Nicolas Sebrecht [this message]
2009-08-24 8:09 ` [PATCH] " Nanako Shiraishi
2009-08-23 17:01 ` [PATCH-v2/RFC 3/6] xutils: fix ignore-all-space on incomplete line Thell Fowler
2009-08-23 19:40 ` Junio C Hamano
2009-08-23 20:33 ` Thell Fowler
2009-08-23 21:11 ` Junio C Hamano
2009-08-24 3:26 ` Thell Fowler
2009-08-24 6:02 ` Junio C Hamano
2009-08-24 14:13 ` Thell Fowler
2009-08-25 5:58 ` Thell Fowler
2009-08-23 3:49 ` [PATCH-v2/RFC 4/6] xutils: fix ignore-space-change " Thell Fowler
2009-08-23 3:49 ` [PATCH-v2/RFC 5/6] xutils: fix ignore-space-at-eol " Thell Fowler
2009-08-23 3:49 ` [PATCH-v2/RFC 6/6] t4015: add tests for trailing-space " Thell Fowler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090826035401.GJ3526@vidovic \
--to=nicolas.s.dev@gmx.fr \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@tbfowler.name \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=nanako3@lavabit.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).