Merge branch 'maint-1.6.1' into maint
authorJunio C Hamano <gitster@pobox.com>
Sun, 8 Mar 2009 05:00:27 +0000 (21:00 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sun, 8 Mar 2009 05:00:27 +0000 (21:00 -0800)
* maint-1.6.1:
builtin-revert.c: release index lock when cherry-picking an empty commit

1  2 
builtin-revert.c
diff --combined builtin-revert.c
index d210150671830c10f098463175e5a6e8d304c1a4,09d08fa3e3dd45b3bbb1ded4776da6bfb546a43d..3f2614e1bbef009afadefff7d284225533db2a09
@@@ -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();
            (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");