Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* maint:
  am: remove rebase-apply directory before gc
  rerere: fix memory leak if rerere images can't be read
  Documentation: mention conflict marker size argument (%L) for merge driver
  • Loading branch information
Junio C Hamano committed Feb 23, 2010
2 parents 241b925 + 29b6754 commit 0901d5a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Documentation/gitattributes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,8 @@ command to run to merge ancestor's version (`%O`), current
version (`%A`) and the other branches' version (`%B`). These
three tokens are replaced with the names of temporary files that
hold the contents of these versions when the command line is
built.
built. Additionally, %L will be replaced with the conflict marker
size (see below).

The merge driver is expected to leave the result of the merge in
the file named with `%A` by overwriting it, and exit with zero
Expand Down
3 changes: 1 addition & 2 deletions git-am.sh
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,5 @@ do
go_next
done

git gc --auto

rm -fr "$dotest"
git gc --auto
9 changes: 6 additions & 3 deletions rerere.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,16 +364,18 @@ static int find_conflict(struct string_list *conflict)
static int merge(const char *name, const char *path)
{
int ret;
mmfile_t cur, base, other;
mmfile_t cur = {NULL, 0}, base = {NULL, 0}, other = {NULL, 0};
mmbuffer_t result = {NULL, 0};

if (handle_file(path, NULL, rerere_path(name, "thisimage")) < 0)
return 1;

if (read_mmfile(&cur, rerere_path(name, "thisimage")) ||
read_mmfile(&base, rerere_path(name, "preimage")) ||
read_mmfile(&other, rerere_path(name, "postimage")))
return 1;
read_mmfile(&other, rerere_path(name, "postimage"))) {
ret = 1;
goto out;
}
ret = ll_merge(&result, path, &base, &cur, "", &other, "", 0);
if (!ret) {
FILE *f = fopen(path, "w");
Expand All @@ -387,6 +389,7 @@ static int merge(const char *name, const char *path)
strerror(errno));
}

out:
free(cur.ptr);
free(base.ptr);
free(other.ptr);
Expand Down

0 comments on commit 0901d5a

Please sign in to comment.