Merge branch 'np/progress'
authorJunio C Hamano <gitster@pobox.com>
Fri, 2 Nov 2007 23:27:37 +0000 (16:27 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 Nov 2007 23:27:37 +0000 (16:27 -0700)
* np/progress:
Show total transferred as part of throughput progress
make sure throughput display gets updated even if progress doesn't move
return the prune-packed progress display to the inner loop
add throughput display to git-push
add some copyright notice to the progress display code
add throughput display to index-pack
add throughput to progress display
relax usage of the progress API
make struct progress an opaque type
prune-packed: don't call display_progress() for every file
Stop displaying "Pack pack-$ID created." during git-gc
Teach prune-packed to use the standard progress meter
Change 'Deltifying objects' to 'Compressing objects'
fix for more minor memory leaks
fix const issues with some functions
pack-objects.c: fix some global variable abuse and memory leaks
pack-objects: no delta possible with only one object in the list
cope with multiple line breaks within sideband progress messages
more compact progress display

1  2 
pack-write.c
pack.h
diff --combined pack-write.c
index 979bdfff7c516ada7fb36281a22b41d303d1b99c,d1ed3abe21502464ca0ec6b90c1b3272e3db6176..665e2b29b8817aa6a8aa83ccd859ab51e7bb2234
@@@ -17,7 -17,8 +17,8 @@@ static int sha1_compare(const void *_a
   * the SHA1 hash of sorted object names. The objects array passed in
   * will be sorted by SHA1 on exit.
   */
- const char *write_idx_file(const char *index_name, struct pack_idx_entry **objects, int nr_objects, unsigned char *sha1)
+ char *write_idx_file(char *index_name, struct pack_idx_entry **objects,
+                    int nr_objects, unsigned char *sha1)
  {
        struct sha1file *f;
        struct pack_idx_entry **sorted_by_sha, **list, **last;
@@@ -179,29 -180,3 +180,29 @@@ void fixup_pack_header_footer(int pack_
        SHA1_Final(pack_file_sha1, &c);
        write_or_die(pack_fd, pack_file_sha1, 20);
  }
 +
 +char *index_pack_lockfile(int ip_out)
 +{
 +      int len, s;
 +      char packname[46];
 +
 +      /*
 +       * The first thing we expects from index-pack's output
 +       * is "pack\t%40s\n" or "keep\t%40s\n" (46 bytes) where
 +       * %40s is the newly created pack SHA1 name.  In the "keep"
 +       * case, we need it to remove the corresponding .keep file
 +       * later on.  If we don't get that then tough luck with it.
 +       */
 +      for (len = 0;
 +               len < 46 && (s = xread(ip_out, packname+len, 46-len)) > 0;
 +               len += s);
 +      if (len == 46 && packname[45] == '\n' &&
 +              memcmp(packname, "keep\t", 5) == 0) {
 +              char path[PATH_MAX];
 +              packname[45] = 0;
 +              snprintf(path, sizeof(path), "%s/pack/pack-%s.keep",
 +                       get_object_directory(), packname + 5);
 +              return xstrdup(path);
 +      }
 +      return NULL;
 +}
diff --combined pack.h
index b57ba2d9ed6120612c2576b07d8c185d4b54bb76,cab4aa8381a83980558d8e26f0b3ce06746d8962..b31b37608d7f1901c74a20552770c306e633670c
--- 1/pack.h
--- 2/pack.h
+++ b/pack.h
@@@ -55,11 -55,10 +55,11 @@@ struct pack_idx_entry 
        off_t offset;
  };
  
- extern const char *write_idx_file(const char *index_name, struct pack_idx_entry **objects, int nr_objects, unsigned char *sha1);
+ extern char *write_idx_file(char *index_name, struct pack_idx_entry **objects, int nr_objects, unsigned char *sha1);
  
  extern int verify_pack(struct packed_git *, int);
  extern void fixup_pack_header_footer(int, unsigned char *, const char *, uint32_t);
 +extern char *index_pack_lockfile(int fd);
  
  #define PH_ERROR_EOF          (-1)
  #define PH_ERROR_PACK_SIGNATURE       (-2)