Merge branch 'ks/verify-filename-non-option-error-message-tweak'
authorJunio C Hamano <gitster@pobox.com>
Sat, 7 Oct 2017 07:27:55 +0000 (16:27 +0900)
committerJunio C Hamano <gitster@pobox.com>
Sat, 7 Oct 2017 07:27:56 +0000 (16:27 +0900)
Error message tweak.

* ks/verify-filename-non-option-error-message-tweak:
setup: update error message to be more meaningful

1  2 
setup.c
diff --combined setup.c
index d777ff34b7daf50fb24a8653a7e26e3e95b8c0c7,09c79328247dd8b61a8ffe0dff18e429071500f5..03f51e056cd6e672ecd80ba94348173b9d496cc0
+++ b/setup.c
@@@ -230,7 -230,7 +230,7 @@@ void verify_filename(const char *prefix
                     int diagnose_misspelt_rev)
  {
        if (*arg == '-')
-               die("bad flag '%s' used after filename", arg);
+               die("option '%s' must come before non-option arguments", arg);
        if (looks_like_pathspec(arg) || check_filename(prefix, arg))
                return;
        die_verify_filename(prefix, arg, diagnose_misspelt_rev);
@@@ -399,6 -399,11 +399,6 @@@ void setup_work_tree(void
        if (getenv(GIT_WORK_TREE_ENVIRONMENT))
                setenv(GIT_WORK_TREE_ENVIRONMENT, ".", 1);
  
 -      /*
 -       * NEEDSWORK: this call can essentially be set_git_dir(get_git_dir())
 -       * which can cause some problems when trying to free the old value of
 -       * gitdir.
 -       */
        set_git_dir(remove_leading_path(git_dir, work_tree));
        initialized = 1;
  }
@@@ -541,8 -546,7 +541,8 @@@ void read_gitfile_error_die(int error_c
  
  /*
   * Try to read the location of the git directory from the .git file,
 - * return path to git directory if found.
 + * return path to git directory if found. The return value comes from
 + * a shared buffer.
   *
   * On failure, if return_error_code is not NULL, return_error_code
   * will be set to an error code and NULL will be returned. If
@@@ -1023,7 -1027,7 +1023,7 @@@ const char *setup_git_directory_gently(
  {
        static struct strbuf cwd = STRBUF_INIT;
        struct strbuf dir = STRBUF_INIT, gitdir = STRBUF_INIT;
 -      const char *prefix, *env_prefix;
 +      const char *prefix;
  
        /*
         * We may have read an incomplete configuration before
                die("BUG: unhandled setup_git_directory_1() result");
        }
  
 -      /*
 -       * NEEDSWORK: This was a hack in order to get ls-files and grep to have
 -       * properly formated output when recursing submodules.  Once ls-files
 -       * and grep have been changed to perform this recursing in-process this
 -       * needs to be removed.
 -       */
 -      env_prefix = getenv(GIT_TOPLEVEL_PREFIX_ENVIRONMENT);
 -      if (env_prefix)
 -              prefix = env_prefix;
 -
        if (prefix)
                setenv(GIT_PREFIX_ENVIRONMENT, prefix, 1);
        else