Merge branch 'maint'
authorJunio C Hamano <gitster@pobox.com>
Fri, 20 Feb 2009 07:44:07 +0000 (23:44 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 20 Feb 2009 07:44:07 +0000 (23:44 -0800)
* maint:
More friendly message when locking the index fails.
Document git blame --reverse.
Documentation: Note file formats send-email accepts

1  2 
Documentation/git-blame.txt
builtin-update-index.c
cache.h
lockfile.c
index 6999cf2a65723af963e087f57bf4f8bbd1a9350e,cc934e55c38902e1bac0964e134640c910b9de96..4ef54d660280c921913a61afe117968d51960ec3
@@@ -10,7 -10,7 +10,7 @@@ SYNOPSI
  [verse]
  'git blame' [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-p] [-w] [--incremental] [-L n,m]
              [-S <revs-file>] [-M] [-C] [-C] [--since=<date>]
-             [<rev> | --contents <file>] [--] <file>
+           [<rev> | --contents <file> | --reverse <rev>] [--] <file>
  
  DESCRIPTION
  -----------
@@@ -184,12 -184,6 +184,12 @@@ there is ever added information (like t
  commit commentary), a blame viewer won't ever care.
  
  
 +MAPPING AUTHORS
 +---------------
 +
 +include::mailmap.txt[]
 +
 +
  SEE ALSO
  --------
  linkgit:git-annotate[1]
diff --combined builtin-update-index.c
index 560497750586ec61be4e34de6dedd9c307129817,daca0f775e4b49f2576a7c444895146d05b7022c..dd43d5bef425af318a884bfc235a4aff40931633
@@@ -486,7 -486,7 +486,7 @@@ static int unresolve_one(const char *pa
  static void read_head_pointers(void)
  {
        if (read_ref("HEAD", head_sha1))
 -              die("No HEAD -- no initial commit yet?\n");
 +              die("No HEAD -- no initial commit yet?");
        if (read_ref("MERGE_HEAD", merge_head_sha1)) {
                fprintf(stderr, "Not in the middle of a merge.\n");
                exit(0);
@@@ -742,8 -742,7 +742,7 @@@ int cmd_update_index(int argc, const ch
                if (newfd < 0) {
                        if (refresh_flags & REFRESH_QUIET)
                                exit(128);
-                       die("unable to create '%s.lock': %s",
-                           get_index_file(), strerror(lock_error));
+                       unable_to_lock_index_die(get_index_file(), lock_error);
                }
                if (write_cache(newfd, active_cache, active_nr) ||
                    commit_locked_index(lock_file))
diff --combined cache.h
index 21bbf9b119cccd6e91722dc101d4de85f0014c9d,0e2f219b2b4d9ff5944e68dbaf2338c76055161f..21a63103d5d98e8dca520e923f73586f8544d3b4
+++ b/cache.h
@@@ -484,6 -484,7 +484,7 @@@ struct lock_file 
  };
  #define LOCK_DIE_ON_ERROR 1
  #define LOCK_NODEREF 2
+ extern NORETURN void unable_to_lock_index_die(const char *path, int err);
  extern int hold_lock_file_for_update(struct lock_file *, const char *path, int);
  extern int hold_lock_file_for_append(struct lock_file *, const char *path, int);
  extern int commit_lock_file(struct lock_file *);
@@@ -624,9 -625,8 +625,9 @@@ int is_directory(const char *)
  const char *make_absolute_path(const char *path);
  const char *make_nonrelative_path(const char *path);
  const char *make_relative_path(const char *abs, const char *base);
 -int normalize_absolute_path(char *buf, const char *path);
 +int normalize_path_copy(char *dst, const char *src);
  int longest_ancestor_length(const char *path, const char *prefix_list);
 +char *strip_path_suffix(const char *path, const char *suffix);
  
  /* Read and unpack a sha1 file into memory, write memory to a sha1 file */
  extern int sha1_object_info(const unsigned char *, unsigned long *);
@@@ -636,6 -636,9 +637,6 @@@ extern int write_sha1_file(void *buf, u
  extern int pretend_sha1_file(void *, unsigned long, enum object_type, unsigned char *);
  extern int force_object_loose(const unsigned char *sha1, time_t mtime);
  
 -/* just like read_sha1_file(), but non fatal in presence of bad objects */
 -extern void *read_object(const unsigned char *sha1, enum object_type *type, unsigned long *size);
 -
  /* global flag to enable extra checks when accessing packed objects */
  extern int do_check_packed_object_crc;
  
@@@ -668,7 -671,6 +669,7 @@@ extern int read_ref(const char *filenam
  extern const char *resolve_ref(const char *path, unsigned char *sha1, int, int *);
  extern int dwim_ref(const char *str, int len, unsigned char *sha1, char **ref);
  extern int dwim_log(const char *str, int len, unsigned char *sha1, char **ref);
 +extern int interpret_nth_last_branch(const char *str, struct strbuf *);
  
  extern int refname_match(const char *abbrev_name, const char *full_name, const char **rules);
  extern const char *ref_rev_parse_rules[];
@@@ -723,10 -725,6 +724,10 @@@ struct checkout 
  
  extern int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *topath);
  extern int has_symlink_leading_path(int len, const char *name);
 +extern int has_symlink_or_noent_leading_path(int len, const char *name);
 +extern int has_dirs_only_path(int len, const char *name, int prefix_len);
 +extern void invalidate_lstat_cache(int len, const char *name);
 +extern void clear_lstat_cache(void);
  
  extern struct alternate_object_database {
        struct alternate_object_database *next;
@@@ -869,7 -867,6 +870,7 @@@ extern int user_ident_explicitly_given
  
  extern const char *git_commit_encoding;
  extern const char *git_log_output_encoding;
 +extern const char *git_mailmap_file;
  
  /* IO helper functions */
  extern void maybe_flush_or_die(FILE *, const char *);
@@@ -945,6 -942,7 +946,6 @@@ extern int ws_fix_copy(char *, const ch
  extern int ws_blank_line(const char *line, int len, unsigned ws_rule);
  
  /* ls-files */
 -int pathspec_match(const char **spec, char *matched, const char *filename, int skiplen);
  int report_path_error(const char *ps_matched, const char **pathspec, int prefix_offset);
  void overlay_tree_on_cache(const char *tree_name, const char *prefix);
  
diff --combined lockfile.c
index 021c3375c10711027269ee58bb9a201bc69c519a,8e556ff8c9671864db44dc8b6f4a861bd35142a6..1db1a2fefcf40c4f6e613b7a8f750ab9c22adbc3
@@@ -2,7 -2,6 +2,7 @@@
   * Copyright (c) 2005, Junio C Hamano
   */
  #include "cache.h"
 +#include "sigchain.h"
  
  static struct lock_file *lock_file_list;
  static const char *alternate_index_output;
@@@ -25,7 -24,7 +25,7 @@@ static void remove_lock_file(void
  static void remove_lock_file_on_signal(int signo)
  {
        remove_lock_file();
 -      signal(signo, SIG_DFL);
 +      sigchain_pop(signo);
        raise(signo);
  }
  
@@@ -137,7 -136,11 +137,7 @@@ static int lock_file(struct lock_file *
        lk->fd = open(lk->filename, O_RDWR | O_CREAT | O_EXCL, 0666);
        if (0 <= lk->fd) {
                if (!lock_file_list) {
 -                      signal(SIGINT, remove_lock_file_on_signal);
 -                      signal(SIGHUP, remove_lock_file_on_signal);
 -                      signal(SIGTERM, remove_lock_file_on_signal);
 -                      signal(SIGQUIT, remove_lock_file_on_signal);
 -                      signal(SIGPIPE, remove_lock_file_on_signal);
 +                      sigchain_push_common(remove_lock_file_on_signal);
                        atexit(remove_lock_file);
                }
                lk->owner = getpid();
        return lk->fd;
  }
  
+ NORETURN void unable_to_lock_index_die(const char *path, int err)
+ {
+       if (errno == EEXIST) {
+               die("Unable to create '%s.lock': %s.\n\n"
+                   "If no other git process is currently running, this probably means a\n"
+                   "git process crashed in this repository earlier. Make sure no other git\n"
+                   "process is running and remove the file manually to continue.",
+                   path, strerror(err));
+       } else {
+               die("Unable to create '%s.lock': %s", path, strerror(err));
+       }
+ }
  int hold_lock_file_for_update(struct lock_file *lk, const char *path, int flags)
  {
        int fd = lock_file(lk, path, flags);
        if (fd < 0 && (flags & LOCK_DIE_ON_ERROR))
-               die("unable to create '%s.lock': %s", path, strerror(errno));
+               unable_to_lock_index_die(path, errno);
        return fd;
  }