Give the hunk comment its own color
PATCH 1/1 Give the hunk comment its own color
Insired by the coloring of quilt.
Introduce a separate color for the hunk comment part, i.e. the current function. Whitespace between hunk header and hunk comment is now printed as plain.
The current default is magenta. But I'm not settled on this. My favorite would be bold yellow.
--- Documentation/config.txt | 8 +++--- combine-diff.c | 5 +++- diff.c | 62 +++++++++++++++++++++++++++++++++++++++++++-- diff.h | 1 + 4 files changed, 68 insertions(+), 8 deletions(-)
Documentation/config.txt +4 -4
@@ -598,10 +598,10 @@ color.diff.<slot>:: Use customized color for diff colorization. `<slot>` specifies which part of the patch to use the specified color, and is one of `plain` (context text), `meta` (metainformation), `frag` - (hunk header), `old` (removed lines), `new` (added lines), - `commit` (commit headers), or `whitespace` (highlighting - whitespace errors). The values of these variables may be specified as - in color.branch.<slot>. + (hunk header), 'func' (function in hunk header), `old` (removed lines), + `new` (added lines), `commit` (commit headers), or `whitespace` + (highlighting whitespace errors). The values of these variables may be + specified as in color.branch.<slot>. color.grep:: When set to `always`, always highlight matches. When `false` (or
combine-diff.c +4 -1
@@ -524,6 +524,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,int i;unsigned long lno =0 ;const char *c_frag =diff_get_color (use_color,DIFF_FRAGINFO ); +const char *c_func =diff_get_color (use_color,DIFF_FUNCINFO );const char *c_new =diff_get_color (use_color,DIFF_FILE_NEW );const char *c_old =diff_get_color (use_color,DIFF_FILE_OLD );const char *c_plain =diff_get_color (use_color,DIFF_PLAIN );
@@ -588,7 +589,9 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent, comment_end = i; }if (comment_end) -putchar (' ' ); +printf ("%s%s %s%s" , c_reset, + c_plain, c_reset, + c_func);for (i =0 ; i < comment_end; i++)putchar (hunk_comment[i]); }
diff.c +59 -3
86 lines not on this page · raw message
diff.h +1 -0
@@ -130,6 +130,7 @@ enum color_diff {DIFF_FILE_NEW =5 ,DIFF_COMMIT =6 ,DIFF_WHITESPACE =7 , + DIFF_FUNCINFO = 8, };const char *diff_get_color (int diff_use_color,enum color_diff ix);#define diff_get_color_opt (o, ix) \
Signature · 1 line
tg: (785c58e..) bw/func-color (depends on: master)
PATCH v2 1/1 Give the hunk comment its own color
Inspired by the coloring of quilt.
Introduce a separate color for the hunk comment part, i.e. the current function. Whitespace between hunk header and hunk comment is now printed as plain.
The current default is magenta. But I'm not settled on this. My favorite would be bold yellow.
Now with updated test suit.
--- Documentation/config.txt | 8 +++--- combine-diff.c | 5 +++- diff.c | 64 +++++++++++++++++++++++++++++++++++++++++++-- diff.h | 1 + t/t4034-diff-words.sh | 3 +- 5 files changed, 72 insertions(+), 9 deletions(-)
Documentation/config.txt +4 -4
@@ -598,10 +598,10 @@ color.diff.<slot>:: Use customized color for diff colorization. `<slot>` specifies which part of the patch to use the specified color, and is one of `plain` (context text), `meta` (metainformation), `frag` - (hunk header), `old` (removed lines), `new` (added lines), - `commit` (commit headers), or `whitespace` (highlighting - whitespace errors). The values of these variables may be specified as - in color.branch.<slot>. + (hunk header), 'func' (function in hunk header), `old` (removed lines), + `new` (added lines), `commit` (commit headers), or `whitespace` + (highlighting whitespace errors). The values of these variables may be + specified as in color.branch.<slot>. color.grep:: When set to `always`, always highlight matches. When `false` (or
combine-diff.c +4 -1
@@ -524,6 +524,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,int i;unsigned long lno =0 ;const char *c_frag =diff_get_color (use_color,DIFF_FRAGINFO ); +const char *c_func =diff_get_color (use_color,DIFF_FUNCINFO );const char *c_new =diff_get_color (use_color,DIFF_FILE_NEW );const char *c_old =diff_get_color (use_color,DIFF_FILE_OLD );const char *c_plain =diff_get_color (use_color,DIFF_PLAIN );
@@ -588,7 +589,9 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent, comment_end = i; }if (comment_end) -putchar (' ' ); +printf ("%s%s %s%s" , c_reset, + c_plain, c_reset, + c_func);for (i =0 ; i < comment_end; i++)putchar (hunk_comment[i]); }
diff.c +61 -3
88 lines not on this page · raw message
diff.h +1 -0
@@ -130,6 +130,7 @@ enum color_diff {DIFF_FILE_NEW =5 ,DIFF_COMMIT =6 ,DIFF_WHITESPACE =7 , + DIFF_FUNCINFO = 8, };const char *diff_get_color (int diff_use_color,enum color_diff ix);#define diff_get_color_opt (o, ix) \
t/t4034-diff-words.sh +2 -1
@@ -16,6 +16,7 @@ decrypt_color () { -e 's/.\[1m/<WHITE>/g' \ -e 's/.\[31m/<RED>/g' \ -e 's/.\[32m/<GREEN>/g' \ + -e 's/.\[35m/<MAGENTA>/g' \ -e 's/.\[36m/<BROWN>/g' \ -e 's/.\[m/<RESET>/g' }
@@ -70,7 +71,7 @@ cat > expect <<\EOF <WHITE>+++ b/post<RESET> <BROWN>@@ -1 +1 @@<RESET> <RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET> -<BROWN>@@ -3,0 +4,4 @@ a = b + c<RESET> +<BROWN>@@ -3,0 +4,4 @@<RESET> <RESET><MAGENTA>a = b + c<RESET> <GREEN>aa = a<RESET>
Signature · 1 line
tg: (785c58e..) bw/func-color (depends on: master)
Quoted 1 line · Bert Wesarg
Now with updated test suit.
Spelling this as 'suite' would be sweet.
Quoted 6 lines · Jason Sewall
Quoted 1 line · Bert Wesarg
Now with updated test suit.
Spelling this as 'suite' would be sweet.
Thanks. I re-submit only if you find a bug too.
Bert
Quoted 1 line
Quoted 8 lines · Bert Wesarg
Insired by the coloring of quilt.
Introduce a separate color for the hunk comment part, i.e. the current function. Whitespace between hunk header and hunk comment is now printed as plain.
The current default is magenta. But I'm not settled on this. My favorite would be bold yellow.
I don't see any reason not to add this, as it is simply introducing one extra knob to tweak for people who care. However, after some experimentation, I found that I don't personally really like it. I ended up wanting it set to the same color as the hunk header.
I wonder how hard it would be to make it backwards-compatible; that is, to inherit the color value of the hunk header (be it the original or one set by the user) unless the func color is set by the user. But maybe that is over-engineering. It is not like we are breaking scripts, and it is not that hard for people to see the new behavior and then tweak their config if they don't like it.
-Peff
PS I almost complained about your default of "magenta" as the same as the meta color before I remembered that magenta meta is a personal setting I use. Personally I find the bold meta color to be distractingly ugly. Blaming it, the default seems to come from Linus, who even in his commit message (50f575f) seems to indicate that it is somewhat arbitrary (mostly just dropping the purple from the bold purple).
I'm not sure what is the best way to arrive at a default color for something like this. Arguing about it really is almost the definition of bikeshedding. Maybe next year's git survey should contain a special section on colors, and majority should rule. :)
Quoted 6 lines · Jeff King
PS I almost complained about your default of "magenta" as the same as the meta color before I remembered that magenta meta is a personal setting I use. Personally I find the bold meta color to be distractingly ugly. Blaming it, the default seems to come from Linus, who even in his commit message (50f575f) seems to indicate that it is somewhat arbitrary (mostly just dropping the purple from the bold purple).
I took magenta, because it is not used as any other default color value. I think choosing a color other than cyan would bring the attention to this new feature.
Bert
Quoted 3 lines · Jeff King
PS I almost complained about your default of "magenta" as the same as the meta color before I remembered that magenta meta is a personal setting I use.
On black-on-white terminals, cyan tends to be less visible, and I think that is the whole point of painting the hunk header @@ .. @@ in that color--- make it less distracting).
But the function name on the line is not something that should be made less visible---if that part of the line were a meaningless cruft, we wouldn't have configurable funcname patterns after all.
I would suggest "normal" as the neutral default. After all, the purpose of the funcname in the hunk header is to give context to people who read patches.
Quoted 4 lines
I'm not sure what is the best way to arrive at a default color for something like this. Arguing about it really is almost the definition of bikeshedding. Maybe next year's git survey should contain a special section on colors, and majority should rule. :)
Sorry, but this is no democracy ;-)
Quoted 3 lines · Junio C Hamano
On black-on-white terminals, cyan tends to be less visible, and I think that is the whole point of painting the hunk header @@ .. @@ in that color--- make it less distracting).
Hmm. I find cyan-on-white gratingly ugly instead of "less distracting", but then again, I find black-on-white terminals to be eye-searing in general.
Quoted 3 lines
I would suggest "normal" as the neutral default. After all, the purpose of the funcname in the hunk header is to give context to people who read patches.
I think that is sensible.
-Peff
Hi,
Quoted 1 line · Bert Wesarg
Insired by the coloring of quilt.
s/Insired/Inspired/?
Signature · 2 lines
Cheers, Ray Chuan
Quoted 6 lines · Tay Ray Chuan
Hi,
Quoted 1 line · Bert Wesarg
Insired by the coloring of quilt.
s/Insired/Inspired/?
Sure.
I also forgot to update the test suit.
New patch follows.
Bert
Quoted 5 lines
--
Cheers,
Ray Chuan
Junio,
may I kindly remind you of this patch. If it is only the nen-existing consensus of the default color, than please use the die.
Kind regards,
Bert Wesarg
Quoted 1 line · Bert Wesarg
may I kindly remind you of this patch.
Yes you may ;-) A more effective would have been a resend but it is always appreciated.
Quoted 2 lines
... If it is only the nen-existing
consensus of the default color, than please use the die.
If you are having me go find the mail and apply I would probably use "plain" as I suggested.
PATCH v3 1/1 Give the hunk comment its own color
Inspired by the coloring of quilt.
Introduce a separate color for the hunk comment part, i.e. the current function. Whitespace between hunk header and hunk comment is now printed as plain.
The current default is plain.
--- Documentation/config.txt | 8 +++--- combine-diff.c | 5 +++- diff.c | 64 +++++++++++++++++++++++++++++++++++++++++++-- diff.h | 1 + t/t4034-diff-words.sh | 4 ++- 5 files changed, 73 insertions(+), 9 deletions(-)
Documentation/config.txt +4 -4
@@ -635,10 +635,10 @@ color.diff.<slot>:: Use customized color for diff colorization. `<slot>` specifies which part of the patch to use the specified color, and is one of `plain` (context text), `meta` (metainformation), `frag` - (hunk header), `old` (removed lines), `new` (added lines), - `commit` (commit headers), or `whitespace` (highlighting - whitespace errors). The values of these variables may be specified as - in color.branch.<slot>. + (hunk header), 'func' (function in hunk header), `old` (removed lines), + `new` (added lines), `commit` (commit headers), or `whitespace` + (highlighting whitespace errors). The values of these variables may be + specified as in color.branch.<slot>. color.grep:: When set to `always`, always highlight matches. When `false` (or
combine-diff.c +4 -1
@@ -524,6 +524,7 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent,int i;unsigned long lno =0 ;const char *c_frag =diff_get_color (use_color,DIFF_FRAGINFO ); +const char *c_func =diff_get_color (use_color,DIFF_FUNCINFO );const char *c_new =diff_get_color (use_color,DIFF_FILE_NEW );const char *c_old =diff_get_color (use_color,DIFF_FILE_OLD );const char *c_plain =diff_get_color (use_color,DIFF_PLAIN );
@@ -588,7 +589,9 @@ static void dump_sline(struct sline *sline, unsigned long cnt, int num_parent, comment_end = i; }if (comment_end) -putchar (' ' ); +printf ("%s%s %s%s" , c_reset, + c_plain, c_reset, + c_func);for (i =0 ; i < comment_end; i++)putchar (hunk_comment[i]); }
diff.c +61 -3
88 lines not on this page · raw message
diff.h +1 -0
@@ -130,6 +130,7 @@ enum color_diff {DIFF_FILE_NEW =5 ,DIFF_COMMIT =6 ,DIFF_WHITESPACE =7 , + DIFF_FUNCINFO = 8, };const char *diff_get_color (int diff_use_color,enum color_diff ix);#define diff_get_color_opt (o, ix) \
t/t4034-diff-words.sh +3 -1
@@ -8,6 +8,7 @@ test_expect_success setup ' git config diff.color.old red git config diff.color.new green + git config diff.color.func magenta '
@@ -16,6 +17,7 @@ decrypt_color () { -e 's/.\[1m/<WHITE>/g' \ -e 's/.\[31m/<RED>/g' \ -e 's/.\[32m/<GREEN>/g' \ + -e 's/.\[35m/<MAGENTA>/g' \ -e 's/.\[36m/<BROWN>/g' \ -e 's/.\[m/<RESET>/g' }
@@ -70,7 +72,7 @@ cat > expect <<\EOF <WHITE>+++ b/post<RESET> <BROWN>@@ -1 +1 @@<RESET> <RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET> -<BROWN>@@ -3,0 +4,4 @@ a = b + c<RESET> +<BROWN>@@ -3,0 +4,4 @@<RESET> <RESET><MAGENTA>a = b + c<RESET> <GREEN>aa = a<RESET>
Signature · 1 line
tg: (ad7ace7..) bw/func-color (depends on: master)
Quoted 5 lines · Junio C Hamano
Quoted 2 lines
... If it is only the nen-existing
consensus of the default color, than please use the die.If you are having me go find the mail and apply I would probably use "plain" as I suggested.
As the other person in the discussion, I'll just chime in that I also think "plain" is the best of the suggested defaults.
-Peff
Quoted 4 lines · Junio C Hamano
Quoted 1 line · Bert Wesarg
may I kindly remind you of this patch.
Quoted 8 lines
Yes you may ;-) A more effective would have been a resend but it is always appreciated.
Quoted 2 lines
... If it is only the nen-existing
consensus of the default color, than please use the die.If you are having me go find the mail and apply I would probably use "plain" as I suggested.
So I resend with plain as default. And therefore saved one resend ;-)
Bert
Quoted 1 line
I was slightly surprised that this seems to have differences other than the flipping of the default color since the last one, especially after you sounded like you would be sending with only that change.
Quoted 3 lines · Junio C Hamano
I was slightly surprised that this seems to have differences other than the flipping of the default color since the last one, especially after you sounded like you would be sending with only that change.
v3 does only that and adopt the change to the t/t4034-diff-words.sh test. There I set an explicit value of func to magenta for testing.
Maybe you missed v2 (Message-Id:
<[email protected]>)? Which fixed the test and also a small bug.
Bert
Quoted 1 line
Quoted 3 lines · Bert Wesarg
Maybe you missed v2 (Message-Id:
<[email protected]>)? Which fixed the test and also a small bug.
Yeah, that was what happened. Thanks for clarifying.
Quoted 17 lines · Bert Wesarg
diff.c | 64 +++++++++++++++++++++++++++++++++++++++++++--...
diff.c +11
-0@@ -344,6 +347,63 @@ static void emit_add_line(const char *reset, } } +static void emit_hunk_line (struct emit_callback *ecbdata, +const char *line,int len) +{ +const char *plain =diff_get_color (ecbdata->color_diff,DIFF_PLAIN ); +const char *frag =diff_get_color (ecbdata->color_diff,DIFF_FRAGINFO ); +const char *func =diff_get_color (ecbdata->color_diff,DIFF_FUNCINFO ); +const char *reset =diff_get_color (ecbdata->color_diff,DIFF_RESET ); +const char *orig_line = line; +int orig_len = len; +const char *frag_start; +int frag_len;
diff.c static void emit_add_line(const char *reset, · line 370
Quoted 10 lines
diff.c +10
-0+const char *part_end =NULL ; +int part_len =0 ; + +/* determine length of @ */ +while (part_len < len && line[part_len] =='@' ) + part_len++; + +/* find end of frag, (Ie. find second @@) */ + part_end =memmem (line + part_len, len - part_len, + line, part_len);
This is not incorrect per-se, but probably is overkill; this codepath only deals with two-way diff and we know we are looking at "@@ -..., +... @@" at this point.
part_end = memmem(line + 2, len - 2, "@@", 2);
would be sufficient.
Quoted 8 lines
diff.c +8
-0+if (!part_end) +return emit_line (ecbdata->file, frag, reset, line, len); +/* calculate total length of frag */ + part_len = (part_end + part_len) - line; + +/* remember frag part, we emit only if we find a space separator */ + frag_start = line; + frag_len = part_len;
diff.c static void emit_add_line(const char *reset, · line 388
Quoted 10 lines
diff.c +10
-0+ +/* consume hunk header */ + len -= part_len; + line += part_len; + +/* +* for empty reminder or empty space sequence (exclusive any newlines +* or carriage returns) emit complete original line as FRAGINFO +*/ +if (!len || !(part_len =strspn (line," \t" )))
Slightly worrisome is what guarantees this strspn() won't step outside len.
I would probably write the function like this instead.
-- >8 --
static void emit_hunk_header(struct emit_callback *ecbdata,
const char *line, int len)
{
const char *plain = diff_get_color(ecbdata->color_diff, DIFF_PLAIN);
const char *frag = diff_get_color(ecbdata->color_diff, DIFF_FRAGINFO);
const char *func = diff_get_color(ecbdata->color_diff, DIFF_FUNCINFO);
const char *reset = diff_get_color(ecbdata->color_diff, DIFF_RESET);
static const char atat[2] = { '@', '@' };
const char *cp, *ep;
/*
* As a hunk header must begin with "@@ -<old>, +<new> @@",
* it always is at least 10 bytes long.
*/
if (len < 10 ||
memcmp(line, atat, 2) ||
!(ep = memmem(line + 2, len - 2, atat, 2))) {
emit_line(ecbdata->file, plain, reset, line, len);
return;
}
ep += 2; /* skip over the second @@ */
/* The hunk header in fraginfo color */
emit_line(ecbdata->file, frag, reset, line, ep - line);
/* blank before the func header */
for (cp = ep; ep - line < len; ep++)
if (*ep != ' ' && *ep != 't')
break;
if (ep != cp)
emit_line(ecbdata->file, plain, reset, cp, ep - cp);
if (ep < line + len)
emit_line(ecbdata->file, func, reset, ep, line + len - ep);
}Bert Wesarg
Acked-byQuoted 34 lines · Junio C Hamano
Quoted 17 lines · Bert Wesarg
diff.c | 64 +++++++++++++++++++++++++++++++++++++++++++--
...diff.c +11
-0@@ -344,6 +347,63 @@ static void emit_add_line(const char *reset, } } +static void emit_hunk_line (struct emit_callback *ecbdata, + const char *line, int len) +{ + const char *plain = diff_get_color(ecbdata->color_diff, DIFF_PLAIN); + const char *frag = diff_get_color(ecbdata->color_diff, DIFF_FRAGINFO); + const char *func = diff_get_color(ecbdata->color_diff, DIFF_FUNCINFO); + const char *reset = diff_get_color(ecbdata->color_diff, DIFF_RESET); + const char *orig_line = line; + int orig_len = len; + const char *frag_start; + int frag_len;diff.c static void emit_add_line(const char *reset, · line 370
Quoted 10 lines
diff.c +10
-0+ const char *part_end = NULL; + int part_len = 0; + + /* determine length of @ */ + while (part_len < len && line[part_len] == '@') + part_len++; + + /* find end of frag, (Ie. find second @@) */ + part_end = memmem(line + part_len, len - part_len, + line, part_len);This is not incorrect per-se, but probably is overkill; this codepath only deals with two-way diff and we know we are looking at "@@ -..., +... @@" at this point.
Quoted 3 lines
part_end =
memmem(line + 2, len - 2, "@@", 2);would be sufficient.
Thats right, I made it generic by purpose.
Quoted 14 lines
Quoted 14 lines
diff.c +13
-0+ if (!part_end) + return emit_line(ecbdata->file, frag, reset, line, len); + /* calculate total length of frag */ + part_len = (part_end + part_len) - line; + + /* remember frag part, we emit only if we find a space separator */ + frag_start = line; + frag_len = part_len; + + /* consume hunk header */ + len -= part_len; + line += part_len; +
Quoted 8 lines
diff.c static void emit_add_line(const char *reset, · line 388
Quoted 5 lines
diff.c +5
-0+ /* + * for empty reminder or empty space sequence (exclusive any newlines + * or carriage returns) emit complete original line as FRAGINFO + */ + if (!len || !(part_len = strspn(line, " \t")))Slightly worrisome is what guarantees this
strspn()won't step outside len.
Thats a valid concern and should be addressed.
Quoted 37 lines
I would probably write the function like this instead.
-- >8 --
static void emit_hunk_header(struct
emit_callback*ecbdata,
const char *line, int len)
{
const char *plain =diff_get_color(ecbdata->color_diff, DIFF_PLAIN); const char *frag =diff_get_color(ecbdata->color_diff, DIFF_FRAGINFO); const char *func =diff_get_color(ecbdata->color_diff, DIFF_FUNCINFO); const char *reset =diff_get_color(ecbdata->color_diff, DIFF_RESET); static const char atat[2] = { '@', '@' };
const char *cp, *ep;/*
* As a hunk header must begin with "@@ -<old>, +<new> @@",
* it always is at least 10 bytes long.
*/
if (len < 10 ||
memcmp(line, atat, 2) ||
!(ep =memmem(line + 2, len - 2, atat, 2))) {emit_line(ecbdata->file, plain, reset, line, len); return;
}
ep += 2; /* skip over the second @@ *//* The hunk header in fraginfo color */
emit_line(ecbdata->file, frag, reset, line, ep - line);/* blank before the func header */
for (cp = ep; ep - line < len; ep++)
if (*ep != ' ' && *ep != 't')
break;
if (ep != cp)
emit_line(ecbdata->file, plain, reset, cp, ep - cp);
Quoted 3 lines
if (ep < line + len)
emit_line(ecbdata->file, func, reset, ep, line + len - ep); }
Please check that its really an *ep != '\t'. Its wrong in this mail, I see only an *ep != 't'. Otherwise:
Quoted 2 lines
Quoted 5 lines
Quoted 3 lines
/* blank before the func header */
for (cp = ep; ep - line < len; ep++)
if (*ep != ' ' && *ep != 't')Please check that its really an *ep != '\t'. Its wrong in this mail, I see only an *ep != 't'.
Obviously, you have not checked it. Please squash this in:
diff.c +1 -1
@@ -376,7 +376,7 @@ static void emit_hunk_header(struct emit_callback *ecbdata,/* blank before the func header */ for (cp = ep; ep - line < len; ep++) -if (*ep !=' ' && *ep !='t' ) +if (*ep !=' ' && *ep !='\t' )break ;if (ep != cp)emit_line (ecbdata->file, plain, reset, cp, ep - cp);
Bert
Sorry, but I think the fix is already in 'next', no?
Quoted 1 line · Junio C Hamano
Sorry, but I think the fix is already in 'next', no?
Yes it is, should have fetched first. sorry.
Quoted 3 lines · Bert Wesarg
Quoted 1 line · Junio C Hamano
Sorry, but I think the fix is already in 'next', no?
Yes it is, should have fetched first. sorry.
Don't be sorry; thanks for catching it.
The current 'next' branch has the original commit with a botched rewrite by mine, and also a fixed commit, so unfortunately shortlog would list the patch twice. I'll merge the updated (i.e. rewound and then rebuilt) tip of the topic branch when the topic graduates to the master (hopefully before 1.6.6-rc1), so we won't see the botched one in the end result.
Heya,
Quoted 3 lines · Junio C Hamano
I'll merge the updated (i.e. rewound and then rebuilt) tip of the topic branch when the topic graduates to the master (hopefully before 1.6.6-rc1), so we won't see the botched one in the end result.
I'm curious how you do this. Do you keep a list of replacements, that is "when merging branch foo from next to master, instead merge bar", or is it something the original author should remind you of when it's time to merge to master?
Signature · 3 lines
Cheers, Sverre Rabbelier
Quoted 10 lines · Sverre Rabbelier
Quoted 3 lines · Junio C Hamano
I'll merge the updated (i.e. rewound and then rebuilt) tip of the topic branch when the topic graduates to the master (hopefully before 1.6.6-rc1), so we won't see the botched one in the end result.
I'm curious how you do this. Do you keep a list of replacements, that is "when merging branch foo from next to master, instead merge bar", or is it something the original author should remind you of when it's time to merge to master?
If you run "git log --oneline --first-parent master..pu", you will notice that there is no "Merge ... into next" at all.
I maintain a private 'jch' branch that merges everything that has been merged so far to 'next' and the branch always builds on top of 'master' whenever 'pu' is pushed out. The tree object recorded by the tip of 'jch' is designed to always match that of 'next'. And 'pu' is built on top of 'jch', instead of 'next', these days.
The Reintegrate script fron 'todo' (recall that I have a checkout of the branch in "Meta/" directory) is used this way:
... update 'jch' by merging topics that had new commits $ git checkout jch && git merge xx/topic && ... ... update the list of topics
$ Meta/Reintegrate master..jch >/var/tmp/redo-jch.sh
... update 'master' with commits and merges
$ git checkout master
$ git am trivially-correct-patch.mbox
$ git merge yy/topic
... update 'next'
$ git checkout next
$ git merge master
... will merge new topics and topics that had new commits $ sh /var/tmp/redo-jch.sh
... rebuild 'jch' on top of the updated master $ git checkout jch
$ git reset --hard master
$ sh /var/tmp/redo-jch.sh
... then this shouldn't produce any output
$ git diff next
This time, what I did _after_ Bert noticed my typo was:
$ git checkout bw/diff-color-hunk-header
$ edit diff.c ;# fix my typo
$ git commit --amend -a
$ git diff HEAD@{1} >P.diff
$ git checkout next
$ git apply --index P.diff
$ git commit -m 'typofix'After this, while rebuilding 'jch' branch the next time, Reintegrate script will notice that the bw/diff-color-hunk-header topic has been rebased. I can simply edit that note out in the /var/tmp/redo-jch.sh script and rebuild 'jch' branch---the result will exactly match 'next'.
The end result is that the commit merged in 'next' is not the tip of bw/diff-color-hunk-header anymore, but merging the _current_ tip of that branch together with all the other topics on top of 'master' would produce the desired result without "oops---that was a stupid typo" fixups.
Heya,
Quoted 5 lines · Junio C Hamano
I maintain a private 'jch' branch that merges everything that has been merged so far to 'next' and the branch always builds on top of 'master' whenever 'pu' is pushed out. The tree object recorded by the tip of 'jch' is designed to always match that of 'next'. And 'pu' is built on top of 'jch', instead of 'next', these days.
Ah, so _that''s_ how you pull of not rebasing and still maintaining a clean history in master: keeping a private shadow branch with the cleaned up history that is tree-identical to the no-rebase next branch. Interesting.
Quoted 4 lines
The end result is that the commit merged in 'next' is not the tip of bw/diff-color-hunk-header anymore, but merging the _current_ tip of that branch together with all the other topics on top of 'master' would produce the desired result without "oops---that was a stupid typo" fixups.
Thanks for explaining, git really does allow for a lot of interesting workflows :).
Signature · 3 lines
Cheers, Sverre Rabbelier
Quoted 10 lines · Jeff King
Quoted 5 lines · Junio C Hamano
Quoted 2 lines
... If it is only the nen-existing
consensus of the default color, than please use the die.If you are having me go find the mail and apply I would probably use "plain" as I suggested.
As the other person in the discussion, I'll just chime in that I also think "plain" is the best of the suggested defaults.
Ok, I tweaked the patch locally and applied.
Thanks.