summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2010-02-23 14:27:55 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-02-23 14:27:55 -0800
commit0901d5a2ef80996cf64c8afeaec765e1bc09f795 (patch)
tree72b1f5df7b0235174c0affe68ce549d697d762c1
parentMerge branch 'ml/maint-grep-doc' (diff)
parentam: remove rebase-apply directory before gc (diff)
downloadtgif-0901d5a2ef80996cf64c8afeaec765e1bc09f795.tar.xz
Merge branch 'maint'
* 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
-rw-r--r--Documentation/gitattributes.txt3
-rwxr-xr-xgit-am.sh3
-rw-r--r--rerere.c9
3 files changed, 9 insertions, 6 deletions
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
index b396a871b3..d892e642ed 100644
--- a/Documentation/gitattributes.txt
+++ b/Documentation/gitattributes.txt
@@ -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
diff --git a/git-am.sh b/git-am.sh
index 3c08d53161..ebfbee59d3 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -776,6 +776,5 @@ do
go_next
done
-git gc --auto
-
rm -fr "$dotest"
+git gc --auto
diff --git a/rerere.c b/rerere.c
index d1d3e75395..a59f74f76c 100644
--- a/rerere.c
+++ b/rerere.c
@@ -364,7 +364,7 @@ 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)
@@ -372,8 +372,10 @@ static int merge(const char *name, const char *path)
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");
@@ -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);