Merge branch 'jc/maint-reset-unmerged-path' into maint
authorJunio C Hamano <gitster@pobox.com>
Tue, 16 Aug 2011 18:41:28 +0000 (11:41 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 16 Aug 2011 18:41:28 +0000 (11:41 -0700)
* jc/maint-reset-unmerged-path:
reset [<commit>] paths...: do not mishandle unmerged paths

1  2 
diff-lib.c
diff --combined diff-lib.c
index 2e09500c8210e22d6c81484aa198f1d811a9933d,fd61acbdce8c65f5146b15af0ab322501f271794..b3797592c63a86b46a3af0d875b6fe04ea43f536
@@@ -379,7 -379,8 +379,8 @@@ static void do_oneway_diff(struct unpac
        if (cached && idx && ce_stage(idx)) {
                struct diff_filepair *pair;
                pair = diff_unmerge(&revs->diffopt, idx->name);
-               fill_filespec(pair->one, idx->sha1, idx->ce_mode);
+               if (tree)
+                       fill_filespec(pair->one, tree->sha1, tree->ce_mode);
                return;
        }
  
@@@ -433,13 -434,8 +434,13 @@@ static int oneway_diff(struct cache_ent
        if (tree == o->df_conflict_entry)
                tree = NULL;
  
 -      if (ce_path_match(idx ? idx : tree, &revs->prune_data))
 +      if (ce_path_match(idx ? idx : tree, &revs->prune_data)) {
                do_oneway_diff(o, idx, tree);
 +              if (diff_can_quit_early(&revs->diffopt)) {
 +                      o->exiting_early = 1;
 +                      return -1;
 +              }
 +      }
  
        return 0;
  }