Merge branch 'jk/http-error-messages'
authorJunio C Hamano <gitster@pobox.com>
Mon, 15 Apr 2013 19:40:46 +0000 (12:40 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 Apr 2013 19:40:46 +0000 (12:40 -0700)
Improve error reporting from the http transfer clients.

* jk/http-error-messages:
http: drop http_error function
remote-curl: die directly with http error messages
http: re-word http error message
http: simplify http_error helper function
remote-curl: consistently report repo url for http errors
remote-curl: always show friendlier 404 message
remote-curl: let servers override http 404 advice
remote-curl: show server content on http errors
http: add HTTP_KEEP_ERROR option

100 files changed:
Documentation/RelNotes/1.8.1.6.txt
Documentation/RelNotes/1.8.2.1.txt
Documentation/RelNotes/1.8.3.txt
Documentation/cat-texi.perl
Documentation/config.txt
Documentation/git-archive.txt
Documentation/git-commit.txt
Documentation/git-credential.txt
Documentation/git-fast-export.txt
Documentation/git-help.txt
Documentation/git-remote-ext.txt
Documentation/git-svn.txt
Documentation/git-tools.txt
Documentation/git.txt
Documentation/gitremote-helpers.txt
Documentation/revisions.txt
Documentation/technical/api-argv-array.txt
Documentation/technical/api-credentials.txt
Documentation/technical/api-ref-iteration.txt
Documentation/technical/pack-format.txt
INSTALL
advice.c
advice.h
bisect.c
branch.c
builtin/apply.c
builtin/fast-export.c
builtin/help.c
builtin/push.c
builtin/rm.c
cache.h
combine-diff.c
commit.c
commit.h
compat/nedmalloc/malloc.c.h
compat/obstack.h
compat/precompose_utf8.c
compat/regex/regcomp.c
compat/regex/regex.c
compat/regex/regex_internal.c
contrib/mw-to-git/git-remote-mediawiki.perl
contrib/mw-to-git/t/README
contrib/mw-to-git/t/install-wiki/LocalSettings.php
contrib/mw-to-git/t/t9362-mw-to-git-utf8.sh
contrib/remote-helpers/Makefile
contrib/remote-helpers/git-remote-bzr
contrib/remote-helpers/test-bzr.sh
contrib/remote-helpers/test-hg-hg-git.sh
contrib/remote-helpers/test-hg.sh
contrib/subtree/t/t7900-subtree.sh
diff.c
diffcore-break.c
diffcore-pickaxe.c
dir.c
git-add--interactive.perl
git-cvsserver.perl
git-filter-branch.sh
git-quiltimport.sh
git.c
gitweb/INSTALL
gitweb/gitweb.perl
kwset.c
path.c
perl/Git.pm
perl/Git/I18N.pm
perl/private-Error.pm
po/README
remote.c
remote.h
rerere.c
revision.c
sequencer.c
t/README
t/t1006-cat-file.sh
t/t2030-unresolve-info.sh
t/t3200-branch.sh
t/t3600-rm.sh
t/t3701-add-interactive.sh
t/t4014-format-patch.sh
t/t4038-diff-combined.sh
t/t4124-apply-ws-rule.sh
t/t4209-log-pickaxe.sh
t/t5516-fetch-push.sh
t/t6012-rev-list-simplify.sh
t/t6030-bisect-porcelain.sh
t/t7003-filter-branch.sh
t/t7512-status-help.sh
t/t7601-merge-pull-config.sh
t/t7610-mergetool.sh
t/t9001-send-email.sh
t/t9010-svn-fe.sh
t/t9300-fast-import.sh
t/t9700/test.pl
t/test-lib.sh
transport-helper.c
transport.h
wt-status.c
wt-status.h
xdiff/xdiffi.c
xdiff/xhistogram.c
index d9de6390809b476d3ee191b8f77fea450337f18f..c15cf2e80545bbcf1556209bbb078688a544e732 100644 (file)
@@ -4,6 +4,11 @@ Git 1.8.1.6 Release Notes
 Fixes since v1.8.1.5
 --------------------
 
+ * An earlier change to the attribute system introduced at v1.8.1.2 by
+   mistake stopped a pattern "dir" (without trailing slash) from
+   matching a directory "dir" (it only wanted to allow pattern "dir/"
+   to also match).
+
  * The code to keep track of what directory names are known to Git on
    platforms with case insensitive filesystems can get confused upon a
    hash collision between these pathnames and looped forever.
index 1ded500fc34a9d4da164e74c2ff433dc764d7e57..1354ad03f5e65cf85ec4c1e2b68c6152c3f295b8 100644 (file)
@@ -4,6 +4,11 @@ Git v1.8.2.1 Release Notes
 Fixes since v1.8.2
 ------------------
 
+ * An earlier change to the attribute system introduced at v1.8.1.2 by
+   mistake stopped a pattern "dir" (without trailing slash) from
+   matching a directory "dir" (it only wanted to allow pattern "dir/"
+   to also match).
+
  * Verification of signed tags were not done correctly when not in C
    or en/US locale.
 
index a05c70fe1d0bf45469aa2cf921505a941243203e..bcbcf1569651d5aff9d0af738db7b912285954dd 100644 (file)
@@ -32,8 +32,23 @@ Updates since v1.8.2
 
 UI, Workflows & Features
 
+ * "git help" learned "-g" option to show the list of guides just like
+   list of commands are given with "-a".
+
+ * A triangular "pull from one place, push to another place" workflow
+   is supported better by new remote.pushdefault (overrides the
+   "origin" thing) and branch.*.pushremote (overrides the
+   branch.*.remote) configuration variables.
+
+ * "git status" learned to report that you are in the middle of a
+   revert session, just like it does for a cherry-pick and a bisect
+   session.
+
+ * The handling by "git branch --set-upstream-to" against various forms
+   of erroneous inputs was suboptimal and has been improved.
+
  * When the interactive access to git-shell is not enabled, it issues
-   a message meant to help the system admininstrator to enable it.
+   a message meant to help the system administrator to enable it.
    An explicit way to help the end users who connect to the service by
    issuing custom messages to refuse such an access has been added.
 
@@ -101,6 +116,13 @@ Performance, Internal Implementation, etc.
 
  * Updates for building under msvc.
 
+ * The logic to coalesce the same lines removed from the parents in
+   the output from "diff -c/--cc" has been updated, but with an O(n^2)
+   complexity, so this might turn out to be undesirable.
+
+ * The code to enforce permission bits on files in $GIT_DIR/ for
+   shared repositories have been simplified.
+
  * A few codepaths knew how much data they need to put in the
    hashtables they use upfront, but still started from a small table
    repeatedly growing and rehashing.
@@ -124,6 +146,9 @@ Performance, Internal Implementation, etc.
    which have been consolidated.  Also a bug in "git checkout dir/"
    that is started from an unmerged index has been fixed.
 
+ * A few bugfixes to "git rerere" working on corner case merge
+   conflicts have been applied.
+
 
 Also contains minor documentation updates and code clean-ups.
 
@@ -135,6 +160,16 @@ Unless otherwise noted, all the fixes since v1.8.2 in the maintenance
 track are contained in this release (see release notes to them for
 details).
 
+ * "git log -S/-G" started paying attention to textconv filter, but
+   there was no way to disable this.  Make it honor --no-textconv
+   option.
+   (merge 61690bf sr/log-SG-no-textconv later to maint).
+
+ * When used with "-d temporary-directory" option, "git filter-branch"
+   failed to come back to the original working tree to perform the
+   final clean-up procedure.
+   (merge 9727601 jk/filter-branch-come-back-to-original later to maint).
+
  * "git merge $(git rev-parse v1.8.2)" behaved quite differently from
    "git merge v1.8.2", as if v1.8.2 were written as v1.8.2^0 and did
    not pay much attention to the annotated tag payload.  Make the code
@@ -159,8 +194,8 @@ details).
    "--option=value" form.
    (merge 862ae6c rs/submodule-summary-limit later to maint).
 
- * "index-pack --fix-thin" used uninitialize value to compute delta
-   depths of objects it appends to the resulting pack.
+ * "index-pack --fix-thin" used an uninitialized value to compute
+   delta depths of objects it appends to the resulting pack.
    (merge 57165db jk/index-pack-correct-depth-fix later to maint).
 
  * "index-pack --verify-stat" used a few counters outside protection
@@ -274,4 +309,4 @@ details).
    alphabetical order.
 
  * "git submodule update", when recursed into sub-submodules, did not
-   acccumulate the prefix paths.
+   accumulate the prefix paths.
index 828ec62554fe927eb16a03f835448e6db0c303a1..87437f8a95768595e040b8c4c1d48e5c29ada087 100755 (executable)
@@ -12,6 +12,7 @@
                push @menu, $1;
        }
        s/\(\@pxref{\[(URLS|REMOTES)\]}\)//;
+       s/\@anchor\{[^{}]*\}//g;
        print TMP;
 }
 close TMP;
index f79184c0a83170ea54298f2b8ac960372371b0f3..3d750e0452308a4d3bf15053bfc5131d43c8c913 100644 (file)
@@ -727,9 +727,22 @@ branch.autosetuprebase::
        This option defaults to never.
 
 branch.<name>.remote::
-       When in branch <name>, it tells 'git fetch' and 'git push' which
-       remote to fetch from/push to.  It defaults to `origin` if no remote is
-       configured. `origin` is also used if you are not on any branch.
+       When on branch <name>, it tells 'git fetch' and 'git push'
+       which remote to fetch from/push to.  The remote to push to
+       may be overridden with `remote.pushdefault` (for all branches).
+       The remote to push to, for the current branch, may be further
+       overridden by `branch.<name>.pushremote`.  If no remote is
+       configured, or if you are not on any branch, it defaults to
+       `origin` for fetching and `remote.pushdefault` for pushing.
+
+branch.<name>.pushremote::
+       When on branch <name>, it overrides `branch.<name>.remote` for
+       pushing.  It also overrides `remote.pushdefault` for pushing
+       from branch <name>.  When you pull from one place (e.g. your
+       upstream) and push to another place (e.g. your own publishing
+       repository), you would want to set `remote.pushdefault` to
+       specify the remote to push to for all branches, and use this
+       option to override it for a specific branch.
 
 branch.<name>.merge::
        Defines, together with branch.<name>.remote, the upstream branch
@@ -1898,6 +1911,11 @@ receive.updateserverinfo::
        If set to true, git-receive-pack will run git-update-server-info
        after receiving data from git-push and updating refs.
 
+remote.pushdefault::
+       The remote to push to by default.  Overrides
+       `branch.<name>.remote` for all branches, and is overridden by
+       `branch.<name>.pushremote` for specific branches.
+
 remote.<name>.url::
        The URL of a remote repository.  See linkgit:git-fetch[1] or
        linkgit:git-push[1].
index b4c2e24849b1154fb55608fa95cead9e405a03bf..250e5228a35165e72f2f55fd347941c3a2a1d08c 100644 (file)
@@ -56,7 +56,8 @@ OPTIONS
        Write the archive to <file> instead of stdout.
 
 --worktree-attributes::
-       Look for attributes in .gitattributes in working directory too.
+       Look for attributes in .gitattributes files in the working tree
+       as well (see <<ATTRIBUTES>>).
 
 <extra>::
        This can be any options that the archiver backend understands.
@@ -120,6 +121,7 @@ tar.<format>.remote::
        user-defined formats, but true for the "tar.gz" and "tgz"
        formats.
 
+[[ATTRIBUTES]]
 ATTRIBUTES
 ----------
 
index 05f82973687bb3fd7fbb066f725d72d386cd446f..9b1be5581d34b9911e3d60f23dcdda440d3bc17f 100644 (file)
@@ -207,14 +207,15 @@ variable (see linkgit:git-config[1]).
        without changing its commit message.
 
 --amend::
-       Used to amend the tip of the current branch. Prepare the tree
-       object you would want to replace the latest commit as usual
-       (this includes the usual -i/-o and explicit paths), and the
-       commit log editor is seeded with the commit message from the
-       tip of the current branch. The commit you create replaces the
-       current tip -- if it was a merge, it will have the parents of
-       the current tip as parents -- so the current top commit is
-       discarded.
+       Replace the tip of the current branch by creating a new
+       commit. The recorded tree is prepared as usual (including
+       the effect of the `-i` and `-o` options and explicit
+       pathspec), and the message from the original commit is used
+       as the starting point, instead of an empty message, when no
+       other message is specified from the command line via options
+       such as `-m`, `-F`, `-c`, etc.  The new commit has the same
+       parents and author as the current one (the `--reset-author`
+       option can countermand this).
 +
 --
 It is a rough equivalent for:
index 472f00f607850d7298535eead2982915412400d9..7da0f13a5cb26e9e5d1cb7d9c73fd4af57443d72 100644 (file)
@@ -56,7 +56,7 @@ For example, if we want a password for
 `https://example.com/foo.git`, we might generate the following
 credential description (don't forget the blank line at the end; it
 tells `git credential` that the application finished feeding all the
-infomation it has):
+information it has):
 
         protocol=https
         host=example.com
index d6487e1ce03a9c060ae41b7b7455c442c6ea58f3..feab7a3e4ecb56aa17c32bd555e907a51001ef1f 100644 (file)
@@ -66,6 +66,8 @@ produced incorrect results if you gave these options.
        incremental runs.  As <file> is only opened and truncated
        at completion, the same path can also be safely given to
        \--import-marks.
+       The file will not be written if no new object has been
+       marked/exported.
 
 --import-marks=<file>::
        Before processing any input, load the marks specified in
index e07b6dc19ada9f3bb2ff4a6ae66eb587455fab11..b21e9d79be22cf134cf4e5f009fc8d71a635cc73 100644 (file)
@@ -8,31 +8,45 @@ git-help - Display help information about Git
 SYNOPSIS
 --------
 [verse]
-'git help' [-a|--all|-i|--info|-m|--man|-w|--web] [COMMAND]
+'git help' [-a|--all] [-g|--guide]
+          [-i|--info|-m|--man|-w|--web] [COMMAND|GUIDE]
 
 DESCRIPTION
 -----------
 
-With no options and no COMMAND given, the synopsis of the 'git'
+With no options and no COMMAND or GUIDE given, the synopsis of the 'git'
 command and a list of the most commonly used Git commands are printed
 on the standard output.
 
-If the option '--all' or '-a' is given, then all available commands are
+If the option '--all' or '-a' is given, all available commands are
 printed on the standard output.
 
-If a Git subcommand is named, a manual page for that subcommand is brought
-up. The 'man' program is used by default for this purpose, but this
-can be overridden by other options or configuration variables.
+If the option '--guide' or '-g' is given, a list of the useful
+Git guides is also printed on the standard output.
+
+If a command, or a guide, is given, a manual page for that command or
+guide is brought up. The 'man' program is used by default for this
+purpose, but this can be overridden by other options or configuration
+variables.
 
 Note that `git --help ...` is identical to `git help ...` because the
 former is internally converted into the latter.
 
+To display the linkgit:git[1] man page, use `git help git`.
+
+This page can be displayed with 'git help help' or `git help --help`
+
 OPTIONS
 -------
 -a::
 --all::
        Prints all the available commands on the standard output. This
-       option supersedes any other option.
+       option overrides any given command or guide name.
+
+-g::
+--guides::
+       Prints a list of useful guides on the standard output. This
+       option overrides any given command or guide name.
 
 -i::
 --info::
index 58b7facb09915a1856613dfcfd32b28d30cf896c..8cfc748ae2da4fce4c7ef804dcd50d2d923068d5 100644 (file)
@@ -86,7 +86,7 @@ begins with `ext::`.  Examples:
        edit .ssh/config.
 
 "ext::socat -t3600 - ABSTRACT-CONNECT:/git-server %G/somerepo"::
-       Represents repository with path /somerepo accessable over
+       Represents repository with path /somerepo accessible over
        git protocol at abstract namespace address /git-server.
 
 "ext::git-server-alias foo %G/repo"::
index 1b8b6498cd8afa4e2581e3597c4787981dc042df..7706d41c8704679c00a302306651628e5b99d1c1 100644 (file)
@@ -245,7 +245,7 @@ first have already been pushed into SVN.
        patch), "all" (accept all patches), or "quit".
        +
        'git svn dcommit' returns immediately if answer if "no" or "quit", without
-       commiting anything to SVN.
+       committing anything to SVN.
 
 'branch'::
        Create a branch in the SVN repository.
@@ -856,7 +856,7 @@ HANDLING OF SVN BRANCHES
 ------------------------
 If 'git svn' is configured to fetch branches (and --follow-branches
 is in effect), it sometimes creates multiple Git branches for one
-SVN branch, where the addtional branches have names of the form
+SVN branch, where the additional branches have names of the form
 'branchname@nnn' (with nnn an SVN revision number).  These additional
 branches are created if 'git svn' cannot find a parent commit for the
 first commit in an SVN branch, to connect the branch to the history of
index ad8b823f7732fe05e911fe5e8f2a1d60983c7a26..78a0d955ec22e22fbb1028f4eb6bfceeafc976f7 100644 (file)
@@ -109,7 +109,7 @@ Others
 
    - *git.el* (contrib/)
 
-   This is an Emacs interface for Git. The user interface is modeled on
+   This is an Emacs interface for Git. The user interface is modelled on
    pcl-cvs. It has been developed on Emacs 21 and will probably need some
    tweaking to work on XEmacs.
 
index 4307d62bd4a4e4b5361200ef54d8ecba60e4f1b0..6a875f2adefe34e27bc0fc3b6fdb9d7bcfd23301 100644 (file)
@@ -43,14 +43,16 @@ unreleased) version of Git, that is available from 'master'
 branch of the `git.git` repository.
 Documentation for older releases are available here:
 
-* link:v1.8.2/git.html[documentation for release 1.8.2]
+* link:v1.8.2.1/git.html[documentation for release 1.8.2.1]
 
 * release notes for
+  link:RelNotes/1.8.2.1.txt[1.8.2.1].
   link:RelNotes/1.8.2.txt[1.8.2].
 
-* link:v1.8.1.5/git.html[documentation for release 1.8.1.5]
+* link:v1.8.1.6/git.html[documentation for release 1.8.1.6]
 
 * release notes for
+  link:RelNotes/1.8.1.6.txt[1.8.1.6],
   link:RelNotes/1.8.1.5.txt[1.8.1.5],
   link:RelNotes/1.8.1.4.txt[1.8.1.4],
   link:RelNotes/1.8.1.3.txt[1.8.1.3],
index 0c91aba86182f91206fcba5470b7202e4496f073..f506031ae49070e216e71914d8ef241da58430e1 100644 (file)
@@ -174,8 +174,8 @@ ref.
 This capability can be advertised multiple times.  The first
 applicable refspec takes precedence.  The left-hand of refspecs
 advertised with this capability must cover all refs reported by
-the list command.  If no 'refspec' capability is advertised,
-there is an implied `refspec *:*`.
+the list command.  If a helper does not need a specific 'refspec'
+capability then it should advertise `refspec *:*`.
 
 'bidi-import'::
        This modifies the 'import' capability.
index 1707d451b604e05de69d8a3d9f8dc326079d4742..8855b1a0ac99012fcd98fcb3272b39e465d84626 100644 (file)
@@ -55,7 +55,7 @@ when you run `git cherry-pick`.
 +
 Note that any of the 'refs/*' cases above may come either from
 the '$GIT_DIR/refs' directory or from the '$GIT_DIR/packed-refs' file.
-While the ref name encoding is unspecified, UTF-8 is prefered as
+While the ref name encoding is unspecified, UTF-8 is preferred as
 some output processing may assume ref names in UTF-8.
 
 '<refname>@\{<date>\}', e.g. 'master@\{yesterday\}', 'HEAD@\{5 minutes ago\}'::
index a959517b2339847e92464c86a73f9c472bfdb2d0..a6b7d83a8eb05086cb88a9168117aa54cf018551 100644 (file)
@@ -55,7 +55,7 @@ Functions
        initial, empty state.
 
 `argv_array_detach`::
-       Detach the argv array from the `struct argv_array`, transfering
+       Detach the argv array from the `struct argv_array`, transferring
        ownership of the allocated array and strings.
 
 `argv_array_free_detached`::
index 516fda74120c18f4d124ee8e5402dda39b72777a..c1b42a40d3c0c297994cd2966b60cd48629e57fa 100644 (file)
@@ -160,7 +160,7 @@ int foo_login(struct foo_connection *f)
                break;
        default:
                /*
-                * Some other error occured. We don't know if the
+                * Some other error occurred. We don't know if the
                 * credential is good or bad, so report nothing to the
                 * credential subsystem.
                 */
index dbbea95db7a8104dcd5de4b1ac59235f2eadaaa8..aa1c50f181eb20e27a8299ca8ec691eeffa9d51b 100644 (file)
@@ -35,7 +35,7 @@ Iteration functions
 * `head_ref_submodule()`, `for_each_ref_submodule()`,
   `for_each_ref_in_submodule()`, `for_each_tag_ref_submodule()`,
   `for_each_branch_ref_submodule()`, `for_each_remote_ref_submodule()`
-  do the same as the functions descibed above but for a specified
+  do the same as the functions described above but for a specified
   submodule.
 
 * `for_each_rawref()` can be used to learn about broken ref and symref.
index 0e37ec9de51bd4ecb99cecce1958c6cea9bea715..a37f1378d05d6def0ea3cac840acf62875536a70 100644 (file)
@@ -26,7 +26,9 @@ Git pack format
 
      (deltified representation)
      n-byte type and length (3-bit type, (n-1)*7+4-bit length)
-     20-byte base object name
+     20-byte base object name if OBJ_REF_DELTA or a negative relative
+        offset from the delta object's position in the pack if this
+        is an OBJ_OFS_DELTA object
      compressed delta data
 
      Observation: length of each object is encoded in a variable
diff --git a/INSTALL b/INSTALL
index 2dc3b61d1fe1b675377a6ece96feaddf8a0721ba..ba01e7421eb892cfe2b86c4b26786ae9e5bb00af 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -101,7 +101,7 @@ Issues of note:
        - "openssl" library is used by git-imap-send to use IMAP over SSL.
          If you don't need it, use NO_OPENSSL.
 
-         By default, git uses OpenSSL for SHA1 but it will use it's own
+         By default, git uses OpenSSL for SHA1 but it will use its own
          library (inspired by Mozilla's) with either NO_OPENSSL or
          BLK_SHA1.  Also included is a version optimized for PowerPC
          (PPC_SHA1).
index 3bc86260b8a2a809a379c91627f919ef0a529aa1..a8deee6e6419a1e867e06e90a70300cd2e01b556 100644 (file)
--- a/advice.c
+++ b/advice.c
@@ -13,6 +13,7 @@ int advice_commit_before_merge = 1;
 int advice_resolve_conflict = 1;
 int advice_implicit_identity = 1;
 int advice_detached_head = 1;
+int advice_set_upstream_failure = 1;
 
 static struct {
        const char *name;
@@ -31,6 +32,7 @@ static struct {
        { "resolveconflict", &advice_resolve_conflict },
        { "implicitidentity", &advice_implicit_identity },
        { "detachedhead", &advice_detached_head },
+       { "setupstreamfailure", &advice_set_upstream_failure },
 
        /* make this an alias for backward compatibility */
        { "pushnonfastforward", &advice_push_update_rejected }
index af0c983c686b9ca5be2e8631562e60bd19656c22..94caa32f9213f59a627176ec8b4aea022f6b0f8f 100644 (file)
--- a/advice.h
+++ b/advice.h
@@ -16,6 +16,7 @@ extern int advice_commit_before_merge;
 extern int advice_resolve_conflict;
 extern int advice_implicit_identity;
 extern int advice_detached_head;
+extern int advice_set_upstream_failure;
 
 int git_default_advice_config(const char *var, const char *value);
 void advise(const char *advice, ...);
index bd1b7b5dac81ada592a16630214d1f2cbb655b88..374d9e24bd0a18b0453f3e948db93251a859ba18 100644 (file)
--- a/bisect.c
+++ b/bisect.c
@@ -525,9 +525,9 @@ struct commit_list *filter_skipped(struct commit_list *list,
  * is increased by one between each call, but that should not matter
  * for this application.
  */
-static int get_prn(int count) {
+static unsigned get_prn(unsigned count) {
        count = count * 1103515245 + 12345;
-       return ((unsigned)(count/65536) % PRN_MODULO);
+       return (count/65536) % PRN_MODULO;
 }
 
 /*
index 2bef1e7e71b7cb3375b3d96fab5c4f20e0c3adff..6ae6a4c321ab8866a3e21f15302b5549a95b4646 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -197,6 +197,20 @@ int validate_new_branchname(const char *name, struct strbuf *ref,
        return 1;
 }
 
+static const char upstream_not_branch[] =
+N_("Cannot setup tracking information; starting point '%s' is not a branch.");
+static const char upstream_missing[] =
+N_("the requested upstream branch '%s' does not exist");
+static const char upstream_advice[] =
+N_("\n"
+"If you are planning on basing your work on an upstream\n"
+"branch that already exists at the remote, you may need to\n"
+"run \"git fetch\" to retrieve it.\n"
+"\n"
+"If you are planning to push out a new local branch that\n"
+"will track its remote counterpart, you may want to use\n"
+"\"git push -u\" to set the upstream config as you push.");
+
 void create_branch(const char *head,
                   const char *name, const char *start_name,
                   int force, int reflog, int clobber_head,
@@ -224,21 +238,30 @@ void create_branch(const char *head,
        }
 
        real_ref = NULL;
-       if (get_sha1(start_name, sha1))
+       if (get_sha1(start_name, sha1)) {
+               if (explicit_tracking) {
+                       if (advice_set_upstream_failure) {
+                               error(_(upstream_missing), start_name);
+                               advise(_(upstream_advice));
+                               exit(1);
+                       }
+                       die(_(upstream_missing), start_name);
+               }
                die("Not a valid object name: '%s'.", start_name);
+       }
 
        switch (dwim_ref(start_name, strlen(start_name), sha1, &real_ref)) {
        case 0:
                /* Not branching from any existing branch */
                if (explicit_tracking)
-                       die("Cannot setup tracking information; starting point is not a branch.");
+                       die(_(upstream_not_branch), start_name);
                break;
        case 1:
                /* Unique completion -- good, only if it is a real branch */
                if (prefixcmp(real_ref, "refs/heads/") &&
                    prefixcmp(real_ref, "refs/remotes/")) {
                        if (explicit_tracking)
-                               die("Cannot setup tracking information; starting point is not a branch.");
+                               die(_(upstream_not_branch), start_name);
                        else
                                real_ref = NULL;
                }
index 5b882d01f6622b1be4f494d2f4a3cbda5adeec08..30eefc3c7b390800e9452a06da18208d2fef4f11 100644 (file)
@@ -1921,7 +1921,7 @@ static int parse_binary(char *buffer, unsigned long size, struct patch *patch)
 }
 
 /*
- * Read the patch text in "buffer" taht extends for "size" bytes; stop
+ * Read the patch text in "buffer" that extends for "size" bytes; stop
  * reading after seeing a single patch (i.e. changes to a single file).
  * Create fragments (i.e. patch hunks) and hang them to the given patch.
  * Return the number of bytes consumed, so that the caller can call us
@@ -3029,7 +3029,7 @@ static struct patch *in_fn_table(const char *name)
  *
  * The latter is needed to deal with a case where two paths A and B
  * are swapped by first renaming A to B and then renaming B to A;
- * moving A to B should not be prevented due to presense of B as we
+ * moving A to B should not be prevented due to presence of B as we
  * will remove it in a later patch.
  */
 #define PATH_TO_BE_DELETED ((struct patch *) -2)
@@ -3513,7 +3513,7 @@ static int check_patch(struct patch *patch)
         *
         * A patch to swap-rename between A and B would first rename A
         * to B and then rename B to A.  While applying the first one,
-        * the presense of B should not stop A from getting renamed to
+        * the presence of B should not stop A from getting renamed to
         * B; ask to_be_deleted() about the later rename.  Removal of
         * B and rename from A to B is handled the same way by asking
         * was_deleted().
index d380155d9cf8fedf133dddbae479a910decd55b2..725c0a7dca70ae8cbb31f571e0284f5c31a61cff 100644 (file)
@@ -43,7 +43,7 @@ static int parse_opt_signed_tag_mode(const struct option *opt,
        else if (!strcmp(arg, "strip"))
                signed_tag_mode = STRIP;
        else
-               return error("Unknown signed-tag mode: %s", arg);
+               return error("Unknown signed-tags mode: %s", arg);
        return 0;
 }
 
@@ -420,7 +420,7 @@ static void handle_tag(const char *name, struct tag *tag)
                        switch(signed_tag_mode) {
                        case ABORT:
                                die ("Encountered signed tag %s; use "
-                                    "--signed-tag=<mode> to handle it.",
+                                    "--signed-tags=<mode> to handle it.",
                                     sha1_to_hex(tag->object.sha1));
                        case WARN:
                                warning ("Exporting signed tag %s",
@@ -618,9 +618,12 @@ static void import_marks(char *input_file)
                        || *mark_end != ' ' || get_sha1(mark_end + 1, sha1))
                        die("corrupt mark line: %s", line);
 
+               if (last_idnum < mark)
+                       last_idnum = mark;
+
                object = parse_object(sha1);
                if (!object)
-                       die ("Could not read blob %s", sha1_to_hex(sha1));
+                       continue;
 
                if (object->flags & SHOWN)
                        error("Object %s already has a mark", sha1_to_hex(sha1));
@@ -630,8 +633,6 @@ static void import_marks(char *input_file)
                        continue;
 
                mark_object(object, mark);
-               if (last_idnum < mark)
-                       last_idnum = mark;
 
                object->flags |= SHOWN;
        }
@@ -645,6 +646,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
        struct string_list extra_refs = STRING_LIST_INIT_NODUP;
        struct commit *commit;
        char *export_filename = NULL, *import_filename = NULL;
+       uint32_t lastimportid;
        struct option options[] = {
                OPT_INTEGER(0, "progress", &progress,
                            N_("show progress after <n> objects")),
@@ -688,6 +690,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
 
        if (import_filename)
                import_marks(import_filename);
+       lastimportid = last_idnum;
 
        if (import_filename && revs.prune_data.nr)
                full_tree = 1;
@@ -710,7 +713,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
 
        handle_tags_and_duplicates(&extra_refs);
 
-       if (export_filename)
+       if (export_filename && lastimportid != last_idnum)
                export_marks(export_filename);
 
        if (use_done_feature)
index d1d71816a9df67721578bc29665c15887575caec..062957f629af09db81d78b9cb0be1ce60fd75ec4 100644 (file)
@@ -36,10 +36,12 @@ enum help_format {
 static const char *html_path;
 
 static int show_all = 0;
+static int show_guides = 0;
 static unsigned int colopts;
 static enum help_format help_format = HELP_FORMAT_NONE;
 static struct option builtin_help_options[] = {
-       OPT_BOOLEAN('a', "all", &show_all, N_("print all available commands")),
+       OPT_BOOL('a', "all", &show_all, N_("print all available commands")),
+       OPT_BOOL('g', "guides", &show_guides, N_("print list of useful guides")),
        OPT_SET_INT('m', "man", &help_format, N_("show man page"), HELP_FORMAT_MAN),
        OPT_SET_INT('w', "web", &help_format, N_("show manual in web browser"),
                        HELP_FORMAT_WEB),
@@ -49,7 +51,7 @@ static struct option builtin_help_options[] = {
 };
 
 static const char * const builtin_help_usage[] = {
-       N_("git help [--all] [--man|--web|--info] [command]"),
+       N_("git help [--all] [--guides] [--man|--web|--info] [command]"),
        NULL
 };
 
@@ -413,6 +415,37 @@ static void show_html_page(const char *git_cmd)
        open_html(page_path.buf);
 }
 
+static struct {
+       const char *name;
+       const char *help;
+} common_guides[] = {
+       { "attributes", N_("Defining attributes per path") },
+       { "glossary", N_("A Git glossary") },
+       { "ignore", N_("Specifies intentionally untracked files to ignore") },
+       { "modules", N_("Defining submodule properties") },
+       { "revisions", N_("Specifying revisions and ranges for Git") },
+       { "tutorial", N_("A tutorial introduction to Git (for version 1.5.1 or newer)") },
+       { "workflows", N_("An overview of recommended workflows with Git") },
+};
+
+static void list_common_guides_help(void)
+{
+       int i, longest = 0;
+
+       for (i = 0; i < ARRAY_SIZE(common_guides); i++) {
+               if (longest < strlen(common_guides[i].name))
+                       longest = strlen(common_guides[i].name);
+       }
+
+       puts(_("The common Git guides are:\n"));
+       for (i = 0; i < ARRAY_SIZE(common_guides); i++) {
+               printf("   %s   ", common_guides[i].name);
+               mput_char(' ', longest - strlen(common_guides[i].name));
+               puts(_(common_guides[i].help));
+       }
+       putchar('\n');
+}
+
 int cmd_help(int argc, const char **argv, const char *prefix)
 {
        int nongit;
@@ -428,7 +461,16 @@ int cmd_help(int argc, const char **argv, const char *prefix)
                git_config(git_help_config, NULL);
                printf(_("usage: %s%s"), _(git_usage_string), "\n\n");
                list_commands(colopts, &main_cmds, &other_cmds);
+       }
+
+       if (show_guides)
+               list_common_guides_help();
+
+       if (show_all || show_guides) {
                printf("%s\n", _(git_more_info_string));
+               /*
+               * We're done. Ignore any remaining args
+               */
                return 0;
        }
 
index 5e4a0e958f3649c5a5a9f317876e8afd6f6bea6f..909c34dfda984be86fba2013fedc3fdb10b5e2f1 100644 (file)
@@ -322,7 +322,7 @@ static int push_with_options(struct transport *transport, int flags)
 static int do_push(const char *repo, int flags)
 {
        int i, errs;
-       struct remote *remote = remote_get(repo);
+       struct remote *remote = pushremote_get(repo);
        const char **url;
        int url_nr;
 
index dabfcf689068804f2b352d200b35770b467a27e8..7b91d52f39004dbfcc9b0dc5b8aadf3df5c6d320 100644 (file)
@@ -110,7 +110,7 @@ static int check_local_mod(unsigned char *head, int index_only)
                ce = active_cache[pos];
 
                if (lstat(ce->name, &st) < 0) {
-                       if (errno != ENOENT)
+                       if (errno != ENOENT && errno != ENOTDIR)
                                warning("'%s': %s", ce->name, strerror(errno));
                        /* It already vanished from the working tree */
                        continue;
diff --git a/cache.h b/cache.h
index c12957bb0364ed8e316cb055bf7c0710ef2ce28e..e1e8ce80ed11efb9483fca3205f383a3f0825cd7 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -719,8 +719,7 @@ enum sharedrepo {
        PERM_EVERYBODY      = 0664
 };
 int git_config_perm(const char *var, const char *value);
-int set_shared_perm(const char *path, int mode);
-#define adjust_shared_perm(path) set_shared_perm((path), 0)
+int adjust_shared_perm(const char *path);
 int safe_create_leading_directories(char *path);
 int safe_create_leading_directories_const(const char *path);
 int mkdir_in_gitdir(const char *path);
index 6288485965b5f79c1311e48e8de5c1be97730977..77d7872aafe659045e9ec228de97e87c9cea00a1 100644 (file)
@@ -74,16 +74,24 @@ static struct combine_diff_path *intersect_paths(struct combine_diff_path *curr,
 
 /* Lines lost from parent */
 struct lline {
-       struct lline *next;
+       struct lline *next, *prev;
        int len;
        unsigned long parent_map;
        char line[FLEX_ARRAY];
 };
 
+/* Lines lost from current parent (before coalescing) */
+struct plost {
+       struct lline *lost_head, *lost_tail;
+       int len;
+};
+
 /* Lines surviving in the merge result */
 struct sline {
-       struct lline *lost_head, **lost_tail;
-       struct lline *next_lost;
+       /* Accumulated and coalesced lost lines */
+       struct lline *lost;
+       int lenlost;
+       struct plost plost;
        char *bol;
        int len;
        /* bit 0 up to (N-1) are on if the parent has this line (i.e.
@@ -95,34 +103,6 @@ struct sline {
        unsigned long *p_lno;
 };
 
-static char *grab_blob(const unsigned char *sha1, unsigned int mode,
-                      unsigned long *size, struct userdiff_driver *textconv,
-                      const char *path)
-{
-       char *blob;
-       enum object_type type;
-
-       if (S_ISGITLINK(mode)) {
-               blob = xmalloc(100);
-               *size = snprintf(blob, 100,
-                                "Subproject commit %s\n", sha1_to_hex(sha1));
-       } else if (is_null_sha1(sha1)) {
-               /* deleted blob */
-               *size = 0;
-               return xcalloc(1, 1);
-       } else if (textconv) {
-               struct diff_filespec *df = alloc_filespec(path);
-               fill_filespec(df, sha1, 1, mode);
-               *size = fill_textconv(textconv, df, &blob);
-               free_filespec(df);
-       } else {
-               blob = read_sha1_file(sha1, &type, size);
-               if (type != OBJ_BLOB)
-                       die("object '%s' is not a blob!", sha1_to_hex(sha1));
-       }
-       return blob;
-}
-
 static int match_string_spaces(const char *line1, int len1,
                               const char *line2, int len2,
                               long flags)
@@ -163,36 +143,180 @@ static int match_string_spaces(const char *line1, int len1,
        return 0;
 }
 
-static void append_lost(struct sline *sline, int n, const char *line, int len, long flags)
+enum coalesce_direction { MATCH, BASE, NEW };
+
+/* Coalesce new lines into base by finding LCS */
+static struct lline *coalesce_lines(struct lline *base, int *lenbase,
+                                   struct lline *new, int lennew,
+                                   unsigned long parent, long flags)
 {
-       struct lline *lline;
-       unsigned long this_mask = (1UL<<n);
-       if (line[len-1] == '\n')
-               len--;
+       int **lcs;
+       enum coalesce_direction **directions;
+       struct lline *baseend, *newend = NULL;
+       int i, j, origbaselen = *lenbase;
 
-       /* Check to see if we can squash things */
-       if (sline->lost_head) {
-               lline = sline->next_lost;
-               while (lline) {
-                       if (match_string_spaces(lline->line, lline->len,
-                                               line, len, flags)) {
-                               lline->parent_map |= this_mask;
-                               sline->next_lost = lline->next;
-                               return;
+       if (new == NULL)
+               return base;
+
+       if (base == NULL) {
+               *lenbase = lennew;
+               return new;
+       }
+
+       /*
+        * Coalesce new lines into base by finding the LCS
+        * - Create the table to run dynamic programing
+        * - Compute the LCS
+        * - Then reverse read the direction structure:
+        *   - If we have MATCH, assign parent to base flag, and consume
+        *   both baseend and newend
+        *   - Else if we have BASE, consume baseend
+        *   - Else if we have NEW, insert newend lline into base and
+        *   consume newend
+        */
+       lcs = xcalloc(origbaselen + 1, sizeof(int*));
+       directions = xcalloc(origbaselen + 1, sizeof(enum coalesce_direction*));
+       for (i = 0; i < origbaselen + 1; i++) {
+               lcs[i] = xcalloc(lennew + 1, sizeof(int));
+               directions[i] = xcalloc(lennew + 1, sizeof(enum coalesce_direction));
+               directions[i][0] = BASE;
+       }
+       for (j = 1; j < lennew + 1; j++)
+               directions[0][j] = NEW;
+
+       for (i = 1, baseend = base; i < origbaselen + 1; i++) {
+               for (j = 1, newend = new; j < lennew + 1; j++) {
+                       if (match_string_spaces(baseend->line, baseend->len,
+                                               newend->line, newend->len, flags)) {
+                               lcs[i][j] = lcs[i - 1][j - 1] + 1;
+                               directions[i][j] = MATCH;
+                       } else if (lcs[i][j - 1] >= lcs[i - 1][j]) {
+                               lcs[i][j] = lcs[i][j - 1];
+                               directions[i][j] = NEW;
+                       } else {
+                               lcs[i][j] = lcs[i - 1][j];
+                               directions[i][j] = BASE;
+                       }
+                       if (newend->next)
+                               newend = newend->next;
+               }
+               if (baseend->next)
+                       baseend = baseend->next;
+       }
+
+       for (i = 0; i < origbaselen + 1; i++)
+               free(lcs[i]);
+       free(lcs);
+
+       /* At this point, baseend and newend point to the end of each lists */
+       i--;
+       j--;
+       while (i != 0 || j != 0) {
+               if (directions[i][j] == MATCH) {
+                       baseend->parent_map |= 1<<parent;
+                       baseend = baseend->prev;
+                       newend = newend->prev;
+                       i--;
+                       j--;
+               } else if (directions[i][j] == NEW) {
+                       struct lline *lline;
+
+                       lline = newend;
+                       /* Remove lline from new list and update newend */
+                       if (lline->prev)
+                               lline->prev->next = lline->next;
+                       else
+                               new = lline->next;
+                       if (lline->next)
+                               lline->next->prev = lline->prev;
+
+                       newend = lline->prev;
+                       j--;
+
+                       /* Add lline to base list */
+                       if (baseend) {
+                               lline->next = baseend->next;
+                               lline->prev = baseend;
+                               if (lline->prev)
+                                       lline->prev->next = lline;
                        }
-                       lline = lline->next;
+                       else {
+                               lline->next = base;
+                               base = lline;
+                       }
+                       (*lenbase)++;
+
+                       if (lline->next)
+                               lline->next->prev = lline;
+
+               } else {
+                       baseend = baseend->prev;
+                       i--;
                }
        }
 
+       newend = new;
+       while (newend) {
+               struct lline *lline = newend;
+               newend = newend->next;
+               free(lline);
+       }
+
+       for (i = 0; i < origbaselen + 1; i++)
+               free(directions[i]);
+       free(directions);
+
+       return base;
+}
+
+static char *grab_blob(const unsigned char *sha1, unsigned int mode,
+                      unsigned long *size, struct userdiff_driver *textconv,
+                      const char *path)
+{
+       char *blob;
+       enum object_type type;
+
+       if (S_ISGITLINK(mode)) {
+               blob = xmalloc(100);
+               *size = snprintf(blob, 100,
+                                "Subproject commit %s\n", sha1_to_hex(sha1));
+       } else if (is_null_sha1(sha1)) {
+               /* deleted blob */
+               *size = 0;
+               return xcalloc(1, 1);
+       } else if (textconv) {
+               struct diff_filespec *df = alloc_filespec(path);
+               fill_filespec(df, sha1, 1, mode);
+               *size = fill_textconv(textconv, df, &blob);
+               free_filespec(df);
+       } else {
+               blob = read_sha1_file(sha1, &type, size);
+               if (type != OBJ_BLOB)
+                       die("object '%s' is not a blob!", sha1_to_hex(sha1));
+       }
+       return blob;
+}
+
+static void append_lost(struct sline *sline, int n, const char *line, int len)
+{
+       struct lline *lline;
+       unsigned long this_mask = (1UL<<n);
+       if (line[len-1] == '\n')
+               len--;
+
        lline = xmalloc(sizeof(*lline) + len + 1);
        lline->len = len;
        lline->next = NULL;
+       lline->prev = sline->plost.lost_tail;
+       if (lline->prev)
+               lline->prev->next = lline;
+       else
+               sline->plost.lost_head = lline;
+       sline->plost.lost_tail = lline;
+       sline->plost.len++;
        lline->parent_map = this_mask;
        memcpy(lline->line, line, len);
        lline->line[len] = 0;
-       *sline->lost_tail = lline;
-       sline->lost_tail = &lline->next;
-       sline->next_lost = NULL;
 }
 
 struct combine_diff_state {
@@ -203,7 +327,6 @@ struct combine_diff_state {
        int n;
        struct sline *sline;
        struct sline *lost_bucket;
-       long flags;
 };
 
 static void consume_line(void *state_, char *line, unsigned long len)
@@ -236,14 +359,13 @@ static void consume_line(void *state_, char *line, unsigned long len)
                                xcalloc(state->num_parent,
                                        sizeof(unsigned long));
                state->sline[state->nb-1].p_lno[state->n] = state->ob;
-               state->lost_bucket->next_lost = state->lost_bucket->lost_head;
                return;
        }
        if (!state->lost_bucket)
                return; /* not in any hunk yet */
        switch (line[0]) {
        case '-':
-               append_lost(state->lost_bucket, state->n, line+1, len-1, state->flags);
+               append_lost(state->lost_bucket, state->n, line+1, len-1);
                break;
        case '+':
                state->sline[state->lno-1].flag |= state->nmask;
@@ -276,7 +398,6 @@ static void combine_diff(const unsigned char *parent, unsigned int mode,
        xpp.flags = flags;
        memset(&xecfg, 0, sizeof(xecfg));
        memset(&state, 0, sizeof(state));
-       state.flags = flags;
        state.nmask = nmask;
        state.sline = sline;
        state.lno = 1;
@@ -298,8 +419,18 @@ static void combine_diff(const unsigned char *parent, unsigned int mode,
                struct lline *ll;
                sline[lno].p_lno[n] = p_lno;
 
+               /* Coalesce new lines */
+               if (sline[lno].plost.lost_head) {
+                       struct sline *sl = &sline[lno];
+                       sl->lost = coalesce_lines(sl->lost, &sl->lenlost,
+                                                 sl->plost.lost_head,
+                                                 sl->plost.len, n, flags);
+                       sl->plost.lost_head = sl->plost.lost_tail = NULL;
+                       sl->plost.len = 0;
+               }
+
                /* How many lines would this sline advance the p_lno? */
-               ll = sline[lno].lost_head;
+               ll = sline[lno].lost;
                while (ll) {
                        if (ll->parent_map & nmask)
                                p_lno++; /* '-' means parent had it */
@@ -319,7 +450,7 @@ static int interesting(struct sline *sline, unsigned long all_mask)
        /* If some parents lost lines here, or if we have added to
         * some parent, it is interesting.
         */
-       return ((sline->flag & all_mask) || sline->lost_head);
+       return ((sline->flag & all_mask) || sline->lost);
 }
 
 static unsigned long adjust_hunk_tail(struct sline *sline,
@@ -502,7 +633,7 @@ static int make_hunks(struct sline *sline, unsigned long cnt,
                has_interesting = 0;
                for (j = i; j < hunk_end && !has_interesting; j++) {
                        unsigned long this_diff = sline[j].flag & all_mask;
-                       struct lline *ll = sline[j].lost_head;
+                       struct lline *ll = sline[j].lost;
                        if (this_diff) {
                                /* This has some changes.  Is it the
                                 * same as others?
@@ -656,7 +787,7 @@ static void dump_sline(struct sline *sline, const char *line_prefix,
                        int j;
                        unsigned long p_mask;
                        struct sline *sl = &sline[lno++];
-                       ll = (sl->flag & no_pre_delete) ? NULL : sl->lost_head;
+                       ll = (sl->flag & no_pre_delete) ? NULL : sl->lost;
                        while (ll) {
                                printf("%s%s", line_prefix, c_old);
                                for (j = 0; j < num_parent; j++) {
@@ -707,7 +838,7 @@ static void reuse_combine_diff(struct sline *sline, unsigned long cnt,
        jmask = (1UL<<j);
 
        for (lno = 0; lno <= cnt; lno++) {
-               struct lline *ll = sline->lost_head;
+               struct lline *ll = sline->lost;
                sline->p_lno[i] = sline->p_lno[j];
                while (ll) {
                        if (ll->parent_map & jmask)
@@ -966,10 +1097,6 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
 
        sline = xcalloc(cnt+2, sizeof(*sline));
        sline[0].bol = result;
-       for (lno = 0; lno <= cnt + 1; lno++) {
-               sline[lno].lost_tail = &sline[lno].lost_head;
-               sline[lno].flag = 0;
-       }
        for (lno = 0, cp = result; cp < result + result_size; cp++) {
                if (*cp == '\n') {
                        sline[lno].len = cp - sline[lno].bol;
@@ -1019,8 +1146,8 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
        free(result);
 
        for (lno = 0; lno < cnt; lno++) {
-               if (sline[lno].lost_head) {
-                       struct lline *ll = sline[lno].lost_head;
+               if (sline[lno].lost) {
+                       struct lline *ll = sline[lno].lost;
                        while (ll) {
                                struct lline *tmp = ll;
                                ll = ll->next;
index 516a4ff7d21d5ebcfabda7b1b886eb10b05cebfc..888e02ae2f65ab566555465e5d88d02bbe52420f 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -841,7 +841,7 @@ struct commit_list *get_merge_bases(struct commit *one, struct commit *two,
 }
 
 /*
- * Is "commit" a decendant of one of the elements on the "with_commit" list?
+ * Is "commit" a descendant of one of the elements on the "with_commit" list?
  */
 int is_descendant_of(struct commit *commit, struct commit_list *with_commit)
 {
index 87b4b6cc0c036d4b7d2ff67cf9d6e98c58f13793..057ff8045efb2cc80f747ee15b2a308a6dead5e5 100644 (file)
--- a/commit.h
+++ b/commit.h
@@ -166,7 +166,7 @@ extern struct commit_list *get_merge_bases(struct commit *rev1, struct commit *r
 extern struct commit_list *get_merge_bases_many(struct commit *one, int n, struct commit **twos, int cleanup);
 extern struct commit_list *get_octopus_merge_bases(struct commit_list *in);
 
-/* largest postive number a signed 32-bit integer can contain */
+/* largest positive number a signed 32-bit integer can contain */
 #define INFINITE_DEPTH 0x7fffffff
 
 extern int register_shallow(const unsigned char *sha1);
index ff7c2c4fd8642da754b1c85a9e177baf4ddc7136..1401a6727414480e181023f8de974bad76a04d24 100644 (file)
@@ -4778,7 +4778,7 @@ void* dlmalloc(size_t bytes) {
 
 void dlfree(void* mem) {
   /*
-     Consolidate freed chunks with preceeding or succeeding bordering
+     Consolidate freed chunks with preceding or succeeding bordering
      free chunks, if they exist, and then place in a bin.  Intermixed
      with special cases for top, dv, mmapped chunks, and usage errors.
   */
@@ -5680,10 +5680,10 @@ int mspace_mallopt(int param_number, int value) {
        Wolfram Gloger (Gloger@lrz.uni-muenchen.de).
       * Use last_remainder in more cases.
       * Pack bins using idea from  colin@nyx10.cs.du.edu
-      * Use ordered bins instead of best-fit threshhold
+      * Use ordered bins instead of best-fit threshold
       * Eliminate block-local decls to simplify tracing and debugging.
       * Support another case of realloc via move into top
-      * Fix error occuring when initial sbrk_base not word-aligned.
+      * Fix error occurring when initial sbrk_base not word-aligned.
       * Rely on page size for units instead of SBRK_UNIT to
        avoid surprises about sbrk alignment conventions.
       * Add mallinfo, mallopt. Thanks to Raymond Nijssen
index d178bd67162fd2b566364ac6dff84cecdcaa9473..ceb4bdbcdd6ed583ab3b7c9cc5d9d2783128dee6 100644 (file)
@@ -128,7 +128,7 @@ extern "C" {
 
 #define __BPTR_ALIGN(B, P, A) ((B) + (((P) - (B) + (A)) & ~(A)))
 
-/* Similiar to _BPTR_ALIGN (B, P, A), except optimize the common case
+/* Similar to _BPTR_ALIGN (B, P, A), except optimize the common case
    where pointers can be converted to integers, aligned as integers,
    and converted back again.  If PTR_INT_TYPE is narrower than a
    pointer (e.g., the AS/400), play it safe and compute the alignment
index 8cf59558e1c6fcc6782b8eaf94534ea041599191..030174db515e764aa883b21afe9be8fb3ae41f2e 100644 (file)
@@ -134,7 +134,7 @@ struct dirent_prec_psx *precompose_utf8_readdir(PREC_DIR *prec_dir)
                        if (prec_dir->ic_precompose == (iconv_t)-1) {
                                die("iconv_open(%s,%s) failed, but needed:\n"
                                                "    precomposed unicode is not supported.\n"
-                                               "    If you wnat to use decomposed unicode, run\n"
+                                               "    If you want to use decomposed unicode, run\n"
                                                "    \"git config core.precomposeunicode false\"\n",
                                                repo_encoding, path_encoding);
                        } else {
index 8c96ed942c3f7139a4b161c75c6c81e42530c085..d0025bd58d48cfcf137e5ef3bba90881dc00ec68 100644 (file)
@@ -2095,7 +2095,7 @@ peek_token_bracket (re_token_t *token, re_string_t *input, reg_syntax_t syntax)
 
 /* Entry point of the parser.
    Parse the regular expression REGEXP and return the structure tree.
-   If an error is occured, ERR is set by error code, and return NULL.
+   If an error has occurred, ERR is set by error code, and return NULL.
    This function build the following tree, from regular expression <reg_exp>:
           CAT
           / \
@@ -3715,7 +3715,7 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
 /* This is intended for the expressions like "a{1,3}".
    Fetch a number from `input', and return the number.
    Return -1, if the number field is empty like "{,1}".
-   Return -2, If an error is occured.  */
+   Return -2, if an error has occurred.  */
 
 static int
 fetch_number (re_string_t *input, re_token_t *token, reg_syntax_t syntax)
index 3dd8dfa01f2a6ab7a197ecddd481704150253c36..6aaae003274e268f274df4b76e02609d5f27e457 100644 (file)
@@ -22,7 +22,7 @@
 #include "config.h"
 #endif
 
-/* Make sure noone compiles this code with a C++ compiler.  */
+/* Make sure no one compiles this code with a C++ compiler.  */
 #ifdef __cplusplus
 # error "This is C code, use a C compiler"
 #endif
index 193854cf5b609d714b03218bd507af840d478c6e..d4121f2f4f1cfa9bf90c22b6e3c944f451225fdf 100644 (file)
@@ -1284,7 +1284,7 @@ re_node_set_merge (re_node_set *dest, const re_node_set *src)
 
 /* Insert the new element ELEM to the re_node_set* SET.
    SET should not already have ELEM.
-   return -1 if an error is occured, return 1 otherwise.  */
+   return -1 if an error has occurred, return 1 otherwise.  */
 
 static int
 internal_function
@@ -1341,7 +1341,7 @@ re_node_set_insert (re_node_set *set, int elem)
 
 /* Insert the new element ELEM to the re_node_set* SET.
    SET should not already have any element greater than or equal to ELEM.
-   Return -1 if an error is occured, return 1 otherwise.  */
+   Return -1 if an error has occurred, return 1 otherwise.  */
 
 static int
 internal_function
@@ -1416,7 +1416,7 @@ re_node_set_remove_at (re_node_set *set, int idx)
 \f
 
 /* Add the token TOKEN to dfa->nodes, and return the index of the token.
-   Or return -1, if an error will be occured.  */
+   Or return -1, if an error has occurred.  */
 
 static int
 internal_function
index 094129de09ca92643d98f34f20a35479089bcbcb..9c14c1f88d3a8f23df54db2adc7985eb00722c12 100755 (executable)
@@ -28,7 +28,7 @@
 use constant SLASH_REPLACEMENT => "%2F";
 
 # It's not always possible to delete pages (may require some
-# priviledges). Deleted pages are replaced with this content.
+# privileges). Deleted pages are replaced with this content.
 use constant DELETED_CONTENT => "[[Category:Deleted]]\n";
 
 # It's not possible to create empty pages. New empty files in Git are
@@ -841,7 +841,7 @@ sub mw_import_ref {
        if ($fetch_from == 1 && $n == 0) {
                print STDERR "You appear to have cloned an empty MediaWiki.\n";
                # Something has to be done remote-helper side. If nothing is done, an error is
-               # thrown saying that HEAD is refering to unknown object 0000000000000000000
+               # thrown saying that HEAD is referring to unknown object 0000000000000000000
                # and the clone fails.
        }
 }
@@ -1067,7 +1067,7 @@ sub mw_push_file {
                my $file_content;
                if ($page_deleted) {
                        # Deleting a page usually requires
-                       # special priviledges. A common
+                       # special privileges. A common
                        # convention is to replace the page
                        # with this content instead:
                        $file_content = DELETED_CONTENT;
index 96e97390cf90822e771bc8ccf600c394792f2b96..03f6ee5d72f5096e287c23e048746fe1f756f062 100644 (file)
@@ -25,7 +25,7 @@ Principles and Technical Choices
 
 The test environment makes it easy to install and manipulate one or
 several MediaWiki instances. To allow developers to run the testsuite
-easily, the environment does not require root priviledge (except to
+easily, the environment does not require root privilege (except to
 install the required packages if needed). It starts a webserver
 instance on the user's account (using lighttpd greatly helps for
 that), and does not need a separate database daemon (thanks to the use
@@ -81,7 +81,7 @@ parameters, please refer to the `test-gitmw-lib.sh` and
 
 ** `test_check_wiki_precond`:
 Check if the tests must be skipped or not. Please use this function
-at the beggining of each new test file.
+at the beginning of each new test file.
 
 ** `wiki_getpage`:
 Fetch a given page from the wiki and puts its content in the
@@ -113,7 +113,7 @@ Tests if a given page exists on the wiki.
 
 ** `wiki_reset`:
 Reset the wiki, i.e. flush the database. Use this function at the
-begining of each new test, except if the test re-uses the same wiki
+beginning of each new test, except if the test re-uses the same wiki
 (and history) as the previous test.
 
 How to write a new test
index 29f125116b59ed408339a37dbf82f2d913877d78..745e47e88173cac83c65b1c47d087cc98ec28621 100644 (file)
@@ -88,7 +88,7 @@ $wgShellLocale = "en_US.utf8";
 
 ## Set $wgCacheDirectory to a writable directory on the web server
 ## to make your wiki go slightly faster. The directory should not
-## be publically accessible from the web.
+## be publicly accessible from the web.
 #$wgCacheDirectory = "$IP/cache";
 
 # Site language code, should be one of the list in ./languages/Names.php
index b6405ce2628480240fc92ac5d69307991f2d5c69..37021e200a32d36e37f5c0ca7f6cacdca7d80187 100755 (executable)
@@ -139,7 +139,7 @@ test_expect_success 'character $ in file name (git -> mw) ' '
 '
 
 
-test_expect_failure 'capital at the begining of file names' '
+test_expect_failure 'capital at the beginning of file names' '
        wiki_reset &&
        git clone mediawiki::'"$WIKI_URL"' mw_dir_10 &&
        (
@@ -156,7 +156,7 @@ test_expect_failure 'capital at the begining of file names' '
 '
 
 
-test_expect_failure 'special character at the begining of file name from mw to git' '
+test_expect_failure 'special character at the beginning of file name from mw to git' '
        wiki_reset &&
        git clone mediawiki::'"$WIKI_URL"' mw_dir_11 &&
        wiki_editpage {char_1 "expect to be renamed {char_1" false &&
@@ -189,7 +189,7 @@ test_expect_success 'Push page with title containing ":" other than namespace se
        wiki_page_exist NotANameSpace:Page
 '
 
-test_expect_success 'test of correct formating for file name from mw to git' '
+test_expect_success 'test of correct formatting for file name from mw to git' '
        wiki_reset &&
        git clone mediawiki::'"$WIKI_URL"' mw_dir_12 &&
        wiki_editpage char_%_7b_1 "expect to be renamed char{_1" false &&
@@ -207,7 +207,7 @@ test_expect_success 'test of correct formating for file name from mw to git' '
 '
 
 
-test_expect_failure 'test of correct formating for file name begining with special character' '
+test_expect_failure 'test of correct formatting for file name beginning with special character' '
        wiki_reset &&
        git clone mediawiki::'"$WIKI_URL"' mw_dir_13 &&
        (
@@ -215,7 +215,7 @@ test_expect_failure 'test of correct formating for file name begining with speci
                echo "my new file {char_1" >\{char_1.mw &&
                echo "my new file [char_2" >\[char_2.mw &&
                git add . &&
-               git commit -am "commiting some exotic file name..." &&
+               git commit -am "committing some exotic file name..." &&
                git push &&
                git pull
        ) &&
@@ -226,7 +226,7 @@ test_expect_failure 'test of correct formating for file name begining with speci
 '
 
 
-test_expect_success 'test of correct formating for file name from git to mw' '
+test_expect_success 'test of correct formatting for file name from git to mw' '
        wiki_reset &&
        git clone mediawiki::'"$WIKI_URL"' mw_dir_14 &&
        (
@@ -234,7 +234,7 @@ test_expect_success 'test of correct formating for file name from git to mw' '
                echo "my new file char{_1" >Char\{_1.mw &&
                echo "my new file char[_2" >Char\[_2.mw &&
                git add . &&
-               git commit -m "commiting some exotic file name..." &&
+               git commit -m "committing some exotic file name..." &&
                git push
        ) &&
        wiki_getallpage ref_page_14 &&
index 9a76575f78f7c2cc6154c0a0d57f732de1e7f5d9..239161de33373d4ca97581a242cac848463fbbf3 100644 (file)
@@ -3,6 +3,7 @@ TESTS := $(wildcard test*.sh)
 export T := $(addprefix $(CURDIR)/,$(TESTS))
 export MAKE := $(MAKE) -e
 export PATH := $(CURDIR):$(PATH)
+export TEST_LINT := test-lint-executable test-lint-shell-syntax
 
 test:
        $(MAKE) -C ../../t $@
index c5822e4ac97ed3640c81cb645509346489199379..bd25e082027f90e614f3f265b94b49979d96e49f 100755 (executable)
@@ -25,6 +25,7 @@ bzrlib.plugin.load_plugins()
 
 import bzrlib.generate_ids
 import bzrlib.transport
+import bzrlib.errors
 
 import sys
 import os
@@ -183,15 +184,24 @@ def get_filechanges(cur, prev):
 
     changes = cur.changes_from(prev)
 
+    def u(s):
+        return s.encode('utf-8')
+
     for path, fid, kind in changes.added:
-        modified[path] = fid
+        modified[u(path)] = fid
     for path, fid, kind in changes.removed:
-        removed[path] = None
+        removed[u(path)] = None
     for path, fid, kind, mod, _ in changes.modified:
-        modified[path] = fid
+        modified[u(path)] = fid
     for oldpath, newpath, fid, kind, mod, _ in changes.renamed:
-        removed[oldpath] = None
-        modified[newpath] = fid
+        removed[u(oldpath)] = None
+        if kind == 'directory':
+            lst = cur.list_files(from_dir=newpath, recursive=True)
+            for path, file_class, kind, fid, entry in lst:
+                if kind != 'directory':
+                    modified[u(newpath + '/' + path)] = fid
+        else:
+            modified[u(newpath)] = fid
 
     return modified, removed
 
@@ -260,7 +270,12 @@ def export_branch(branch, name):
         tz = rev.timezone
         committer = rev.committer.encode('utf-8')
         committer = "%s %u %s" % (fixup_user(committer), time, gittz(tz))
-        author = committer
+        authors = rev.get_apparent_authors()
+        if authors:
+            author = authors[0].encode('utf-8')
+            author = "%s %u %s" % (fixup_user(author), time, gittz(tz))
+        else:
+            author = committer
         msg = rev.message.encode('utf-8')
 
         msg += '\n'
@@ -297,10 +312,10 @@ def export_branch(branch, name):
             else:
                 print "merge :%s" % m
 
+        for f in removed:
+            print "D %s" % (f,)
         for f in modified_final:
             print "M %s :%u %s" % f
-        for f in removed:
-            print "D %s" % (f)
         print
 
         count += 1
@@ -321,12 +336,9 @@ def export_branch(branch, name):
 
 def export_tag(repo, name):
     global tags
-    try:
-        print "reset refs/tags/%s" % name
-        print "from :%u" % rev_to_mark(tags[name])
-        print
-    except KeyError:
-        warn("TODO: fetch tag '%s'" % name)
+    print "reset refs/tags/%s" % name
+    print "from :%u" % rev_to_mark(tags[name])
+    print
 
 def do_import(parser):
     global dirname
@@ -501,6 +513,11 @@ class CustomTree():
     def get_symlink_target(self, file_id):
         return self.updates[file_id]['data']
 
+def c_style_unescape(string):
+    if string[0] == string[-1] == '"':
+        return string.decode('string-escape')[1:-1]
+    return string
+
 def parse_commit(parser):
     global marks, blob_marks, bmarks, parsed_refs
     global mode
@@ -540,6 +557,7 @@ def parse_commit(parser):
             f = { 'deleted' : True }
         else:
             die('Unknown file command: %s' % line)
+        path = c_style_unescape(path).decode('utf-8')
         files[path] = f
 
     repo = parser.repo
@@ -619,10 +637,9 @@ def do_export(parser):
                     peer.import_last_revision_info_and_tags(repo, revno, revid)
                 else:
                     peer.import_last_revision_info(repo.repository, revno, revid)
-                wt = peer.bzrdir.open_workingtree()
             else:
                 wt = repo.bzrdir.open_workingtree()
-            wt.update()
+                wt.update()
         print "ok %s" % ref
     print
 
@@ -641,12 +658,25 @@ def do_capabilities(parser):
 
     print
 
+def ref_is_valid(name):
+    return not True in [c in name for c in '~^: \\']
+
 def do_list(parser):
     global tags
     print "? refs/heads/%s" % 'master'
-    for tag, revid in parser.repo.tags.get_tag_dict().items():
+
+    branch = parser.repo
+    branch.lock_read()
+    for tag, revid in branch.tags.get_tag_dict().items():
+        try:
+            branch.revision_id_to_dotted_revno(revid)
+        except bzrlib.errors.NoSuchRevision:
+            continue
+        if not ref_is_valid(tag):
+            continue
         print "? refs/tags/%s" % tag
         tags[tag] = revid
+    branch.unlock()
     print "@refs/heads/%s HEAD" % 'master'
     print
 
index 70aa8a010a6bc00a131860f2db509e56a7f75797..34666e1d0f60813abf65fa231dc13f2b4c080440 100755 (executable)
@@ -17,20 +17,6 @@ if ! "$PYTHON_PATH" -c 'import bzrlib'; then
        test_done
 fi
 
-cmd='
-import bzrlib
-bzrlib.initialize()
-import bzrlib.plugin
-bzrlib.plugin.load_plugins()
-import bzrlib.plugins.fastimport
-'
-
-if ! "$PYTHON_PATH" -c "$cmd"; then
-       echo "consider setting BZR_PLUGIN_PATH=$HOME/.bazaar/plugins" 1>&2
-       skip_all='skipping remote-bzr tests; bzr-fastimport not available'
-       test_done
-fi
-
 check () {
        (cd $1 &&
        git log --format='%s' -1 &&
@@ -136,7 +122,109 @@ test_expect_success 'special modes' '
   (cd gitrepo &&
   git cat-file -p HEAD:link > ../actual) &&
 
-  echo -n content > expected &&
+  printf content > expected &&
+  test_cmp expected actual
+'
+
+cat > expected <<EOF
+100644 blob 54f9d6da5c91d556e6b54340b1327573073030af   content
+100755 blob 68769579c3eaadbe555379b9c3538e6628bae1eb   executable
+120000 blob 6b584e8ece562ebffc15d38808cd6b98fc3d97ea   link
+040000 tree 35c0caa46693cef62247ac89a680f0c5ce32b37b   movedir-new
+EOF
+
+test_expect_success 'moving directory' '
+  (cd bzrrepo &&
+  mkdir movedir &&
+  echo one > movedir/one &&
+  echo two > movedir/two &&
+  bzr add movedir &&
+  bzr commit -m movedir &&
+  bzr mv movedir movedir-new &&
+  bzr commit -m movedir-new) &&
+
+  (cd gitrepo &&
+  git pull &&
+  git ls-tree HEAD > ../actual) &&
+
+  test_cmp expected actual
+'
+
+test_expect_success 'different authors' '
+  (cd bzrrepo &&
+  echo john >> content &&
+  bzr commit -m john \
+    --author "Jane Rey <jrey@example.com>" \
+    --author "John Doe <jdoe@example.com>") &&
+
+  (cd gitrepo &&
+  git pull &&
+  git show --format="%an <%ae>, %cn <%ce>" --quiet > ../actual) &&
+
+  echo "Jane Rey <jrey@example.com>, A U Thor <author@example.com>" > expected &&
+  test_cmp expected actual
+'
+
+test_expect_success 'fetch utf-8 filenames' '
+  mkdir -p tmp && cd tmp &&
+  test_when_finished "cd .. && rm -rf tmp && LC_ALL=C" &&
+
+  LC_ALL=en_US.UTF-8
+  export LC_ALL
+  (
+  bzr init bzrrepo &&
+  cd bzrrepo &&
+
+  echo test >> "ærø" &&
+  bzr add "ærø" &&
+  echo test >> "ø~?" &&
+  bzr add "ø~?" &&
+  bzr commit -m add-utf-8 &&
+  echo test >> "ærø" &&
+  bzr commit -m test-utf-8 &&
+  bzr rm "ø~?" &&
+  bzr mv "ærø" "ø~?" &&
+  bzr commit -m bzr-mv-utf-8
+  ) &&
+
+  (
+  git clone "bzr::$PWD/bzrrepo" gitrepo &&
+  cd gitrepo &&
+  git -c core.quotepath=false ls-files > ../actual
+  ) &&
+  echo "ø~?" > expected &&
+  test_cmp expected actual
+'
+
+test_expect_success 'push utf-8 filenames' '
+  mkdir -p tmp && cd tmp &&
+  test_when_finished "cd .. && rm -rf tmp && LC_ALL=C" &&
+
+  LC_ALL=en_US.UTF-8
+  export LC_ALL
+
+  (
+  bzr init bzrrepo &&
+  cd bzrrepo &&
+
+  echo one >> content &&
+  bzr add content &&
+  bzr commit -m one
+  ) &&
+
+  (
+  git clone "bzr::$PWD/bzrrepo" gitrepo &&
+  cd gitrepo &&
+
+  echo test >> "ærø" &&
+  git add "ærø" &&
+  git commit -m utf-8 &&
+
+  git push
+  ) &&
+
+  (cd bzrrepo && bzr ls > ../actual) &&
+  printf "content\nærø\n" > expected &&
   test_cmp expected actual
 '
 
index 7e3967f5b6f0c19939bf1c0c30be0d756ec6aa04..3f253b7de75a6fa44c4cff3b2e1f53f9feffcf5d 100755 (executable)
@@ -140,7 +140,6 @@ test_expect_success 'executable bit' '
                git_clone_$x hgrepo-$x gitrepo2-$x &&
                git_log gitrepo2-$x > log-$x
        done &&
-       cp -r log-* output-* /tmp/foo/ &&
 
        test_cmp output-hg output-git &&
        test_cmp log-hg log-git
index 5f81dfae6c4a31f11ed766dd467fdd4a542afdf3..7bb81f2f8e0e288eb7e392075491fc1df0bd91d1 100755 (executable)
@@ -115,7 +115,7 @@ test_expect_success 'update bookmark' '
   git push
   ) &&
 
-  hg -R hgrepo bookmarks | grep "devel\s\+3:"
+  hg -R hgrepo bookmarks | egrep "devel[        ]+3:"
 '
 
 test_done
index 80d339960bbd5f70d17472a6f39f715dd8ec9182..b0f8536fca58d910f85334727b89925651bfa8ae 100755 (executable)
@@ -419,7 +419,7 @@ test_expect_success 'add main-sub5' '
 test_expect_success 'split for main-sub5 without --onto' '
         # also test that we still can split out an entirely new subtree
         # if the parent of the first commit in the tree is not empty,
-        # then the new subtree has accidently been attached to something
+       # then the new subtree has accidentally been attached to something
         git subtree split --prefix subdir2 --branch mainsub5 &&
         check_equal ''"$(git log --pretty=format:%P -1 mainsub5)"'' ""
 '
diff --git a/diff.c b/diff.c
index db952a5bc71ac967cb045bada8c71f5fda218ca2..0eb26535f52adf516961672628f2810e55a31a9d 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -1565,7 +1565,7 @@ static void show_stats(struct diffstat_t *data, struct diff_options *options)
         * Binary files are displayed with "Bin XXX -> YYY bytes"
         * instead of the change count and graph. This part is treated
         * similarly to the graph part, except that it is not
-        * "scaled". If total width is too small to accomodate the
+        * "scaled". If total width is too small to accommodate the
         * guaranteed minimum width of the filename part and the
         * separators and this message, this message will "overflow"
         * making the line longer than the maximum width.
index 44f8678d22ea466b0867591429bbcc3285cdaf91..1d9e530a84758e34d616690684c4842cd1af4cfc 100644 (file)
@@ -68,6 +68,9 @@ static int should_break(struct diff_filespec *src,
        if (max_size < MINIMUM_BREAK_SIZE)
                return 0; /* we do not break too small filepair */
 
+       if (!src->size)
+               return 0; /* we do not let empty files get renamed */
+
        if (diffcore_count_changes(src, dst,
                                   &src->cnt_data, &dst->cnt_data,
                                   0,
index b097fa766177f90e4b7983789a9286506664b2fd..63722f86dca4c00389d6f305fd8aa1af8ef8ed6c 100644 (file)
@@ -8,7 +8,12 @@
 #include "xdiff-interface.h"
 #include "kwset.h"
 
-typedef int (*pickaxe_fn)(struct diff_filepair *p, struct diff_options *o, regex_t *regexp, kwset_t kws);
+typedef int (*pickaxe_fn)(mmfile_t *one, mmfile_t *two,
+                         struct diff_options *o,
+                         regex_t *regexp, kwset_t kws);
+
+static int pickaxe_match(struct diff_filepair *p, struct diff_options *o,
+                        regex_t *regexp, kwset_t kws, pickaxe_fn fn);
 
 static void pickaxe(struct diff_queue_struct *q, struct diff_options *o,
                    regex_t *regexp, kwset_t kws, pickaxe_fn fn)
@@ -22,7 +27,7 @@ static void pickaxe(struct diff_queue_struct *q, struct diff_options *o,
                /* Showing the whole changeset if needle exists */
                for (i = 0; i < q->nr; i++) {
                        struct diff_filepair *p = q->queue[i];
-                       if (fn(p, o, regexp, kws))
+                       if (pickaxe_match(p, o, regexp, kws, fn))
                                return; /* do not munge the queue */
                }
 
@@ -37,7 +42,7 @@ static void pickaxe(struct diff_queue_struct *q, struct diff_options *o,
                /* Showing only the filepairs that has the needle */
                for (i = 0; i < q->nr; i++) {
                        struct diff_filepair *p = q->queue[i];
-                       if (fn(p, o, regexp, kws))
+                       if (pickaxe_match(p, o, regexp, kws, fn))
                                diff_q(&outq, p);
                        else
                                diff_free_filepair(p);
@@ -74,64 +79,33 @@ static void diffgrep_consume(void *priv, char *line, unsigned long len)
        line[len] = hold;
 }
 
-static void fill_one(struct diff_filespec *one,
-                    mmfile_t *mf, struct userdiff_driver **textconv)
-{
-       if (DIFF_FILE_VALID(one)) {
-               *textconv = get_textconv(one);
-               mf->size = fill_textconv(*textconv, one, &mf->ptr);
-       } else {
-               memset(mf, 0, sizeof(*mf));
-       }
-}
-
-static int diff_grep(struct diff_filepair *p, struct diff_options *o,
+static int diff_grep(mmfile_t *one, mmfile_t *two,
+                    struct diff_options *o,
                     regex_t *regexp, kwset_t kws)
 {
        regmatch_t regmatch;
-       struct userdiff_driver *textconv_one = NULL;
-       struct userdiff_driver *textconv_two = NULL;
-       mmfile_t mf1, mf2;
-       int hit;
+       struct diffgrep_cb ecbdata;
+       xpparam_t xpp;
+       xdemitconf_t xecfg;
 
-       if (diff_unmodified_pair(p))
-               return 0;
+       if (!one)
+               return !regexec(regexp, two->ptr, 1, &regmatch, 0);
+       if (!two)
+               return !regexec(regexp, one->ptr, 1, &regmatch, 0);
 
-       fill_one(p->one, &mf1, &textconv_one);
-       fill_one(p->two, &mf2, &textconv_two);
-
-       if (!mf1.ptr) {
-               if (!mf2.ptr)
-                       return 0; /* ignore unmerged */
-               /* created "two" -- does it have what we are looking for? */
-               hit = !regexec(regexp, mf2.ptr, 1, &regmatch, 0);
-       } else if (!mf2.ptr) {
-               /* removed "one" -- did it have what we are looking for? */
-               hit = !regexec(regexp, mf1.ptr, 1, &regmatch, 0);
-       } else {
-               /*
-                * We have both sides; need to run textual diff and see if
-                * the pattern appears on added/deleted lines.
-                */
-               struct diffgrep_cb ecbdata;
-               xpparam_t xpp;
-               xdemitconf_t xecfg;
-
-               memset(&xpp, 0, sizeof(xpp));
-               memset(&xecfg, 0, sizeof(xecfg));
-               ecbdata.regexp = regexp;
-               ecbdata.hit = 0;
-               xecfg.ctxlen = o->context;
-               xecfg.interhunkctxlen = o->interhunkcontext;
-               xdi_diff_outf(&mf1, &mf2, diffgrep_consume, &ecbdata,
-                             &xpp, &xecfg);
-               hit = ecbdata.hit;
-       }
-       if (textconv_one)
-               free(mf1.ptr);
-       if (textconv_two)
-               free(mf2.ptr);
-       return hit;
+       /*
+        * We have both sides; need to run textual diff and see if
+        * the pattern appears on added/deleted lines.
+        */
+       memset(&xpp, 0, sizeof(xpp));
+       memset(&xecfg, 0, sizeof(xecfg));
+       ecbdata.regexp = regexp;
+       ecbdata.hit = 0;
+       xecfg.ctxlen = o->context;
+       xecfg.interhunkctxlen = o->interhunkcontext;
+       xdi_diff_outf(one, two, diffgrep_consume, &ecbdata,
+                     &xpp, &xecfg);
+       return ecbdata.hit;
 }
 
 static void diffcore_pickaxe_grep(struct diff_options *o)
@@ -198,17 +172,37 @@ static unsigned int contains(mmfile_t *mf, struct diff_options *o,
        return cnt;
 }
 
-static int has_changes(struct diff_filepair *p, struct diff_options *o,
+static int has_changes(mmfile_t *one, mmfile_t *two,
+                      struct diff_options *o,
                       regex_t *regexp, kwset_t kws)
 {
-       struct userdiff_driver *textconv_one = get_textconv(p->one);
-       struct userdiff_driver *textconv_two = get_textconv(p->two);
+       if (!one)
+               return contains(two, o, regexp, kws) != 0;
+       if (!two)
+               return contains(one, o, regexp, kws) != 0;
+       return contains(one, o, regexp, kws) != contains(two, o, regexp, kws);
+}
+
+static int pickaxe_match(struct diff_filepair *p, struct diff_options *o,
+                        regex_t *regexp, kwset_t kws, pickaxe_fn fn)
+{
+       struct userdiff_driver *textconv_one = NULL;
+       struct userdiff_driver *textconv_two = NULL;
        mmfile_t mf1, mf2;
        int ret;
 
        if (!o->pickaxe[0])
                return 0;
 
+       /* ignore unmerged */
+       if (!DIFF_FILE_VALID(p->one) && !DIFF_FILE_VALID(p->two))
+               return 0;
+
+       if (DIFF_OPT_TST(o, ALLOW_TEXTCONV)) {
+               textconv_one = get_textconv(p->one);
+               textconv_two = get_textconv(p->two);
+       }
+
        /*
         * If we have an unmodified pair, we know that the count will be the
         * same and don't even have to load the blobs. Unless textconv is in
@@ -219,20 +213,12 @@ static int has_changes(struct diff_filepair *p, struct diff_options *o,
        if (textconv_one == textconv_two && diff_unmodified_pair(p))
                return 0;
 
-       fill_one(p->one, &mf1, &textconv_one);
-       fill_one(p->two, &mf2, &textconv_two);
+       mf1.size = fill_textconv(textconv_one, p->one, &mf1.ptr);
+       mf2.size = fill_textconv(textconv_two, p->two, &mf2.ptr);
 
-       if (!mf1.ptr) {
-               if (!mf2.ptr)
-                       ret = 0; /* ignore unmerged */
-               /* created */
-               ret = contains(&mf2, o, regexp, kws) != 0;
-       }
-       else if (!mf2.ptr) /* removed */
-               ret = contains(&mf1, o, regexp, kws) != 0;
-       else
-               ret = contains(&mf1, o, regexp, kws) !=
-                     contains(&mf2, o, regexp, kws);
+       ret = fn(DIFF_FILE_VALID(p->one) ? &mf1 : NULL,
+                DIFF_FILE_VALID(p->two) ? &mf2 : NULL,
+                o, regexp, kws);
 
        if (textconv_one)
                free(mf1.ptr);
diff --git a/dir.c b/dir.c
index 1e42b2b1509e2cf154a1d9722138fbeae437daf5..91cfd996711f8b9523da92ff75088292e16d316c 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -1647,7 +1647,7 @@ int remove_path(const char *name)
 {
        char *slash;
 
-       if (unlink(name) && errno != ENOENT)
+       if (unlink(name) && errno != ENOENT && errno != ENOTDIR)
                return -1;
 
        slash = strrchr(name, '/');
index 710764abb132f16e393fd16178b845d8160e37cf..d2c4ce6e1e88f543bd06cd8347e8949fef11a381 100755 (executable)
@@ -1247,7 +1247,7 @@ sub summarize_hunk {
 
 
 # Print a one-line summary of each hunk in the array ref in
-# the first argument, starting wih the index in the 2nd.
+# the first argument, starting with the index in the 2nd.
 sub display_hunks {
        my ($hunks, $i) = @_;
        my $ctr = 0;
index f1c3f49a836a8cf7f980bd3bc99d4fe9c2d49b65..a0d796e57087e0ca5bac94520997ecacec9fd295 100755 (executable)
@@ -2911,7 +2911,7 @@ sub filenamesplit
 }
 
 # Cleanup various junk in filename (try to canonicalize it), and
-# add prependdir to accomodate running CVS client from a
+# add prependdir to accommodate running CVS client from a
 # subdirectory (so the output is relative to top directory of the project).
 sub filecleanup
 {
@@ -4583,7 +4583,7 @@ sub getmeta
     #     the numerical value of the corresponding byte plus
     #     100.
     #      - "plus 100" avoids "0"s, and also reduces the
-    #        likelyhood of a collision in the case that someone someday
+    #        likelihood of a collision in the case that someone someday
     #        writes an import tool that tries to preserve original
     #        CVS revision numbers, and the original CVS data had done
     #        lots of branches off of branches and other strangeness to
index 53142492afcfb92f0453359af9a00a045c51e7e9..ac2a005fdb23c48d8451188ffd7b1c8194b0295f 100755 (executable)
@@ -199,6 +199,7 @@ t)
        test -d "$tempdir" &&
                die "$tempdir already exists, please remove it"
 esac
+orig_dir=$(pwd)
 mkdir -p "$tempdir/t" &&
 tempdir="$(cd "$tempdir"; pwd)" &&
 cd "$tempdir/t" &&
@@ -206,7 +207,7 @@ workdir="$(pwd)" ||
 die ""
 
 # Remove tempdir on exit
-trap 'cd ../..; rm -rf "$tempdir"' 0
+trap 'cd "$orig_dir"; rm -rf "$tempdir"' 0
 
 ORIG_GIT_DIR="$GIT_DIR"
 ORIG_GIT_WORK_TREE="$GIT_WORK_TREE"
@@ -469,7 +470,7 @@ if [ "$filter_tag_name" ]; then
        done
 fi
 
-cd ../..
+cd "$orig_dir"
 rm -rf "$tempdir"
 
 trap - 0
index 9a6ba2b9874e12d31adeba354d8d44436ceadaf3..8e17525dd86aa614000d9b335f9671a829678901 100755 (executable)
@@ -59,7 +59,7 @@ tmp_patch="$tmp_dir/patch"
 tmp_info="$tmp_dir/info"
 
 
-# Find the intial commit
+# Find the initial commit
 commit=$(git rev-parse HEAD)
 
 mkdir $tmp_dir || exit 2
diff --git a/git.c b/git.c
index 850d3f5527f4100f45cb5eb1a7d8772e04ae4443..1ada169d5cff3051effee33c6f9ba5b9be15b2e6 100644 (file)
--- a/git.c
+++ b/git.c
@@ -13,7 +13,9 @@ const char git_usage_string[] =
        "           <command> [<args>]";
 
 const char git_more_info_string[] =
-       N_("See 'git help <command>' for more information on a specific command.");
+       N_("'git help -a' and 'git help -g' lists available subcommands and some\n"
+          "concept guides. See 'git help <command>' or 'git help <concept>'\n"
+          "to read about a specific subcommand or concept.");
 
 static struct startup_info git_startup_info;
 static int use_pager = -1;
index 6d4540679731bdfd33af61635c59b798b19a8888..08f3dda02d43f9b2e994ee2f7a8dccaecb82733e 100644 (file)
@@ -244,7 +244,7 @@ for gitweb (in gitweb/README), and gitweb.conf(5) manpage.
   through the GITWEB_CONFIG_SYSTEM environment variable.
 
   Note that if per-instance configuration file exists, then system-wide
-  configuration is _not used at all_.  This is quite untypical and suprising
+  configuration is _not used at all_.  This is quite untypical and surprising
   behavior.  On the other hand changing current behavior would break backwards
   compatibility and can lead to unexpected changes in gitweb behavior.
   Therefore gitweb also looks for common system-wide configuration file,
index 1309196d27e675013825cdac8afd6d7328e44b1f..80950c018d54f3bbb7b700286b4923d39cbe2d00 100755 (executable)
@@ -683,7 +683,7 @@ sub evaluate_gitweb_config {
        our $GITWEB_CONFIG_SYSTEM = $ENV{'GITWEB_CONFIG_SYSTEM'} || "++GITWEB_CONFIG_SYSTEM++";
        our $GITWEB_CONFIG_COMMON = $ENV{'GITWEB_CONFIG_COMMON'} || "++GITWEB_CONFIG_COMMON++";
 
-       # Protect agains duplications of file names, to not read config twice.
+       # Protect against duplications of file names, to not read config twice.
        # Only one of $GITWEB_CONFIG and $GITWEB_CONFIG_SYSTEM is used, so
        # there possibility of duplication of filename there doesn't matter.
        $GITWEB_CONFIG = ""        if ($GITWEB_CONFIG eq $GITWEB_CONFIG_COMMON);
@@ -1136,7 +1136,7 @@ sub handle_errors_html {
 
        # to avoid infinite loop where error occurs in die_error,
        # change handler to default handler, disabling handle_errors_html
-       set_message("Error occured when inside die_error:\n$msg");
+       set_message("Error occurred when inside die_error:\n$msg");
 
        # you cannot jump out of die_error when called as error handler;
        # the subroutine set via CGI::Carp::set_message is called _after_
@@ -7485,7 +7485,7 @@ sub git_object {
                system(git_cmd(), "cat-file", '-e', $hash_base) == 0
                        or die_error(404, "Base object does not exist");
 
-               # here errors should not hapen
+               # here errors should not happen
                open my $fd, "-|", git_cmd(), "ls-tree", $hash_base, "--", $file_name
                        or die_error(500, "Open git-ls-tree failed");
                my $line = <$fd>;
diff --git a/kwset.c b/kwset.c
index 51b2ab6c7e61413851a958f7a4009a0194744b68..5800999b4c16cd8f5eeb2301f72c33ec62c5ea71 100644 (file)
--- a/kwset.c
+++ b/kwset.c
@@ -26,7 +26,7 @@
    The author may be reached (Email) at the address mike@ai.mit.edu,
    or (US mail) as Mike Haertel c/o Free Software Foundation. */
 
-/* The algorithm implemented by these routines bears a startling resemblence
+/* The algorithm implemented by these routines bears a startling resemblance
    to one discovered by Beate Commentz-Walter, although it is not identical.
    See "A String Matching Algorithm Fast on the Average," Technical Report,
    IBM-Germany, Scientific Center Heidelberg, Tiergartenstrasse 15, D-6900
@@ -435,7 +435,7 @@ kwsprep (kwset_t kws)
          /* Update the delta table for the descendents of this node. */
          treedelta(curr->links, curr->depth, delta);
 
-         /* Compute the failure function for the decendents of this node. */
+         /* Compute the failure function for the descendants of this node. */
          treefails(curr->links, curr->fail, kwset->trie);
 
          /* Update the shifts at each node in the current node's chain
diff --git a/path.c b/path.c
index 2fdccc2f18367399b8247ee79ec8bf4934f596cb..04ff1487ed31685b6b3f7923f9bfbfc7217f70a0 100644 (file)
--- a/path.c
+++ b/path.c
@@ -1,14 +1,5 @@
 /*
- * I'm tired of doing "vsnprintf()" etc just to open a
- * file, so here's a "return static buffer with printf"
- * interface for paths.
- *
- * It's obviously not thread-safe. Sue me. But it's quite
- * useful for doing things like
- *
- *   f = open(mkpath("%s/%s.git", base, name), O_RDONLY);
- *
- * which is what it's designed for.
+ * Utilities for paths and pathnames
  */
 #include "cache.h"
 #include "strbuf.h"
@@ -405,26 +396,14 @@ const char *enter_repo(const char *path, int strict)
        return NULL;
 }
 
-int set_shared_perm(const char *path, int mode)
+static int calc_shared_perm(int mode)
 {
-       int tweak, shared, orig_mode;
+       int tweak;
 
-       if (!shared_repository) {
-               if (mode)
-                       return chmod(path, mode & ~S_IFMT);
-               return 0;
-       }
-       if (!mode) {
-               if (get_st_mode_bits(path, &mode) < 0)
-                       return -1;
-               orig_mode = mode;
-       } else
-               orig_mode = 0;
        if (shared_repository < 0)
-               shared = -shared_repository;
+               tweak = -shared_repository;
        else
-               shared = shared_repository;
-       tweak = shared;
+               tweak = shared_repository;
 
        if (!(mode & S_IWUSR))
                tweak &= ~0222;
@@ -436,16 +415,28 @@ int set_shared_perm(const char *path, int mode)
        else
                mode |= tweak;
 
-       if (S_ISDIR(mode)) {
+       return mode;
+}
+
+
+int adjust_shared_perm(const char *path)
+{
+       int old_mode, new_mode;
+
+       if (!shared_repository)
+               return 0;
+       if (get_st_mode_bits(path, &old_mode) < 0)
+               return -1;
+
+       new_mode = calc_shared_perm(old_mode);
+       if (S_ISDIR(old_mode)) {
                /* Copy read bits to execute bits */
-               mode |= (shared & 0444) >> 2;
-               mode |= FORCE_DIR_SET_GID;
+               new_mode |= (new_mode & 0444) >> 2;
+               new_mode |= FORCE_DIR_SET_GID;
        }
 
-       if (((shared_repository < 0
-             ? (orig_mode & (FORCE_DIR_SET_GID | 0777))
-             : (orig_mode & mode)) != mode) &&
-           chmod(path, (mode & ~S_IFMT)) < 0)
+       if (((old_mode ^ new_mode) & ~S_IFMT) &&
+                       chmod(path, (new_mode & ~S_IFMT)) < 0)
                return -2;
        return 0;
 }
index 96cac39a4c8ebc0ce4e111271429fdf68b03bf97..dc48159ccab1cf2f888a6169460c5fc60d0d1bab 100644 (file)
@@ -1180,7 +1180,7 @@ sub credential {
 
 =item temp_acquire ( NAME )
 
-Attempts to retreive the temporary file mapped to the string C<NAME>. If an
+Attempts to retrieve the temporary file mapped to the string C<NAME>. If an
 associated temp file has not been created this session or was closed, it is
 created, cached, and set for autoflush and binmode.
 
@@ -1489,12 +1489,12 @@ sub _command_common_pipe {
                if (not defined $pid) {
                        throw Error::Simple("open failed: $!");
                } elsif ($pid == 0) {
-                       if (defined $opts{STDERR}) {
-                               close STDERR;
-                       }
                        if ($opts{STDERR}) {
                                open (STDERR, '>&', $opts{STDERR})
                                        or die "dup failed: $!";
+                       } elsif (defined $opts{STDERR}) {
+                               open (STDERR, '>', '/dev/null')
+                                       or die "opening /dev/null failed: $!";
                        }
                        _cmd_exec($self, $cmd, @args);
                }
index 40dd8971912d6b387bde7c9bb04cc6896521acec..f889fd6da91d2d9b6a7469442a02e5478f094f8d 100644 (file)
@@ -68,7 +68,7 @@ =head1 SYNOPSIS
 
        print __("Welcome to Git!\n");
 
-       printf __("The following error occured: %s\n"), $error;
+       printf __("The following error occurred: %s\n"), $error;
 
 =head1 DESCRIPTION
 
index 11e9cd9a02eb3f85a9150c6fb06d1fc76abd9b09..6098135ae2b2d473729373b69e776f475cf919dd 100644 (file)
@@ -630,7 +630,7 @@ =head1 CLASS INTERFACE
 =head2 CONSTRUCTORS
 
 The C<Error> object is implemented as a HASH. This HASH is initialized
-with the arguments that are passed to it's constructor. The elements
+with the arguments that are passed to its constructor. The elements
 that are used by, or are retrievable by the C<Error> class are listed
 below, other classes may add to these.
 
@@ -763,13 +763,13 @@ =head1 PRE-DEFINED ERROR CLASSES
 
 =item Error::Simple
 
-This class can be used to hold simple error strings and values. It's
+This class can be used to hold simple error strings and values. Its
 constructor takes two arguments. The first is a text value, the second
 is a numeric value. These values are what will be returned by the
 overload methods.
 
 If the text value ends with C<at file line 1> as $@ strings do, then
-this infomation will be used to set the C<-file> and C<-line> arguments
+this information will be used to set the C<-file> and C<-line> arguments
 of the error object.
 
 This class is used internally if an eval'd block die's with an error
index c1520e8cdeaf5ab5c52d2ae057582cd8f32b7fe6..d8c9111c82a541a39d71465c9b18a626d2dea94e 100644 (file)
--- a/po/README
+++ b/po/README
@@ -232,7 +232,7 @@ Shell:
 
        # To interpolate variables:
        details="oh noes"
-       eval_gettext "An error occured: \$details"; echo
+       eval_gettext "An error occurred: \$details"; echo
 
    In addition we have wrappers for messages that end with a trailing
    newline. I.e. you could write the above as:
@@ -242,7 +242,7 @@ Shell:
 
        # To interpolate variables:
        details="oh noes"
-       eval_gettextln "An error occured: \$details"
+       eval_gettextln "An error occurred: \$details"
 
    More documentation about the interface is available in the GNU info
    page: `info '(gettext)sh'`. Looking at git-am.sh (the first shell
@@ -257,7 +257,7 @@ Perl:
 
        use Git::I18N;
        print __("Welcome to Git!\n");
-       printf __("The following error occured: %s\n"), $error;
+       printf __("The following error occurred: %s\n"), $error;
 
    Run `perldoc perl/Git/I18N.pm` for more info.
 
index ca1edd901e4e64cb497b790f675537283c4ee1c0..68eb99bdf0ca3fedd02ab1bc93db7549b21b62d4 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -49,6 +49,7 @@ static int branches_nr;
 
 static struct branch *current_branch;
 static const char *default_remote_name;
+static const char *pushremote_name;
 static int explicit_default_remote_name;
 
 static struct rewrites rewrites;
@@ -357,13 +358,16 @@ static int handle_config(const char *key, const char *value, void *cb)
                        return 0;
                branch = make_branch(name, subkey - name);
                if (!strcmp(subkey, ".remote")) {
-                       if (!value)
-                               return config_error_nonbool(key);
-                       branch->remote_name = xstrdup(value);
+                       if (git_config_string(&branch->remote_name, key, value))
+                               return -1;
                        if (branch == current_branch) {
                                default_remote_name = branch->remote_name;
                                explicit_default_remote_name = 1;
                        }
+               } else if (!strcmp(subkey, ".pushremote")) {
+                       if (branch == current_branch)
+                               if (git_config_string(&pushremote_name, key, value))
+                                       return -1;
                } else if (!strcmp(subkey, ".merge")) {
                        if (!value)
                                return config_error_nonbool(key);
@@ -389,9 +393,16 @@ static int handle_config(const char *key, const char *value, void *cb)
                        add_instead_of(rewrite, xstrdup(value));
                }
        }
+
        if (prefixcmp(key,  "remote."))
                return 0;
        name = key + 7;
+
+       /* Handle remote.* variables */
+       if (!strcmp(name, "pushdefault"))
+               return git_config_string(&pushremote_name, key, value);
+
+       /* Handle remote.<name>.* variables */
        if (*name == '/') {
                warning("Config remote shorthand cannot begin with '/': %s",
                        name);
@@ -671,17 +682,21 @@ static int valid_remote_nick(const char *name)
        return !strchr(name, '/'); /* no slash */
 }
 
-struct remote *remote_get(const char *name)
+static struct remote *remote_get_1(const char *name, const char *pushremote_name)
 {
        struct remote *ret;
        int name_given = 0;
 
-       read_config();
        if (name)
                name_given = 1;
        else {
-               name = default_remote_name;
-               name_given = explicit_default_remote_name;
+               if (pushremote_name) {
+                       name = pushremote_name;
+                       name_given = 1;
+               } else {
+                       name = default_remote_name;
+                       name_given = explicit_default_remote_name;
+               }
        }
 
        ret = make_remote(name, 0);
@@ -700,6 +715,18 @@ struct remote *remote_get(const char *name)
        return ret;
 }
 
+struct remote *remote_get(const char *name)
+{
+       read_config();
+       return remote_get_1(name, NULL);
+}
+
+struct remote *pushremote_get(const char *name)
+{
+       read_config();
+       return remote_get_1(name, pushremote_name);
+}
+
 int remote_is_configured(const char *name)
 {
        int i;
index 8743d6ef9df69167c08f3ea9b79b91fbd6ab09d3..cf5672466151254b92582ba4729a2a95e670beff 100644 (file)
--- a/remote.h
+++ b/remote.h
@@ -51,6 +51,7 @@ struct remote {
 };
 
 struct remote *remote_get(const char *name);
+struct remote *pushremote_get(const char *name);
 int remote_is_configured(const char *name);
 
 typedef int each_remote_fn(struct remote *remote, void *priv);
index a6a5cd57bef4aaf204f1bad293c18b5af6f57f53..98e3e294d0dc295290b7b891a834186c0791e43a 100644 (file)
--- a/rerere.c
+++ b/rerere.c
@@ -284,8 +284,10 @@ static int rerere_mem_getline(struct strbuf *sb, struct rerere_io *io_)
        strbuf_release(sb);
        if (!io->input.len)
                return -1;
-       ep = strchrnul(io->input.buf, '\n');
-       if (*ep == '\n')
+       ep = memchr(io->input.buf, '\n', io->input.len);
+       if (!ep)
+               ep = io->input.buf + io->input.len;
+       else if (*ep == '\n')
                ep++;
        len = ep - io->input.buf;
        strbuf_add(sb, io->input.buf, len);
@@ -295,7 +297,7 @@ static int rerere_mem_getline(struct strbuf *sb, struct rerere_io *io_)
 
 static int handle_cache(const char *path, unsigned char *sha1, const char *output)
 {
-       mmfile_t mmfile[3];
+       mmfile_t mmfile[3] = {{NULL}};
        mmbuffer_t result = {NULL, 0};
        struct cache_entry *ce;
        int pos, len, i, hunk_no;
@@ -314,17 +316,16 @@ static int handle_cache(const char *path, unsigned char *sha1, const char *outpu
        for (i = 0; i < 3; i++) {
                enum object_type type;
                unsigned long size;
+               int j;
 
-               mmfile[i].size = 0;
-               mmfile[i].ptr = NULL;
                if (active_nr <= pos)
                        break;
                ce = active_cache[pos++];
-               if (ce_namelen(ce) != len || memcmp(ce->name, path, len)
-                   || ce_stage(ce) != i + 1)
-                       break;
-               mmfile[i].ptr = read_sha1_file(ce->sha1, &type, &size);
-               mmfile[i].size = size;
+               if (ce_namelen(ce) != len || memcmp(ce->name, path, len))
+                       continue;
+               j = ce_stage(ce) - 1;
+               mmfile[j].ptr = read_sha1_file(ce->sha1, &type, &size);
+               mmfile[j].size = size;
        }
        for (i = 0; i < 3; i++) {
                if (!mmfile[i].ptr && !mmfile[i].size)
index 71e62d831229773a9af2c4a81d72be5b33d3c921..eb981288686a2c7cd8c854e3f414b606ed4f8c69 100644 (file)
@@ -1970,22 +1970,6 @@ static struct merge_simplify_state *locate_simplify_state(struct rev_info *revs,
        return st;
 }
 
-static void remove_treesame_parents(struct commit *commit)
-{
-       struct commit_list **pp, *p;
-
-       pp = &commit->parents;
-       while ((p = *pp) != NULL) {
-               struct commit *parent = p->item;
-               if (parent->object.flags & TREESAME) {
-                       *pp = p->next;
-                       free(p);
-                       continue;
-               }
-               pp = &p->next;
-       }
-}
-
 static struct commit_list **simplify_one(struct rev_info *revs, struct commit *commit, struct commit_list **tail)
 {
        struct commit_list *p;
@@ -2039,17 +2023,10 @@ static struct commit_list **simplify_one(struct rev_info *revs, struct commit *c
                        break;
        }
 
-       if (revs->first_parent_only) {
+       if (revs->first_parent_only)
                cnt = 1;
-       } else {
-               /*
-                * A merge with a tree-same parent is useless
-                */
-               if (commit->parents && commit->parents->next)
-                       remove_treesame_parents(commit);
-
+       else
                cnt = remove_duplicate_parents(commit);
-       }
 
        /*
         * It is possible that we are a merge and one side branch
index baa031052e4e3f77bb6d4a257a5669ca5a5d617e..ee4f8c6ed4f040072b4d706c26d04a07f665c9f6 100644 (file)
@@ -216,7 +216,7 @@ static void print_advice(int show_hint, struct replay_opts *opts)
        if (msg) {
                fprintf(stderr, "%s\n", msg);
                /*
-                * A conflict has occured but the porcelain
+                * A conflict has occurred but the porcelain
                 * (typically rebase --interactive) wants to take care
                 * of the commit itself so remove CHERRY_PICK_HEAD
                 */
index 9b41fe7a9f55b3803aa52cd26c9f0af4e34830ee..e669bb31b9aa2513a6f71de9fd066a21a0a3bde7 100644 (file)
--- a/t/README
+++ b/t/README
@@ -86,7 +86,10 @@ appropriately before running "make".
 
 --immediate::
        This causes the test to immediately exit upon the first
-       failed test.
+       failed test. Cleanup commands requested with
+       test_when_finished are not executed if the test failed,
+       in order to keep the state for inspection by the tester
+       to diagnose the bug.
 
 --long-tests::
        This causes additional long-running tests to be run (where
@@ -619,6 +622,11 @@ use these, and "test_set_prereq" for how to define your own.
    The process retains the same pid across exec(2). See fb9a2bea for
    details.
 
+ - PIPE
+
+   The filesystem we're on supports creation of FIFOs (named pipes)
+   via mkfifo(1).
+
  - SYMLINKS
 
    The filesystem we're on supports symbolic links. E.g. a FAT
index d8b7f2ffbcc0427b1ae9d48feb4387f580e81d61..9820f70c84d93b9461ae6663e6ab5b3cd735e3d5 100755 (executable)
@@ -116,9 +116,9 @@ tree_pretty_content="100644 blob $hello_sha1        hello"
 
 run_tests 'tree' $tree_sha1 $tree_size "" "$tree_pretty_content"
 
-commit_message="Intial commit"
+commit_message="Initial commit"
 commit_sha1=$(echo_without_newline "$commit_message" | git commit-tree $tree_sha1)
-commit_size=176
+commit_size=177
 commit_content="tree $tree_sha1
 author $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL> 0000000000 +0000
 committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 0000000000 +0000
index f2620650ce1d25252210c07db20e54f99bd515c6..309199bca272b63499ca69edbb953bcc8c770ecc 100755 (executable)
@@ -44,14 +44,21 @@ prime_resolve_undo () {
 
 test_expect_success setup '
        mkdir fi &&
+       printf "a\0a" >binary &&
+       git add binary &&
        test_commit initial fi/le first &&
        git branch side &&
        git branch another &&
+       printf "a\0b" >binary &&
+       git add binary &&
        test_commit second fi/le second &&
        git checkout side &&
        test_commit third fi/le third &&
+       git branch add-add &&
        git checkout another &&
        test_commit fourth fi/le fourth &&
+       git checkout add-add &&
+       test_commit fifth add-differently &&
        git checkout master
 '
 
@@ -167,4 +174,22 @@ test_expect_success 'rerere and rerere forget (subdirectory)' '
        test_cmp expect actual
 '
 
+test_expect_success 'rerere forget (binary)' '
+       git checkout -f side &&
+       printf "a\0c" >binary &&
+       git commit -a -m binary &&
+       test_must_fail git merge second &&
+       git rerere forget binary
+'
+
+test_expect_success 'rerere forget (add-add conflict)' '
+       git checkout -f master &&
+       echo master >add-differently &&
+       git add add-differently &&
+       git commit -m "add differently" &&
+       test_must_fail git merge fifth &&
+       git rerere forget add-differently 2>actual &&
+       test_i18ngrep "no remembered" actual
+'
+
 test_done
index 8311c7da440a5932107cd8e4787f236c29518861..d969f0ecd85a6907f219d141cad2c00c4b5a89f8 100755 (executable)
@@ -409,6 +409,18 @@ test_expect_success '--set-upstream-to fails on detached HEAD' '
        git checkout -
 '
 
+test_expect_success '--set-upstream-to fails on a missing dst branch' '
+       test_must_fail git branch --set-upstream-to master does-not-exist
+'
+
+test_expect_success '--set-upstream-to fails on a missing src branch' '
+       test_must_fail git branch --set-upstream-to does-not-exist master
+'
+
+test_expect_success '--set-upstream-to fails on a non-ref' '
+       test_must_fail git branch --set-upstream-to HEAD^{}
+'
+
 test_expect_success 'use --set-upstream-to modify HEAD' '
        test_config branch.master.remote foo &&
        test_config branch.master.merge foo &&
index 37bf5f13b07a632cb8e96e865a75b51f1b7844aa..0c44e9f5d04af8d038a1e78ed5fdf892ce4dd5b5 100755 (executable)
@@ -622,4 +622,69 @@ test_expect_success 'rm of a populated nested submodule with a nested .git direc
        rm -rf submod
 '
 
+test_expect_success 'rm of d/f when d has become a non-directory' '
+       rm -rf d &&
+       mkdir d &&
+       >d/f &&
+       git add d &&
+       rm -rf d &&
+       >d &&
+       git rm d/f &&
+       test_must_fail git rev-parse --verify :d/f &&
+       test_path_is_file d
+'
+
+test_expect_success SYMLINKS 'rm of d/f when d has become a dangling symlink' '
+       rm -rf d &&
+       mkdir d &&
+       >d/f &&
+       git add d &&
+       rm -rf d &&
+       ln -s nonexistent d &&
+       git rm d/f &&
+       test_must_fail git rev-parse --verify :d/f &&
+       test -h d &&
+       test_path_is_missing d
+'
+
+test_expect_success 'rm of file when it has become a directory' '
+       rm -rf d &&
+       >d &&
+       git add d &&
+       rm -f d &&
+       mkdir d &&
+       >d/f &&
+       test_must_fail git rm d &&
+       git rev-parse --verify :d &&
+       test_path_is_file d/f
+'
+
+test_expect_success SYMLINKS 'rm across a symlinked leading path (no index)' '
+       rm -rf d e &&
+       mkdir e &&
+       echo content >e/f &&
+       ln -s e d &&
+       git add -A e d &&
+       git commit -m "symlink d to e, e/f exists" &&
+       test_must_fail git rm d/f &&
+       git rev-parse --verify :d &&
+       git rev-parse --verify :e/f &&
+       test -h d &&
+       test_path_is_file e/f
+'
+
+test_expect_failure SYMLINKS 'rm across a symlinked leading path (w/ index)' '
+       rm -rf d e &&
+       mkdir d &&
+       echo content >d/f &&
+       git add -A e d &&
+       git commit -m "d/f exists" &&
+       mv d e &&
+       ln -s e d &&
+       test_must_fail git rm d/f &&
+       git rev-parse --verify :d/f &&
+       test -h d &&
+       test_path_is_file e/f
+'
+
 test_done
index 098a6ae4a086ccfeb8c658a80773eb07c9d66441..9fab25cc96b079349a3ca3caffbd8d2bc322265c 100755 (executable)
@@ -319,7 +319,7 @@ test_expect_success PERL 'split hunk "add -p (edit)"' '
        # times to get out.
        #
        # 2. Correct version applies the (not)edited version, and asks
-       #    about the next hunk, against wich we say q and program
+       #    about the next hunk, against which we say q and program
        #    exits.
        for a in s e     q n q q
        do
index b993dae64574cd2828fc636d3afc15b2c0c2e5a0..86ee0771077a9da0404a276873c81dd17600ceb4 100755 (executable)
@@ -742,21 +742,21 @@ test_expect_success 'format-patch --signature --cover-letter' '
        test 2 = $(grep "my sig" output | wc -l)
 '
 
-test_expect_success 'format.signature="" supresses signatures' '
+test_expect_success 'format.signature="" suppresses signatures' '
        git config format.signature "" &&
        git format-patch --stdout -1 >output &&
        check_patch output &&
        ! grep "^-- \$" output
 '
 
-test_expect_success 'format-patch --no-signature supresses signatures' '
+test_expect_success 'format-patch --no-signature suppresses signatures' '
        git config --unset-all format.signature &&
        git format-patch --stdout --no-signature -1 >output &&
        check_patch output &&
        ! grep "^-- \$" output
 '
 
-test_expect_success 'format-patch --signature="" supresses signatures' '
+test_expect_success 'format-patch --signature="" suppresses signatures' '
        git format-patch --stdout --signature="" -1 >output &&
        check_patch output &&
        ! grep "^-- \$" output
index b7e16a7840afc32d36c6a118ed2fa1dbb579476a..1261dbbdf5869b671e36cd7128bfde61fd67b8de 100755 (executable)
@@ -224,4 +224,133 @@ test_expect_success 'check combined output (ignore all spaces)' '
        compare_diff_patch expected actual
 '
 
+test_expect_success 'combine diff coalesce simple' '
+       >test &&
+       git add test &&
+       git commit -m initial &&
+       test_seq 4 >test &&
+       git commit -a -m empty1 &&
+       git branch side1 &&
+       git checkout HEAD^ &&
+       test_seq 5 >test &&
+       git commit -a -m empty2 &&
+       test_must_fail git merge side1 &&
+       >test &&
+       git commit -a -m merge &&
+       git show >actual.tmp &&
+       sed -e "1,/^@@@/d" < actual.tmp >actual &&
+       tr -d Q <<-\EOF >expected &&
+       --1
+       --2
+       --3
+       --4
+       - 5
+       EOF
+       compare_diff_patch expected actual
+'
+
+test_expect_success 'combine diff coalesce tricky' '
+       >test &&
+       git add test &&
+       git commit -m initial --allow-empty &&
+       cat <<-\EOF >test &&
+       3
+       1
+       2
+       3
+       4
+       EOF
+       git commit -a -m empty1 &&
+       git branch -f side1 &&
+       git checkout HEAD^ &&
+       cat <<-\EOF >test &&
+       1
+       3
+       5
+       4
+       EOF
+       git commit -a -m empty2 &&
+       git branch -f side2 &&
+       test_must_fail git merge side1 &&
+       >test &&
+       git commit -a -m merge &&
+       git show >actual.tmp &&
+       sed -e "1,/^@@@/d" < actual.tmp >actual &&
+       tr -d Q <<-\EOF >expected &&
+        -3
+       --1
+        -2
+       --3
+       - 5
+       --4
+       EOF
+       compare_diff_patch expected actual &&
+       git checkout -f side1 &&
+       test_must_fail git merge side2 &&
+       >test &&
+       git commit -a -m merge &&
+       git show >actual.tmp &&
+       sed -e "1,/^@@@/d" < actual.tmp >actual &&
+       tr -d Q <<-\EOF >expected &&
+       - 3
+       --1
+       - 2
+       --3
+        -5
+       --4
+       EOF
+       compare_diff_patch expected actual
+'
+
+test_expect_failure 'combine diff coalesce three parents' '
+       >test &&
+       git add test &&
+       git commit -m initial --allow-empty &&
+       cat <<-\EOF >test &&
+       3
+       1
+       2
+       3
+       4
+       EOF
+       git commit -a -m empty1 &&
+       git checkout -B side1 &&
+       git checkout HEAD^ &&
+       cat <<-\EOF >test &&
+       1
+       3
+       7
+       5
+       4
+       EOF
+       git commit -a -m empty2 &&
+       git branch -f side2 &&
+       git checkout HEAD^ &&
+       cat <<-\EOF >test &&
+       3
+       1
+       6
+       5
+       4
+       EOF
+       git commit -a -m empty3 &&
+       >test &&
+       git add test &&
+       TREE=$(git write-tree) &&
+       COMMIT=$(git commit-tree -p HEAD -p side1 -p side2 -m merge $TREE) &&
+       git show $COMMIT >actual.tmp &&
+       sed -e "1,/^@@@/d" < actual.tmp >actual &&
+       tr -d Q <<-\EOF >expected &&
+       -- 3
+       ---1
+       -  6
+        - 2
+        --3
+         -7
+       - -5
+       ---4
+       EOF
+       compare_diff_patch expected actual
+'
+
 test_done
index 0bbcf0603d20380e71ef27cec654ec6c604561d1..5d0c5983381b4072d915de0f8d75053b19172d66 100755 (executable)
@@ -47,7 +47,7 @@ test_fix () {
        # find touched lines
        $DIFF file target | sed -n -e "s/^> //p" >fixed
 
-       # the changed lines are all expeced to change
+       # the changed lines are all expected to change
        fixed_cnt=$(wc -l <fixed)
        case "$1" in
        '') expect_cnt=$fixed_cnt ;;
index eed727341dca4cd16a2558644506573885baccd9..38fb80f643534a2bd724e13ef271f90167ac11a3 100755 (executable)
@@ -80,6 +80,20 @@ test_expect_success 'log -G -i (match)' '
        test_cmp expect actual
 '
 
+test_expect_success 'log -G --textconv (missing textconv tool)' '
+       echo "* diff=test" >.gitattributes &&
+       test_must_fail git -c diff.test.textconv=missing log -Gfoo &&
+       rm .gitattributes
+'
+
+test_expect_success 'log -G --no-textconv (missing textconv tool)' '
+       echo "* diff=test" >.gitattributes &&
+       git -c diff.test.textconv=missing log -Gfoo --no-textconv >actual &&
+       >expect &&
+       test_cmp expect actual &&
+       rm .gitattributes
+'
+
 test_expect_success 'log -S (nomatch)' '
        git log -Spicked --format=%H >actual &&
        >expect &&
@@ -116,4 +130,18 @@ test_expect_success 'log -S -i (nomatch)' '
        test_cmp expect actual
 '
 
+test_expect_success 'log -S --textconv (missing textconv tool)' '
+       echo "* diff=test" >.gitattributes &&
+       test_must_fail git -c diff.test.textconv=missing log -Sfoo &&
+       rm .gitattributes
+'
+
+test_expect_success 'log -S --no-textconv (missing textconv tool)' '
+       echo "* diff=test" >.gitattributes &&
+       git -c diff.test.textconv=missing log -Sfoo --no-textconv >actual &&
+       >expect &&
+       test_cmp expect actual &&
+       rm .gitattributes
+'
+
 test_done
index 32ad89107b20fc2187b416bc7e3f4d45e17474c6..838e71dafea8388cbe18c82b26f58f074f56abbd 100755 (executable)
@@ -1,16 +1,28 @@
 #!/bin/sh
 
-test_description='fetching and pushing, with or without wildcard'
+test_description='Basic fetch/push functionality.
+
+This test checks the following functionality:
+
+* command-line syntax
+* refspecs
+* fast-forward detection, and overriding it
+* configuration
+* hooks
+* --porcelain output format
+* hiderefs
+'
 
 . ./test-lib.sh
 
 D=`pwd`
 
 mk_empty () {
-       rm -fr testrepo &&
-       mkdir testrepo &&
+       repo_name="$1"
+       rm -fr "$repo_name" &&
+       mkdir "$repo_name" &&
        (
-               cd testrepo &&
+               cd "$repo_name" &&
                git init &&
                git config receive.denyCurrentBranch warn &&
                mv .git/hooks .git/hooks-disabled
@@ -18,14 +30,17 @@ mk_empty () {
 }
 
 mk_test () {
-       mk_empty &&
+       repo_name="$1"
+       shift
+
+       mk_empty "$repo_name" &&
        (
                for ref in "$@"
                do
-                       git push testrepo $the_first_commit:refs/$ref ||
+                       git push "$repo_name" $the_first_commit:refs/$ref ||
                        exit
                done &&
-               cd testrepo &&
+               cd "$repo_name" &&
                for ref in "$@"
                do
                        echo "$the_first_commit" >expect &&
@@ -38,9 +53,10 @@ mk_test () {
 }
 
 mk_test_with_hooks() {
+       repo_name=$1
        mk_test "$@" &&
        (
-               cd testrepo &&
+               cd "$repo_name" &&
                mkdir .git/hooks &&
                cd .git/hooks &&
 
@@ -72,13 +88,16 @@ mk_test_with_hooks() {
 }
 
 mk_child() {
-       rm -rf "$1" &&
-       git clone testrepo "$1"
+       rm -rf "$2" &&
+       git clone "$1" "$2"
 }
 
 check_push_result () {
+       repo_name="$1"
+       shift
+
        (
-               cd testrepo &&
+               cd "$repo_name" &&
                echo "$1" >expect &&
                shift &&
                for ref in "$@"
@@ -108,7 +127,7 @@ test_expect_success setup '
 '
 
 test_expect_success 'fetch without wildcard' '
-       mk_empty &&
+       mk_empty testrepo &&
        (
                cd testrepo &&
                git fetch .. refs/heads/master:refs/remotes/origin/master &&
@@ -120,7 +139,7 @@ test_expect_success 'fetch without wildcard' '
 '
 
 test_expect_success 'fetch with wildcard' '
-       mk_empty &&
+       mk_empty testrepo &&
        (
                cd testrepo &&
                git config remote.up.url .. &&
@@ -134,7 +153,7 @@ test_expect_success 'fetch with wildcard' '
 '
 
 test_expect_success 'fetch with insteadOf' '
-       mk_empty &&
+       mk_empty testrepo &&
        (
                TRASH=$(pwd)/ &&
                cd testrepo &&
@@ -150,7 +169,7 @@ test_expect_success 'fetch with insteadOf' '
 '
 
 test_expect_success 'fetch with pushInsteadOf (should not rewrite)' '
-       mk_empty &&
+       mk_empty testrepo &&
        (
                TRASH=$(pwd)/ &&
                cd testrepo &&
@@ -166,7 +185,7 @@ test_expect_success 'fetch with pushInsteadOf (should not rewrite)' '
 '
 
 test_expect_success 'push without wildcard' '
-       mk_empty &&
+       mk_empty testrepo &&
 
        git push testrepo refs/heads/master:refs/remotes/origin/master &&
        (
@@ -178,7 +197,7 @@ test_expect_success 'push without wildcard' '
 '
 
 test_expect_success 'push with wildcard' '
-       mk_empty &&
+       mk_empty testrepo &&
 
        git push testrepo "refs/heads/*:refs/remotes/origin/*" &&
        (
@@ -190,7 +209,7 @@ test_expect_success 'push with wildcard' '
 '
 
 test_expect_success 'push with insteadOf' '
-       mk_empty &&
+       mk_empty testrepo &&
        TRASH="$(pwd)/" &&
        test_config "url.$TRASH.insteadOf" trash/ &&
        git push trash/testrepo refs/heads/master:refs/remotes/origin/master &&
@@ -203,7 +222,7 @@ test_expect_success 'push with insteadOf' '
 '
 
 test_expect_success 'push with pushInsteadOf' '
-       mk_empty &&
+       mk_empty testrepo &&
        TRASH="$(pwd)/" &&
        test_config "url.$TRASH.pushInsteadOf" trash/ &&
        git push trash/testrepo refs/heads/master:refs/remotes/origin/master &&
@@ -216,7 +235,7 @@ test_expect_success 'push with pushInsteadOf' '
 '
 
 test_expect_success 'push with pushInsteadOf and explicit pushurl (pushInsteadOf should not rewrite)' '
-       mk_empty &&
+       mk_empty testrepo &&
        test_config "url.trash2/.pushInsteadOf" testrepo/ &&
        test_config "url.trash3/.pusnInsteadOf" trash/wrong &&
        test_config remote.r.url trash/wrong &&
@@ -232,237 +251,237 @@ test_expect_success 'push with pushInsteadOf and explicit pushurl (pushInsteadOf
 
 test_expect_success 'push with matching heads' '
 
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        git push testrepo &&
-       check_push_result $the_commit heads/master
+       check_push_result testrepo $the_commit heads/master
 
 '
 
 test_expect_success 'push with matching heads on the command line' '
 
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        git push testrepo : &&
-       check_push_result $the_commit heads/master
+       check_push_result testrepo $the_commit heads/master
 
 '
 
 test_expect_success 'failed (non-fast-forward) push with matching heads' '
 
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        git push testrepo : &&
        git commit --amend -massaged &&
        test_must_fail git push testrepo &&
-       check_push_result $the_commit heads/master &&
+       check_push_result testrepo $the_commit heads/master &&
        git reset --hard $the_commit
 
 '
 
 test_expect_success 'push --force with matching heads' '
 
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        git push testrepo : &&
        git commit --amend -massaged &&
        git push --force testrepo &&
-       ! check_push_result $the_commit heads/master &&
+       ! check_push_result testrepo $the_commit heads/master &&
        git reset --hard $the_commit
 
 '
 
 test_expect_success 'push with matching heads and forced update' '
 
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        git push testrepo : &&
        git commit --amend -massaged &&
        git push testrepo +: &&
-       ! check_push_result $the_commit heads/master &&
+       ! check_push_result testrepo $the_commit heads/master &&
        git reset --hard $the_commit
 
 '
 
 test_expect_success 'push with no ambiguity (1)' '
 
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        git push testrepo master:master &&
-       check_push_result $the_commit heads/master
+       check_push_result testrepo $the_commit heads/master
 
 '
 
 test_expect_success 'push with no ambiguity (2)' '
 
-       mk_test remotes/origin/master &&
+       mk_test testrepo remotes/origin/master &&
        git push testrepo master:origin/master &&
-       check_push_result $the_commit remotes/origin/master
+       check_push_result testrepo $the_commit remotes/origin/master
 
 '
 
 test_expect_success 'push with colon-less refspec, no ambiguity' '
 
-       mk_test heads/master heads/t/master &&
+       mk_test testrepo heads/master heads/t/master &&
        git branch -f t/master master &&
        git push testrepo master &&
-       check_push_result $the_commit heads/master &&
-       check_push_result $the_first_commit heads/t/master
+       check_push_result testrepo $the_commit heads/master &&
+       check_push_result testrepo $the_first_commit heads/t/master
 
 '
 
 test_expect_success 'push with weak ambiguity (1)' '
 
-       mk_test heads/master remotes/origin/master &&
+       mk_test testrepo heads/master remotes/origin/master &&
        git push testrepo master:master &&
-       check_push_result $the_commit heads/master &&
-       check_push_result $the_first_commit remotes/origin/master
+       check_push_result testrepo $the_commit heads/master &&
+       check_push_result testrepo $the_first_commit remotes/origin/master
 
 '
 
 test_expect_success 'push with weak ambiguity (2)' '
 
-       mk_test heads/master remotes/origin/master remotes/another/master &&
+       mk_test testrepo heads/master remotes/origin/master remotes/another/master &&
        git push testrepo master:master &&
-       check_push_result $the_commit heads/master &&
-       check_push_result $the_first_commit remotes/origin/master remotes/another/master
+       check_push_result testrepo $the_commit heads/master &&
+       check_push_result testrepo $the_first_commit remotes/origin/master remotes/another/master
 
 '
 
 test_expect_success 'push with ambiguity' '
 
-       mk_test heads/frotz tags/frotz &&
+       mk_test testrepo heads/frotz tags/frotz &&
        test_must_fail git push testrepo master:frotz &&
-       check_push_result $the_first_commit heads/frotz tags/frotz
+       check_push_result testrepo $the_first_commit heads/frotz tags/frotz
 
 '
 
 test_expect_success 'push with colon-less refspec (1)' '
 
-       mk_test heads/frotz tags/frotz &&
+       mk_test testrepo heads/frotz tags/frotz &&
        git branch -f frotz master &&
        git push testrepo frotz &&
-       check_push_result $the_commit heads/frotz &&
-       check_push_result $the_first_commit tags/frotz
+       check_push_result testrepo $the_commit heads/frotz &&
+       check_push_result testrepo $the_first_commit tags/frotz
 
 '
 
 test_expect_success 'push with colon-less refspec (2)' '
 
-       mk_test heads/frotz tags/frotz &&
+       mk_test testrepo heads/frotz tags/frotz &&
        if git show-ref --verify -q refs/heads/frotz
        then
                git branch -D frotz
        fi &&
        git tag -f frotz &&
        git push -f testrepo frotz &&
-       check_push_result $the_commit tags/frotz &&
-       check_push_result $the_first_commit heads/frotz
+       check_push_result testrepo $the_commit tags/frotz &&
+       check_push_result testrepo $the_first_commit heads/frotz
 
 '
 
 test_expect_success 'push with colon-less refspec (3)' '
 
-       mk_test &&
+       mk_test testrepo &&
        if git show-ref --verify -q refs/tags/frotz
        then
                git tag -d frotz
        fi &&
        git branch -f frotz master &&
        git push testrepo frotz &&
-       check_push_result $the_commit heads/frotz &&
+       check_push_result testrepo $the_commit heads/frotz &&
        test 1 = $( cd testrepo && git show-ref | wc -l )
 '
 
 test_expect_success 'push with colon-less refspec (4)' '
 
-       mk_test &&
+       mk_test testrepo &&
        if git show-ref --verify -q refs/heads/frotz
        then
                git branch -D frotz
        fi &&
        git tag -f frotz &&
        git push testrepo frotz &&
-       check_push_result $the_commit tags/frotz &&
+       check_push_result testrepo $the_commit tags/frotz &&
        test 1 = $( cd testrepo && git show-ref | wc -l )
 
 '
 
 test_expect_success 'push head with non-existent, incomplete dest' '
 
-       mk_test &&
+       mk_test testrepo &&
        git push testrepo master:branch &&
-       check_push_result $the_commit heads/branch
+       check_push_result testrepo $the_commit heads/branch
 
 '
 
 test_expect_success 'push tag with non-existent, incomplete dest' '
 
-       mk_test &&
+       mk_test testrepo &&
        git tag -f v1.0 &&
        git push testrepo v1.0:tag &&
-       check_push_result $the_commit tags/tag
+       check_push_result testrepo $the_commit tags/tag
 
 '
 
 test_expect_success 'push sha1 with non-existent, incomplete dest' '
 
-       mk_test &&
+       mk_test testrepo &&
        test_must_fail git push testrepo `git rev-parse master`:foo
 
 '
 
 test_expect_success 'push ref expression with non-existent, incomplete dest' '
 
-       mk_test &&
+       mk_test testrepo &&
        test_must_fail git push testrepo master^:branch
 
 '
 
 test_expect_success 'push with HEAD' '
 
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        git checkout master &&
        git push testrepo HEAD &&
-       check_push_result $the_commit heads/master
+       check_push_result testrepo $the_commit heads/master
 
 '
 
 test_expect_success 'push with HEAD nonexisting at remote' '
 
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        git checkout -b local master &&
        git push testrepo HEAD &&
-       check_push_result $the_commit heads/local
+       check_push_result testrepo $the_commit heads/local
 '
 
 test_expect_success 'push with +HEAD' '
 
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        git checkout master &&
        git branch -D local &&
        git checkout -b local &&
        git push testrepo master local &&
-       check_push_result $the_commit heads/master &&
-       check_push_result $the_commit heads/local &&
+       check_push_result testrepo $the_commit heads/master &&
+       check_push_result testrepo $the_commit heads/local &&
 
        # Without force rewinding should fail
        git reset --hard HEAD^ &&
        test_must_fail git push testrepo HEAD &&
-       check_push_result $the_commit heads/local &&
+       check_push_result testrepo $the_commit heads/local &&
 
        # With force rewinding should succeed
        git push testrepo +HEAD &&
-       check_push_result $the_first_commit heads/local
+       check_push_result testrepo $the_first_commit heads/local
 
 '
 
 test_expect_success 'push HEAD with non-existent, incomplete dest' '
 
-       mk_test &&
+       mk_test testrepo &&
        git checkout master &&
        git push testrepo HEAD:branch &&
-       check_push_result $the_commit heads/branch
+       check_push_result testrepo $the_commit heads/branch
 
 '
 
 test_expect_success 'push with config remote.*.push = HEAD' '
 
-       mk_test heads/local &&
+       mk_test testrepo heads/local &&
        git checkout master &&
        git branch -f local $the_commit &&
        (
@@ -474,35 +493,62 @@ test_expect_success 'push with config remote.*.push = HEAD' '
        test_config remote.there.push HEAD &&
        test_config branch.master.remote there &&
        git push &&
-       check_push_result $the_commit heads/master &&
-       check_push_result $the_first_commit heads/local
+       check_push_result testrepo $the_commit heads/master &&
+       check_push_result testrepo $the_first_commit heads/local
+'
+
+test_expect_success 'push with remote.pushdefault' '
+       mk_test up_repo heads/master &&
+       mk_test down_repo heads/master &&
+       test_config remote.up.url up_repo &&
+       test_config remote.down.url down_repo &&
+       test_config branch.master.remote up &&
+       test_config remote.pushdefault down &&
+       git push &&
+       check_push_result up_repo $the_first_commit heads/master &&
+       check_push_result down_repo $the_commit heads/master
 '
 
 test_expect_success 'push with config remote.*.pushurl' '
 
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        git checkout master &&
        test_config remote.there.url test2repo &&
        test_config remote.there.pushurl testrepo &&
        git push there &&
-       check_push_result $the_commit heads/master
+       check_push_result testrepo $the_commit heads/master
+'
+
+test_expect_success 'push with config branch.*.pushremote' '
+       mk_test up_repo heads/master &&
+       mk_test side_repo heads/master &&
+       mk_test down_repo heads/master &&
+       test_config remote.up.url up_repo &&
+       test_config remote.pushdefault side_repo &&
+       test_config remote.down.url down_repo &&
+       test_config branch.master.remote up &&
+       test_config branch.master.pushremote down &&
+       git push &&
+       check_push_result up_repo $the_first_commit heads/master &&
+       check_push_result side_repo $the_first_commit heads/master &&
+       check_push_result down_repo $the_commit heads/master
 '
 
 test_expect_success 'push with dry-run' '
 
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        (
                cd testrepo &&
                old_commit=$(git show-ref -s --verify refs/heads/master)
        ) &&
        git push --dry-run testrepo &&
-       check_push_result $old_commit heads/master
+       check_push_result testrepo $old_commit heads/master
 '
 
 test_expect_success 'push updates local refs' '
 
-       mk_test heads/master &&
-       mk_child child &&
+       mk_test testrepo heads/master &&
+       mk_child testrepo child &&
        (
                cd child &&
                git pull .. master &&
@@ -515,9 +561,9 @@ test_expect_success 'push updates local refs' '
 
 test_expect_success 'push updates up-to-date local refs' '
 
-       mk_test heads/master &&
-       mk_child child1 &&
-       mk_child child2 &&
+       mk_test testrepo heads/master &&
+       mk_child testrepo child1 &&
+       mk_child testrepo child2 &&
        (cd child1 && git pull .. master && git push) &&
        (
                cd child2 &&
@@ -531,8 +577,8 @@ test_expect_success 'push updates up-to-date local refs' '
 
 test_expect_success 'push preserves up-to-date packed refs' '
 
-       mk_test heads/master &&
-       mk_child child &&
+       mk_test testrepo heads/master &&
+       mk_child testrepo child &&
        (
                cd child &&
                git push &&
@@ -543,8 +589,8 @@ test_expect_success 'push preserves up-to-date packed refs' '
 
 test_expect_success 'push does not update local refs on failure' '
 
-       mk_test heads/master &&
-       mk_child child &&
+       mk_test testrepo heads/master &&
+       mk_child testrepo child &&
        mkdir testrepo/.git/hooks &&
        echo "#!/no/frobnication/today" >testrepo/.git/hooks/pre-receive &&
        chmod +x testrepo/.git/hooks/pre-receive &&
@@ -560,7 +606,7 @@ test_expect_success 'push does not update local refs on failure' '
 
 test_expect_success 'allow deleting an invalid remote ref' '
 
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        rm -f testrepo/.git/objects/??/* &&
        git push testrepo :refs/heads/master &&
        (cd testrepo && test_must_fail git rev-parse --verify refs/heads/master)
@@ -568,7 +614,7 @@ test_expect_success 'allow deleting an invalid remote ref' '
 '
 
 test_expect_success 'pushing valid refs triggers post-receive and post-update hooks' '
-       mk_test_with_hooks heads/master heads/next &&
+       mk_test_with_hooks testrepo heads/master heads/next &&
        orgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) &&
        newmaster=$(git show-ref -s --verify refs/heads/master) &&
        orgnext=$(cd testrepo && git show-ref -s --verify refs/heads/next) &&
@@ -604,7 +650,7 @@ test_expect_success 'pushing valid refs triggers post-receive and post-update ho
 '
 
 test_expect_success 'deleting dangling ref triggers hooks with correct args' '
-       mk_test_with_hooks heads/master &&
+       mk_test_with_hooks testrepo heads/master &&
        rm -f testrepo/.git/objects/??/* &&
        git push testrepo :refs/heads/master &&
        (
@@ -633,7 +679,7 @@ test_expect_success 'deleting dangling ref triggers hooks with correct args' '
 '
 
 test_expect_success 'deletion of a non-existent ref is not fed to post-receive and post-update hooks' '
-       mk_test_with_hooks heads/master &&
+       mk_test_with_hooks testrepo heads/master &&
        orgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) &&
        newmaster=$(git show-ref -s --verify refs/heads/master) &&
        git push testrepo master :refs/heads/nonexistent &&
@@ -665,7 +711,7 @@ test_expect_success 'deletion of a non-existent ref is not fed to post-receive a
 '
 
 test_expect_success 'deletion of a non-existent ref alone does trigger post-receive and post-update hooks' '
-       mk_test_with_hooks heads/master &&
+       mk_test_with_hooks testrepo heads/master &&
        git push testrepo :refs/heads/nonexistent &&
        (
                cd testrepo/.git &&
@@ -685,7 +731,7 @@ test_expect_success 'deletion of a non-existent ref alone does trigger post-rece
 '
 
 test_expect_success 'mixed ref updates, deletes, invalid deletes trigger hooks with correct input' '
-       mk_test_with_hooks heads/master heads/next heads/pu &&
+       mk_test_with_hooks testrepo heads/master heads/next heads/pu &&
        orgmaster=$(cd testrepo && git show-ref -s --verify refs/heads/master) &&
        newmaster=$(git show-ref -s --verify refs/heads/master) &&
        orgnext=$(cd testrepo && git show-ref -s --verify refs/heads/next) &&
@@ -731,14 +777,14 @@ test_expect_success 'mixed ref updates, deletes, invalid deletes trigger hooks w
 '
 
 test_expect_success 'allow deleting a ref using --delete' '
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        (cd testrepo && git config receive.denyDeleteCurrent warn) &&
        git push testrepo --delete master &&
        (cd testrepo && test_must_fail git rev-parse --verify refs/heads/master)
 '
 
 test_expect_success 'allow deleting a tag using --delete' '
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        git tag -a -m dummy_message deltag heads/master &&
        git push testrepo --tags &&
        (cd testrepo && git rev-parse --verify -q refs/tags/deltag) &&
@@ -747,17 +793,17 @@ test_expect_success 'allow deleting a tag using --delete' '
 '
 
 test_expect_success 'push --delete without args aborts' '
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        test_must_fail git push testrepo --delete
 '
 
 test_expect_success 'push --delete refuses src:dest refspecs' '
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        test_must_fail git push testrepo --delete master:foo
 '
 
 test_expect_success 'warn on push to HEAD of non-bare repository' '
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        (
                cd testrepo &&
                git checkout master &&
@@ -768,7 +814,7 @@ test_expect_success 'warn on push to HEAD of non-bare repository' '
 '
 
 test_expect_success 'deny push to HEAD of non-bare repository' '
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        (
                cd testrepo &&
                git checkout master &&
@@ -778,7 +824,7 @@ test_expect_success 'deny push to HEAD of non-bare repository' '
 '
 
 test_expect_success 'allow push to HEAD of bare repository (bare)' '
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        (
                cd testrepo &&
                git checkout master &&
@@ -790,7 +836,7 @@ test_expect_success 'allow push to HEAD of bare repository (bare)' '
 '
 
 test_expect_success 'allow push to HEAD of non-bare repository (config)' '
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        (
                cd testrepo &&
                git checkout master &&
@@ -801,7 +847,7 @@ test_expect_success 'allow push to HEAD of non-bare repository (config)' '
 '
 
 test_expect_success 'fetch with branches' '
-       mk_empty &&
+       mk_empty testrepo &&
        git branch second $the_first_commit &&
        git checkout second &&
        echo ".." > testrepo/.git/branches/branch1 &&
@@ -816,7 +862,7 @@ test_expect_success 'fetch with branches' '
 '
 
 test_expect_success 'fetch with branches containing #' '
-       mk_empty &&
+       mk_empty testrepo &&
        echo "..#second" > testrepo/.git/branches/branch2 &&
        (
                cd testrepo &&
@@ -829,7 +875,7 @@ test_expect_success 'fetch with branches containing #' '
 '
 
 test_expect_success 'push with branches' '
-       mk_empty &&
+       mk_empty testrepo &&
        git checkout second &&
        echo "testrepo" > .git/branches/branch1 &&
        git push branch1 &&
@@ -842,7 +888,7 @@ test_expect_success 'push with branches' '
 '
 
 test_expect_success 'push with branches containing #' '
-       mk_empty &&
+       mk_empty testrepo &&
        echo "testrepo#branch3" > .git/branches/branch2 &&
        git push branch2 &&
        (
@@ -855,9 +901,9 @@ test_expect_success 'push with branches containing #' '
 '
 
 test_expect_success 'push into aliased refs (consistent)' '
-       mk_test heads/master &&
-       mk_child child1 &&
-       mk_child child2 &&
+       mk_test testrepo heads/master &&
+       mk_child testrepo child1 &&
+       mk_child testrepo child2 &&
        (
                cd child1 &&
                git branch foo &&
@@ -877,9 +923,9 @@ test_expect_success 'push into aliased refs (consistent)' '
 '
 
 test_expect_success 'push into aliased refs (inconsistent)' '
-       mk_test heads/master &&
-       mk_child child1 &&
-       mk_child child2 &&
+       mk_test testrepo heads/master &&
+       mk_child testrepo child1 &&
+       mk_child testrepo child2 &&
        (
                cd child1 &&
                git branch foo &&
@@ -904,9 +950,9 @@ test_expect_success 'push into aliased refs (inconsistent)' '
 '
 
 test_expect_success 'push requires --force to update lightweight tag' '
-       mk_test heads/master &&
-       mk_child child1 &&
-       mk_child child2 &&
+       mk_test testrepo heads/master &&
+       mk_child testrepo child1 &&
+       mk_child testrepo child2 &&
        (
                cd child1 &&
                git tag Tag &&
@@ -925,7 +971,7 @@ test_expect_success 'push requires --force to update lightweight tag' '
 '
 
 test_expect_success 'push --porcelain' '
-       mk_empty &&
+       mk_empty testrepo &&
        echo >.git/foo  "To testrepo" &&
        echo >>.git/foo "*      refs/heads/master:refs/remotes/origin/master    [new branch]"  &&
        echo >>.git/foo "Done" &&
@@ -940,13 +986,13 @@ test_expect_success 'push --porcelain' '
 '
 
 test_expect_success 'push --porcelain bad url' '
-       mk_empty &&
+       mk_empty testrepo &&
        test_must_fail git push >.git/bar --porcelain asdfasdfasd refs/heads/master:refs/remotes/origin/master &&
        test_must_fail grep -q Done .git/bar
 '
 
 test_expect_success 'push --porcelain rejected' '
-       mk_empty &&
+       mk_empty testrepo &&
        git push testrepo refs/heads/master:refs/remotes/origin/master &&
        (cd testrepo &&
                git reset --hard origin/master^
@@ -960,7 +1006,7 @@ test_expect_success 'push --porcelain rejected' '
 '
 
 test_expect_success 'push --porcelain --dry-run rejected' '
-       mk_empty &&
+       mk_empty testrepo &&
        git push testrepo refs/heads/master:refs/remotes/origin/master &&
        (cd testrepo &&
                git reset --hard origin/master
@@ -975,25 +1021,25 @@ test_expect_success 'push --porcelain --dry-run rejected' '
 '
 
 test_expect_success 'push --prune' '
-       mk_test heads/master heads/second heads/foo heads/bar &&
+       mk_test testrepo heads/master heads/second heads/foo heads/bar &&
        git push --prune testrepo &&
-       check_push_result $the_commit heads/master &&
-       check_push_result $the_first_commit heads/second &&
-       ! check_push_result $the_first_commit heads/foo heads/bar
+       check_push_result testrepo $the_commit heads/master &&
+       check_push_result testrepo $the_first_commit heads/second &&
+       ! check_push_result testrepo $the_first_commit heads/foo heads/bar
 '
 
 test_expect_success 'push --prune refspec' '
-       mk_test tmp/master tmp/second tmp/foo tmp/bar &&
+       mk_test testrepo tmp/master tmp/second tmp/foo tmp/bar &&
        git push --prune testrepo "refs/heads/*:refs/tmp/*" &&
-       check_push_result $the_commit tmp/master &&
-       check_push_result $the_first_commit tmp/second &&
-       ! check_push_result $the_first_commit tmp/foo tmp/bar
+       check_push_result testrepo $the_commit tmp/master &&
+       check_push_result testrepo $the_first_commit tmp/second &&
+       ! check_push_result testrepo $the_first_commit tmp/foo tmp/bar
 '
 
 for configsection in transfer receive
 do
        test_expect_success "push to update a ref hidden by $configsection.hiderefs" '
-               mk_test heads/master hidden/one hidden/two hidden/three &&
+               mk_test testrepo heads/master hidden/one hidden/two hidden/three &&
                (
                        cd testrepo &&
                        git config $configsection.hiderefs refs/hidden
@@ -1001,32 +1047,32 @@ do
 
                # push to unhidden ref succeeds normally
                git push testrepo master:refs/heads/master &&
-               check_push_result $the_commit heads/master &&
+               check_push_result testrepo $the_commit heads/master &&
 
                # push to update a hidden ref should fail
                test_must_fail git push testrepo master:refs/hidden/one &&
-               check_push_result $the_first_commit hidden/one &&
+               check_push_result testrepo $the_first_commit hidden/one &&
 
                # push to delete a hidden ref should fail
                test_must_fail git push testrepo :refs/hidden/two &&
-               check_push_result $the_first_commit hidden/two &&
+               check_push_result testrepo $the_first_commit hidden/two &&
 
                # idempotent push to update a hidden ref should fail
                test_must_fail git push testrepo $the_first_commit:refs/hidden/three &&
-               check_push_result $the_first_commit hidden/three
+               check_push_result testrepo $the_first_commit hidden/three
        '
 done
 
 test_expect_success 'fetch exact SHA1' '
-       mk_test heads/master hidden/one &&
+       mk_test testrepo heads/master hidden/one &&
        git push testrepo master:refs/hidden/one &&
        (
                cd testrepo &&
                git config transfer.hiderefs refs/hidden
        ) &&
-       check_push_result $the_commit hidden/one &&
+       check_push_result testrepo $the_commit hidden/one &&
 
-       mk_child child &&
+       mk_child testrepo child &&
        (
                cd child &&
 
@@ -1052,7 +1098,7 @@ test_expect_success 'fetch exact SHA1' '
 '
 
 test_expect_success 'fetch follows tags by default' '
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        rm -fr src dst &&
        git init src &&
        (
@@ -1079,7 +1125,7 @@ test_expect_success 'fetch follows tags by default' '
 '
 
 test_expect_success 'push does not follow tags by default' '
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        rm -fr src dst &&
        git init src &&
        git init --bare dst &&
@@ -1102,7 +1148,7 @@ test_expect_success 'push does not follow tags by default' '
 '
 
 test_expect_success 'push --follow-tag only pushes relevant tags' '
-       mk_test heads/master &&
+       mk_test testrepo heads/master &&
        rm -fr src dst &&
        git init src &&
        git init --bare dst &&
index 8e2ff13423ba01095404ec49232760bc66c68978..dd6dc844e787549ab7622fb4fbec4f89b52e22ab 100755 (executable)
@@ -77,14 +77,16 @@ test_expect_success setup '
 
 FMT='tformat:%P        %H | %s'
 
-check_result () {
+check_outcome () {
+       outcome=$1
+       shift
        for c in $1
        do
                echo "$c"
        done >expect &&
        shift &&
        param="$*" &&
-       test_expect_success "log $param" '
+       test_expect_$outcome "log $param" '
                git log --pretty="$FMT" --parents $param |
                unnote >actual &&
                sed -e "s/^.*   \([^ ]*\) .*/\1/" >check <actual &&
@@ -95,11 +97,15 @@ check_result () {
        '
 }
 
+check_result () {
+       check_outcome success "$@"
+}
+
 check_result 'L K J I H G F E D C B A' --full-history
 check_result 'K I H E C B A' --full-history -- file
 check_result 'K I H E C B A' --full-history --topo-order -- file
 check_result 'K I H E C B A' --full-history --date-order -- file
-check_result 'I E C B A' --simplify-merges -- file
+check_outcome failure 'I E C B A' --simplify-merges -- file
 check_result 'I B A' -- file
 check_result 'I B A' --topo-order -- file
 check_result 'H' --first-parent -- another-file
index 2fce99a0754481a36b3644d01f8577310e19d763..8bf53de3ef6bc7cc5de14b70e93ffe42b9b3f094 100755 (executable)
@@ -190,7 +190,7 @@ test_expect_success 'bisect start: no ".git/BISECT_START" if checkout error' '
 # $HASH1 is good, $HASH4 is bad, we skip $HASH3
 # but $HASH2 is bad,
 # so we should find $HASH2 as the first bad commit
-test_expect_success 'bisect skip: successfull result' '
+test_expect_success 'bisect skip: successful result' '
        git bisect reset &&
        git bisect start $HASH4 $HASH1 &&
        git bisect skip &&
index 1e7a209efa715bc52d14d7f653ecfc13ffb5301f..9496736a89eb6b0b1ece64052cd2726c516c952b 100755 (executable)
@@ -64,6 +64,20 @@ test_expect_success 'correct GIT_DIR while using -d' '
        grep drepo "$TRASHDIR/backup-refs"
 '
 
+test_expect_success 'tree-filter works with -d' '
+       git init drepo-tree &&
+       (
+               cd drepo-tree &&
+               test_commit one &&
+               git filter-branch -d "$TRASHDIR/dfoo" \
+                       --tree-filter "echo changed >one.t" &&
+               echo changed >expect &&
+               git cat-file blob HEAD:one.t >actual &&
+               test_cmp expect actual &&
+               test_cmp one.t actual
+       )
+'
+
 test_expect_success 'Fail if commit filter fails' '
        test_must_fail git filter-branch -f --commit-filter "exit 1" HEAD
 '
index 06749a6aa07e40a5e5081c8912264d9c15b385ef..bf08d4e098f1bdc3adc5ec3df37b90d90b0e5c8f 100755 (executable)
@@ -678,4 +678,62 @@ test_expect_success 'status showing detached from a tag' '
        test_i18ncmp expected actual
 '
 
+test_expect_success 'status while reverting commit (conflicts)' '
+       git checkout master &&
+       echo before >to-revert.txt &&
+       test_commit before to-revert.txt &&
+       echo old >to-revert.txt &&
+       test_commit old to-revert.txt &&
+       echo new >to-revert.txt &&
+       test_commit new to-revert.txt &&
+       TO_REVERT=$(git rev-parse --short HEAD^) &&
+       test_must_fail git revert $TO_REVERT &&
+       cat >expected <<-EOF
+       # On branch master
+       # You are currently reverting commit $TO_REVERT.
+       #   (fix conflicts and run "git revert --continue")
+       #   (use "git revert --abort" to cancel the revert operation)
+       #
+       # Unmerged paths:
+       #   (use "git reset HEAD <file>..." to unstage)
+       #   (use "git add <file>..." to mark resolution)
+       #
+       #       both modified:      to-revert.txt
+       #
+       no changes added to commit (use "git add" and/or "git commit -a")
+       EOF
+       git status --untracked-files=no >actual &&
+       test_i18ncmp expected actual
+'
+
+test_expect_success 'status while reverting commit (conflicts resolved)' '
+       echo reverted >to-revert.txt &&
+       git add to-revert.txt &&
+       cat >expected <<-EOF
+       # On branch master
+       # You are currently reverting commit $TO_REVERT.
+       #   (all conflicts fixed: run "git revert --continue")
+       #   (use "git revert --abort" to cancel the revert operation)
+       #
+       # Changes to be committed:
+       #   (use "git reset HEAD <file>..." to unstage)
+       #
+       #       modified:   to-revert.txt
+       #
+       # Untracked files not listed (use -u option to show untracked files)
+       EOF
+       git status --untracked-files=no >actual &&
+       test_i18ncmp expected actual
+'
+
+test_expect_success 'status after reverting commit' '
+       git revert --continue &&
+       cat >expected <<-\EOF
+       # On branch master
+       nothing to commit (use -u to show untracked files)
+       EOF
+       git status --untracked-files=no >actual &&
+       test_i18ncmp expected actual
+'
+
 test_done
index b44b29395049308b30e61b00a55e2eb39f4355a1..25dac798894f6a3cb4b62c8b9ba944bfc1d82d9f 100755 (executable)
@@ -109,7 +109,7 @@ test_expect_success 'setup conflicted merge' '
 '
 
 # First do the merge with resolve and recursive then verify that
-# recusive is choosen.
+# recusive is chosen.
 
 test_expect_success 'merge picks up the best result' '
        git config --unset-all pull.twohead &&
index bc38737b2a5ebd9b7ba20fcb92ac87c48b9496c8..d526b1d96a2e98bc304f4d36eaaa60858080e63d 100755 (executable)
@@ -237,7 +237,7 @@ test_expect_success 'mergetool takes partial path' '
     git submodule update -N &&
     test_must_fail git merge master &&
 
-    #shouldnt need these lines
+    #should not need these lines
     #( yes "d" | git mergetool file11 >/dev/null 2>&1 ) &&
     #( yes "d" | git mergetool file12 >/dev/null 2>&1 ) &&
     #( yes "l" | git mergetool submod >/dev/null 2>&1 ) &&
index 97d6f4c7de57c54adfd5fed6401dbd168b5f3064..ebd5c5db45c8816f39b2d8c60775f455ab9c48aa 100755 (executable)
@@ -101,7 +101,7 @@ test_expect_success $PREREQ \
 
 test_expect_success $PREREQ 'Send patches with --envelope-sender' '
     clean_fake_sendmail &&
-     git send-email --envelope-sender="Patch Contributer <patch@example.com>" --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
+     git send-email --envelope-sender="Patch Contributor <patch@example.com>" --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors
 '
 
 test_expect_success $PREREQ 'setup expect' '
@@ -787,7 +787,7 @@ test_expect_success $PREREQ 'confirm detects EOF (auto causes failure)' '
        test $ret = "0"
 '
 
-test_expect_success $PREREQ 'confirm doesnt loop forever' '
+test_expect_success $PREREQ 'confirm does not loop forever' '
        CONFIRM=$(git config --get sendemail.confirm) &&
        git config sendemail.confirm auto &&
        GIT_SEND_EMAIL_NOTTY=1 &&
index b7eed2489fa169aa1c6e5c98f59a0349ba8118fa..6dafe7e99ab4bd0006ed4f7204062fca31750689 100755 (executable)
@@ -54,14 +54,6 @@ text_no_props () {
 
 >empty
 
-test_expect_success 'setup: have pipes?' '
-       rm -f frob &&
-       if mkfifo frob
-       then
-               test_set_prereq PIPE
-       fi
-'
-
 test_expect_success PIPE 'empty dump' '
        reinit_git &&
        echo "SVN-fs-dump-format-version: 2" >input &&
index 2fcf2694696fedb5e7e3d57c869f7dbbbf23dbec..ac6f3b6af25c67ae3a2c0748c34f99b4cd0d4b32 100755 (executable)
@@ -49,14 +49,6 @@ echo "$@"'
 
 >empty
 
-test_expect_success 'setup: have pipes?' '
-       rm -f frob &&
-       if mkfifo frob
-       then
-               test_set_prereq PIPE
-       fi
-'
-
 ###
 ### series A
 ###
index 0d4e366232c29bdde0e1059d431ae96afc259112..1140767b50706f03b0da5b2c8befdae6898e4136 100755 (executable)
@@ -45,7 +45,8 @@ BEGIN
 # Failure cases for config:
 # Save and restore STDERR; we will probably extract this into a
 # "dies_ok" method and possibly move the STDERR handling to Git.pm.
-open our $tmpstderr, ">&STDERR" or die "cannot save STDERR"; close STDERR;
+open our $tmpstderr, ">&STDERR" or die "cannot save STDERR";
+open STDERR, ">", "/dev/null" or die "cannot redirect STDERR to /dev/null";
 is($r->config("test.dupstring"), "value2", "config: multivar");
 eval { $r->config_bool("test.boolother") };
 ok($@, "config_bool: non-boolean values fail");
index da57a2f45c3d76991f823364743fcdf73b524a91..debd8b475186591ec1d1ef38848fef1a213889f4 100644 (file)
@@ -735,6 +735,11 @@ test_i18ngrep () {
        fi
 }
 
+test_lazy_prereq PIPE '
+       # test whether the filesystem supports FIFOs
+       rm -f testfifo && mkfifo testfifo
+'
+
 test_lazy_prereq SYMLINKS '
        # test whether the filesystem supports symbolic links
        ln -s x y && test -h y
index cb3ef7d38e475480a5d81ce6077c4c87ea09a318..dcd8d97411dd15e01ba1480a44b2a998043b424a 100644 (file)
@@ -991,7 +991,7 @@ struct unidirectional_transfer {
        int src_is_sock;
        /* Is destination socket? */
        int dest_is_sock;
-       /* Transfer state (TRANSFERING/FLUSHING/FINISHED) */
+       /* Transfer state (TRANSFERRING/FLUSHING/FINISHED) */
        int state;
        /* Buffer. */
        char buf[BUFFERSIZE];
index 93544627087bdaed1373efb2205fc6f94b89527c..fcb1d25d96a750c171c4341a9c5f08992915fb6b 100644 (file)
@@ -74,7 +74,7 @@ struct transport {
                       const char *executable, int fd[2]);
 
        /** get_refs_list(), fetch(), and push_refs() can keep
-        * resources (such as a connection) reserved for futher
+        * resources (such as a connection) reserved for further
         * use. disconnect() releases these resources.
         **/
        int (*disconnect)(struct transport *connection);
index cea8e55d8bc1d9117a6104c4181be9ff875c3ffa..ec5f27c5992e5fec5fb54384a04ffacf1745ce4a 100644 (file)
@@ -965,6 +965,25 @@ static void show_cherry_pick_in_progress(struct wt_status *s,
        wt_status_print_trailer(s);
 }
 
+static void show_revert_in_progress(struct wt_status *s,
+                                       struct wt_status_state *state,
+                                       const char *color)
+{
+       status_printf_ln(s, color, _("You are currently reverting commit %s."),
+                        find_unique_abbrev(state->revert_head_sha1, DEFAULT_ABBREV));
+       if (advice_status_hints) {
+               if (has_unmerged(s))
+                       status_printf_ln(s, color,
+                               _("  (fix conflicts and run \"git revert --continue\")"));
+               else
+                       status_printf_ln(s, color,
+                               _("  (all conflicts fixed: run \"git revert --continue\")"));
+               status_printf_ln(s, color,
+                       _("  (use \"git revert --abort\" to cancel the revert operation)"));
+       }
+       wt_status_print_trailer(s);
+}
+
 static void show_bisect_in_progress(struct wt_status *s,
                                struct wt_status_state *state,
                                const char *color)
@@ -1086,6 +1105,7 @@ void wt_status_get_state(struct wt_status_state *state,
                         int get_detached_from)
 {
        struct stat st;
+       unsigned char sha1[20];
 
        if (!stat(git_path("MERGE_HEAD"), &st)) {
                state->merge_in_progress = 1;
@@ -1113,6 +1133,11 @@ void wt_status_get_state(struct wt_status_state *state,
                state->bisect_in_progress = 1;
                state->branch = read_and_strip_branch("BISECT_START");
        }
+       if (!stat(git_path("REVERT_HEAD"), &st) &&
+           !get_sha1("REVERT_HEAD", sha1)) {
+               state->revert_in_progress = 1;
+               hashcpy(state->revert_head_sha1, sha1);
+       }
 
        if (get_detached_from)
                wt_status_get_detached_from(state);
@@ -1130,6 +1155,8 @@ static void wt_status_print_state(struct wt_status *s,
                show_rebase_in_progress(s, state, state_color);
        else if (state->cherry_pick_in_progress)
                show_cherry_pick_in_progress(s, state, state_color);
+       else if (state->revert_in_progress)
+               show_revert_in_progress(s, state, state_color);
        if (state->bisect_in_progress)
                show_bisect_in_progress(s, state, state_color);
 }
@@ -1198,14 +1225,10 @@ void wt_status_print(struct wt_status *s)
                if (advice_status_u_option && 2000 < s->untracked_in_ms) {
                        status_printf_ln(s, GIT_COLOR_NORMAL, "");
                        status_printf_ln(s, GIT_COLOR_NORMAL,
-                                _("It took %.2f seconds to enumerate untracked files."
-                                  "  'status -uno'"),
-                                s->untracked_in_ms / 1000.0);
-                       status_printf_ln(s, GIT_COLOR_NORMAL,
-                                _("may speed it up, but you have to be careful not"
-                                  " to forget to add"));
-                       status_printf_ln(s, GIT_COLOR_NORMAL,
-                                _("new files yourself (see 'git help status')."));
+                                        _("It took %.2f seconds to enumerate untracked files. 'status -uno'\n"
+                                          "may speed it up, but you have to be careful not to forget to add\n"
+                                          "new files yourself (see 'git help status')."),
+                                        s->untracked_in_ms / 1000.0);
                }
        } else if (s->commitable)
                status_printf_ln(s, GIT_COLOR_NORMAL, _("Untracked files not listed%s"),
index be7a016173487780fdd4d37e24b4a47fcb766454..4121bc208db2fbe5e4eb00af10056a9d8c0bab40 100644 (file)
@@ -80,10 +80,12 @@ struct wt_status_state {
        int rebase_interactive_in_progress;
        int cherry_pick_in_progress;
        int bisect_in_progress;
+       int revert_in_progress;
        char *branch;
        char *onto;
        char *detached_from;
        unsigned char detached_sha1[20];
+       unsigned char revert_head_sha1[20];
 };
 
 void wt_status_prepare(struct wt_status *s);
index 1b7012a119ad3ea7e2ebe0aad80891529d4936da..b2eb6db2c851aea7eb08b17d802155876bef211c 100644 (file)
@@ -490,7 +490,7 @@ int xdl_change_compact(xdfile_t *xdf, xdfile_t *xdfo, long flags) {
 
                /*
                 * Try to move back the possibly merged group of changes, to match
-                * the recorded postion in the other file.
+                * the recorded position in the other file.
                 */
                while (ixref < ix) {
                        rchg[--ixs] = 1;
index bf99787c3e4c791426311495dda9d4da81cbb571..73210cb6f3fb5d1cb90b1c5959a5a90e058ea1f2 100644 (file)
@@ -55,7 +55,7 @@ struct histindex {
        struct record {
                unsigned int ptr, cnt;
                struct record *next;
-       } **records, /* an ocurrence */
+       } **records, /* an occurrence */
          **line_map; /* map of line to record chain */
        chastore_t rcha;
        unsigned int *next_ptrs;