Skip to content

Commit 9e6324c

Browse files
committed
Merge branch 'maint'
* maint: Update draft release notes for 1.7.8.1 Git 1.7.7.5 Git 1.7.6.5 blame: don't overflow time buffer fetch: create status table using strbuf Conflicts: RelNotes
2 parents 73c6b35 + 7b6c583 commit 9e6324c

File tree

6 files changed

+114
-41
lines changed

6 files changed

+114
-41
lines changed

Documentation/RelNotes/1.7.6.5.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Git v1.7.6.5 Release Notes
2+
==========================
3+
4+
Fixes since v1.7.6.4
5+
--------------------
6+
7+
* The date parser did not accept timezone designators that lack minutes
8+
part and also has a colon between "hh:mm".
9+
10+
* After fetching from a remote that has very long refname, the reporting
11+
output could have corrupted by overrunning a static buffer.
12+
13+
* "git mergetool" did not use its arguments as pathspec, but as a path to
14+
the file that may not even have any conflict.
15+
16+
* "git name-rev --all" tried to name all _objects_, naturally failing to
17+
describe many blobs and trees, instead of showing only commits as
18+
advertised in its documentation.
19+
20+
* "git remote rename $a $b" were not careful to match the remote name
21+
against $a (i.e. source side of the remote nickname).
22+
23+
* "gitweb" used to produce a non-working link while showing the contents
24+
of a blob, when JavaScript actions are enabled.
25+
26+
Also contains minor fixes and documentation updates.

Documentation/RelNotes/1.7.7.5.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Git v1.7.7.5 Release Notes
2+
==========================
3+
4+
Fixes since v1.7.7.4
5+
--------------------
6+
7+
* After fetching from a remote that has very long refname, the reporting
8+
output could have corrupted by overrunning a static buffer.
9+
10+
* "git checkout" and "git merge" treated in-tree .gitignore and exclude
11+
file in $GIT_DIR/info/ directory inconsistently when deciding which
12+
untracked files are ignored and expendable.
13+
14+
Also contains minor fixes and documentation updates.

Documentation/RelNotes/1.7.8.1.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Git v1.7.8.1 Release Notes
2+
==========================
3+
4+
Fixes since v1.7.8.1
5+
--------------------
6+
7+
* In some codepaths (notably, checkout and merge), the ignore patterns
8+
recorded in $GIT_DIR/info/exclude were not honored. They now are.
9+
10+
* After fetching from a remote that has very long refname, the reporting
11+
output could have corrupted by overrunning a static buffer.
12+
13+
* "git checkout" and "git merge" treated in-tree .gitignore and exclude
14+
file in $GIT_DIR/info/ directory inconsistently when deciding which
15+
untracked files are ignored and expendable.
16+
17+
Also contains minor fixes and documentation updates.

Documentation/git.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,20 @@ Documentation for older releases are available here:
4949
* release notes for
5050
link:RelNotes/1.7.8.txt[1.7.8].
5151

52-
* link:v1.7.7.1/git.html[documentation for release 1.7.7.1]
52+
* link:v1.7.7.5/git.html[documentation for release 1.7.7.5]
5353

5454
* release notes for
55+
link:RelNotes/1.7.7.5.txt[1.7.7.5],
56+
link:RelNotes/1.7.7.4.txt[1.7.7.4],
57+
link:RelNotes/1.7.7.3.txt[1.7.7.3],
58+
link:RelNotes/1.7.7.2.txt[1.7.7.2],
5559
link:RelNotes/1.7.7.1.txt[1.7.7.1],
5660
link:RelNotes/1.7.7.txt[1.7.7].
5761

58-
* link:v1.7.6.4/git.html[documentation for release 1.7.6.4]
62+
* link:v1.7.6.5/git.html[documentation for release 1.7.6.5]
5963

6064
* release notes for
65+
link:RelNotes/1.7.6.5.txt[1.7.6.5],
6166
link:RelNotes/1.7.6.4.txt[1.7.6.4],
6267
link:RelNotes/1.7.6.3.txt[1.7.6.3],
6368
link:RelNotes/1.7.6.2.txt[1.7.6.2],

builtin/blame.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1598,7 +1598,7 @@ static const char *format_time(unsigned long time, const char *tz_str,
15981598
int tz;
15991599

16001600
if (show_raw_time) {
1601-
sprintf(time_buf, "%lu %s", time, tz_str);
1601+
snprintf(time_buf, sizeof(time_buf), "%lu %s", time, tz_str);
16021602
}
16031603
else {
16041604
tz = atoi(tz_str);

builtin/fetch.c

Lines changed: 49 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -240,23 +240,23 @@ static int s_update_ref(const char *action,
240240

241241
static int update_local_ref(struct ref *ref,
242242
const char *remote,
243-
char *display)
243+
struct strbuf *display)
244244
{
245245
struct commit *current = NULL, *updated;
246246
enum object_type type;
247247
struct branch *current_branch = branch_get(NULL);
248248
const char *pretty_ref = prettify_refname(ref->name);
249249

250-
*display = 0;
251250
type = sha1_object_info(ref->new_sha1, NULL);
252251
if (type < 0)
253252
die(_("object %s not found"), sha1_to_hex(ref->new_sha1));
254253

255254
if (!hashcmp(ref->old_sha1, ref->new_sha1)) {
256255
if (verbosity > 0)
257-
sprintf(display, "= %-*s %-*s -> %s", TRANSPORT_SUMMARY_WIDTH,
258-
_("[up to date]"), REFCOL_WIDTH, remote,
259-
pretty_ref);
256+
strbuf_addf(display, "= %-*s %-*s -> %s",
257+
TRANSPORT_SUMMARY_WIDTH,
258+
_("[up to date]"), REFCOL_WIDTH,
259+
remote, pretty_ref);
260260
return 0;
261261
}
262262

@@ -268,19 +268,22 @@ static int update_local_ref(struct ref *ref,
268268
* If this is the head, and it's not okay to update
269269
* the head, and the old value of the head isn't empty...
270270
*/
271-
sprintf(display, _("! %-*s %-*s -> %s (can't fetch in current branch)"),
272-
TRANSPORT_SUMMARY_WIDTH, _("[rejected]"), REFCOL_WIDTH, remote,
273-
pretty_ref);
271+
strbuf_addf(display,
272+
_("! %-*s %-*s -> %s (can't fetch in current branch)"),
273+
TRANSPORT_SUMMARY_WIDTH, _("[rejected]"),
274+
REFCOL_WIDTH, remote, pretty_ref);
274275
return 1;
275276
}
276277

277278
if (!is_null_sha1(ref->old_sha1) &&
278279
!prefixcmp(ref->name, "refs/tags/")) {
279280
int r;
280281
r = s_update_ref("updating tag", ref, 0);
281-
sprintf(display, "%c %-*s %-*s -> %s%s", r ? '!' : '-',
282-
TRANSPORT_SUMMARY_WIDTH, _("[tag update]"), REFCOL_WIDTH, remote,
283-
pretty_ref, r ? _(" (unable to update local ref)") : "");
282+
strbuf_addf(display, "%c %-*s %-*s -> %s%s",
283+
r ? '!' : '-',
284+
TRANSPORT_SUMMARY_WIDTH, _("[tag update]"),
285+
REFCOL_WIDTH, remote, pretty_ref,
286+
r ? _(" (unable to update local ref)") : "");
284287
return r;
285288
}
286289

@@ -303,9 +306,11 @@ static int update_local_ref(struct ref *ref,
303306
}
304307

305308
r = s_update_ref(msg, ref, 0);
306-
sprintf(display, "%c %-*s %-*s -> %s%s", r ? '!' : '*',
307-
TRANSPORT_SUMMARY_WIDTH, what, REFCOL_WIDTH, remote, pretty_ref,
308-
r ? _(" (unable to update local ref)") : "");
309+
strbuf_addf(display, "%c %-*s %-*s -> %s%s",
310+
r ? '!' : '*',
311+
TRANSPORT_SUMMARY_WIDTH, what,
312+
REFCOL_WIDTH, remote, pretty_ref,
313+
r ? _(" (unable to update local ref)") : "");
309314
return r;
310315
}
311316

@@ -319,9 +324,11 @@ static int update_local_ref(struct ref *ref,
319324
(recurse_submodules != RECURSE_SUBMODULES_ON))
320325
check_for_new_submodule_commits(ref->new_sha1);
321326
r = s_update_ref("fast-forward", ref, 1);
322-
sprintf(display, "%c %-*s %-*s -> %s%s", r ? '!' : ' ',
323-
TRANSPORT_SUMMARY_WIDTH, quickref, REFCOL_WIDTH, remote,
324-
pretty_ref, r ? _(" (unable to update local ref)") : "");
327+
strbuf_addf(display, "%c %-*s %-*s -> %s%s",
328+
r ? '!' : ' ',
329+
TRANSPORT_SUMMARY_WIDTH, quickref,
330+
REFCOL_WIDTH, remote, pretty_ref,
331+
r ? _(" (unable to update local ref)") : "");
325332
return r;
326333
} else if (force || ref->force) {
327334
char quickref[84];
@@ -333,15 +340,17 @@ static int update_local_ref(struct ref *ref,
333340
(recurse_submodules != RECURSE_SUBMODULES_ON))
334341
check_for_new_submodule_commits(ref->new_sha1);
335342
r = s_update_ref("forced-update", ref, 1);
336-
sprintf(display, "%c %-*s %-*s -> %s (%s)", r ? '!' : '+',
337-
TRANSPORT_SUMMARY_WIDTH, quickref, REFCOL_WIDTH, remote,
338-
pretty_ref,
339-
r ? _("unable to update local ref") : _("forced update"));
343+
strbuf_addf(display, "%c %-*s %-*s -> %s (%s)",
344+
r ? '!' : '+',
345+
TRANSPORT_SUMMARY_WIDTH, quickref,
346+
REFCOL_WIDTH, remote, pretty_ref,
347+
r ? _("unable to update local ref") : _("forced update"));
340348
return r;
341349
} else {
342-
sprintf(display, "! %-*s %-*s -> %s %s",
343-
TRANSPORT_SUMMARY_WIDTH, _("[rejected]"), REFCOL_WIDTH, remote,
344-
pretty_ref, _("(non-fast-forward)"));
350+
strbuf_addf(display, "! %-*s %-*s -> %s %s",
351+
TRANSPORT_SUMMARY_WIDTH, _("[rejected]"),
352+
REFCOL_WIDTH, remote, pretty_ref,
353+
_("(non-fast-forward)"));
345354
return 1;
346355
}
347356
}
@@ -363,8 +372,8 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
363372
{
364373
FILE *fp;
365374
struct commit *commit;
366-
int url_len, i, note_len, shown_url = 0, rc = 0;
367-
char note[1024];
375+
int url_len, i, shown_url = 0, rc = 0;
376+
struct strbuf note = STRBUF_INIT;
368377
const char *what, *kind;
369378
struct ref *rm;
370379
char *url, *filename = dry_run ? "/dev/null" : git_path("FETCH_HEAD");
@@ -427,40 +436,41 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
427436
if (4 < i && !strncmp(".git", url + i - 3, 4))
428437
url_len = i - 3;
429438

430-
note_len = 0;
439+
strbuf_reset(&note);
431440
if (*what) {
432441
if (*kind)
433-
note_len += sprintf(note + note_len, "%s ",
434-
kind);
435-
note_len += sprintf(note + note_len, "'%s' of ", what);
442+
strbuf_addf(&note, "%s ", kind);
443+
strbuf_addf(&note, "'%s' of ", what);
436444
}
437-
note[note_len] = '\0';
438445
fprintf(fp, "%s\t%s\t%s",
439446
sha1_to_hex(rm->old_sha1),
440447
rm->merge ? "" : "not-for-merge",
441-
note);
448+
note.buf);
442449
for (i = 0; i < url_len; ++i)
443450
if ('\n' == url[i])
444451
fputs("\\n", fp);
445452
else
446453
fputc(url[i], fp);
447454
fputc('\n', fp);
448455

456+
strbuf_reset(&note);
449457
if (ref) {
450-
rc |= update_local_ref(ref, what, note);
458+
rc |= update_local_ref(ref, what, &note);
451459
free(ref);
452460
} else
453-
sprintf(note, "* %-*s %-*s -> FETCH_HEAD",
454-
TRANSPORT_SUMMARY_WIDTH, *kind ? kind : "branch",
455-
REFCOL_WIDTH, *what ? what : "HEAD");
456-
if (*note) {
461+
strbuf_addf(&note, "* %-*s %-*s -> FETCH_HEAD",
462+
TRANSPORT_SUMMARY_WIDTH,
463+
*kind ? kind : "branch",
464+
REFCOL_WIDTH,
465+
*what ? what : "HEAD");
466+
if (note.len) {
457467
if (verbosity >= 0 && !shown_url) {
458468
fprintf(stderr, _("From %.*s\n"),
459469
url_len, url);
460470
shown_url = 1;
461471
}
462472
if (verbosity >= 0)
463-
fprintf(stderr, " %s\n", note);
473+
fprintf(stderr, " %s\n", note.buf);
464474
}
465475
}
466476

@@ -470,6 +480,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
470480
"branches"), remote_name);
471481

472482
abort:
483+
strbuf_release(&note);
473484
free(url);
474485
fclose(fp);
475486
return rc;

0 commit comments

Comments
 (0)