fmt-merge-msg fix
The new C version mistranslated the original Perl version in the case to pull from the HEAD. This made it to say nonsense like this: Merge commit ...url... of HEAD * HEAD: ... Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Jul 12, 2006 at 22:21 UTC
e918c6abac65fb56b381f37cc139753fbe6768a3
1 file changed
+10
-6
builtin-fmt-merge-msg.c
+10
-6
@@ -76,6 +76,7 @@ static int handle_line(char *line)
76
unsigned char *sha1;
77
char *src, *origin;
78
struct src_data *src_data;
79
+ int pulling_head = 0;
80
81
if (len < 43 || line[40] != '\t')
82
return 1;
@@ -101,8 +102,11 @@ static int handle_line(char *line)
102
if (src) {
103
*src = 0;
104
src += 4;
104
- } else
105
- src = "HEAD";
105
+ pulling_head = 0;
106
+ } else {
107
+ src = line;
108
+ pulling_head = 1;
109
+ }
110
111
i = find_in_list(&srcs, src);
112
if (i < 0) {
@@ -112,7 +116,10 @@ static int handle_line(char *line)
116
}
117
src_data = srcs.payload[i];
118
115
- if (!strncmp(line, "branch ", 7)) {
119
+ if (pulling_head) {
120
+ origin = strdup(src);
121
+ src_data->head_status |= 1;
122
+ } else if (!strncmp(line, "branch ", 7)) {
123
origin = strdup(line + 7);
124
append_to_list(&src_data->branch, origin, NULL);
125
src_data->head_status |= 2;
@@ -124,9 +131,6 @@ static int handle_line(char *line)
131
origin = strdup(line + 14);
132
append_to_list(&src_data->r_branch, origin, NULL);
133
src_data->head_status |= 2;
127
- } else if (!strcmp(line, "HEAD")) {
128
- origin = strdup(src);
129
- src_data->head_status |= 1;
134
} else {
135
origin = strdup(src);
136
append_to_list(&src_data->generic, strdup(line), NULL);