Merge branch 'ls/editor-waiting-message'
authorJunio C Hamano <gitster@pobox.com>
Tue, 19 Dec 2017 19:33:59 +0000 (11:33 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 19 Dec 2017 19:33:59 +0000 (11:33 -0800)
Git shows a message to tell the user that it is waiting for the
user to finish editing when spawning an editor, in case the editor
opens to a hidden window or somewhere obscure and the user gets
lost.

* ls/editor-waiting-message:
launch_editor(): indicate that Git waits for user input
refactor "dumb" terminal determination

1  2 
Documentation/config.txt
advice.c
advice.h
cache.h
diff --combined Documentation/config.txt
index 9fac2f2b88c4b26a771b698b40483f3472600c96,6ebc50eea8a63e5feac9e84b48ee98f0f1f460a5..b18c0f97fec8dda4ba90a245f8e827b57a585cf4
@@@ -351,9 -351,9 +351,12 @@@ advice.*:
        addEmbeddedRepo::
                Advice on what to do when you've accidentally added one
                git repo inside of another.
 +      ignoredHook::
 +              Advice shown if an hook is ignored because the hook is not
 +              set as executable.
+       waitingForEditor::
+               Print a message to the terminal whenever Git is waiting for
+               editor input from the user.
  --
  
  core.fileMode::
@@@ -416,13 -416,6 +419,13 @@@ core.protectNTFS:
        8.3 "short" names.
        Defaults to `true` on Windows, and `false` elsewhere.
  
 +core.fsmonitor::
 +      If set, the value of this variable is used as a command which
 +      will identify all files that may have changed since the
 +      requested date/time. This information is used to speed up git by
 +      avoiding unnecessary processing of files that have not changed.
 +      See the "fsmonitor-watchman" section of linkgit:githooks[5].
 +
  core.trustctime::
        If false, the ctime differences between the index and the
        working tree are ignored; useful when the inode change time
@@@ -2108,40 -2101,15 +2111,40 @@@ matched against are those given directl
  visited as a result of a redirection do not participate in matching.
  
  ssh.variant::
 -      Depending on the value of the environment variables `GIT_SSH` or
 -      `GIT_SSH_COMMAND`, or the config setting `core.sshCommand`, Git
 -      auto-detects whether to adjust its command-line parameters for use
 -      with plink or tortoiseplink, as opposed to the default (OpenSSH).
 +      By default, Git determines the command line arguments to use
 +      based on the basename of the configured SSH command (configured
 +      using the environment variable `GIT_SSH` or `GIT_SSH_COMMAND` or
 +      the config setting `core.sshCommand`). If the basename is
 +      unrecognized, Git will attempt to detect support of OpenSSH
 +      options by first invoking the configured SSH command with the
 +      `-G` (print configuration) option and will subsequently use
 +      OpenSSH options (if that is successful) or no options besides
 +      the host and remote command (if it fails).
 ++
 +The config variable `ssh.variant` can be set to override this detection.
 +Valid values are `ssh` (to use OpenSSH options), `plink`, `putty`,
 +`tortoiseplink`, `simple` (no options except the host and remote command).
 +The default auto-detection can be explicitly requested using the value
 +`auto`.  Any other value is treated as `ssh`.  This setting can also be
 +overridden via the environment variable `GIT_SSH_VARIANT`.
 ++
 +The current command-line parameters used for each variant are as
 +follows:
 ++
 +--
 +
 +* `ssh` - [-p port] [-4] [-6] [-o option] [username@]host command
 +
 +* `simple` - [username@]host command
 +
 +* `plink` or `putty` - [-P port] [-4] [-6] [username@]host command
 +
 +* `tortoiseplink` - [-P port] [-4] [-6] -batch [username@]host command
 +
 +--
  +
 -The config variable `ssh.variant` can be set to override this auto-detection;
 -valid values are `ssh`, `plink`, `putty` or `tortoiseplink`. Any other value
 -will be treated as normal ssh. This setting can be overridden via the
 -environment variable `GIT_SSH_VARIANT`.
 +Except for the `simple` variant, command-line parameters are likely to
 +change as git gains new features.
  
  i18n.commitEncoding::
        Character encoding the commit messages are stored in; Git itself
@@@ -2569,23 -2537,6 +2572,23 @@@ The protocol names currently used by gi
      `hg` to allow the `git-remote-hg` helper)
  --
  
 +protocol.version::
 +      Experimental. If set, clients will attempt to communicate with a
 +      server using the specified protocol version.  If unset, no
 +      attempt will be made by the client to communicate using a
 +      particular protocol version, this results in protocol version 0
 +      being used.
 +      Supported versions:
 ++
 +--
 +
 +* `0` - the original wire protocol.
 +
 +* `1` - the original wire protocol with the addition of a version string
 +  in the initial response from the server.
 +
 +--
 +
  pull.ff::
        By default, Git does not create an extra merge commit when merging
        a commit that is a descendant of the current commit. Instead, the
@@@ -2690,35 -2641,6 +2693,35 @@@ push.gpgSign:
        override a value from a lower-priority config file. An explicit
        command-line flag always overrides this config option.
  
 +push.pushOption::
 +      When no `--push-option=<option>` argument is given from the
 +      command line, `git push` behaves as if each <value> of
 +      this variable is given as `--push-option=<value>`.
 ++
 +This is a multi-valued variable, and an empty value can be used in a
 +higher priority configuration file (e.g. `.git/config` in a
 +repository) to clear the values inherited from a lower priority
 +configuration files (e.g. `$HOME/.gitconfig`).
 ++
 +--
 +
 +Example:
 +
 +/etc/gitconfig
 +  push.pushoption = a
 +  push.pushoption = b
 +
 +~/.gitconfig
 +  push.pushoption = c
 +
 +repo/.git/config
 +  push.pushoption =
 +  push.pushoption = b
 +
 +This will result in only b (a and c are cleared).
 +
 +--
 +
  push.recurseSubmodules::
        Make sure all submodule commits used by the revisions to be pushed
        are available on a remote-tracking branch. If the value is 'check'
@@@ -3049,7 -2971,6 +3052,7 @@@ sendemail.smtpPass:
  sendemail.suppresscc::
  sendemail.suppressFrom::
  sendemail.to::
 +sendemail.tocmd::
  sendemail.smtpDomain::
  sendemail.smtpServer::
  sendemail.smtpServerPort::
@@@ -3468,13 -3389,3 +3471,13 @@@ web.browser:
        Specify a web browser that may be used by some commands.
        Currently only linkgit:git-instaweb[1] and linkgit:git-help[1]
        may use it.
 +
 +worktree.guessRemote::
 +      With `add`, if no branch argument, and neither of `-b` nor
 +      `-B` nor `--detach` are given, the command defaults to
 +      creating a new branch from HEAD.  If `worktree.guessRemote` is
 +      set to true, `worktree add` tries to find a remote-tracking
 +      branch whose name uniquely matches the new branch name.  If
 +      such a branch exists, it is checked out and set as "upstream"
 +      for the new branch.  If no such match can be found, it falls
 +      back to creating a new branch from the current HEAD.
diff --combined advice.c
index c6169bcb52fa935969ee938967adb337b06961c7,af29d23e43173ce8af60bffa6ebb32a73754fa36..406efc183ba272b94a39d4cc7e97d7483a40a9d4
+++ b/advice.c
@@@ -17,7 -17,7 +17,8 @@@ int advice_set_upstream_failure = 1
  int advice_object_name_warning = 1;
  int advice_rm_hints = 1;
  int advice_add_embedded_repo = 1;
 +int advice_ignored_hook = 1;
+ int advice_waiting_for_editor = 1;
  
  static struct {
        const char *name;
@@@ -39,7 -39,7 +40,8 @@@
        { "objectnamewarning", &advice_object_name_warning },
        { "rmhints", &advice_rm_hints },
        { "addembeddedrepo", &advice_add_embedded_repo },
 +      { "ignoredhook", &advice_ignored_hook },
+       { "waitingforeditor", &advice_waiting_for_editor },
  
        /* make this an alias for backward compatibility */
        { "pushnonfastforward", &advice_push_update_rejected }
diff --combined advice.h
index f525d6f89cb44dc39188dd06472cf8a59b56f411,f7cbbd342fc9d41b34a48a23b1b6c67247bf3351..70568fa7922d8aea403e415f9b9b554a88ace293
+++ b/advice.h
@@@ -19,7 -19,7 +19,8 @@@ extern int advice_set_upstream_failure
  extern int advice_object_name_warning;
  extern int advice_rm_hints;
  extern int advice_add_embedded_repo;
 +extern int advice_ignored_hook;
+ extern int advice_waiting_for_editor;
  
  int git_default_advice_config(const char *var, const char *value);
  __attribute__((format (printf, 1, 2)))
diff --combined cache.h
index 3d00d03d92bc205fea39bb147b51c69f35faa307,02174627ea889f6b550f2d4155bb2de33a321e4a..a2ec8c0b55422f2b95a30d140cb2bfdf15f0721d
+++ b/cache.h
@@@ -14,7 -14,6 +14,7 @@@
  #include "hash.h"
  #include "path.h"
  #include "sha1-array.h"
 +#include "repository.h"
  
  #ifndef platform_SHA_CTX
  /*
@@@ -78,8 -77,6 +78,8 @@@ struct object_id 
        unsigned char hash[GIT_MAX_RAWSZ];
  };
  
 +#define the_hash_algo the_repository->hash_algo
 +
  #if defined(DT_UNKNOWN) && !defined(NO_D_TYPE_IN_DIRENT)
  #define DTYPE(de)     ((de)->d_type)
  #else
@@@ -207,7 -204,6 +207,7 @@@ struct cache_entry 
  #define CE_ADDED             (1 << 19)
  
  #define CE_HASHED            (1 << 20)
 +#define CE_FSMONITOR_VALID   (1 << 21)
  #define CE_WT_REMOVE         (1 << 22) /* remove in work directory */
  #define CE_CONFLICTED        (1 << 23)
  
@@@ -331,7 -327,6 +331,7 @@@ static inline unsigned int canon_mode(u
  #define CACHE_TREE_CHANGED    (1 << 5)
  #define SPLIT_INDEX_ORDERED   (1 << 6)
  #define UNTRACKED_CHANGED     (1 << 7)
 +#define FSMONITOR_CHANGED     (1 << 8)
  
  struct split_index;
  struct untracked_cache;
@@@ -350,8 -345,6 +350,8 @@@ struct index_state 
        struct hashmap dir_hash;
        unsigned char sha1[20];
        struct untracked_cache *untracked;
 +      uint64_t fsmonitor_last_update;
 +      struct ewah_bitmap *fsmonitor_dirty;
  };
  
  extern struct index_state the_index;
@@@ -453,16 -446,6 +453,16 @@@ static inline enum object_type object_t
  #define GIT_QUARANTINE_ENVIRONMENT "GIT_QUARANTINE_PATH"
  #define GIT_OPTIONAL_LOCKS_ENVIRONMENT "GIT_OPTIONAL_LOCKS"
  
 +/*
 + * Environment variable used in handshaking the wire protocol.
 + * Contains a colon ':' separated list of keys with optional values
 + * 'key[=value]'.  Presence of unknown keys and values must be
 + * ignored.
 + */
 +#define GIT_PROTOCOL_ENVIRONMENT "GIT_PROTOCOL"
 +/* HTTP header used to handshake the wire protocol */
 +#define GIT_PROTOCOL_HEADER "Git-Protocol"
 +
  /*
   * This environment variable is expected to contain a boolean indicating
   * whether we should or should not treat:
@@@ -619,28 -602,9 +619,28 @@@ extern int do_read_index(struct index_s
  extern int read_index_from(struct index_state *, const char *path);
  extern int is_index_unborn(struct index_state *);
  extern int read_index_unmerged(struct index_state *);
 +
 +/* For use with `write_locked_index()`. */
  #define COMMIT_LOCK           (1 << 0)
 -#define CLOSE_LOCK            (1 << 1)
 +
 +/*
 + * Write the index while holding an already-taken lock. Close the lock,
 + * and if `COMMIT_LOCK` is given, commit it.
 + *
 + * Unless a split index is in use, write the index into the lockfile.
 + *
 + * With a split index, write the shared index to a temporary file,
 + * adjust its permissions and rename it into place, then write the
 + * split index to the lockfile. If the temporary file for the shared
 + * index cannot be created, fall back to the behavior described in
 + * the previous paragraph.
 + *
 + * With `COMMIT_LOCK`, the lock is always committed or rolled back.
 + * Without it, the lock is closed, but neither committed nor rolled
 + * back.
 + */
  extern int write_locked_index(struct index_state *, struct lock_file *lock, unsigned flags);
 +
  extern int discard_index(struct index_state *);
  extern void move_index_extensions(struct index_state *dst, struct index_state *src);
  extern int unmerged_index(const struct index_state *);
@@@ -717,14 -681,11 +717,14 @@@ extern void *read_blob_data_from_index(
  #define CE_MATCH_IGNORE_MISSING               0x08
  /* enable stat refresh */
  #define CE_MATCH_REFRESH              0x10
 -extern int ie_match_stat(const struct index_state *, const struct cache_entry *, struct stat *, unsigned int);
 -extern int ie_modified(const struct index_state *, const struct cache_entry *, struct stat *, unsigned int);
 +/* don't refresh_fsmonitor state or do stat comparison even if CE_FSMONITOR_VALID is true */
 +#define CE_MATCH_IGNORE_FSMONITOR 0X20
 +extern int ie_match_stat(struct index_state *, const struct cache_entry *, struct stat *, unsigned int);
 +extern int ie_modified(struct index_state *, const struct cache_entry *, struct stat *, unsigned int);
  
  #define HASH_WRITE_OBJECT 1
  #define HASH_FORMAT_CHECK 2
 +#define HASH_RENORMALIZE  4
  extern int index_fd(struct object_id *oid, int fd, struct stat *st, enum object_type type, const char *path, unsigned flags);
  extern int index_path(struct object_id *oid, const char *path, struct stat *st, unsigned flags);
  
@@@ -755,17 -716,12 +755,17 @@@ extern void fill_stat_cache_info(struc
  extern int refresh_index(struct index_state *, unsigned int flags, const struct pathspec *pathspec, char *seen, const char *header_msg);
  extern struct cache_entry *refresh_cache_entry(struct cache_entry *, unsigned int);
  
 +/*
 + * Opportunistically update the index but do not complain if we can't.
 + * The lockfile is always committed or rolled back.
 + */
  extern void update_index_if_able(struct index_state *, struct lock_file *);
  
  extern int hold_locked_index(struct lock_file *, int);
  extern void set_alternate_index_output(const char *);
  
  extern int verify_index_checksum;
 +extern int verify_ce_order;
  
  /* Environment bits from configuration mechanism */
  extern int trust_executable_bit;
@@@ -819,7 -775,6 +819,7 @@@ extern int core_apply_sparse_checkout
  extern int precomposed_unicode;
  extern int protect_hfs;
  extern int protect_ntfs;
 +extern const char *core_fsmonitor;
  
  /*
   * Include broken refs in all ref iterations, which will
@@@ -910,7 -865,6 +910,7 @@@ struct repository_format 
        int version;
        int precious_objects;
        int is_bare;
 +      int hash_algo;
        char *work_tree;
        struct string_list unknown_extensions;
  };
@@@ -1043,22 -997,22 +1043,22 @@@ extern const struct object_id empty_blo
  
  static inline int is_empty_blob_sha1(const unsigned char *sha1)
  {
 -      return !hashcmp(sha1, EMPTY_BLOB_SHA1_BIN);
 +      return !hashcmp(sha1, the_hash_algo->empty_blob->hash);
  }
  
  static inline int is_empty_blob_oid(const struct object_id *oid)
  {
 -      return !hashcmp(oid->hash, EMPTY_BLOB_SHA1_BIN);
 +      return !oidcmp(oid, the_hash_algo->empty_blob);
  }
  
  static inline int is_empty_tree_sha1(const unsigned char *sha1)
  {
 -      return !hashcmp(sha1, EMPTY_TREE_SHA1_BIN);
 +      return !hashcmp(sha1, the_hash_algo->empty_tree->hash);
  }
  
  static inline int is_empty_tree_oid(const struct object_id *oid)
  {
 -      return !hashcmp(oid->hash, EMPTY_TREE_SHA1_BIN);
 +      return !oidcmp(oid, the_hash_algo->empty_tree);
  }
  
  /* set default permissions by passing mode arguments to open(2) */
@@@ -1363,13 -1317,6 +1363,13 @@@ extern int set_disambiguate_hint_config
  extern int get_sha1_hex(const char *hex, unsigned char *sha1);
  extern int get_oid_hex(const char *hex, struct object_id *sha1);
  
 +/*
 + * Read `len` pairs of hexadecimal digits from `hex` and write the
 + * values to `binary` as `len` bytes. Return 0 on success, or -1 if
 + * the input does not consist of hex digits).
 + */
 +extern int hex_to_bytes(unsigned char *binary, const char *hex, size_t len);
 +
  /*
   * Convert a binary sha1 to its hex equivalent. The `_r` variant is reentrant,
   * and writes the NUL-terminated output to the buffer `out`, which must be at
@@@ -1491,6 -1438,7 +1491,7 @@@ extern const char *ident_default_name(v
  extern const char *ident_default_email(void);
  extern const char *git_editor(void);
  extern const char *git_pager(int stdout_is_tty);
+ extern int is_terminal_dumb(void);
  extern int git_ident_config(const char *, const char *, void *);
  extern void reset_ident_date(void);
  
@@@ -1972,10 -1920,4 +1973,10 @@@ void sleep_millisec(int millisec)
   */
  void safe_create_dir(const char *dir, int share);
  
 +/*
 + * Should we print an ellipsis after an abbreviated SHA-1 value
 + * when doing diff-raw output or indicating a detached HEAD?
 + */
 +extern int print_sha1_ellipsis(void);
 +
  #endif /* CACHE_H */