Skip to content

Commit 58b1ef2

Browse files
committed
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
2 parents 4525e8e + 78d3b06 commit 58b1ef2

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

refs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1525,8 +1525,10 @@ int for_each_recent_reflog_ent(const char *ref, each_reflog_ent_fn fn, long ofs,
15251525
if (fstat(fileno(logfp), &statbuf) ||
15261526
statbuf.st_size < ofs ||
15271527
fseek(logfp, -ofs, SEEK_END) ||
1528-
fgets(buf, sizeof(buf), logfp))
1528+
fgets(buf, sizeof(buf), logfp)) {
1529+
fclose(logfp);
15291530
return -1;
1531+
}
15301532
}
15311533

15321534
while (fgets(buf, sizeof(buf), logfp)) {

sha1_name.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -777,8 +777,6 @@ int interpret_branch_name(const char *name, struct strbuf *buf)
777777
for_each_recent_reflog_ent("HEAD", grab_nth_branch_switch, 40960, &cb);
778778
if (cb.cnt < nth) {
779779
cb.cnt = 0;
780-
for (i = 0; i < nth; i++)
781-
strbuf_release(&cb.buf[i]);
782780
for_each_reflog_ent("HEAD", grab_nth_branch_switch, &cb);
783781
}
784782
if (cb.cnt < nth)

unpack-trees.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ int oneway_merge(struct cache_entry **src, struct unpack_trees_options *o)
999999
return error("Cannot do a oneway merge of %d trees",
10001000
o->merge_size);
10011001

1002-
if (!a)
1002+
if (!a || a == o->df_conflict_entry)
10031003
return deleted_entry(old, old, o);
10041004

10051005
if (old && same(old, a)) {

0 commit comments

Comments
 (0)