Merge branch 'gh/diff-raw-has-no-ellipses'
authorJunio C Hamano <gitster@pobox.com>
Sat, 1 Dec 2018 12:41:45 +0000 (21:41 +0900)
committerJunio C Hamano <gitster@pobox.com>
Sat, 1 Dec 2018 12:41:45 +0000 (21:41 +0900)
"git diff --raw" lost ellipses to adjust the output columns for
some time now, but the documentation still showed them.

* gh/diff-raw-has-no-ellipses:
doc: update diff-format.txt for removed ellipses in --raw

28 files changed:
Documentation/git-format-patch.txt
Documentation/git-reset.txt
builtin/log.c
builtin/push.c
builtin/rebase.c
builtin/replace.c
compat/msvc.h
git-legacy-rebase.sh
http.c
log-tree.c
midx.c
range-diff.c
range-diff.h
refs/files-backend.c
t/lib-git-daemon.sh
t/perf/perf-lib.sh
t/t0001-init.sh
t/t3406-rebase-message.sh
t/t4013-diff-various.sh
t/t5516-fetch-push.sh
t/t5562-http-backend-content-length.sh
t/t5562/invoke-with-content-length.pl [changed mode: 0755->0644]
t/t5601-clone.sh
t/t6050-replace.sh
t/t9902-completion.sh
t/test-lib-functions.sh
t/test-lib.sh
transport-helper.c
index aba4c5febeb7ef4248d50a638d0a8bd58f7d553b..27304428a12ce9d0ee46e10e3c63069b4677838a 100644 (file)
@@ -250,6 +250,11 @@ feeding the result to `git send-email`.
        feature/v2`), or a revision range if the two versions of the series are
        disjoint (for example `git format-patch --cover-letter
        --range-diff=feature/v1~3..feature/v1 -3 feature/v2`).
++
+Note that diff options passed to the command affect how the primary
+product of `format-patch` is generated, and they are not passed to
+the underlying `range-diff` machinery used to generate the cover-letter
+material (this may change in the future).
 
 --creation-factor=<percent>::
        Used with `--range-diff`, tweak the heuristic which matches up commits
index 2dac95c71a510b2cead5f39fd0dc5f03816ae5c4..9f69ae8b693a15184f26f65a44e552fb31a0bd32 100644 (file)
@@ -14,14 +14,14 @@ SYNOPSIS
 
 DESCRIPTION
 -----------
-In the first and second form, copy entries from <tree-ish> to the index.
-In the third form, set the current branch head (HEAD) to <commit>, optionally
-modifying index and working tree to match.  The <tree-ish>/<commit> defaults
-to HEAD in all forms.
+In the first and second form, copy entries from `<tree-ish>` to the index.
+In the third form, set the current branch head (`HEAD`) to `<commit>`,
+optionally modifying index and working tree to match.
+The `<tree-ish>`/`<commit>` defaults to `HEAD` in all forms.
 
 'git reset' [-q] [<tree-ish>] [--] <paths>...::
-       This form resets the index entries for all <paths> to their
-       state at <tree-ish>.  (It does not affect the working tree or
+       This form resets the index entries for all `<paths>` to their
+       state at `<tree-ish>`.  (It does not affect the working tree or
        the current branch.)
 +
 This means that `git reset <paths>` is the opposite of `git add
@@ -36,7 +36,7 @@ working tree in one go.
 
 'git reset' (--patch | -p) [<tree-ish>] [--] [<paths>...]::
        Interactively select hunks in the difference between the index
-       and <tree-ish> (defaults to HEAD).  The chosen hunks are applied
+       and `<tree-ish>` (defaults to `HEAD`).  The chosen hunks are applied
        in reverse to the index.
 +
 This means that `git reset -p` is the opposite of `git add -p`, i.e.
@@ -44,16 +44,16 @@ you can use it to selectively reset hunks. See the ``Interactive Mode''
 section of linkgit:git-add[1] to learn how to operate the `--patch` mode.
 
 'git reset' [<mode>] [<commit>]::
-       This form resets the current branch head to <commit> and
-       possibly updates the index (resetting it to the tree of <commit>) and
-       the working tree depending on <mode>. If <mode> is omitted,
-       defaults to "--mixed". The <mode> must be one of the following:
+       This form resets the current branch head to `<commit>` and
+       possibly updates the index (resetting it to the tree of `<commit>`) and
+       the working tree depending on `<mode>`. If `<mode>` is omitted,
+       defaults to `--mixed`. The `<mode>` must be one of the following:
 +
 --
 --soft::
        Does not touch the index file or the working tree at all (but
-       resets the head to <commit>, just like all modes do). This leaves
-       all your changed files "Changes to be committed", as 'git status'
+       resets the head to `<commit>`, just like all modes do). This leaves
+       all your changed files "Changes to be committed", as `git status`
        would put it.
 
 --mixed::
@@ -66,24 +66,24 @@ linkgit:git-add[1]).
 
 --hard::
        Resets the index and working tree. Any changes to tracked files in the
-       working tree since <commit> are discarded.
+       working tree since `<commit>` are discarded.
 
 --merge::
        Resets the index and updates the files in the working tree that are
-       different between <commit> and HEAD, but keeps those which are
+       different between `<commit>` and `HEAD`, but keeps those which are
        different between the index and working tree (i.e. which have changes
        which have not been added).
-       If a file that is different between <commit> and the index has unstaged
-       changes, reset is aborted.
+       If a file that is different between `<commit>` and the index has
+       unstaged changes, reset is aborted.
 +
-In other words, --merge does something like a 'git read-tree -u -m <commit>',
+In other words, `--merge` does something like a `git read-tree -u -m <commit>`,
 but carries forward unmerged index entries.
 
 --keep::
        Resets index entries and updates files in the working tree that are
-       different between <commit> and HEAD.
-       If a file that is different between <commit> and HEAD has local changes,
-       reset is aborted.
+       different between `<commit>` and `HEAD`.
+       If a file that is different between `<commit>` and `HEAD` has local
+       changes, reset is aborted.
 --
 
 If you want to undo a commit other than the latest on a branch,
@@ -116,15 +116,15 @@ $ git pull git://info.example.com/ nitfol  <4>
 +
 <1> You are happily working on something, and find the changes
 in these files are in good order.  You do not want to see them
-when you run "git diff", because you plan to work on other files
+when you run `git diff`, because you plan to work on other files
 and changes with these files are distracting.
 <2> Somebody asks you to pull, and the changes sound worthy of merging.
 <3> However, you already dirtied the index (i.e. your index does
-not match the HEAD commit).  But you know the pull you are going
-to make does not affect frotz.c or filfre.c, so you revert the
+not match the `HEAD` commit).  But you know the pull you are going
+to make does not affect `frotz.c` or `filfre.c`, so you revert the
 index changes for these two files.  Your changes in working tree
 remain there.
-<4> Then you can pull and merge, leaving frotz.c and filfre.c
+<4> Then you can pull and merge, leaving `frotz.c` and `filfre.c`
 changes still in the working tree.
 
 Undo a commit and redo::
@@ -140,11 +140,11 @@ $ git commit -a -c ORIG_HEAD  <3>
 just committed is incomplete, or you misspelled your commit
 message, or both.  Leaves working tree as it was before "reset".
 <2> Make corrections to working tree files.
-<3> "reset" copies the old head to .git/ORIG_HEAD; redo the
+<3> "reset" copies the old head to `.git/ORIG_HEAD`; redo the
 commit by starting with its log message.  If you do not need to
-edit the message further, you can give -C option instead.
+edit the message further, you can give `-C` option instead.
 +
-See also the --amend option to linkgit:git-commit[1].
+See also the `--amend` option to linkgit:git-commit[1].
 
 Undo a commit, making it a topic branch::
 +
@@ -155,11 +155,11 @@ $ git checkout topic/wip   <3>
 ------------
 +
 <1> You have made some commits, but realize they were premature
-to be in the "master" branch.  You want to continue polishing
-them in a topic branch, so create "topic/wip" branch off of the
-current HEAD.
+to be in the `master` branch.  You want to continue polishing
+them in a topic branch, so create `topic/wip` branch off of the
+current `HEAD`.
 <2> Rewind the master branch to get rid of those three commits.
-<3> Switch to "topic/wip" branch and keep working.
+<3> Switch to `topic/wip` branch and keep working.
 
 Undo commits permanently::
 +
@@ -168,7 +168,7 @@ $ git commit ...
 $ git reset --hard HEAD~3   <1>
 ------------
 +
-<1> The last three commits (HEAD, HEAD^, and HEAD~2) were bad
+<1> The last three commits (`HEAD`, `HEAD^`, and `HEAD~2`) were bad
 and you do not want to ever see them again.  Do *not* do this if
 you have already given these commits to somebody else.  (See the
 "RECOVERING FROM UPSTREAM REBASE" section in linkgit:git-rebase[1] for
@@ -191,14 +191,14 @@ $ git reset --hard ORIG_HEAD       <4>
 <1> Try to update from the upstream resulted in a lot of
 conflicts; you were not ready to spend a lot of time merging
 right now, so you decide to do that later.
-<2> "pull" has not made merge commit, so "git reset --hard"
-which is a synonym for "git reset --hard HEAD" clears the mess
+<2> "pull" has not made merge commit, so `git reset --hard`
+which is a synonym for `git reset --hard HEAD` clears the mess
 from the index file and the working tree.
 <3> Merge a topic branch into the current branch, which resulted
 in a fast-forward.
 <4> But you decided that the topic branch is not ready for public
 consumption yet.  "pull" or "merge" always leaves the original
-tip of the current branch in ORIG_HEAD, so resetting hard to it
+tip of the current branch in `ORIG_HEAD`, so resetting hard to it
 brings your index file and the working tree back to that state,
 and resets the tip of the branch to that commit.
 
@@ -214,14 +214,14 @@ $ git reset --merge ORIG_HEAD      <2>
 ------------
 +
 <1> Even if you may have local modifications in your
-working tree, you can safely say "git pull" when you know
+working tree, you can safely say `git pull` when you know
 that the change in the other branch does not overlap with
 them.
 <2> After inspecting the result of the merge, you may find
 that the change in the other branch is unsatisfactory.  Running
-"git reset --hard ORIG_HEAD" will let you go back to where you
+`git reset --hard ORIG_HEAD` will let you go back to where you
 were, but it will discard your local changes, which you do not
-want.  "git reset --merge" keeps your local changes.
+want.  `git reset --merge` keeps your local changes.
 
 
 Interrupted workflow::
@@ -287,13 +287,13 @@ $ git checkout -b branch2                   <2>
 $ git reset --keep start                    <3>
 ------------
 +
-<1> This commits your first edits in branch1.
+<1> This commits your first edits in `branch1`.
 <2> In the ideal world, you could have realized that the earlier
     commit did not belong to the new topic when you created and switched
-    to branch2 (i.e. "git checkout -b branch2 start"), but nobody is
+    to `branch2` (i.e. `git checkout -b branch2 start`), but nobody is
     perfect.
-<3> But you can use "reset --keep" to remove the unwanted commit after
-    you switched to "branch2".
+<3> But you can use `reset --keep` to remove the unwanted commit after
+    you switched to `branch2`.
 
 Split a commit apart into a sequence of commits::
 +
@@ -317,26 +317,27 @@ $ git commit ...                            <8>
 +
 <1> First, reset the history back one commit so that we remove the original
     commit, but leave the working tree with all the changes. The -N ensures
-    that any new files added with HEAD are still marked so that git add -p
+    that any new files added with `HEAD` are still marked so that `git add -p`
     will find them.
-<2> Next, we interactively select diff hunks to add using the git add -p
+<2> Next, we interactively select diff hunks to add using the `git add -p`
     facility. This will ask you about each diff hunk in sequence and you can
     use simple commands such as "yes, include this", "No don't include this"
     or even the very powerful "edit" facility.
 <3> Once satisfied with the hunks you want to include, you should verify what
-    has been prepared for the first commit by using git diff --cached. This
+    has been prepared for the first commit by using `git diff --cached`. This
     shows all the changes that have been moved into the index and are about
     to be committed.
-<4> Next, commit the changes stored in the index. The -c option specifies to
+<4> Next, commit the changes stored in the index. The `-c` option specifies to
     pre-populate the commit message from the original message that you started
-    with in the first commit. This is helpful to avoid retyping it. The HEAD@{1}
-    is a special notation for the commit that HEAD used to be at prior to the
-    original reset commit (1 change ago). See linkgit:git-reflog[1] for more
-    details. You may also use any other valid commit reference.
+    with in the first commit. This is helpful to avoid retyping it. The
+    `HEAD@{1}` is a special notation for the commit that `HEAD` used to be at
+    prior to the original reset commit (1 change ago).
+    See linkgit:git-reflog[1] for more details. You may also use any other
+    valid commit reference.
 <5> You can repeat steps 2-4 multiple times to break the original code into
     any number of commits.
 <6> Now you've split out many of the changes into their own commits, and might
-    no longer use the patch mode of git add, in order to select all remaining
+    no longer use the patch mode of `git add`, in order to select all remaining
     uncommitted changes.
 <7> Once again, check to verify that you've included what you want to. You may
     also wish to verify that git diff doesn't show any remaining changes to be
@@ -353,104 +354,120 @@ The tables below show what happens when running:
 git reset --option target
 ----------
 
-to reset the HEAD to another commit (`target`) with the different
+to reset the `HEAD` to another commit (`target`) with the different
 reset options depending on the state of the files.
 
-In these tables, A, B, C and D are some different states of a
+In these tables, `A`, `B`, `C` and `D` are some different states of a
 file. For example, the first line of the first table means that if a
-file is in state A in the working tree, in state B in the index, in
-state C in HEAD and in state D in the target, then "git reset --soft
-target" will leave the file in the working tree in state A and in the
-index in state B.  It resets (i.e. moves) the HEAD (i.e. the tip of
-the current branch, if you are on one) to "target" (which has the file
-in state D).
-
-      working index HEAD target         working index HEAD
-      ----------------------------------------------------
-       A       B     C    D     --soft   A       B     D
-                               --mixed  A       D     D
-                               --hard   D       D     D
-                               --merge (disallowed)
-                               --keep  (disallowed)
-
-      working index HEAD target         working index HEAD
-      ----------------------------------------------------
-       A       B     C    C     --soft   A       B     C
-                               --mixed  A       C     C
-                               --hard   C       C     C
-                               --merge (disallowed)
-                               --keep   A       C     C
-
-      working index HEAD target         working index HEAD
-      ----------------------------------------------------
-       B       B     C    D     --soft   B       B     D
-                               --mixed  B       D     D
-                               --hard   D       D     D
-                               --merge  D       D     D
-                               --keep  (disallowed)
-
-      working index HEAD target         working index HEAD
-      ----------------------------------------------------
-       B       B     C    C     --soft   B       B     C
-                               --mixed  B       C     C
-                               --hard   C       C     C
-                               --merge  C       C     C
-                               --keep   B       C     C
-
-      working index HEAD target         working index HEAD
-      ----------------------------------------------------
-       B       C     C    D     --soft   B       C     D
-                               --mixed  B       D     D
-                               --hard   D       D     D
-                               --merge (disallowed)
-                               --keep  (disallowed)
-
-      working index HEAD target         working index HEAD
-      ----------------------------------------------------
-       B       C     C    C     --soft   B       C     C
-                               --mixed  B       C     C
-                               --hard   C       C     C
-                               --merge  B       C     C
-                               --keep   B       C     C
-
-"reset --merge" is meant to be used when resetting out of a conflicted
+file is in state `A` in the working tree, in state `B` in the index, in
+state `C` in `HEAD` and in state `D` in the target, then `git reset --soft
+target` will leave the file in the working tree in state `A` and in the
+index in state `B`.  It resets (i.e. moves) the `HEAD` (i.e. the tip of
+the current branch, if you are on one) to `target` (which has the file
+in state `D`).
+
+....
+working index HEAD target         working index HEAD
+----------------------------------------------------
+ A       B     C    D     --soft   A       B     D
+                         --mixed  A       D     D
+                         --hard   D       D     D
+                         --merge (disallowed)
+                         --keep  (disallowed)
+....
+
+....
+working index HEAD target         working index HEAD
+----------------------------------------------------
+ A       B     C    C     --soft   A       B     C
+                         --mixed  A       C     C
+                         --hard   C       C     C
+                         --merge (disallowed)
+                         --keep   A       C     C
+....
+
+....
+working index HEAD target         working index HEAD
+----------------------------------------------------
+ B       B     C    D     --soft   B       B     D
+                         --mixed  B       D     D
+                         --hard   D       D     D
+                         --merge  D       D     D
+                         --keep  (disallowed)
+....
+
+....
+working index HEAD target         working index HEAD
+----------------------------------------------------
+ B       B     C    C     --soft   B       B     C
+                         --mixed  B       C     C
+                         --hard   C       C     C
+                         --merge  C       C     C
+                         --keep   B       C     C
+....
+
+....
+working index HEAD target         working index HEAD
+----------------------------------------------------
+ B       C     C    D     --soft   B       C     D
+                         --mixed  B       D     D
+                         --hard   D       D     D
+                         --merge (disallowed)
+                         --keep  (disallowed)
+....
+
+....
+working index HEAD target         working index HEAD
+----------------------------------------------------
+ B       C     C    C     --soft   B       C     C
+                         --mixed  B       C     C
+                         --hard   C       C     C
+                         --merge  B       C     C
+                         --keep   B       C     C
+....
+
+`reset --merge` is meant to be used when resetting out of a conflicted
 merge. Any mergy operation guarantees that the working tree file that is
 involved in the merge does not have local change wrt the index before
 it starts, and that it writes the result out to the working tree. So if
 we see some difference between the index and the target and also
 between the index and the working tree, then it means that we are not
 resetting out from a state that a mergy operation left after failing
-with a conflict. That is why we disallow --merge option in this case.
+with a conflict. That is why we disallow `--merge` option in this case.
 
-"reset --keep" is meant to be used when removing some of the last
+`reset --keep` is meant to be used when removing some of the last
 commits in the current branch while keeping changes in the working
 tree. If there could be conflicts between the changes in the commit we
 want to remove and the changes in the working tree we want to keep,
 the reset is disallowed. That's why it is disallowed if there are both
-changes between the working tree and HEAD, and between HEAD and the
+changes between the working tree and `HEAD`, and between `HEAD` and the
 target. To be safe, it is also disallowed when there are unmerged
 entries.
 
 The following tables show what happens when there are unmerged
 entries:
 
-      working index HEAD target         working index HEAD
-      ----------------------------------------------------
-       X       U     A    B     --soft  (disallowed)
-                               --mixed  X       B     B
-                               --hard   B       B     B
-                               --merge  B       B     B
-                               --keep  (disallowed)
-
-      working index HEAD target         working index HEAD
-      ----------------------------------------------------
-       X       U     A    A     --soft  (disallowed)
-                               --mixed  X       A     A
-                               --hard   A       A     A
-                               --merge  A       A     A
-                               --keep  (disallowed)
-
-X means any state and U means an unmerged index.
+....
+working index HEAD target         working index HEAD
+----------------------------------------------------
+ X       U     A    B     --soft  (disallowed)
+                         --mixed  X       B     B
+                         --hard   B       B     B
+                         --merge  B       B     B
+                         --keep  (disallowed)
+....
+
+....
+working index HEAD target         working index HEAD
+----------------------------------------------------
+ X       U     A    A     --soft  (disallowed)
+                         --mixed  X       A     A
+                         --hard   A       A     A
+                         --merge  A       A     A
+                         --keep  (disallowed)
+....
+
+`X` means any state and `U` means an unmerged index.
 
 GIT
 ---
index 0fe6f9ba1e94ec496f2e083ca964592272d898f2..5ac18e28486b61b91239d859c445bc620c51c5ad 100644 (file)
@@ -1096,7 +1096,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
        if (rev->rdiff1) {
                fprintf_ln(rev->diffopt.file, "%s", rev->rdiff_title);
                show_range_diff(rev->rdiff1, rev->rdiff2,
-                               rev->creation_factor, 1, &rev->diffopt);
+                               rev->creation_factor, 1, NULL);
        }
 }
 
index d09a42062c36d930b8147d6b0a4bcfedf34a2321..8bb8a0849ba90aff5d295acc3894b2034cbbdef2 100644 (file)
@@ -173,10 +173,10 @@ static NORETURN int die_push_simple(struct branch *branch, struct remote *remote
              "\n"
              "To push to the branch of the same name on the remote, use\n"
              "\n"
-             "    git push %s %s\n"
+             "    git push %s HEAD\n"
              "%s"),
            remote->name, short_upstream,
-           remote->name, branch->name, advice_maybe);
+           remote->name, advice_maybe);
 }
 
 static const char message_detached_head_die[] =
index 5b3e5baec8a09fb19798c71b201d08f88225e7af..b5c99ec10c200a5fccb293c0acadae80642f2808 100644 (file)
@@ -776,6 +776,23 @@ static void NORETURN error_on_missing_default_upstream(void)
        exit(1);
 }
 
+static void set_reflog_action(struct rebase_options *options)
+{
+       const char *env;
+       struct strbuf buf = STRBUF_INIT;
+
+       if (!is_interactive(options))
+               return;
+
+       env = getenv(GIT_REFLOG_ACTION_ENVIRONMENT);
+       if (env && strcmp("rebase", env))
+               return; /* only override it if it is "rebase" */
+
+       strbuf_addf(&buf, "rebase -i (%s)", options->action);
+       setenv(GIT_REFLOG_ACTION_ENVIRONMENT, buf.buf, 1);
+       strbuf_release(&buf);
+}
+
 int cmd_rebase(int argc, const char **argv, const char *prefix)
 {
        struct rebase_options options = {
@@ -871,7 +888,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
                               "them"), REBASE_PRESERVE_MERGES),
                OPT_BOOL(0, "rerere-autoupdate",
                         &options.allow_rerere_autoupdate,
-                        N_("allow rerere to update index  with resolved "
+                        N_("allow rerere to update index with resolved "
                            "conflict")),
                OPT_BOOL('k', "keep-empty", &options.keep_empty,
                         N_("preserve empty commits during rebase")),
@@ -978,6 +995,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 
        if (action != NO_ACTION && !in_progress)
                die(_("No rebase in progress?"));
+       setenv(GIT_REFLOG_ACTION_ENVIRONMENT, "rebase", 0);
 
        if (action == ACTION_EDIT_TODO && !is_interactive(&options))
                die(_("The --edit-todo action can only be used during "
@@ -990,6 +1008,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
                int fd;
 
                options.action = "continue";
+               set_reflog_action(&options);
 
                /* Sanity check */
                if (get_oid("HEAD", &head))
@@ -1018,6 +1037,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
                struct string_list merge_rr = STRING_LIST_INIT_DUP;
 
                options.action = "skip";
+               set_reflog_action(&options);
 
                rerere_clear(&merge_rr);
                string_list_clear(&merge_rr, 1);
@@ -1033,6 +1053,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
        case ACTION_ABORT: {
                struct string_list merge_rr = STRING_LIST_INIT_DUP;
                options.action = "abort";
+               set_reflog_action(&options);
 
                rerere_clear(&merge_rr);
                string_list_clear(&merge_rr, 1);
@@ -1440,11 +1461,12 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
                                }
 
                                strbuf_reset(&buf);
-                               strbuf_addf(&buf, "rebase: checkout %s",
+                               strbuf_addf(&buf, "%s: checkout %s",
+                                           getenv(GIT_REFLOG_ACTION_ENVIRONMENT),
                                            options.switch_to);
                                if (reset_head(&oid, "checkout",
                                               options.head_name, 0,
-                                              NULL, NULL) < 0) {
+                                              NULL, buf.buf) < 0) {
                                        ret = !!error(_("could not switch to "
                                                        "%s"),
                                                      options.switch_to);
@@ -1481,10 +1503,15 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
        if (options.flags & REBASE_DIFFSTAT) {
                struct diff_options opts;
 
-               if (options.flags & REBASE_VERBOSE)
-                       printf(_("Changes from %s to %s:\n"),
-                               oid_to_hex(&merge_base),
-                               oid_to_hex(&options.onto->object.oid));
+               if (options.flags & REBASE_VERBOSE) {
+                       if (is_null_oid(&merge_base))
+                               printf(_("Changes to %s:\n"),
+                                      oid_to_hex(&options.onto->object.oid));
+                       else
+                               printf(_("Changes from %s to %s:\n"),
+                                      oid_to_hex(&merge_base),
+                                      oid_to_hex(&options.onto->object.oid));
+               }
 
                /* We want color (if set), but no pager */
                diff_setup(&opts);
@@ -1494,8 +1521,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
                        DIFF_FORMAT_SUMMARY | DIFF_FORMAT_DIFFSTAT;
                opts.detect_rename = DIFF_DETECT_RENAME;
                diff_setup_done(&opts);
-               diff_tree_oid(&merge_base, &options.onto->object.oid,
-                             "", &opts);
+               diff_tree_oid(is_null_oid(&merge_base) ?
+                             the_hash_algo->empty_tree : &merge_base,
+                             &options.onto->object.oid, "", &opts);
                diffcore_std(&opts);
                diff_flush(&opts);
        }
@@ -1508,7 +1536,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
                printf(_("First, rewinding head to replay your work on top of "
                         "it...\n"));
 
-       strbuf_addf(&msg, "rebase: checkout %s", options.onto_name);
+       strbuf_addf(&msg, "%s: checkout %s",
+                   getenv(GIT_REFLOG_ACTION_ENVIRONMENT), options.onto_name);
        if (reset_head(&options.onto->object.oid, "checkout", NULL,
                       RESET_HEAD_DETACH, NULL, msg.buf))
                die(_("Could not detach HEAD"));
@@ -1520,7 +1549,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
         */
        strbuf_reset(&msg);
        if (!oidcmp(&merge_base, &options.orig_head)) {
-               printf(_("Fast-forwarded %s to %s. \n"),
+               printf(_("Fast-forwarded %s to %s.\n"),
                        branch_name, options.onto_name);
                strbuf_addf(&msg, "rebase finished: %s onto %s",
                        options.head_name ? options.head_name : "detached HEAD",
index a58b9c6d130568602ac7928bd1da4a83724ff4f1..affcdfb4169899c2affee51593f0453d5d9b9add 100644 (file)
@@ -495,6 +495,7 @@ static int convert_graft_file(int force)
        if (!fp)
                return -1;
 
+       advice_graft_file_deprecated = 0;
        while (strbuf_getline(&buf, fp) != EOF) {
                if (*buf.buf == '#')
                        continue;
index 580bb55bf4a71d9a968a0875e2af827c94785313..29a8ce820435d5c67dd5fd9bc23dab0c2e7d8394 100644 (file)
 #define inline __inline
 #define __inline__ __inline
 #define __attribute__(x)
+#define strcasecmp   _stricmp
 #define strncasecmp  _strnicmp
 #define ftruncate    _chsize
 #define strtoull     _strtoui64
 #define strtoll      _strtoi64
 
-static __inline int strcasecmp (const char *s1, const char *s2)
-{
-       int size1 = strlen(s1);
-       int sisz2 = strlen(s2);
-       return _strnicmp(s1, s2, sisz2 > size1 ? sisz2 : size1);
-}
-
 #undef ERROR
 
 #include "compat/mingw.h"
index b97ffdc9dd550d8802039d672623f2ba3e7a5f0c..b4c7dbfa575d3b5c664677c22b8613284d2e33fb 100755 (executable)
@@ -718,10 +718,16 @@ if test -n "$diffstat"
 then
        if test -n "$verbose"
        then
-               echo "$(eval_gettext "Changes from \$mb to \$onto:")"
+               if test -z "$mb"
+               then
+                       echo "$(eval_gettext "Changes to \$onto:")"
+               else
+                       echo "$(eval_gettext "Changes from \$mb to \$onto:")"
+               fi
        fi
+       mb_tree="${mb:-$(git hash-object -t tree /dev/null)}"
        # We want color (if set), but no pager
-       GIT_PAGER='' git diff --stat --summary "$mb" "$onto"
+       GIT_PAGER='' git diff --stat --summary "$mb_tree" "$onto"
 fi
 
 test -n "$interactive_rebase" && run_specific_rebase
diff --git a/http.c b/http.c
index 3dc8c560d65e7acebb22f63e797406e38afc6422..eacc2a75ef2e41da9d5f5741defcf1952e6c01a3 100644 (file)
--- a/http.c
+++ b/http.c
@@ -834,7 +834,7 @@ static CURL *get_curl_handle(void)
 #if LIBCURL_VERSION_NUM >= 0x072c00
                curl_easy_setopt(result, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NO_REVOKE);
 #else
-               warning(_("CURLSSLOPT_NO_REVOKE not suported with cURL < 7.44.0"));
+               warning(_("CURLSSLOPT_NO_REVOKE not supported with cURL < 7.44.0"));
 #endif
        }
 
index 7a83e99250c5245bbbbd43908f3c116567f39b62..b243779a0b7dc15200689febe68549a85ce5c6a7 100644 (file)
@@ -762,7 +762,7 @@ void show_log(struct rev_info *opt)
                next_commentary_block(opt, NULL);
                fprintf_ln(opt->diffopt.file, "%s", opt->rdiff_title);
                show_range_diff(opt->rdiff1, opt->rdiff2,
-                               opt->creation_factor, 1, &opt->diffopt);
+                               opt->creation_factor, 1, NULL);
 
                memcpy(&diff_queued_diff, &dq, sizeof(diff_queued_diff));
        }
diff --git a/midx.c b/midx.c
index 730ff84dff6cb23e4ba2218e956629dc1465744b..2a6a24fcd7eff1a074c37e6c556f2143ef134c19 100644 (file)
--- a/midx.c
+++ b/midx.c
@@ -202,7 +202,7 @@ int prepare_midx_pack(struct multi_pack_index *m, uint32_t pack_int_id)
        struct strbuf pack_name = STRBUF_INIT;
 
        if (pack_int_id >= m->num_packs)
-               die(_("bad pack-int-id: %u (%u total packs"),
+               die(_("bad pack-int-id: %u (%u total packs)"),
                    pack_int_id, m->num_packs);
 
        if (m->packs[pack_int_id])
index 767af8c5bb5617016ba2c341334c05696fdcbcc1..48b0e1b4ce0ff69b9c7a430174db25b1ca6494f8 100644 (file)
@@ -460,7 +460,11 @@ int show_range_diff(const char *range1, const char *range2,
                struct diff_options opts;
                struct strbuf indent = STRBUF_INIT;
 
-               memcpy(&opts, diffopt, sizeof(opts));
+               if (diffopt)
+                       memcpy(&opts, diffopt, sizeof(opts));
+               else
+                       diff_setup(&opts);
+
                if (!opts.output_format)
                        opts.output_format = DIFF_FORMAT_PATCH;
                opts.flags.suppress_diff_headers = 1;
index 190593f0c78151c99cc6e87161137b99c2615c80..08a50b6e98fc768f42e48b33c70ffbf17a7e8e4c 100644 (file)
@@ -5,6 +5,11 @@
 
 #define RANGE_DIFF_CREATION_FACTOR_DEFAULT 60
 
+/*
+ * Compare series of commmits in RANGE1 and RANGE2, and emit to the
+ * standard output.  NULL can be passed to DIFFOPT to use the built-in
+ * default.
+ */
 int show_range_diff(const char *range1, const char *range2,
                    int creation_factor, int dual_color,
                    struct diff_options *diffopt);
index 9183875dadb72c4b285b8a99ee7df7620a1e7eeb..dd8abe918508027ed46c3234bac1d91107c6ca94 100644 (file)
@@ -180,7 +180,8 @@ static void files_reflog_path(struct files_ref_store *refs,
                break;
        case REF_TYPE_OTHER_PSEUDOREF:
        case REF_TYPE_MAIN_PSEUDOREF:
-               return files_reflog_path_other_worktrees(refs, sb, refname);
+               files_reflog_path_other_worktrees(refs, sb, refname);
+               break;
        case REF_TYPE_NORMAL:
                strbuf_addf(sb, "%s/logs/%s", refs->gitcommondir, refname);
                break;
index edbea2d986134f36b86e044f307abae1457f8165..f98de95c15b14aa4030c65d26e6270dc06088372 100644 (file)
@@ -92,7 +92,7 @@ stop_git_daemon() {
        kill "$GIT_DAEMON_PID"
        wait "$GIT_DAEMON_PID" >&3 2>&4
        ret=$?
-       if test_match_signal 15 $?
+       if ! test_match_signal 15 $ret
        then
                error "git daemon exited with status: $ret"
        fi
index 11d1922cf58edb78b8e311e3fa041ae54b625e74..2e33ab3ec3ef9838962c7a8b1a997faeed11f071 100644 (file)
@@ -82,7 +82,7 @@ test_perf_do_repo_symlink_config_ () {
 
 test_perf_create_repo_from () {
        test "$#" = 2 ||
-       error "bug in the test script: not 2 parameters to test-create-repo"
+       BUG "not 2 parameters to test-create-repo"
        repo="$1"
        source="$2"
        source_git="$("$MODERN_GIT" -C "$source" rev-parse --git-dir)"
@@ -184,7 +184,7 @@ test_wrapper_ () {
        test_start_
        test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq=
        test "$#" = 2 ||
-       error "bug in the test script: not 2 or 3 parameters to test-expect-success"
+       BUG "not 2 or 3 parameters to test-expect-success"
        export test_prereq
        if ! test_skip "$@"
        then
index 182da069f1743b8a06b65396599f94530080e67f..42a263cadafe55803bacf5e8bc071b9999618fc4 100755 (executable)
@@ -319,14 +319,14 @@ test_lazy_prereq GETCWD_IGNORES_PERMS '
        base=GETCWD_TEST_BASE_DIR &&
        mkdir -p $base/dir &&
        chmod 100 $base ||
-       error "bug in test script: cannot prepare $base"
+       BUG "cannot prepare $base"
 
        (cd $base/dir && /bin/pwd -P)
        status=$?
 
        chmod 700 $base &&
        rm -rf $base ||
-       error "bug in test script: cannot clean $base"
+       BUG "cannot clean $base"
        return $status
 '
 
index 38bd876cabf9757cce439be90c0f1e094225cac3..f64b130cb805bbca8475f3c262693fa0faa2cafe 100755 (executable)
@@ -91,4 +91,40 @@ test_expect_success 'error out early upon -C<n> or --whitespace=<bad>' '
        test_i18ngrep "Invalid whitespace option" err
 '
 
+test_expect_success 'GIT_REFLOG_ACTION' '
+       git checkout start &&
+       test_commit reflog-onto &&
+       git checkout -b reflog-topic start &&
+       test_commit reflog-to-rebase &&
+
+       git rebase reflog-onto &&
+       git log -g --format=%gs -3 >actual &&
+       cat >expect <<-\EOF &&
+       rebase finished: returning to refs/heads/reflog-topic
+       rebase: reflog-to-rebase
+       rebase: checkout reflog-onto
+       EOF
+       test_cmp expect actual &&
+
+       git checkout -b reflog-prefix reflog-to-rebase &&
+       GIT_REFLOG_ACTION=change-the-reflog git rebase reflog-onto &&
+       git log -g --format=%gs -3 >actual &&
+       cat >expect <<-\EOF &&
+       rebase finished: returning to refs/heads/reflog-prefix
+       change-the-reflog: reflog-to-rebase
+       change-the-reflog: checkout reflog-onto
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success 'rebase -i onto unrelated history' '
+       git init unrelated &&
+       test_commit -C unrelated 1 &&
+       git -C unrelated remote add -f origin "$PWD" &&
+       git -C unrelated branch --set-upstream-to=origin/master &&
+       git -C unrelated -c core.editor=true rebase -i -v --stat >actual &&
+       test_i18ngrep "Changes to " actual &&
+       test_i18ngrep "5 files changed" actual
+'
+
 test_done
index 73f7038253d6429f9d05c38f36c226107b5251ff..7d985ff6b1bff3c73e4309cde675f67c813d93da 100755 (executable)
@@ -129,7 +129,7 @@ do
                case "$magic" in
                noellipses) ;;
                *)
-                       die "bug in t4103: unknown magic $magic" ;;
+                       BUG "unknown magic $magic" ;;
                esac ;;
        *)
                cmd="$magic $cmd" magic=
index 7316365a24679edbb9d79db74a4ba6e9aa4ad9be..37e8e80893dad130c5c00882796047417aae115b 100755 (executable)
@@ -95,7 +95,7 @@ mk_child() {
 
 check_push_result () {
        test $# -ge 3 ||
-       error "bug in the test script: check_push_result requires at least 3 parameters"
+       BUG "check_push_result requires at least 3 parameters"
 
        repo_name="$1"
        shift
index b24d8b05a498674612870a133e1a4fc4a37bd5d3..90d890d02fd8f5451d0d78d880f6698d11b22a3d 100755 (executable)
@@ -31,6 +31,7 @@ test_http_env() {
                PATH_TRANSLATED="$PWD/.git/git-$handler_type-pack" \
                GIT_HTTP_EXPORT_ALL=TRUE \
                REQUEST_METHOD=POST \
+               "$PERL_PATH" \
                "$TEST_DIRECTORY"/t5562/invoke-with-content-length.pl \
                    "$request_body" git http-backend >act.out 2>act.err
 }
old mode 100755 (executable)
new mode 100644 (file)
index 6c2aae7..0943474
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
 use 5.008;
 use strict;
 use warnings;
index c28d51bd59259a3cf2ceb7b3b14e5171901145b2..8bbc7068acbd1eab9f0499ff1151abd58a87079c 100755 (executable)
@@ -628,7 +628,7 @@ test_expect_success 'clone on case-insensitive fs' '
        )
 '
 
-test_expect_success !MINGW,CASE_INSENSITIVE_FS 'colliding file detection' '
+test_expect_success CASE_INSENSITIVE_FS 'colliding file detection' '
        grep X icasefs/warning &&
        grep x icasefs/warning &&
        test_i18ngrep "the following paths have collided" icasefs/warning
index 86374a9c52c0bd26a8ba7223526c9e1f128f468a..5d6d3184ac390f2cd476a322cf6d15e69a912494 100755 (executable)
@@ -461,7 +461,10 @@ test_expect_success '--convert-graft-file' '
        printf "%s\n%s %s\n\n# comment\n%s\n" \
                $(git rev-parse HEAD^^ HEAD^ HEAD^^ HEAD^2) \
                >.git/info/grafts &&
-       git replace --convert-graft-file &&
+       git status 2>stderr &&
+       test_i18ngrep "hint:.*grafts is deprecated" stderr &&
+       git replace --convert-graft-file 2>stderr &&
+       test_i18ngrep ! "hint:.*grafts is deprecated" stderr &&
        test_path_is_missing .git/info/grafts &&
 
        : verify that the history is now "grafted" &&
index 3c6b185b60891c164f56a638071873051420fdac..d01ad8eb2587ba32637d7ec8161811696a0aec34 100755 (executable)
@@ -1249,7 +1249,7 @@ test_expect_success 'teardown after ref completion' '
 
 test_path_completion ()
 {
-       test $# = 2 || error "bug in the test script: not 2 parameters to test_path_completion"
+       test $# = 2 || BUG "not 2 parameters to test_path_completion"
 
        local cur="$1" expected="$2"
        echo "$expected" >expected &&
index b4e391526a2957fe2e578d226ef756321e51aef7..6b3bbf99e46cf7cc418eca1eaf768d526ac658aa 100644 (file)
@@ -418,14 +418,14 @@ test_declared_prereq () {
 test_verify_prereq () {
        test -z "$test_prereq" ||
        expr >/dev/null "$test_prereq" : '[A-Z0-9_,!]*$' ||
-       error "bug in the test script: '$test_prereq' does not look like a prereq"
+       BUG "'$test_prereq' does not look like a prereq"
 }
 
 test_expect_failure () {
        test_start_
        test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq=
        test "$#" = 2 ||
-       error "bug in the test script: not 2 or 3 parameters to test-expect-failure"
+       BUG "not 2 or 3 parameters to test-expect-failure"
        test_verify_prereq
        export test_prereq
        if ! test_skip "$@"
@@ -445,7 +445,7 @@ test_expect_success () {
        test_start_
        test "$#" = 3 && { test_prereq=$1; shift; } || test_prereq=
        test "$#" = 2 ||
-       error "bug in the test script: not 2 or 3 parameters to test-expect-success"
+       BUG "not 2 or 3 parameters to test-expect-success"
        test_verify_prereq
        export test_prereq
        if ! test_skip "$@"
@@ -472,7 +472,7 @@ test_expect_success () {
 test_external () {
        test "$#" = 4 && { test_prereq=$1; shift; } || test_prereq=
        test "$#" = 3 ||
-       error >&5 "bug in the test script: not 3 or 4 parameters to test_external"
+       BUG "not 3 or 4 parameters to test_external"
        descr="$1"
        shift
        test_verify_prereq
@@ -613,7 +613,7 @@ test_path_is_missing () {
 test_line_count () {
        if test $# != 3
        then
-               error "bug in the test script: not 3 parameters to test_line_count"
+               BUG "not 3 parameters to test_line_count"
        elif ! test $(wc -l <"$3") "$1" "$2"
        then
                echo "test_line_count: line count for $3 !$1 $2"
@@ -793,13 +793,12 @@ test_i18ngrep () {
        eval "last_arg=\${$#}"
 
        test -f "$last_arg" ||
-       error "bug in the test script: test_i18ngrep requires a file" \
-             "to read as the last parameter"
+       BUG "test_i18ngrep requires a file to read as the last parameter"
 
        if test $# -lt 2 ||
           { test "x!" = "x$1" && test $# -lt 3 ; }
        then
-               error "bug in the test script: too few parameters to test_i18ngrep"
+               BUG "too few parameters to test_i18ngrep"
        fi
 
        if test_have_prereq !C_LOCALE_OUTPUT
@@ -854,9 +853,23 @@ test_must_be_empty () {
 
 # Tests that its two parameters refer to the same revision
 test_cmp_rev () {
-       git rev-parse --verify "$1" >expect.rev &&
-       git rev-parse --verify "$2" >actual.rev &&
-       test_cmp expect.rev actual.rev
+       if test $# != 2
+       then
+               error "bug in the test script: test_cmp_rev requires two revisions, but got $#"
+       else
+               local r1 r2
+               r1=$(git rev-parse --verify "$1") &&
+               r2=$(git rev-parse --verify "$2") &&
+               if test "$r1" != "$r2"
+               then
+                       cat >&4 <<-EOF
+                       error: two revisions point to different objects:
+                         '$1': $r1
+                         '$2': $r2
+                       EOF
+                       return 1
+               fi
+       fi
 }
 
 # Print a sequence of integers in increasing order, either with
@@ -871,7 +884,7 @@ test_seq () {
        case $# in
        1)      set 1 "$@" ;;
        2)      ;;
-       *)      error "bug in the test script: not 1 or 2 parameters to test_seq" ;;
+       *)      BUG "not 1 or 2 parameters to test_seq" ;;
        esac
        test_seq_counter__=$1
        while test "$test_seq_counter__" -le "$2"
@@ -909,7 +922,7 @@ test_when_finished () {
        # doing so on Bash is better than nothing (the test will
        # silently pass on other shells).
        test "${BASH_SUBSHELL-0}" = 0 ||
-       error "bug in test script: test_when_finished does nothing in a subshell"
+       BUG "test_when_finished does nothing in a subshell"
        test_cleanup="{ $*
                } && (exit \"\$eval_ret\"); eval_ret=\$?; $test_cleanup"
 }
@@ -918,7 +931,7 @@ test_when_finished () {
 # Usage: test_create_repo <directory>
 test_create_repo () {
        test "$#" = 1 ||
-       error "bug in the test script: not 1 parameter to test-create-repo"
+       BUG "not 1 parameter to test-create-repo"
        repo="$1"
        mkdir -p "$repo"
        (
@@ -1231,7 +1244,7 @@ test_oid_cache () {
 
                if ! expr "$k" : '[a-z0-9][a-z0-9]*$' >/dev/null
                then
-                       error 'bug in the test script: bad hash algorithm'
+                       BUG 'bad hash algorithm'
                fi &&
                eval "test_oid_${k}_$tag=\"\$v\""
        done
@@ -1246,7 +1259,7 @@ test_oid () {
        # key-hash pair, so exit with an error.
        if eval "test -z \"\${$var+set}\""
        then
-               error "bug in the test script: undefined key '$1'" >&2
+               BUG "undefined key '$1'"
        fi &&
        eval "printf '%s' \"\${$var}\""
 }
index 6c6c0af7a128ea7f35fb1753ed39c073208976ea..0f1faa24b27b90f4d246d33da9950325f8736633 100644 (file)
@@ -402,6 +402,10 @@ error () {
        exit 1
 }
 
+BUG () {
+       error >&7 "bug in the test script: $*"
+}
+
 say () {
        say_color info "$*"
 }
@@ -729,7 +733,7 @@ test_run_ () {
                if $(printf '%s\n' "$1" | sed -f "$GIT_BUILD_DIR/t/chainlint.sed" | grep -q '?![A-Z][A-Z]*?!') ||
                        test "OK-117" != "$(test_eval_ "(exit 117) && $1${LF}${LF}echo OK-\$?" 3>&1)"
                then
-                       error "bug in the test script: broken &&-chain or run-away HERE-DOC: $1"
+                       BUG "broken &&-chain or run-away HERE-DOC: $1"
                fi
                trace=$trace_tmp
        fi
@@ -1231,7 +1235,7 @@ test_lazy_prereq SANITY '
        chmod -w SANETESTD.1 &&
        chmod -r SANETESTD.1/x &&
        chmod -rx SANETESTD.2 ||
-       error "bug in test sript: cannot prepare SANETESTD"
+       BUG "cannot prepare SANETESTD"
 
        ! test -r SANETESTD.1/x &&
        ! rm SANETESTD.1/x && ! test -f SANETESTD.2/x
@@ -1239,7 +1243,7 @@ test_lazy_prereq SANITY '
 
        chmod +rwx SANETESTD.1 SANETESTD.2 &&
        rm -rf SANETESTD.1 SANETESTD.2 ||
-       error "bug in test sript: cannot clean SANETESTD"
+       BUG "cannot clean SANETESTD"
        return $status
 '
 
index 7213fa0d320284e318c7895cc0915ef556ac4f6d..bf225c698fac81a9a94eff6d3371988ac4ff0bac 100644 (file)
@@ -573,7 +573,7 @@ static int run_connect(struct transport *transport, struct strbuf *cmdbuf)
                        fprintf(stderr, "Debug: Falling back to dumb "
                                "transport.\n");
        } else {
-               die(_(_("unknown response to connect: %s")),
+               die(_("unknown response to connect: %s"),
                    cmdbuf->buf);
        }