summaryrefslogtreecommitdiff
path: root/builtin-fast-export.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-07-24 09:27:09 -0700
committerJunio C Hamano <gitster@pobox.com>2009-07-24 09:27:09 -0700
commitf87dd2152a6941dfa7f3ddaf599bc30f58562a98 (patch)
tree308c66f7be4942b01b468e958cb7c9c64dd39131 /builtin-fast-export.c
parent4aacaeb3dc82bb6479e70e120053dc27a399460e (diff)
parent01ae841ccf3aa5d5331a4e6aed6122fee6617740 (diff)
downloadgit-f87dd2152a6941dfa7f3ddaf599bc30f58562a98.tar.gz
Merge branch 'maint'
* maint: SunOS grep does not understand -C<n> nor -e Fix export_marks() error handling. git branch: clean up detached branch handling git branch: avoid unnecessary object lookups git branch: fix performance problem do_one_ref(): null_sha1 check is not about broken ref Conflicts: Makefile
Diffstat (limited to 'builtin-fast-export.c')
-rw-r--r--builtin-fast-export.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/builtin-fast-export.c b/builtin-fast-export.c
index 9a8a6fc6b1..ca198250c3 100644
--- a/builtin-fast-export.c
+++ b/builtin-fast-export.c
@@ -428,21 +428,27 @@ static void export_marks(char *file)
uint32_t mark;
struct object_decoration *deco = idnums.hash;
FILE *f;
+ int e = 0;
f = fopen(file, "w");
if (!f)
- error("Unable to open marks file %s for writing", file);
+ error("Unable to open marks file %s for writing.", file);
for (i = 0; i < idnums.size; i++) {
if (deco->base && deco->base->type == 1) {
mark = ptr_to_mark(deco->decoration);
- fprintf(f, ":%"PRIu32" %s\n", mark,
- sha1_to_hex(deco->base->sha1));
+ if (fprintf(f, ":%"PRIu32" %s\n", mark,
+ sha1_to_hex(deco->base->sha1)) < 0) {
+ e = 1;
+ break;
+ }
}
deco++;
}
- if (ferror(f) || fclose(f))
+ e |= ferror(f);
+ e |= fclose(f);
+ if (e)
error("Unable to write marks file %s.", file);
}