summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b4524d3)
raw | patch | inline | side by side (parent: b4524d3)
author | Johannes Sixt <j6t@kdbg.org> | |
Wed, 23 Nov 2011 08:49:38 +0000 (09:49 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 23 Nov 2011 18:54:57 +0000 (10:54 -0800) |
On Windows, it is not possible to rename or remove a directory that has
open files. 'revert --abort' renamed .git/sequencer when it still had
.git/sequencer/head open. Close the file as early as possible to allow
the rename operation on Windows.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
open files. 'revert --abort' renamed .git/sequencer when it still had
.git/sequencer/head open. Close the file as early as possible to allow
the rename operation on Windows.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/revert.c | patch | blob | history |
diff --git a/builtin/revert.c b/builtin/revert.c
index 9b9b2e57475ad201719d5d590c9e1be2d4d43401..c0b259225146d4712e82e61805210a0327a3c27a 100644 (file)
--- a/builtin/revert.c
+++ b/builtin/revert.c
if (strbuf_getline(&buf, f, '\n')) {
error(_("cannot read %s: %s"), filename, ferror(f) ?
strerror(errno) : _("unexpected end of file"));
+ fclose(f);
goto fail;
}
+ fclose(f);
if (get_sha1_hex(buf.buf, sha1) || buf.buf[40] != '\0') {
error(_("stored pre-cherry-pick HEAD file '%s' is corrupt"),
filename);
if (reset_for_rollback(sha1))
goto fail;
strbuf_release(&buf);
- fclose(f);
return 0;
fail:
strbuf_release(&buf);
- fclose(f);
return -1;
}