builtin-fetch--tool: fix reflog notes.
Also the verbose output had unnecessary SHA1 and not-for-merge markers leaked because append_fetch_head() cheated Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Feb 28, 2007 at 17:02 UTC
855b34680ea334f05385b3ad58232c3ccdca51d5
1 file changed
+6
-4
builtin-fetch--tool.c
+6
-4
@@ -181,16 +181,18 @@ static int append_fetch_head(FILE *fp,
181
remote_len = i + 1;
182
if (4 < i && !strncmp(".git", remote + i - 3, 4))
183
remote_len = i - 3;
184
- note_len = sprintf(note, "%s\t%s\t",
185
- sha1_to_hex(commit ? commit->object.sha1 : sha1),
186
- not_for_merge ? "not-for-merge" : "");
184
+
185
+ note_len = 0;
186
if (*what) {
187
if (*kind)
188
note_len += sprintf(note + note_len, "%s ", kind);
189
note_len += sprintf(note + note_len, "'%s' of ", what);
190
}
191
note_len += sprintf(note + note_len, "%.*s", remote_len, remote);
193
- fprintf(fp, "%s\n", note);
192
+ fprintf(fp, "%s\t%s\t%s\n",
193
+ sha1_to_hex(commit ? commit->object.sha1 : sha1),
194
+ not_for_merge ? "not-for-merge" : "",
195
+ note);
196
return update_local_ref(local_name, head, note, verbose, force);
197
}
198