Merge branch 'nd/maint-fix-replace'
authorJunio C Hamano <gitster@pobox.com>
Sat, 4 Sep 2010 05:23:13 +0000 (22:23 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 4 Sep 2010 05:23:13 +0000 (22:23 -0700)
* nd/maint-fix-replace:
parse_object: pass on the original sha1, not the replaced one

1  2 
object.c
t/t6050-replace.sh
diff --combined object.c
index 277b3ddba7dc5387cd97cb35c23d3358727898be,cdf7b30baa98e900e179c9954d93c92073684675..7adfda75f2914863c3c8eec86abffe581be4d480
+++ b/object.c
@@@ -199,7 -199,7 +199,7 @@@ struct object *parse_object(const unsig
                        return NULL;
                }
  
-               obj = parse_object_buffer(repl, type, size, buffer, &eaten);
+               obj = parse_object_buffer(sha1, type, size, buffer, &eaten);
                if (!eaten)
                        free(buffer);
                return obj;
@@@ -217,6 -217,27 +217,6 @@@ struct object_list *object_list_insert(
          return new_list;
  }
  
 -void object_list_append(struct object *item,
 -                      struct object_list **list_p)
 -{
 -      while (*list_p) {
 -              list_p = &((*list_p)->next);
 -      }
 -      *list_p = xmalloc(sizeof(struct object_list));
 -      (*list_p)->next = NULL;
 -      (*list_p)->item = item;
 -}
 -
 -unsigned object_list_length(struct object_list *list)
 -{
 -      unsigned ret = 0;
 -      while (list) {
 -              list = list->next;
 -              ret++;
 -      }
 -      return ret;
 -}
 -
  int object_list_contains(struct object_list *list, struct object *obj)
  {
        while (list) {
@@@ -252,10 -273,10 +252,10 @@@ void add_object_array_with_mode(struct 
  
  void object_array_remove_duplicates(struct object_array *array)
  {
 -      int ref, src, dst;
 +      unsigned int ref, src, dst;
        struct object_array_entry *objects = array->objects;
  
 -      for (ref = 0; ref < array->nr - 1; ref++) {
 +      for (ref = 0; ref + 1 < array->nr; ref++) {
                for (src = ref + 1, dst = src;
                     src < array->nr;
                     src++) {
diff --combined t/t6050-replace.sh
index 4185b7ca1d3679b458d16753581fe78e3b68b376,903ebc53d730a3e5bd2481adb716246c7f2e8c93..dd917d76da4f30ee8079caa17766c71513670d2e
@@@ -209,7 -209,7 +209,7 @@@ test_expect_success 'fetch branch with 
  
  test_expect_success 'bisect and replacements' '
       git bisect start $HASH7 $HASH1 &&
-      test "$S" = "$(git rev-parse --verify HEAD)" &&
+      test "$PARA3" = "$(git rev-parse --verify HEAD)" &&
       git bisect reset &&
       GIT_NO_REPLACE_OBJECTS=1 git bisect start $HASH7 $HASH1 &&
       test "$HASH4" = "$(git rev-parse --verify HEAD)" &&
       git bisect reset
  '
  
 +test_expect_success 'index-pack and replacements' '
 +      git --no-replace-objects rev-list --objects HEAD |
 +      git --no-replace-objects pack-objects test- &&
 +      git index-pack test-*.pack
 +'
 +
  #
  #
  test_done