Merge branch 'maint'
authorJunio C Hamano <junkio@cox.net>
Thu, 31 May 2007 07:15:14 +0000 (00:15 -0700)
committerJunio C Hamano <junkio@cox.net>
Thu, 31 May 2007 07:15:14 +0000 (00:15 -0700)
* maint:
git-config: Improve documentation of git-config file handling
git-config: Various small fixes to asciidoc documentation
decode_85(): fix missing return.
fix signed range problems with hex conversions

1  2 
cache.h
sha1_file.c
diff --combined cache.h
index ec85d93e0d39a3c55c9579c734401b80331aa19a,5dff2f1d73eb1a41f664d959d18e6f2c0e102e64..0da7070da4a88852995da8e11d4ad5436c328aa8
+++ b/cache.h
@@@ -40,8 -40,8 +40,8 @@@
   * happens that everybody shares the same bit representation
   * in the UNIX world (and apparently wider too..)
   */
 -#define S_IFDIRLNK    0160000
 -#define S_ISDIRLNK(m) (((m) & S_IFMT) == S_IFDIRLNK)
 +#define S_IFGITLINK   0160000
 +#define S_ISGITLINK(m)        (((m) & S_IFMT) == S_IFGITLINK)
  
  /*
   * Intensive research over the course of many years has shown that
@@@ -123,8 -123,8 +123,8 @@@ static inline unsigned int create_ce_mo
  {
        if (S_ISLNK(mode))
                return htonl(S_IFLNK);
 -      if (S_ISDIR(mode) || S_ISDIRLNK(mode))
 -              return htonl(S_IFDIRLNK);
 +      if (S_ISDIR(mode) || S_ISGITLINK(mode))
 +              return htonl(S_IFGITLINK);
        return htonl(S_IFREG | ce_permissions(mode));
  }
  static inline unsigned int ce_mode_from_stat(struct cache_entry *ce, unsigned int mode)
  }
  #define canon_mode(mode) \
        (S_ISREG(mode) ? (S_IFREG | ce_permissions(mode)) : \
 -      S_ISLNK(mode) ? S_IFLNK : S_ISDIR(mode) ? S_IFDIR : S_IFDIRLNK)
 +      S_ISLNK(mode) ? S_IFLNK : S_ISDIR(mode) ? S_IFDIR : S_IFGITLINK)
  
  #define cache_entry_size(len) ((offsetof(struct cache_entry,name) + (len) + 8) & ~7)
  
@@@ -273,6 -273,7 +273,6 @@@ extern void rollback_lock_file(struct l
  extern int delete_ref(const char *, const unsigned char *sha1);
  
  /* Environment bits from configuration mechanism */
 -extern int use_legacy_headers;
  extern int trust_executable_bit;
  extern int has_symlinks;
  extern int assume_unchanged;
@@@ -282,8 -283,6 +282,8 @@@ extern int warn_ambiguous_refs
  extern int shared_repository;
  extern const char *apply_default_whitespace;
  extern int zlib_compression_level;
 +extern int core_compression_level;
 +extern int core_compression_seen;
  extern size_t packed_git_window_size;
  extern size_t packed_git_limit;
  extern size_t delta_base_cache_limit;
@@@ -355,12 -354,13 +355,12 @@@ extern int move_temp_to_file(const cha
  extern int has_sha1_pack(const unsigned char *sha1, const char **ignore);
  extern int has_sha1_file(const unsigned char *sha1);
  extern void *map_sha1_file(const unsigned char *sha1, unsigned long *);
 -extern int legacy_loose_object(unsigned char *);
  
  extern int has_pack_file(const unsigned char *sha1);
  extern int has_pack_index(const unsigned char *sha1);
  
- extern signed char hexval_table[256];
- static inline unsigned int hexval(unsigned int c)
+ extern const signed char hexval_table[256];
+ static inline unsigned int hexval(unsigned char c)
  {
        return hexval_table[c];
  }
@@@ -463,10 -463,11 +463,10 @@@ struct ref 
  #define REF_HEADS     (1u << 1)
  #define REF_TAGS      (1u << 2)
  
 -extern pid_t git_connect(int fd[2], char *url, const char *prog);
 +#define CONNECT_VERBOSE       (1u << 0)
 +extern pid_t git_connect(int fd[2], char *url, const char *prog, int flags);
  extern int finish_connect(pid_t pid);
  extern int path_match(const char *path, int nr, char **match);
 -extern int match_refs(struct ref *src, struct ref *dst, struct ref ***dst_tail,
 -                    int nr_refspec, char **refspec, int all);
  extern int get_ack(int fd, unsigned char *result_sha1);
  extern struct ref **get_remote_heads(int in, struct ref **list, int nr_match, char **match, unsigned int flags);
  extern int server_supports(const char *feature);
diff --combined sha1_file.c
index cf855ac244cb47f7dabd0304689d451cb4febc27,c2f807f4c282b99fe063e999ecf61a3dc12fb86d..a1b8fca6c969938d685957af1ff060d5d41ad025
@@@ -33,7 -33,7 +33,7 @@@ const unsigned char null_sha1[20]
  
  static unsigned int sha1_file_open_flag = O_NOATIME;
  
- signed char hexval_table[256] = {
const signed char hexval_table[256] = {
         -1, -1, -1, -1, -1, -1, -1, -1,                /* 00-07 */
         -1, -1, -1, -1, -1, -1, -1, -1,                /* 08-0f */
         -1, -1, -1, -1, -1, -1, -1, -1,                /* 10-17 */
@@@ -972,7 -972,7 +972,7 @@@ void *map_sha1_file(const unsigned cha
        return map;
  }
  
 -int legacy_loose_object(unsigned char *map)
 +static int legacy_loose_object(unsigned char *map)
  {
        unsigned int word;
  
@@@ -1034,14 -1034,6 +1034,14 @@@ static int unpack_sha1_header(z_stream 
                return inflate(stream, 0);
        }
  
 +
 +      /*
 +       * There used to be a second loose object header format which
 +       * was meant to mimic the in-pack format, allowing for direct
 +       * copy of the object data.  This format turned up not to be
 +       * really worth it and we don't write it any longer.  But we
 +       * can still read it.
 +       */
        used = unpack_object_header_gently(map, mapsize, &type, &size);
        if (!used || !valid_loose_object_type[type])
                return -1;
@@@ -1654,25 -1646,20 +1654,25 @@@ static int matches_pack_name(struct pac
  
  static int find_pack_entry(const unsigned char *sha1, struct pack_entry *e, const char **ignore_packed)
  {
 +      static struct packed_git *last_found = (void *)1;
        struct packed_git *p;
        off_t offset;
  
        prepare_packed_git();
 +      if (!packed_git)
 +              return 0;
 +      p = (last_found == (void *)1) ? packed_git : last_found;
  
 -      for (p = packed_git; p; p = p->next) {
 +      do {
                if (ignore_packed) {
                        const char **ig;
                        for (ig = ignore_packed; *ig; ig++)
                                if (!matches_pack_name(p, *ig))
                                        break;
                        if (*ig)
 -                              continue;
 +                              goto next;
                }
 +
                offset = find_pack_entry_one(sha1, p);
                if (offset) {
                        /*
                         */
                        if (p->pack_fd == -1 && open_packed_git(p)) {
                                error("packfile %s cannot be accessed", p->pack_name);
 -                              continue;
 +                              goto next;
                        }
                        e->offset = offset;
                        e->p = p;
                        hashcpy(e->sha1, sha1);
 +                      last_found = p;
                        return 1;
                }
 -      }
 +
 +              next:
 +              if (p == last_found)
 +                      p = packed_git;
 +              else
 +                      p = p->next;
 +              if (p == last_found)
 +                      p = p->next;
 +      } while (p);
        return 0;
  }
  
@@@ -1984,6 -1962,40 +1984,6 @@@ static int write_buffer(int fd, const v
        return 0;
  }
  
 -static int write_binary_header(unsigned char *hdr, enum object_type type, unsigned long len)
 -{
 -      int hdr_len;
 -      unsigned char c;
 -
 -      c = (type << 4) | (len & 15);
 -      len >>= 4;
 -      hdr_len = 1;
 -      while (len) {
 -              *hdr++ = c | 0x80;
 -              hdr_len++;
 -              c = (len & 0x7f);
 -              len >>= 7;
 -      }
 -      *hdr = c;
 -      return hdr_len;
 -}
 -
 -static void setup_object_header(z_stream *stream, const char *type, unsigned long len)
 -{
 -      int obj_type, hdrlen;
 -
 -      if (use_legacy_headers) {
 -              while (deflate(stream, 0) == Z_OK)
 -                      /* nothing */;
 -              return;
 -      }
 -      obj_type = type_from_string(type);
 -      hdrlen = write_binary_header(stream->next_out, obj_type, len);
 -      stream->total_out = hdrlen;
 -      stream->next_out += hdrlen;
 -      stream->avail_out -= hdrlen;
 -}
 -
  int hash_sha1_file(const void *buf, unsigned long len, const char *type,
                     unsigned char *sha1)
  {
@@@ -2050,8 -2062,7 +2050,8 @@@ int write_sha1_file(void *buf, unsigne
        /* First header.. */
        stream.next_in = (unsigned char *)hdr;
        stream.avail_in = hdrlen;
 -      setup_object_header(&stream, type, len);
 +      while (deflate(&stream, 0) == Z_OK)
 +              /* nothing */;
  
        /* Then the data itself.. */
        stream.next_in = buf;