From: Junio C Hamano Date: Sun, 8 Mar 2009 05:00:27 +0000 (-0800) Subject: Merge branch 'maint-1.6.1' into maint X-Git-Tag: v1.6.2.1~8 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/9a6682bab5e800465f0a4e44cdf18fe396ff4f6d?ds=inline;hp=-c Merge branch 'maint-1.6.1' into maint * maint-1.6.1: builtin-revert.c: release index lock when cherry-picking an empty commit --- 9a6682bab5e800465f0a4e44cdf18fe396ff4f6d diff --combined builtin-revert.c index d210150671,09d08fa3e3..3f2614e1bb --- a/builtin-revert.c +++ b/builtin-revert.c @@@ -223,6 -223,17 +223,6 @@@ static char *help_msg(const unsigned ch return helpbuf; } -static int index_is_dirty(void) -{ - struct rev_info rev; - init_revisions(&rev, NULL); - setup_revisions(0, NULL, &rev, "HEAD"); - DIFF_OPT_SET(&rev.diffopt, QUIET); - DIFF_OPT_SET(&rev.diffopt, EXIT_WITH_STATUS); - run_diff_index(&rev, 1); - return !!DIFF_OPT_TST(&rev.diffopt, HAS_CHANGES); -} - static struct tree *empty_tree(void) { struct tree *tree = xcalloc(1, sizeof(struct tree)); @@@ -268,7 -279,7 +268,7 @@@ static int revert_or_cherry_pick(int ar } else { if (get_sha1("HEAD", head)) die ("You do not have a valid HEAD"); - if (index_is_dirty()) + if (index_differs_from("HEAD", 0)) die ("Dirty index: cannot %s", me); } discard_cache(); @@@ -376,6 -387,7 +376,7 @@@ (write_cache(index_fd, active_cache, active_nr) || commit_locked_index(&index_lock))) die("%s: Unable to write new index file", me); + rollback_lock_file(&index_lock); if (!clean) { add_to_msg("\nConflicts:\n\n");