Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
sequencer.c: rework search for start of footer to improve clarity
author
Jonathan Nieder
<jrnieder@gmail.com>
Tue, 12 Feb 2013 10:17:28 +0000
(
02:17
-0800)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 12 Feb 2013 19:07:53 +0000
(11:07 -0800)
This code sequence is somewhat difficult to read. Let's rewrite it and add
some comments to improve clarity.
Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
e8a1f5a
)
diff --git
a/sequencer.c
b/sequencer.c
index 22604902aa4c4dd146f562c4841c344a773a9bda..776ddb19621b0dacc763b1a9afabb40f65fc9ee7 100644
(file)
--- a/
sequencer.c
+++ b/
sequencer.c
@@
-1019,19
+1019,21
@@
int sequencer_pick_revisions(struct replay_opts *opts)
static int ends_rfc2822_footer(struct strbuf *sb, int ignore_footer)
{
static int ends_rfc2822_footer(struct strbuf *sb, int ignore_footer)
{
- int ch;
- int hit = 0;
+ char ch, prev;
int i, j, k;
int len = sb->len - ignore_footer;
int first = 1;
const char *buf = sb->buf;
int i, j, k;
int len = sb->len - ignore_footer;
int first = 1;
const char *buf = sb->buf;
+ prev = '\0';
for (i = len - 1; i > 0; i--) {
for (i = len - 1; i > 0; i--) {
- if (hit && buf[i] == '\n')
+ ch = buf[i];
+ if (prev == '\n' && ch == '\n') /* paragraph break */
break;
break;
-
hit = (buf[i] == '\n')
;
+
prev = ch
;
}
}
+ /* advance to start of last paragraph */
while (i < len - 1 && buf[i] == '\n')
i++;
while (i < len - 1 && buf[i] == '\n')
i++;