Skip to content

Commit 8311158

Browse files
committed
Merge branch 'maint-1.7.7' into maint
* maint-1.7.7: Git 1.7.7.5 Git 1.7.6.5 blame: don't overflow time buffer fetch: create status table using strbuf checkout,merge: loosen overwriting untracked file check based on info/exclude cast variable in call to free() in builtin/diff.c and submodule.c apply: get rid of useless x < 0 comparison on a size_t type Conflicts: Documentation/git.txt GIT-VERSION-GEN RelNotes builtin/fetch.c
2 parents 10dd3b2 + 66c11f0 commit 8311158

File tree

10 files changed

+101
-48
lines changed

10 files changed

+101
-48
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/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/apply.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,6 @@ static int fuzzy_matchlines(const char *s1, size_t n1,
250250
const char *last2 = s2 + n2 - 1;
251251
int result = 0;
252252

253-
if (n1 < 0 || n2 < 0)
254-
return 0;
255-
256253
/* ignore line endings */
257254
while ((*last1 == '\r') || (*last1 == '\n'))
258255
last1--;

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/checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ static int merge_working_tree(struct checkout_opts *opts,
411411
topts.fn = twoway_merge;
412412
topts.dir = xcalloc(1, sizeof(*topts.dir));
413413
topts.dir->flags |= DIR_SHOW_IGNORED;
414-
topts.dir->exclude_per_dir = ".gitignore";
414+
setup_standard_excludes(topts.dir);
415415
tree = parse_tree_indirect(old->commit ?
416416
old->commit->object.sha1 :
417417
EMPTY_TREE_SHA1_BIN);

builtin/diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ static int builtin_diff_combined(struct rev_info *revs,
182182
hashcpy((unsigned char *)(parent + i), ent[i].item->sha1);
183183
diff_tree_combined(parent[0], parent + 1, ents - 1,
184184
revs->dense_combined_merges, revs);
185-
free(parent);
185+
free((void *)parent);
186186
return 0;
187187
}
188188

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,41 +436,42 @@ 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(commit ? commit->object.sha1 :
440447
rm->old_sha1),
441448
rm->merge ? "" : "not-for-merge",
442-
note);
449+
note.buf);
443450
for (i = 0; i < url_len; ++i)
444451
if ('\n' == url[i])
445452
fputs("\\n", fp);
446453
else
447454
fputc(url[i], fp);
448455
fputc('\n', fp);
449456

457+
strbuf_reset(&note);
450458
if (ref) {
451-
rc |= update_local_ref(ref, what, note);
459+
rc |= update_local_ref(ref, what, &note);
452460
free(ref);
453461
} else
454-
sprintf(note, "* %-*s %-*s -> FETCH_HEAD",
455-
TRANSPORT_SUMMARY_WIDTH, *kind ? kind : "branch",
456-
REFCOL_WIDTH, *what ? what : "HEAD");
457-
if (*note) {
462+
strbuf_addf(&note, "* %-*s %-*s -> FETCH_HEAD",
463+
TRANSPORT_SUMMARY_WIDTH,
464+
*kind ? kind : "branch",
465+
REFCOL_WIDTH,
466+
*what ? what : "HEAD");
467+
if (note.len) {
458468
if (verbosity >= 0 && !shown_url) {
459469
fprintf(stderr, _("From %.*s\n"),
460470
url_len, url);
461471
shown_url = 1;
462472
}
463473
if (verbosity >= 0)
464-
fprintf(stderr, " %s\n", note);
474+
fprintf(stderr, " %s\n", note.buf);
465475
}
466476
}
467477

@@ -471,6 +481,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
471481
"branches"), remote_name);
472482

473483
abort:
484+
strbuf_release(&note);
474485
free(url);
475486
fclose(fp);
476487
return rc;

builtin/merge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ int checkout_fast_forward(const unsigned char *head, const unsigned char *remote
775775
memset(&t, 0, sizeof(t));
776776
memset(&dir, 0, sizeof(dir));
777777
dir.flags |= DIR_SHOW_IGNORED;
778-
dir.exclude_per_dir = ".gitignore";
778+
setup_standard_excludes(&dir);
779779
opts.dir = &dir;
780780

781781
opts.head_idx = 1;

submodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ static void commit_need_pushing(struct commit *commit, struct commit_list *paren
391391
rev.diffopt.format_callback_data = needs_pushing;
392392
diff_tree_combined(commit->object.sha1, parents, n, 1, &rev);
393393

394-
free(parents);
394+
free((void *)parents);
395395
}
396396

397397
int check_submodule_needs_pushing(unsigned char new_sha1[20], const char *remotes_name)

0 commit comments

Comments
 (0)