Merge branch 'maint'

* maint:
  checkout -f: deal with a D/F conflict entry correctly
  sha1_name.c: avoid unnecessary strbuf_release
  refs.c: release file descriptor on error return
This commit is contained in:
Junio C Hamano 2009-07-18 16:57:47 -07:00
commit 58b1ef2f0f
3 changed files with 4 additions and 4 deletions

4
refs.c
View File

@ -1525,9 +1525,11 @@ int for_each_recent_reflog_ent(const char *ref, each_reflog_ent_fn fn, long ofs,
if (fstat(fileno(logfp), &statbuf) || if (fstat(fileno(logfp), &statbuf) ||
statbuf.st_size < ofs || statbuf.st_size < ofs ||
fseek(logfp, -ofs, SEEK_END) || fseek(logfp, -ofs, SEEK_END) ||
fgets(buf, sizeof(buf), logfp)) fgets(buf, sizeof(buf), logfp)) {
fclose(logfp);
return -1; return -1;
} }
}
while (fgets(buf, sizeof(buf), logfp)) { while (fgets(buf, sizeof(buf), logfp)) {
unsigned char osha1[20], nsha1[20]; unsigned char osha1[20], nsha1[20];

View File

@ -777,8 +777,6 @@ int interpret_branch_name(const char *name, struct strbuf *buf)
for_each_recent_reflog_ent("HEAD", grab_nth_branch_switch, 40960, &cb); for_each_recent_reflog_ent("HEAD", grab_nth_branch_switch, 40960, &cb);
if (cb.cnt < nth) { if (cb.cnt < nth) {
cb.cnt = 0; cb.cnt = 0;
for (i = 0; i < nth; i++)
strbuf_release(&cb.buf[i]);
for_each_reflog_ent("HEAD", grab_nth_branch_switch, &cb); for_each_reflog_ent("HEAD", grab_nth_branch_switch, &cb);
} }
if (cb.cnt < nth) if (cb.cnt < nth)

View File

@ -999,7 +999,7 @@ int oneway_merge(struct cache_entry **src, struct unpack_trees_options *o)
return error("Cannot do a oneway merge of %d trees", return error("Cannot do a oneway merge of %d trees",
o->merge_size); o->merge_size);
if (!a) if (!a || a == o->df_conflict_entry)
return deleted_entry(old, old, o); return deleted_entry(old, old, o);
if (old && same(old, a)) { if (old && same(old, a)) {