Merge branch 'jc/maint-config-exit-status' into maint-1.7.11
authorJunio C Hamano <gitster@pobox.com>
Tue, 11 Sep 2012 18:09:09 +0000 (11:09 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 11 Sep 2012 18:09:09 +0000 (11:09 -0700)
* jc/maint-config-exit-status:
config: "git config baa" should exit with status 1

1  2 
Documentation/git-config.txt
cache.h
index 5d9fd47ee3044afb55429c7c01e20e67094f6b2b,529395fd1496312335c4bf4a6e1b484a60afd2f7..21b8f6110bfc2a9c7891c166e3ee78a8246dcb1e
@@@ -54,16 -54,16 +54,16 @@@ configuration file by default, and opti
  '--file <filename>' can be used to tell the command to write to
  that location (you can say '--local' but that is the default).
  
- This command will fail (with exit code ret) if:
+ This command will fail with non-zero status upon error.  Some exit
+ codes are:
  
  . The config file is invalid (ret=3),
  . can not write to the config file (ret=4),
  . no section or name was provided (ret=2),
  . the section or key is invalid (ret=1),
  . you try to unset an option which does not exist (ret=5),
- . you try to unset/set an option for which multiple lines match (ret=5),
- . you try to use an invalid regexp (ret=6), or
- . you use '--global' option without $HOME being properly set (ret=128).
+ . you try to unset/set an option for which multiple lines match (ret=5), or
+ . you try to use an invalid regexp (ret=6).
  
  On success, the command returns the exit code 0.
  
@@@ -258,7 -258,7 +258,7 @@@ Given a .git/config like this
  
        ; Proxy settings
        [core]
 -              gitproxy="proxy-command" for kernel.org
 +              gitproxy=proxy-command for kernel.org
                gitproxy=default-proxy ; for all the rest
  
  you can set the filemode to true with
@@@ -333,7 -333,7 +333,7 @@@ To actually match only values with an e
  To add a new proxy, without altering any of the existing ones, use
  
  ------------
 -% git config core.gitproxy '"proxy-command" for example.com'
 +% git config --add core.gitproxy '"proxy-command" for example.com'
  ------------
  
  An example to use customized color from the configuration in your
diff --combined cache.h
index 89581041ce82603ae82866f8f8a5c01b4f7f6d0d,96ba07320b0d7f80f9e397ed8ce83ce4e449b74e..75b3bea92dc3139b21541e37eb736c3ca625171d
+++ b/cache.h
@@@ -105,9 -105,6 +105,9 @@@ struct cache_header 
        unsigned int hdr_entries;
  };
  
 +#define INDEX_FORMAT_LB 2
 +#define INDEX_FORMAT_UB 4
 +
  /*
   * The "cache_time" is just the low 32 bits of the
   * time. It doesn't matter if it overflows - we only
@@@ -118,6 -115,48 +118,6 @@@ struct cache_time 
        unsigned int nsec;
  };
  
 -/*
 - * dev/ino/uid/gid/size are also just tracked to the low 32 bits
 - * Again - this is just a (very strong in practice) heuristic that
 - * the inode hasn't changed.
 - *
 - * We save the fields in big-endian order to allow using the
 - * index file over NFS transparently.
 - */
 -struct ondisk_cache_entry {
 -      struct cache_time ctime;
 -      struct cache_time mtime;
 -      unsigned int dev;
 -      unsigned int ino;
 -      unsigned int mode;
 -      unsigned int uid;
 -      unsigned int gid;
 -      unsigned int size;
 -      unsigned char sha1[20];
 -      unsigned short flags;
 -      char name[FLEX_ARRAY]; /* more */
 -};
 -
 -/*
 - * This struct is used when CE_EXTENDED bit is 1
 - * The struct must match ondisk_cache_entry exactly from
 - * ctime till flags
 - */
 -struct ondisk_cache_entry_extended {
 -      struct cache_time ctime;
 -      struct cache_time mtime;
 -      unsigned int dev;
 -      unsigned int ino;
 -      unsigned int mode;
 -      unsigned int uid;
 -      unsigned int gid;
 -      unsigned int size;
 -      unsigned char sha1[20];
 -      unsigned short flags;
 -      unsigned short flags2;
 -      char name[FLEX_ARRAY]; /* more */
 -};
 -
  struct cache_entry {
        struct cache_time ce_ctime;
        struct cache_time ce_mtime;
@@@ -214,6 -253,9 +214,6 @@@ static inline size_t ce_namelen(const s
  }
  
  #define ce_size(ce) cache_entry_size(ce_namelen(ce))
 -#define ondisk_ce_size(ce) (((ce)->ce_flags & CE_EXTENDED) ? \
 -                          ondisk_cache_entry_extended_size(ce_namelen(ce)) : \
 -                          ondisk_cache_entry_size(ce_namelen(ce)))
  #define ce_stage(ce) ((CE_STAGEMASK & (ce)->ce_flags) >> CE_STAGESHIFT)
  #define ce_uptodate(ce) ((ce)->ce_flags & CE_UPTODATE)
  #define ce_skip_worktree(ce) ((ce)->ce_flags & CE_SKIP_WORKTREE)
@@@ -264,11 -306,13 +264,11 @@@ static inline unsigned int canon_mode(u
        return S_IFGITLINK;
  }
  
 -#define flexible_size(STRUCT,len) ((offsetof(struct STRUCT,name) + (len) + 8) & ~7)
  #define cache_entry_size(len) (offsetof(struct cache_entry,name) + (len) + 1)
 -#define ondisk_cache_entry_size(len) flexible_size(ondisk_cache_entry,len)
 -#define ondisk_cache_entry_extended_size(len) flexible_size(ondisk_cache_entry_extended,len)
  
  struct index_state {
        struct cache_entry **cache;
 +      unsigned int version;
        unsigned int cache_nr, cache_alloc, cache_changed;
        struct string_list *resolve_undo;
        struct cache_tree *cache_tree;
@@@ -409,11 -453,8 +409,11 @@@ extern const char *setup_git_directory(
  extern char *prefix_path(const char *prefix, int len, const char *path);
  extern const char *prefix_filename(const char *prefix, int len, const char *path);
  extern int check_filename(const char *prefix, const char *name);
 -extern void verify_filename(const char *prefix, const char *name);
 +extern void verify_filename(const char *prefix,
 +                          const char *name,
 +                          int diagnose_misspelt_rev);
  extern void verify_non_filename(const char *prefix, const char *name);
 +extern int path_inside_repo(const char *prefix, const char *path);
  
  #define INIT_DB_QUIET 0x0001
  
@@@ -583,7 -624,6 +583,7 @@@ enum rebase_setup_type 
  enum push_default_type {
        PUSH_DEFAULT_NOTHING = 0,
        PUSH_DEFAULT_MATCHING,
 +      PUSH_DEFAULT_SIMPLE,
        PUSH_DEFAULT_UPSTREAM,
        PUSH_DEFAULT_CURRENT,
        PUSH_DEFAULT_UNSPECIFIED
@@@ -880,8 -920,10 +880,8 @@@ enum date_mode 
  };
  
  const char *show_date(unsigned long time, int timezone, enum date_mode mode);
 -const char *show_date_relative(unsigned long time, int tz,
 -                             const struct timeval *now,
 -                             char *timebuf,
 -                             size_t timebuf_size);
 +void show_date_relative(unsigned long time, int tz, const struct timeval *now,
 +                      struct strbuf *timebuf);
  int parse_date(const char *date, char *buf, int bufsize);
  int parse_date_basic(const char *date, unsigned long *timestamp, int *offset);
  void datestamp(char *buf, int bufsize);
@@@ -890,19 -932,15 +890,19 @@@ unsigned long approxidate_careful(cons
  unsigned long approxidate_relative(const char *date, const struct timeval *now);
  enum date_mode parse_date_format(const char *format);
  
 -#define IDENT_WARN_ON_NO_NAME  1
 -#define IDENT_ERROR_ON_NO_NAME 2
 -#define IDENT_NO_DATE        4
 +#define IDENT_STRICT         1
 +#define IDENT_NO_DATE        2
 +#define IDENT_NO_NAME        4
  extern const char *git_author_info(int);
  extern const char *git_committer_info(int);
  extern const char *fmt_ident(const char *name, const char *email, const char *date_str, int);
  extern const char *fmt_name(const char *name, const char *email);
 +extern const char *ident_default_name(void);
 +extern const char *ident_default_email(void);
 +extern const char *ident_default_date(void);
  extern const char *git_editor(void);
  extern const char *git_pager(int stdout_is_tty);
 +extern int git_ident_config(const char *, const char *, void *);
  
  struct ident_split {
        const char *name_begin;
@@@ -1103,6 -1141,7 +1103,7 @@@ extern int update_server_info(int)
  #define CONFIG_NO_WRITE 4
  #define CONFIG_NOTHING_SET 5
  #define CONFIG_INVALID_PATTERN 6
+ #define CONFIG_GENERIC_ERROR 7
  
  typedef int (*config_fn_t)(const char *, const char *, void *);
  extern int git_default_config(const char *, const char *, void *);
@@@ -1146,6 -1185,9 +1147,6 @@@ struct config_include_data 
  #define CONFIG_INCLUDE_INIT { 0 }
  extern int git_config_include(const char *name, const char *value, void *data);
  
 -#define MAX_GITNAME (1000)
 -extern char git_default_email[MAX_GITNAME];
 -extern char git_default_name[MAX_GITNAME];
  #define IDENT_NAME_GIVEN 01
  #define IDENT_MAIL_GIVEN 02
  #define IDENT_ALL_GIVEN (IDENT_NAME_GIVEN|IDENT_MAIL_GIVEN)