Merge branch 'rr/die-on-missing-upstream' into maint
authorJunio C Hamano <gitster@pobox.com>
Wed, 3 Jul 2013 22:30:24 +0000 (15:30 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 3 Jul 2013 22:30:24 +0000 (15:30 -0700)
When a reflog notation is used for implicit "current branch", we did
not say which branch, and worse said "branch ''".

* rr/die-on-missing-upstream:
sha1_name: fix error message for @{<N>}, @{<date>}
sha1_name: fix error message for @{u}

66 files changed:
Documentation/RelNotes/1.8.3.1.txt [new file with mode: 0644]
Documentation/RelNotes/1.8.3.2.txt [new file with mode: 0644]
Documentation/RelNotes/1.8.3.3.txt [new file with mode: 0644]
Documentation/RelNotes/1.8.3.txt
Documentation/diff-options.txt
Documentation/git-check-ignore.txt
Documentation/git-checkout.txt
Documentation/git-config.txt
Documentation/git-push.txt
Documentation/git.txt
Documentation/gitrepository-layout.txt
Documentation/glossary-content.txt
Documentation/technical/pack-protocol.txt
Documentation/urls.txt
GIT-VERSION-GEN
Makefile
RelNotes
branch.c
builtin/checkout.c
builtin/clone.c
builtin/commit.c
builtin/config.c
builtin/push.c
combine-diff.c
commit.h
compat/clipped-write.c [new file with mode: 0644]
compat/mingw.c
config.c
config.mak.uname
configure.ac
contrib/completion/git-completion.bash
contrib/completion/git-prompt.sh
contrib/remote-helpers/git-remote-hg
contrib/subtree/git-subtree.sh
dir.c
fetch-pack.c
git-compat-util.h
git-difftool.perl
git.c
imap-send.c
revision.c
revision.h
sha1_file.c
sha1_name.c
shallow.c
submodule.c
t/README
t/lib-rebase.sh
t/t0070-fundamental.sh
t/t0100-previous.sh
t/t2024-checkout-dwim.sh [new file with mode: 0755]
t/t3001-ls-files-others-exclude.sh
t/t3200-branch.sh
t/t4038-diff-combined.sh
t/t5500-fetch-pack.sh
t/t6019-rev-list-ancestry-path.sh
t/t7011-skip-worktree-reading.sh
t/t7201-co.sh
t/t7500-commit.sh
t/t7502-commit.sh
t/t7800-difftool.sh
t/t9114-git-svn-dcommit-merge.sh
t/t9903-bash-prompt.sh
templates/hooks--pre-push.sample [changed mode: 0644->0755]
upload-pack.c
wrapper.c
diff --git a/Documentation/RelNotes/1.8.3.1.txt b/Documentation/RelNotes/1.8.3.1.txt
new file mode 100644 (file)
index 0000000..fc3ea18
--- /dev/null
@@ -0,0 +1,14 @@
+Git v1.8.3.1 Release Notes
+========================
+
+Fixes since v1.8.3
+------------------
+
+ * When $HOME is misconfigured to point at an unreadable directory, we
+   used to complain and die. The check has been loosened.
+
+ * Handling of negative exclude pattern for directories "!dir" was
+   broken in the update to v1.8.3.
+
+Also contains a handful of trivial code clean-ups, documentation
+updates, updates to the test suite, etc.
diff --git a/Documentation/RelNotes/1.8.3.2.txt b/Documentation/RelNotes/1.8.3.2.txt
new file mode 100644 (file)
index 0000000..26ae142
--- /dev/null
@@ -0,0 +1,59 @@
+Git v1.8.3.2 Release Notes
+==========================
+
+Fixes since v1.8.3.1
+--------------------
+
+ * Cloning with "git clone --depth N" while fetch.fsckobjects (or
+   transfer.fsckobjects) is set to true did not tell the cut-off
+   points of the shallow history to the process that validates the
+   objects and the history received, causing the validation to fail.
+
+ * "git checkout foo" DWIMs the intended "upstream" and turns it into
+   "git checkout -t -b foo remotes/origin/foo". This codepath has been
+   updated to correctly take existing remote definitions into account.
+
+ * "git fetch" into a shallow repository from a repository that does
+   not know about the shallow boundary commits (e.g. a different fork
+   from the repository the current shallow repository was cloned from)
+   did not work correctly.
+
+ * "git subtree" (in contrib/) had one codepath with loose error
+   checks to lose data at the remote side.
+
+ * "git log --ancestry-path A...B" did not work as expected, as it did
+   not pay attention to the fact that the merge base between A and B
+   was the bottom of the range being specified.
+
+ * "git diff -c -p" was not showing a deleted line from a hunk when
+   another hunk immediately begins where the earlier one ends.
+
+ * "git merge @{-1}~22" was rewritten to "git merge frotz@{1}~22"
+   incorrectly when your previous branch was "frotz" (it should be
+   rewritten to "git merge frotz~22" instead).
+
+ * "git commit --allow-empty-message -m ''" should not start an
+   editor.
+
+ * "git push --[no-]verify" was not documented.
+
+ * An entry for "file://" scheme in the enumeration of URL types Git
+   can take in the HTML documentation was made into a clickable link
+   by mistake.
+
+ * zsh prompt script that borrowed from bash prompt script did not
+   work due to slight differences in array variable notation between
+   these two shells.
+
+ * The bash prompt code (in contrib/) displayed the name of the branch
+   being rebased when "rebase -i/-m/-p" modes are in use, but not the
+   plain vanilla "rebase".
+
+ * "git push $there HEAD:branch" did not resolve HEAD early enough, so
+   it was easy to flip it around while push is still going on and push
+   out a branch that the user did not originally intended when the
+   command was started.
+
+ * "difftool --dir-diff" did not copy back changes made by the
+   end-user in the diff tool backend to the working tree in some
+   cases.
diff --git a/Documentation/RelNotes/1.8.3.3.txt b/Documentation/RelNotes/1.8.3.3.txt
new file mode 100644 (file)
index 0000000..58a570e
--- /dev/null
@@ -0,0 +1,11 @@
+Git v1.8.3.3 Release Notes
+==========================
+
+Fixes since v1.8.3.2
+--------------------
+
+ * Mac OS X does not like to write(2) more than INT_MAX number of
+   bytes; work it around by chopping write(2) into smaller pieces.
+
+ * Newer MacOS X encourages the programs to compile and link with
+   their CommonCrypto, not with OpenSSL.
index 468947cc1a81ca3d1280eed5e62e7b77f9aa6fe4..ead568e7f157132a5030ca9052fc0b36707522f6 100644 (file)
@@ -42,8 +42,11 @@ Updates since v1.8.2
 Foreign interface
 
  * remote-hg and remote-bzr helpers (in contrib/ since v1.8.2) have
-   been updated; especially, the latter has been accelerated to help
-   Emacs folks, whose primary SCM seems to be stagnating.
+   been updated; especially, the latter has been done in an
+   accelerated schedule (read: we may not have merged to this release
+   if we were following the usual "cook sufficiently in next before
+   unleashing it to the world" workflow) in order to help Emacs folks,
+   whose primary SCM seems to be stagnating.
 
 
 UI, Workflows & Features
@@ -111,9 +114,10 @@ UI, Workflows & Features
    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 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.
+   a message meant to help the system administrator to enable it.  An
+   explicit way has been added to issue custom messages to refuse an
+   access over the network to help the end users who connect to the
+   service expecting an interactive shell.
 
  * In addition to the case where the user edits the log message with
    the "e)dit" option of "am -i", replace the "Applying: this patch"
@@ -123,8 +127,8 @@ UI, Workflows & Features
  * "git status" suggests users to look into using --untracked=no option
    when it takes too long.
 
- * "git status" shows a bit more information during a
-   rebase/bisect session.
+ * "git status" shows a bit more information during a rebase/bisect
+   session.
 
  * "git fetch" learned to fetch a commit at the tip of an unadvertised
    ref by specifying a raw object name from the command line when the
@@ -241,7 +245,6 @@ details).
 
  * Various subcommands of "git remote" simply ignored extraneous
    command line arguments instead of diagnosing them as errors.
-   (merge b17dd3f tr/remote-tighten-commandline-parsing later to maint).
 
  * When receive-pack detects an error in the pack header it received in
    order to decide which of unpack-objects or index-pack to run, it
@@ -264,7 +267,6 @@ details).
    buffer around as human readable object names.  This was not a huge
    problem but was exposed by a new change that uses these names in
    error output.
-   (merge 70d26c6 tr/copy-revisions-from-stdin later to maint).
 
  * Smart-capable HTTP servers were not restricted via the
    GIT_NAMESPACE mechanism when talking with commit-walking clients,
@@ -309,11 +311,9 @@ details).
 
  * Fix a 1.8.1.x regression that stopped matching "dir" (without a
    trailing slash) to a directory "dir".
-   (merge efa5f82 jc/directory-attrs-regression-fix later to maint-1.8.1).
 
  * "git apply --whitespace=fix" was not prepared to see a line getting
    longer after fixing whitespaces (e.g. tab-in-indent aka Python).
-   (merge 329b26e jc/apply-ws-fix-tab-in-indent later to maint-1.8.1).
 
  * The prompt string generator (in contrib/completion/) did not notice
    when we are in a middle of a "git revert" session.
index 104579dc75128811e475d408035569ac09f3283b..b8a9b863751cc7fa4e763e61926982359633acc8 100644 (file)
@@ -480,7 +480,7 @@ endif::git-format-patch[]
 
 --ignore-submodules[=<when>]::
        Ignore changes to submodules in the diff generation. <when> can be
-       either "none", "untracked", "dirty" or "all", which is the default
+       either "none", "untracked", "dirty" or "all", which is the default.
        Using "none" will consider the submodule modified when it either contains
        untracked or modified files or its HEAD differs from the commit recorded
        in the superproject and can be used to override any settings of the
index 854e4d0c425a9396bdb71dc84093f43156b04cd5..7f5601bda510d8474afcfafffada3633b7e39f1c 100644 (file)
@@ -82,7 +82,7 @@ SEE ALSO
 --------
 linkgit:gitignore[5]
 linkgit:gitconfig[5]
-linkgit:git-ls-files[5]
+linkgit:git-ls-files[1]
 
 GIT
 ---
index 23a9413525d4f90435c4996af4d4866b326783bb..ca118ac6bfff9f837d06de37f99f457f6d38916b 100644 (file)
@@ -131,9 +131,9 @@ entries; instead, unmerged entries are ignored.
        "--track" in linkgit:git-branch[1] for details.
 +
 If no '-b' option is given, the name of the new branch will be
-derived from the remote-tracking branch.  If "remotes/" or "refs/remotes/"
-is prefixed it is stripped away, and then the part up to the
-next slash (which would be the nickname of the remote) is removed.
+derived from the remote-tracking branch, by looking at the local part of
+the refspec configured for the corresponding remote, and then stripping
+the initial part up to the "*".
 This would tell us to use "hack" as the local branch when branching
 off of "origin/hack" (or "remotes/origin/hack", or even
 "refs/remotes/origin/hack").  If the given name has no slash, or the above
index d88a6fcb29395ac200930191518fdbceca78bbd4..606f00c3b89479477f3bee619309de4f11bffa53 100644 (file)
@@ -82,7 +82,7 @@ OPTIONS
 --get::
        Get the value for a given key (optionally filtered by a regex
        matching the value). Returns error code 1 if the key was not
-       found and error code 2 if multiple key values were found.
+       found and the last value if multiple key values were found.
 
 --get-all::
        Like get, but does not fail if the number of values for the key
index d51481394c08ef6e0706bc6ff0ccd6908cddc7b8..df5be268ba69f34fe5e91c3148f8af8c1e0091d6 100644 (file)
@@ -11,7 +11,7 @@ SYNOPSIS
 [verse]
 'git push' [--all | --mirror | --tags] [--follow-tags] [-n | --dry-run] [--receive-pack=<git-receive-pack>]
           [--repo=<repository>] [-f | --force] [--prune] [-v | --verbose] [-u | --set-upstream]
-          [<repository> [<refspec>...]]
+          [--no-verify] [<repository> [<refspec>...]]
 
 DESCRIPTION
 -----------
@@ -195,6 +195,11 @@ useful if you write an alias or script around 'git push'.
        be pushed. If on-demand was not able to push all necessary
        revisions it will also be aborted and exit with non-zero status.
 
+--[no-]verify::
+       Toggle the pre-push hook (see linkgit:githooks[5]).  The
+       default is \--verify, giving the hook a chance to prevent the
+       push.  With \--no-verify, the hook is bypassed completely.
+
 
 include::urls-remotes.txt[]
 
index 9e302b0a60552c4297cb94018dad49169505bd35..0c3dd1e40c462f44ac26b9bc75d031fd3ba03b3e 100644 (file)
@@ -43,6 +43,13 @@ 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.3.2/git.html[documentation for release 1.8.3.2]
+
+* release notes for
+  link:RelNotes/1.8.3.2.txt[1.8.3.2],
+  link:RelNotes/1.8.3.1.txt[1.8.3.1],
+  link:RelNotes/1.8.3.txt[1.8.3].
+
 * link:v1.8.2.3/git.html[documentation for release 1.8.2.3]
 
 * release notes for
index d6f3393c5f5e4e8b564e702a06c632262847ee9d..aa03882ddb119d2e61da50079a72e1a6ab12f636 100644 (file)
@@ -211,6 +211,9 @@ shallow::
        and maintained by shallow clone mechanism.  See `--depth`
        option to linkgit:git-clone[1] and linkgit:git-fetch[1].
 
+modules::
+       Contains the git-repositories of the submodules.
+
 SEE ALSO
 --------
 linkgit:git-init[1],
index 68a18e14975fadb0cba7ba19e45438887a65bd4f..db2a74df934f3acd93521e42510b6cd00c9eed6f 100644 (file)
@@ -400,12 +400,13 @@ should not be combined with other pathspec.
        <<def_ref,ref>> and local ref.
 
 [[def_remote_tracking_branch]]remote-tracking branch::
-       A regular Git <<def_branch,branch>> that is used to follow changes from
-       another <<def_repository,repository>>. A remote-tracking
-       branch should not contain direct modifications or have local commits
-       made to it. A remote-tracking branch can usually be
-       identified as the right-hand-side <<def_ref,ref>> in a Pull:
-       <<def_refspec,refspec>>.
+       A <<def_ref,ref>> that is used to follow changes from another
+       <<def_repository,repository>>. It typically looks like
+       'refs/remotes/foo/bar' (indicating that it tracks a branch named
+       'bar' in a remote named 'foo'), and matches the right-hand-side of
+       a configured fetch <<def_refspec,refspec>>. A remote-tracking
+       branch should not contain direct modifications or have local
+       commits made to it.
 
 [[def_repository]]repository::
        A collection of <<def_ref,refs>> together with an
index f1a51edf47f94f45ce916f7800924e6f135800e2..b898e97988311fe411c02f9f3fe45608e862a71a 100644 (file)
@@ -228,8 +228,7 @@ obtained through ref discovery.
 The client MUST write all obj-ids which it only has shallow copies
 of (meaning that it does not have the parents of a commit) as
 'shallow' lines so that the server is aware of the limitations of
-the client's history. Clients MUST NOT mention an obj-id which
-it does not know exists on the server.
+the client's history.
 
 The client now sends the maximum commit history depth it wants for
 this transaction, which is the number of commits it wants from the
index 3ca122faedd01cfbd61bf07dbc245b04f40f2b23..60ba30011773804a04d5236a4917382615120cfe 100644 (file)
@@ -33,7 +33,7 @@ For local repositories, also supported by Git natively, the following
 syntaxes may be used:
 
 - /path/to/repo.git/
-- file:///path/to/repo.git/
+- \file:///path/to/repo.git/
 
 ifndef::git-clone[]
 These two syntaxes are mostly equivalent, except when cloning, when
index aa87dbfd539b58f1b606823535956fc2f5ab300c..45ead76e10b5acb9abf2dddbe2c2c6b48072e247 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v1.8.3-rc3
+DEF_VER=v1.8.3.2
 
 LF='
 '
index 0f931a203002aec397f8b454f93df9aee97a21ad..11d89a5d272a426e1eab2b0f43b1561cb8141232 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -69,6 +69,9 @@ all::
 # Define NO_MSGFMT_EXTENDED_OPTIONS if your implementation of msgfmt
 # doesn't support GNU extensions like --check and --statistics
 #
+# Define NEEDS_CLIPPED_WRITE if your write(2) cannot write more than
+# INT_MAX bytes at once (e.g. MacOS X).
+#
 # Define HAVE_PATHS_H if you have paths.h and want to use the default PATH
 # it specifies.
 #
@@ -137,6 +140,10 @@ all::
 # specify your own (or DarwinPort's) include directories and
 # library directories by defining CFLAGS and LDFLAGS appropriately.
 #
+# Define NO_APPLE_COMMON_CRYPTO if you are building on Darwin/Mac OS X
+# and do not want to use Apple's CommonCrypto library.  This allows you
+# to provide your own OpenSSL library, for example from MacPorts.
+#
 # Define BLK_SHA1 environment variable to make use of the bundled
 # optimized C SHA1 routine.
 #
@@ -1054,6 +1061,11 @@ ifeq ($(uname_S),Darwin)
                        BASIC_LDFLAGS += -L/opt/local/lib
                endif
        endif
+       ifndef NO_APPLE_COMMON_CRYPTO
+               APPLE_COMMON_CRYPTO = YesPlease
+               COMPAT_CFLAGS += -DAPPLE_COMMON_CRYPTO
+       endif
+       NO_REGEX = YesPlease
        PTHREAD_LIBS =
 endif
 
@@ -1387,11 +1399,17 @@ ifdef PPC_SHA1
        SHA1_HEADER = "ppc/sha1.h"
        LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
        LIB_H += ppc/sha1.h
+else
+ifdef APPLE_COMMON_CRYPTO
+       COMPAT_CFLAGS += -DCOMMON_DIGEST_FOR_OPENSSL
+       SHA1_HEADER = <CommonCrypto/CommonDigest.h>
 else
        SHA1_HEADER = <openssl/sha.h>
        EXTLIBS += $(LIB_4_CRYPTO)
 endif
 endif
+endif
+
 ifdef NO_PERL_MAKEMAKER
        export NO_PERL_MAKEMAKER
 endif
@@ -1466,6 +1484,11 @@ ifndef NO_MSGFMT_EXTENDED_OPTIONS
        MSGFMT += --check --statistics
 endif
 
+ifdef NEEDS_CLIPPED_WRITE
+       BASIC_CFLAGS += -DNEEDS_CLIPPED_WRITE
+       COMPAT_OBJS += compat/clipped-write.o
+endif
+
 ifneq (,$(XDL_FAST_HASH))
        BASIC_CFLAGS += -DXDL_FAST_HASH
 endif
index 80b7e388ad321ea679e2b14ce4f18972da35156c..a5201213ac9907a441253399dc1021859f92bf5d 120000 (symlink)
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes/1.8.3.txt
\ No newline at end of file
+Documentation/RelNotes/1.8.3.3.txt
\ No newline at end of file
index 97c72bfe7043701132a2710bf03c5ce3ee109ba5..c5c6984cb5266c27d3c13aa6e6aacaab56e112c0 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -197,6 +197,21 @@ int validate_new_branchname(const char *name, struct strbuf *ref,
        return 1;
 }
 
+static int check_tracking_branch(struct remote *remote, void *cb_data)
+{
+       char *tracking_branch = cb_data;
+       struct refspec query;
+       memset(&query, 0, sizeof(struct refspec));
+       query.dst = tracking_branch;
+       return !(remote_find_tracking(remote, &query) ||
+                prefixcmp(query.src, "refs/heads/"));
+}
+
+static int validate_remote_tracking_branch(char *ref)
+{
+       return !for_each_remote(check_tracking_branch, ref);
+}
+
 static const char upstream_not_branch[] =
 N_("Cannot setup tracking information; starting point '%s' is not a branch.");
 static const char upstream_missing[] =
@@ -259,7 +274,7 @@ void create_branch(const char *head,
        case 1:
                /* Unique completion -- good, only if it is a real branch */
                if (prefixcmp(real_ref, "refs/heads/") &&
-                   prefixcmp(real_ref, "refs/remotes/")) {
+                   validate_remote_tracking_branch(real_ref)) {
                        if (explicit_tracking)
                                die(_(upstream_not_branch), start_name);
                        else
index 81b4419da51f3211129833a472048d897385bca4..f5b50e520feb42c50cd1783871eb63d009e0a0e0 100644 (file)
@@ -825,38 +825,40 @@ static int git_checkout_config(const char *var, const char *value, void *cb)
 }
 
 struct tracking_name_data {
-       const char *name;
-       char *remote;
+       /* const */ char *src_ref;
+       char *dst_ref;
+       unsigned char *dst_sha1;
        int unique;
 };
 
-static int check_tracking_name(const char *refname, const unsigned char *sha1,
-                              int flags, void *cb_data)
+static int check_tracking_name(struct remote *remote, void *cb_data)
 {
        struct tracking_name_data *cb = cb_data;
-       const char *slash;
-
-       if (prefixcmp(refname, "refs/remotes/"))
-               return 0;
-       slash = strchr(refname + 13, '/');
-       if (!slash || strcmp(slash + 1, cb->name))
+       struct refspec query;
+       memset(&query, 0, sizeof(struct refspec));
+       query.src = cb->src_ref;
+       if (remote_find_tracking(remote, &query) ||
+           get_sha1(query.dst, cb->dst_sha1))
                return 0;
-       if (cb->remote) {
+       if (cb->dst_ref) {
                cb->unique = 0;
                return 0;
        }
-       cb->remote = xstrdup(refname);
+       cb->dst_ref = xstrdup(query.dst);
        return 0;
 }
 
-static const char *unique_tracking_name(const char *name)
+static const char *unique_tracking_name(const char *name, unsigned char *sha1)
 {
-       struct tracking_name_data cb_data = { NULL, NULL, 1 };
-       cb_data.name = name;
-       for_each_ref(check_tracking_name, &cb_data);
+       struct tracking_name_data cb_data = { NULL, NULL, NULL, 1 };
+       char src_ref[PATH_MAX];
+       snprintf(src_ref, PATH_MAX, "refs/heads/%s", name);
+       cb_data.src_ref = src_ref;
+       cb_data.dst_sha1 = sha1;
+       for_each_remote(check_tracking_name, &cb_data);
        if (cb_data.unique)
-               return cb_data.remote;
-       free(cb_data.remote);
+               return cb_data.dst_ref;
+       free(cb_data.dst_ref);
        return NULL;
 }
 
@@ -919,8 +921,8 @@ static int parse_branchname_arg(int argc, const char **argv,
                if (dwim_new_local_branch_ok &&
                    !check_filename(NULL, arg) &&
                    argc == 1) {
-                       const char *remote = unique_tracking_name(arg);
-                       if (!remote || get_sha1(remote, rev))
+                       const char *remote = unique_tracking_name(arg, rev);
+                       if (!remote)
                                return argcount;
                        *new_branch = arg;
                        arg = remote;
index 035ab649504d69a83f87b854582c8003a2dcb905..dad426598962b2f1a00158ac7eeb05b7958d68ed 100644 (file)
@@ -546,8 +546,12 @@ static void update_remote_refs(const struct ref *refs,
 {
        const struct ref *rm = mapped_refs;
 
+       if (0 <= option_verbosity)
+               printf(_("Checking connectivity... "));
        if (check_everything_connected(iterate_ref_map, 0, &rm))
                die(_("remote did not send all necessary objects"));
+       if (0 <= option_verbosity)
+               printf(_("done\n"));
 
        if (refs) {
                write_remote_refs(mapped_refs);
index d2f30d960a71e41da88d6cc4201cbdca168b8648..1621dfcd4008fc5853fc078a32bf9eefb6c52023 100644 (file)
@@ -107,7 +107,7 @@ static const char *cleanup_arg;
 
 static enum commit_whence whence;
 static int use_editor = 1, include_status = 1;
-static int show_ignored_in_status;
+static int show_ignored_in_status, have_option_m;
 static const char *only_include_assumed;
 static struct strbuf message = STRBUF_INIT;
 
@@ -121,9 +121,11 @@ static enum {
 static int opt_parse_m(const struct option *opt, const char *arg, int unset)
 {
        struct strbuf *buf = opt->value;
-       if (unset)
+       if (unset) {
+               have_option_m = 0;
                strbuf_setlen(buf, 0);
-       else {
+       } else {
+               have_option_m = 1;
                if (buf->len)
                        strbuf_addch(buf, '\n');
                strbuf_addstr(buf, arg);
@@ -975,7 +977,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
        if (force_author && renew_authorship)
                die(_("Using both --reset-author and --author does not make sense"));
 
-       if (logfile || message.len || use_message || fixup_message)
+       if (logfile || have_option_m || use_message || fixup_message)
                use_editor = 0;
        if (0 <= edit_flag)
                use_editor = edit_flag;
index 33c9bf9d84f514330f12de5cbd9dfb610a1b16de..19ffcaf18776e8b100ee3f57c7ca7447436c5476 100644 (file)
@@ -379,8 +379,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)
                         */
                        die("$HOME not set");
 
-               if (access_or_warn(user_config, R_OK) &&
-                   xdg_config && !access_or_warn(xdg_config, R_OK))
+               if (access_or_warn(user_config, R_OK, 0) &&
+                   xdg_config && !access_or_warn(xdg_config, R_OK, 0))
                        given_config_file = xdg_config;
                else
                        given_config_file = user_config;
index 909c34dfda984be86fba2013fedc3fdb10b5e2f1..2d84d10720fad88becdfe957f3770a2c44ac0a8f 100644 (file)
@@ -113,17 +113,19 @@ static NORETURN int die_push_simple(struct branch *branch, struct remote *remote
            remote->name, branch->name, advice_maybe);
 }
 
+static const char message_detached_head_die[] =
+       N_("You are not currently on a branch.\n"
+          "To push the history leading to the current (detached HEAD)\n"
+          "state now, use\n"
+          "\n"
+          "    git push %s HEAD:<name-of-remote-branch>\n");
+
 static void setup_push_upstream(struct remote *remote, int simple)
 {
        struct strbuf refspec = STRBUF_INIT;
        struct branch *branch = branch_get(NULL);
        if (!branch)
-               die(_("You are not currently on a branch.\n"
-                   "To push the history leading to the current (detached HEAD)\n"
-                   "state now, use\n"
-                   "\n"
-                   "    git push %s HEAD:<name-of-remote-branch>\n"),
-                   remote->name);
+               die(_(message_detached_head_die), remote->name);
        if (!branch->merge_nr || !branch->merge || !branch->remote_name)
                die(_("The current branch %s has no upstream branch.\n"
                    "To push the current branch and set the remote as upstream, use\n"
@@ -173,6 +175,8 @@ static void warn_unspecified_push_default_configuration(void)
 
 static void setup_default_push_refspecs(struct remote *remote)
 {
+       struct branch *branch;
+
        switch (push_default) {
        default:
        case PUSH_DEFAULT_UNSPECIFIED:
@@ -192,7 +196,10 @@ static void setup_default_push_refspecs(struct remote *remote)
                break;
 
        case PUSH_DEFAULT_CURRENT:
-               add_refspec("HEAD");
+               branch = branch_get(NULL);
+               if (!branch)
+                       die(_(message_detached_head_die), remote->name);
+               add_refspec(branch->name);
                break;
 
        case PUSH_DEFAULT_NOTHING:
index 77d7872aafe659045e9ec228de97e87c9cea00a1..3e8bb17831aa5f2f39ee3a07eeebdda90ae39556 100644 (file)
@@ -518,8 +518,11 @@ static int give_context(struct sline *sline, unsigned long cnt, int num_parent)
                unsigned long k;
 
                /* Paint a few lines before the first interesting line. */
-               while (j < i)
-                       sline[j++].flag |= mark | no_pre_delete;
+               while (j < i) {
+                       if (!(sline[j].flag & mark))
+                               sline[j].flag |= no_pre_delete;
+                       sline[j++].flag |= mark;
+               }
 
        again:
                /* we know up to i is to be included.  where does the
index 67bd5091be0b34bfea075cd60281d22cf5b34768..6e9c7cd9d5da7d24d4810b36039681f184325932 100644 (file)
--- a/commit.h
+++ b/commit.h
@@ -176,6 +176,8 @@ extern int for_each_commit_graft(each_commit_graft_fn, void *);
 extern int is_repository_shallow(void);
 extern struct commit_list *get_shallow_commits(struct object_array *heads,
                int depth, int shallow_flag, int not_shallow_flag);
+extern void check_shallow_file_for_update(void);
+extern void set_alternate_shallow_file(const char *path);
 
 int is_descendant_of(struct commit *, struct commit_list *);
 int in_merge_bases(struct commit *, struct commit *);
diff --git a/compat/clipped-write.c b/compat/clipped-write.c
new file mode 100644 (file)
index 0000000..b8f98ff
--- /dev/null
@@ -0,0 +1,13 @@
+#include "../git-compat-util.h"
+#undef write
+
+/*
+ * Version of write that will write at most INT_MAX bytes.
+ * Workaround a xnu bug on Mac OS X
+ */
+ssize_t clipped_write(int fildes, const void *buf, size_t nbyte)
+{
+       if (nbyte > INT_MAX)
+               nbyte = INT_MAX;
+       return write(fildes, buf, nbyte);
+}
index b67362558046f354b167fe185369b3d2b98879c1..dae30a081c03b28aa7b89489ffd01b6ce24e8070 100644 (file)
@@ -1677,14 +1677,16 @@ int sigaction(int sig, struct sigaction *in, struct sigaction *out)
 #undef signal
 sig_handler_t mingw_signal(int sig, sig_handler_t handler)
 {
-       sig_handler_t old = timer_fn;
+       sig_handler_t old;
 
        switch (sig) {
        case SIGALRM:
+               old = timer_fn;
                timer_fn = handler;
                break;
 
        case SIGINT:
+               old = sigint_fn;
                sigint_fn = handler;
                break;
 
index aefd80b12a079d4a3c91d43c8a2c33ed6fbd0a38..830ee14b437ca74a3db9e56ea8cedff78b7964b6 100644 (file)
--- a/config.c
+++ b/config.c
@@ -58,7 +58,7 @@ static int handle_path_include(const char *path, struct config_include_data *inc
                path = buf.buf;
        }
 
-       if (!access_or_die(path, R_OK)) {
+       if (!access_or_die(path, R_OK, 0)) {
                if (++inc->depth > MAX_INCLUDE_DEPTH)
                        die(include_depth_advice, MAX_INCLUDE_DEPTH, path,
                            cf && cf->name ? cf->name : "the command line");
@@ -954,23 +954,23 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config)
 
        home_config_paths(&user_config, &xdg_config, "config");
 
-       if (git_config_system() && !access_or_die(git_etc_gitconfig(), R_OK)) {
+       if (git_config_system() && !access_or_die(git_etc_gitconfig(), R_OK, 0)) {
                ret += git_config_from_file(fn, git_etc_gitconfig(),
                                            data);
                found += 1;
        }
 
-       if (xdg_config && !access_or_die(xdg_config, R_OK)) {
+       if (xdg_config && !access_or_die(xdg_config, R_OK, ACCESS_EACCES_OK)) {
                ret += git_config_from_file(fn, xdg_config, data);
                found += 1;
        }
 
-       if (user_config && !access_or_die(user_config, R_OK)) {
+       if (user_config && !access_or_die(user_config, R_OK, ACCESS_EACCES_OK)) {
                ret += git_config_from_file(fn, user_config, data);
                found += 1;
        }
 
-       if (repo_config && !access_or_die(repo_config, R_OK)) {
+       if (repo_config && !access_or_die(repo_config, R_OK, 0)) {
                ret += git_config_from_file(fn, repo_config, data);
                found += 1;
        }
index d78fd3df5b211130ba8ff77197a3f852c32aab86..174703b67cc75fc48fd3bf5345468e9eeca89fc2 100644 (file)
@@ -95,6 +95,7 @@ ifeq ($(uname_S),Darwin)
        NO_MEMMEM = YesPlease
        USE_ST_TIMESPEC = YesPlease
        HAVE_DEV_TTY = YesPlease
+       NEEDS_CLIPPED_WRITE = YesPlease
        COMPAT_OBJS += compat/precompose_utf8.o
        BASIC_CFLAGS += -DPRECOMPOSE_UNICODE
 endif
index f3462d9c81f12ea07229128f6bef7a4ff3fcfe10..2f433939dc9d9001c7ace83bfeadf567eb90c30c 100644 (file)
@@ -193,7 +193,7 @@ AC_ARG_ENABLE([pthreads],
   [FLAGS is the value to pass to the compiler to enable POSIX Threads.]
   [The default if FLAGS is not specified is to try first -pthread]
   [and then -lpthread.]
-  [--without-pthreads will disable threading.])],
+  [--disable-pthreads will disable threading.])],
 [
 if test "x$enableval" = "xyes"; then
    AC_MSG_NOTICE([Will try -pthread then -lpthread to enable POSIX Threads])
index a98c2fd2de4dbd7ed659daee9303389be91bf8ac..ecf58e032873d8619158af907118969a2cdd3746 100644 (file)
@@ -1246,7 +1246,7 @@ __git_diff_common_options="--stat --numstat --shortstat --summary
                        --no-prefix --src-prefix= --dst-prefix=
                        --inter-hunk-context=
                        --patience --histogram --minimal
-                       --raw
+                       --raw --word-diff
                        --dirstat --dirstat= --dirstat-by-file
                        --dirstat-by-file= --cumulative
                        --diff-algorithm=
@@ -1831,7 +1831,7 @@ _git_config ()
                local remote="${prev#remote.}"
                remote="${remote%.fetch}"
                if [ -z "$cur" ]; then
-                       __gitcompadd "refs/heads/" "" "" ""
+                       __gitcomp_nl "refs/heads/" "" "" ""
                        return
                fi
                __gitcomp_nl "$(__git_refs_remotes "$remote")"
index eaf5c369aacde207cbad4c9df9574e7b26634bb7..54e48299ae795b7a3a50cf09f850faa16b87e692 100644 (file)
@@ -124,7 +124,7 @@ __git_ps1_show_upstream ()
                        fi
                        ;;
                svn-remote.*.url)
-                       svn_remote[ $((${#svn_remote[@]} + 1)) ]="$value"
+                       svn_remote[$((${#svn_remote[@]} + 1))]="$value"
                        svn_url_pattern+="\\|$value"
                        upstream=svn+git # default upstream is SVN if available, else git
                        ;;
@@ -146,10 +146,11 @@ __git_ps1_show_upstream ()
        svn*)
                # get the upstream from the "git-svn-id: ..." in a commit message
                # (git-svn uses essentially the same procedure internally)
-               local svn_upstream=($(git log --first-parent -1 \
+               local -a svn_upstream
+               svn_upstream=($(git log --first-parent -1 \
                                        --grep="^git-svn-id: \(${svn_url_pattern#??}\)" 2>/dev/null))
                if [[ 0 -ne ${#svn_upstream[@]} ]]; then
-                       svn_upstream=${svn_upstream[ ${#svn_upstream[@]} - 2 ]}
+                       svn_upstream=${svn_upstream[${#svn_upstream[@]} - 2]}
                        svn_upstream=${svn_upstream%@*}
                        local n_stop="${#svn_remote[@]}"
                        for ((n=1; n <= n_stop; n++)); do
@@ -279,6 +280,7 @@ __git_ps1 ()
                                step=$(cat "$g/rebase-apply/next")
                                total=$(cat "$g/rebase-apply/last")
                                if [ -f "$g/rebase-apply/rebasing" ]; then
+                                       b="$(cat "$g/rebase-apply/head-name")"
                                        r="|REBASE"
                                elif [ -f "$g/rebase-apply/applying" ]; then
                                        r="|AM"
@@ -295,6 +297,7 @@ __git_ps1 ()
                                r="|BISECTING"
                        fi
 
+                       test -n "$b" ||
                        b="$(git symbolic-ref HEAD 2>/dev/null)" || {
                                detached=yes
                                b="$(
index 01555dc3471422e050ebef110840bf98633786e7..1dd3d7030efa7e6a3e25a45d019938e2d8f8d890 100755 (executable)
@@ -24,9 +24,6 @@ import urllib
 import atexit
 import urlparse, hashlib
 
-#
-# If you want to switch to hg-git compatibility mode:
-# git config --global remote-hg.hg-git-compat true
 #
 # If you are not in hg-git-compat mode and want to disable the tracking of
 # named branches:
@@ -36,7 +33,10 @@ import urlparse, hashlib
 # git config --global remote-hg.force-push false
 #
 # If you want the equivalent of hg's clone/pull--insecure option:
-# git config remote-hg.insecure true
+# git config --global remote-hg.insecure true
+#
+# If you want to switch to hg-git compatibility mode:
+# git config --global remote-hg.hg-git-compat true
 #
 # git:
 # Sensible defaults for git.
index 8a23f58ba04c4b1402c66d03db69d0c109c90b58..10daa8b0eb3352305347354d09ef443993af7809 100755 (executable)
@@ -715,7 +715,8 @@ cmd_push()
            repository=$1
            refspec=$2
            echo "git push using: " $repository $refspec
-           git push $repository $(git subtree split --prefix=$prefix):refs/heads/$refspec
+           localrev=$(git subtree split --prefix="$prefix") || die
+           git push $repository $localrev:refs/heads/$refspec
        else
            die "'$dir' must already exist. Try 'git subtree add'."
        fi
diff --git a/dir.c b/dir.c
index a5926fbd1aeafd468860da7dbd3d8a5d5999a650..897c87403e978ab2123ce088cf2d3265e21d7dde 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -821,6 +821,9 @@ static void prep_exclude(struct dir_struct *dir, const char *base, int baselen)
                                dir->basebuf, stk->baselen - 1,
                                dir->basebuf + current, &dt);
                        dir->basebuf[stk->baselen - 1] = '/';
+                       if (dir->exclude &&
+                           dir->exclude->flags & EXC_FLAG_NEGATIVE)
+                               dir->exclude = NULL;
                        if (dir->exclude) {
                                dir->basebuf[stk->baselen] = 0;
                                dir->exclude_stack = stk;
@@ -1542,9 +1545,9 @@ void setup_standard_excludes(struct dir_struct *dir)
                home_config_paths(NULL, &xdg_path, "ignore");
                excludes_file = xdg_path;
        }
-       if (!access_or_warn(path, R_OK))
+       if (!access_or_warn(path, R_OK, 0))
                add_excludes_from_file(dir, path);
-       if (excludes_file && !access_or_warn(excludes_file, R_OK))
+       if (excludes_file && !access_or_warn(excludes_file, R_OK, 0))
                add_excludes_from_file(dir, excludes_file);
 }
 
index f156dd4fac30cda4e09c508b7091cdb8d96917e2..6b5467c6dec9645f53d83cdad2467a158db622c0 100644 (file)
@@ -20,6 +20,8 @@ static int no_done;
 static int fetch_fsck_objects = -1;
 static int transfer_fsck_objects = -1;
 static int agent_supported;
+static struct lock_file shallow_lock;
+static const char *alternate_shallow_file;
 
 #define COMPLETE       (1U << 0)
 #define COMMON         (1U << 1)
@@ -683,7 +685,7 @@ static int get_pack(struct fetch_pack_args *args,
                    int xd[2], char **pack_lockfile)
 {
        struct async demux;
-       const char *argv[20];
+       const char *argv[22];
        char keep_arg[256];
        char hdr_arg[256];
        const char **av;
@@ -724,6 +726,11 @@ static int get_pack(struct fetch_pack_args *args,
                        do_keep = 1;
        }
 
+       if (alternate_shallow_file) {
+               *av++ = "--shallow-file";
+               *av++ = alternate_shallow_file;
+       }
+
        if (do_keep) {
                if (pack_lockfile)
                        cmd.out = -1;
@@ -779,6 +786,27 @@ static int cmp_ref_by_name(const void *a_, const void *b_)
        return strcmp(a->name, b->name);
 }
 
+static void setup_alternate_shallow(void)
+{
+       struct strbuf sb = STRBUF_INIT;
+       int fd;
+
+       check_shallow_file_for_update();
+       fd = hold_lock_file_for_update(&shallow_lock, git_path("shallow"),
+                                      LOCK_DIE_ON_ERROR);
+       if (write_shallow_commits(&sb, 0)) {
+               if (write_in_full(fd, sb.buf, sb.len) != sb.len)
+                       die_errno("failed to write to %s", shallow_lock.filename);
+               alternate_shallow_file = shallow_lock.filename;
+       } else
+               /*
+                * is_repository_shallow() sees empty string as "no
+                * shallow file".
+                */
+               alternate_shallow_file = "";
+       strbuf_release(&sb);
+}
+
 static struct ref *do_fetch_pack(struct fetch_pack_args *args,
                                 int fd[2],
                                 const struct ref *orig_ref,
@@ -858,6 +886,8 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
 
        if (args->stateless_rpc)
                packet_flush(fd[1]);
+       if (args->depth > 0)
+               setup_alternate_shallow();
        if (get_pack(args, fd, pack_lockfile))
                die("git fetch-pack: fetch failed.");
 
@@ -936,15 +966,9 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
                       struct ref **sought, int nr_sought,
                       char **pack_lockfile)
 {
-       struct stat st;
        struct ref *ref_cpy;
 
        fetch_pack_setup();
-       if (args->depth > 0) {
-               if (stat(git_path("shallow"), &st))
-                       st.st_mtime = 0;
-       }
-
        if (nr_sought)
                nr_sought = remove_duplicates_in_refs(sought, nr_sought);
 
@@ -954,35 +978,12 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
        }
        ref_cpy = do_fetch_pack(args, fd, ref, sought, nr_sought, pack_lockfile);
 
-       if (args->depth > 0) {
-               static struct lock_file lock;
-               struct cache_time mtime;
-               struct strbuf sb = STRBUF_INIT;
-               char *shallow = git_path("shallow");
-               int fd;
-
-               mtime.sec = st.st_mtime;
-               mtime.nsec = ST_MTIME_NSEC(st);
-               if (stat(shallow, &st)) {
-                       if (mtime.sec)
-                               die("shallow file was removed during fetch");
-               } else if (st.st_mtime != mtime.sec
-#ifdef USE_NSEC
-                               || ST_MTIME_NSEC(st) != mtime.nsec
-#endif
-                         )
-                       die("shallow file was changed during fetch");
-
-               fd = hold_lock_file_for_update(&lock, shallow,
-                                              LOCK_DIE_ON_ERROR);
-               if (!write_shallow_commits(&sb, 0)
-                || write_in_full(fd, sb.buf, sb.len) != sb.len) {
-                       unlink_or_warn(shallow);
-                       rollback_lock_file(&lock);
-               } else {
-                       commit_lock_file(&lock);
-               }
-               strbuf_release(&sb);
+       if (alternate_shallow_file) {
+               if (*alternate_shallow_file == '\0') { /* --unshallow */
+                       unlink_or_warn(git_path("shallow"));
+                       rollback_lock_file(&shallow_lock);
+               } else
+                       commit_lock_file(&shallow_lock);
        }
 
        reprepare_packed_git();
index e955bb5e8b3101cc8c753cf541beabf5cd037b39..660b7f012ac8a94a25da818c0ec6667ff3378add 100644 (file)
@@ -185,6 +185,11 @@ int get_st_mode_bits(const char *path, int *mode);
 #define probe_utf8_pathname_composition(a,b)
 #endif
 
+#ifdef NEEDS_CLIPPED_WRITE
+ssize_t clipped_write(int fildes, const void *buf, size_t nbyte);
+#define write(x,y,z) clipped_write((x),(y),(z))
+#endif
+
 #ifdef MKDIR_WO_TRAILING_SLASH
 #define mkdir(a,b) compat_mkdir_wo_trailing_slash((a),(b))
 extern int compat_mkdir_wo_trailing_slash(const char*, mode_t);
@@ -692,8 +697,9 @@ int remove_or_warn(unsigned int mode, const char *path);
  * Call access(2), but warn for any error except "missing file"
  * (ENOENT or ENOTDIR).
  */
-int access_or_warn(const char *path, int mode);
-int access_or_die(const char *path, int mode);
+#define ACCESS_EACCES_OK (1U << 0)
+int access_or_warn(const char *path, int mode, unsigned flag);
+int access_or_die(const char *path, int mode, unsigned flag);
 
 /* Warn on an inaccessible file that ought to be accessible */
 void warn_on_inaccessible(const char *path);
index 8a7520553776ec9d0c8d38526041dd37742d3bc1..e57d3d1295a5ba0a9c02c19df512c909a0631baa 100755 (executable)
@@ -85,13 +85,9 @@ sub exit_cleanup
 
 sub use_wt_file
 {
-       my ($repo, $workdir, $file, $sha1, $symlinks) = @_;
+       my ($repo, $workdir, $file, $sha1) = @_;
        my $null_sha1 = '0' x 40;
 
-       if ($sha1 ne $null_sha1 and not $symlinks) {
-               return 0;
-       }
-
        if (! -e "$workdir/$file") {
                # If the file doesn't exist in the working tree, we cannot
                # use it.
@@ -213,8 +209,7 @@ sub setup_dir_diff
 
                if ($rmode ne $null_mode) {
                        my ($use, $wt_sha1) = use_wt_file($repo, $workdir,
-                                                         $dst_path, $rsha1,
-                                                         $symlinks);
+                                                         $dst_path, $rsha1);
                        if ($use) {
                                push @working_tree, $dst_path;
                                $wtindex .= "$rmode $wt_sha1\t$dst_path\0";
diff --git a/git.c b/git.c
index 1ada169d5cff3051effee33c6f9ba5b9be15b2e6..88eef5a7cc6d36f6e17f4855945116dd6f1b0681 100644 (file)
--- a/git.c
+++ b/git.c
@@ -4,6 +4,7 @@
 #include "help.h"
 #include "quote.h"
 #include "run-command.h"
+#include "commit.h"
 
 const char git_usage_string[] =
        "git [--version] [--help] [-c name=value]\n"
@@ -146,6 +147,12 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
                        setenv(GIT_LITERAL_PATHSPECS_ENVIRONMENT, "0", 1);
                        if (envchanged)
                                *envchanged = 1;
+               } else if (!strcmp(cmd, "--shallow-file")) {
+                       (*argv)++;
+                       (*argc)--;
+                       set_alternate_shallow_file((*argv)[0]);
+                       if (envchanged)
+                               *envchanged = 1;
                } else {
                        fprintf(stderr, "Unknown option: %s\n", cmd);
                        usage(git_usage_string);
index d9bcfb44dc334d86363fd60b576fcc2e2121f971..d6b65e204c6009e5c30f358810198319b70eda25 100644 (file)
 #ifdef NO_OPENSSL
 typedef void *SSL;
 #else
+#ifdef APPLE_COMMON_CRYPTO
+#include <CommonCrypto/CommonHMAC.h>
+#define HMAC_CTX CCHmacContext
+#define HMAC_Init(hmac, key, len, algo) CCHmacInit(hmac, algo, key, len)
+#define HMAC_Update CCHmacUpdate
+#define HMAC_Final(hmac, hash, ptr) CCHmacFinal(hmac, hash)
+#define HMAC_CTX_cleanup(ignore)
+#define EVP_md5() kCCHmacAlgMD5
+#else
 #include <openssl/evp.h>
 #include <openssl/hmac.h>
+#endif
 #include <openssl/x509v3.h>
 #endif
 
index a67b615bfc7001ac28e339db1d91ea46a1b125b5..7f7a8ab7cb38eaceeb177472385a4a5fcfabe91c 100644 (file)
@@ -915,6 +915,19 @@ static void add_rev_cmdline(struct rev_info *revs,
        info->nr++;
 }
 
+static void add_rev_cmdline_list(struct rev_info *revs,
+                                struct commit_list *commit_list,
+                                int whence,
+                                unsigned flags)
+{
+       while (commit_list) {
+               struct object *object = &commit_list->item->object;
+               add_rev_cmdline(revs, object, sha1_to_hex(object->sha1),
+                               whence, flags);
+               commit_list = commit_list->next;
+       }
+}
+
 struct all_refs_cb {
        int all_flags;
        int warned_bad_reflog;
@@ -1092,6 +1105,7 @@ static void prepare_show_merge(struct rev_info *revs)
        add_pending_object(revs, &head->object, "HEAD");
        add_pending_object(revs, &other->object, "MERGE_HEAD");
        bases = get_merge_bases(head, other, 1);
+       add_rev_cmdline_list(revs, bases, REV_CMD_MERGE_BASE, UNINTERESTING);
        add_pending_commit_list(revs, bases, UNINTERESTING);
        free_commit_list(bases);
        head->object.flags |= SYMMETRIC_LEFT;
@@ -1179,6 +1193,9 @@ int handle_revision_arg(const char *arg_, struct rev_info *revs, int flags, unsi
 
                        if (symmetric) {
                                exclude = get_merge_bases(a, b, 1);
+                               add_rev_cmdline_list(revs, exclude,
+                                                    REV_CMD_MERGE_BASE,
+                                                    flags_exclude);
                                add_pending_commit_list(revs, exclude,
                                                        flags_exclude);
                                free_commit_list(exclude);
index 01bd2b7c07719c9628bba13e34b581dc1fdbc0af..878a5556fd5e1c82f0fc35e1669e33623397ceeb 100644 (file)
@@ -35,6 +35,7 @@ struct rev_cmdline_info {
                        REV_CMD_PARENTS_ONLY,
                        REV_CMD_LEFT,
                        REV_CMD_RIGHT,
+                       REV_CMD_MERGE_BASE,
                        REV_CMD_REV
                } whence;
                unsigned flags;
index 67e815b2db00e4d406693f82e96b11bb701509a5..b114cc922d4abce741b56e9da11fbef1382b4008 100644 (file)
@@ -2138,7 +2138,7 @@ void *unpack_entry(struct packed_git *p, off_t obj_offset,
                if (!data)
                        die("failed to apply delta");
 
-               free (delta_data);
+               free(delta_data);
        }
 
        *final_type = type;
index 01b36ead42c2c7d22550c83061e8ff17b91720f6..b3a90e6f051e8b75458055144829ea72bbe29970 100644 (file)
@@ -1065,9 +1065,13 @@ int interpret_branch_name(const char *name, struct strbuf *buf)
 int strbuf_branchname(struct strbuf *sb, const char *name)
 {
        int len = strlen(name);
-       if (interpret_branch_name(name, sb) == len)
+       int used = interpret_branch_name(name, sb);
+
+       if (used == len)
                return 0;
-       strbuf_add(sb, name, len);
+       if (used < 0)
+               used = 0;
+       strbuf_add(sb, name + used, len - used);
        return len;
 }
 
index 6be915f38f1fe8dbe0a22c4cd8ae2569331f483f..cbe2526d8c2b2643957eea2729a16269a7a74fab 100644 (file)
--- a/shallow.c
+++ b/shallow.c
@@ -3,6 +3,16 @@
 #include "tag.h"
 
 static int is_shallow = -1;
+static struct stat shallow_stat;
+static char *alternate_shallow_file;
+
+void set_alternate_shallow_file(const char *path)
+{
+       if (is_shallow != -1)
+               die("BUG: is_repository_shallow must not be called before set_alternate_shallow_file");
+       free(alternate_shallow_file);
+       alternate_shallow_file = path ? xstrdup(path) : NULL;
+}
 
 int register_shallow(const unsigned char *sha1)
 {
@@ -21,12 +31,21 @@ int is_repository_shallow(void)
 {
        FILE *fp;
        char buf[1024];
+       const char *path = alternate_shallow_file;
 
        if (is_shallow >= 0)
                return is_shallow;
 
-       fp = fopen(git_path("shallow"), "r");
-       if (!fp) {
+       if (!path)
+               path = git_path("shallow");
+       /*
+        * fetch-pack sets '--shallow-file ""' as an indicator that no
+        * shallow file should be used. We could just open it and it
+        * will likely fail. But let's do an explicit check instead.
+        */
+       if (!*path ||
+           stat(path, &shallow_stat) ||
+           (fp = fopen(path, "r")) == NULL) {
                is_shallow = 0;
                return is_shallow;
        }
@@ -108,3 +127,22 @@ struct commit_list *get_shallow_commits(struct object_array *heads, int depth,
 
        return result;
 }
+
+void check_shallow_file_for_update(void)
+{
+       struct stat st;
+
+       if (!is_shallow)
+               return;
+       else if (is_shallow == -1)
+               die("BUG: shallow must be initialized by now");
+
+       if (stat(git_path("shallow"), &st))
+               die("shallow file was removed during fetch");
+       else if (st.st_mtime != shallow_stat.st_mtime
+#ifdef USE_NSEC
+                || ST_MTIME_NSEC(st) != ST_MTIME_NSEC(shallow_stat)
+#endif
+                  )
+               die("shallow file was changed during fetch");
+}
index e728025f60dbf7f3df87b7104af6410832ddb653..1821a5b3160bd3a3e60f328b50b56a0208b2df9c 100644 (file)
@@ -603,9 +603,8 @@ int fetch_populated_submodules(const struct argv_array *options,
        if (!work_tree)
                goto out;
 
-       if (!the_index.initialized)
-               if (read_cache() < 0)
-                       die("index file corrupt");
+       if (read_cache() < 0)
+               die("index file corrupt");
 
        argv_array_push(&argv, "fetch");
        for (i = 0; i < options->argc; i++)
index e669bb31b9aa2513a6f71de9fd066a21a0a3bde7..35b3c5c2faec0ed543dde460a30de63c48e5f1e7 100644 (file)
--- a/t/README
+++ b/t/README
@@ -324,6 +324,9 @@ Don't:
    use 'test_must_fail git cmd'.  This will signal a failure if git
    dies in an unexpected way (e.g. segfault).
 
+   On the other hand, don't use test_must_fail for running regular
+   platform commands; just use '! cmd'.
+
  - use perl without spelling it as "$PERL_PATH". This is to help our
    friends on Windows where the platform Perl often adds CR before
    the end of line, and they bundle Git with a version of Perl that
index 6ccf7970916b58748aedcce7e583eed2dee782d3..8098a88c823d691a4e349cd544e19f9b340b7650 100644 (file)
@@ -17,6 +17,8 @@
 #       ("squash", "fixup", "edit", or "reword") and the SHA1 taken
 #       from the specified line.
 #
+#   "exec_cmd_with_args" -- add an "exec cmd with args" line.
+#
 #   "#" -- Add a comment line.
 #
 #   ">" -- Add a blank line.
index da2c504e53e37840f71790d6b262106b7b57d697..986b2a8f2664b1734964049a5b24fc50cf938cfe 100755 (executable)
@@ -17,7 +17,7 @@ test_expect_success 'mktemp to nonexistent directory prints filename' '
        grep "doesnotexist/test" err
 '
 
-test_expect_success POSIXPERM 'mktemp to unwritable directory prints filename' '
+test_expect_success POSIXPERM,SANITY 'mktemp to unwritable directory prints filename' '
        mkdir cannotwrite &&
        chmod -w cannotwrite &&
        test_when_finished "chmod +w cannotwrite" &&
index 315b9b3f10cfae0186afca6f8024d73cce0a19e2..e0a69402324fed3c2fd7ca9495f5735742766108 100755 (executable)
@@ -27,6 +27,7 @@ test_expect_success 'merge @{-1}' '
        test_commit B &&
        git checkout A &&
        test_commit C &&
+       test_commit D &&
        git branch -f master B &&
        git branch -f other &&
        git checkout other &&
@@ -35,14 +36,24 @@ test_expect_success 'merge @{-1}' '
        git cat-file commit HEAD | grep "Merge branch '\''other'\''"
 '
 
-test_expect_success 'merge @{-1} when there is not enough switches yet' '
+test_expect_success 'merge @{-1}~1' '
+       git checkout master &&
+       git reset --hard B &&
+       git checkout other &&
+       git checkout master &&
+       git merge @{-1}~1 &&
+       git cat-file commit HEAD >actual &&
+       grep "Merge branch '\''other'\''" actual
+'
+
+test_expect_success 'merge @{-100} before checking out that many branches yet' '
        git reflog expire --expire=now &&
        git checkout -f master &&
        git reset --hard B &&
        git branch -f other C &&
        git checkout other &&
        git checkout master &&
-       test_must_fail git merge @{-12}
+       test_must_fail git merge @{-100}
 '
 
 test_done
diff --git a/t/t2024-checkout-dwim.sh b/t/t2024-checkout-dwim.sh
new file mode 100755 (executable)
index 0000000..dee55e4
--- /dev/null
@@ -0,0 +1,167 @@
+#!/bin/sh
+
+test_description='checkout <branch>
+
+Ensures that checkout on an unborn branch does what the user expects'
+
+. ./test-lib.sh
+
+# Is the current branch "refs/heads/$1"?
+test_branch () {
+       printf "%s\n" "refs/heads/$1" >expect.HEAD &&
+       git symbolic-ref HEAD >actual.HEAD &&
+       test_cmp expect.HEAD actual.HEAD
+}
+
+# Is branch "refs/heads/$1" set to pull from "$2/$3"?
+test_branch_upstream () {
+       printf "%s\n" "$2" "refs/heads/$3" >expect.upstream &&
+       {
+               git config "branch.$1.remote" &&
+               git config "branch.$1.merge"
+       } >actual.upstream &&
+       test_cmp expect.upstream actual.upstream
+}
+
+test_expect_success 'setup' '
+       test_commit my_master &&
+       git init repo_a &&
+       (
+               cd repo_a &&
+               test_commit a_master &&
+               git checkout -b foo &&
+               test_commit a_foo &&
+               git checkout -b bar &&
+               test_commit a_bar
+       ) &&
+       git init repo_b &&
+       (
+               cd repo_b &&
+               test_commit b_master &&
+               git checkout -b foo &&
+               test_commit b_foo &&
+               git checkout -b baz &&
+               test_commit b_baz
+       ) &&
+       git remote add repo_a repo_a &&
+       git remote add repo_b repo_b &&
+       git config remote.repo_b.fetch \
+               "+refs/heads/*:refs/remotes/other_b/*" &&
+       git fetch --all
+'
+
+test_expect_success 'checkout of non-existing branch fails' '
+       git checkout -B master &&
+       test_might_fail git branch -D xyzzy &&
+
+       test_must_fail git checkout xyzzy &&
+       test_must_fail git rev-parse --verify refs/heads/xyzzy &&
+       test_branch master
+'
+
+test_expect_success 'checkout of branch from multiple remotes fails #1' '
+       git checkout -B master &&
+       test_might_fail git branch -D foo &&
+
+       test_must_fail git checkout foo &&
+       test_must_fail git rev-parse --verify refs/heads/foo &&
+       test_branch master
+'
+
+test_expect_success 'checkout of branch from a single remote succeeds #1' '
+       git checkout -B master &&
+       test_might_fail git branch -D bar &&
+
+       git checkout bar &&
+       test_branch bar &&
+       test_cmp_rev remotes/repo_a/bar HEAD &&
+       test_branch_upstream bar repo_a bar
+'
+
+test_expect_success 'checkout of branch from a single remote succeeds #2' '
+       git checkout -B master &&
+       test_might_fail git branch -D baz &&
+
+       git checkout baz &&
+       test_branch baz &&
+       test_cmp_rev remotes/other_b/baz HEAD &&
+       test_branch_upstream baz repo_b baz
+'
+
+test_expect_success '--no-guess suppresses branch auto-vivification' '
+       git checkout -B master &&
+       test_might_fail git branch -D bar &&
+
+       test_must_fail git checkout --no-guess bar &&
+       test_must_fail git rev-parse --verify refs/heads/bar &&
+       test_branch master
+'
+
+test_expect_success 'setup more remotes with unconventional refspecs' '
+       git checkout -B master &&
+       git init repo_c &&
+       (
+               cd repo_c &&
+               test_commit c_master &&
+               git checkout -b bar &&
+               test_commit c_bar
+               git checkout -b spam &&
+               test_commit c_spam
+       ) &&
+       git init repo_d &&
+       (
+               cd repo_d &&
+               test_commit d_master &&
+               git checkout -b baz &&
+               test_commit f_baz
+               git checkout -b eggs &&
+               test_commit c_eggs
+       ) &&
+       git remote add repo_c repo_c &&
+       git config remote.repo_c.fetch \
+               "+refs/heads/*:refs/remotes/extra_dir/repo_c/extra_dir/*" &&
+       git remote add repo_d repo_d &&
+       git config remote.repo_d.fetch \
+               "+refs/heads/*:refs/repo_d/*" &&
+       git fetch --all
+'
+
+test_expect_success 'checkout of branch from multiple remotes fails #2' '
+       git checkout -B master &&
+       test_might_fail git branch -D bar &&
+
+       test_must_fail git checkout bar &&
+       test_must_fail git rev-parse --verify refs/heads/bar &&
+       test_branch master
+'
+
+test_expect_success 'checkout of branch from multiple remotes fails #3' '
+       git checkout -B master &&
+       test_might_fail git branch -D baz &&
+
+       test_must_fail git checkout baz &&
+       test_must_fail git rev-parse --verify refs/heads/baz &&
+       test_branch master
+'
+
+test_expect_success 'checkout of branch from a single remote succeeds #3' '
+       git checkout -B master &&
+       test_might_fail git branch -D spam &&
+
+       git checkout spam &&
+       test_branch spam &&
+       test_cmp_rev refs/remotes/extra_dir/repo_c/extra_dir/spam HEAD &&
+       test_branch_upstream spam repo_c spam
+'
+
+test_expect_success 'checkout of branch from a single remote succeeds #4' '
+       git checkout -B master &&
+       test_might_fail git branch -D eggs &&
+
+       git checkout eggs &&
+       test_branch eggs &&
+       test_cmp_rev refs/repo_d/eggs HEAD &&
+       test_branch_upstream eggs repo_d eggs
+'
+
+test_done
index 4e3735f0cb28d2b545f59a2464ea74bea4b626a1..f0421c09c700bc1203d2ef563c54157e94c83b33 100755 (executable)
@@ -175,6 +175,24 @@ test_expect_success 'negated exclude matches can override previous ones' '
        grep "^a.1" output
 '
 
+test_expect_success 'excluded directory overrides content patterns' '
+
+       git ls-files --others --exclude="one" --exclude="!one/a.1" >output &&
+       if grep "^one/a.1" output
+       then
+               false
+       fi
+'
+
+test_expect_success 'negated directory doesn'\''t affect content patterns' '
+
+       git ls-files --others --exclude="!one" --exclude="one/a.1" >output &&
+       if grep "^one/a.1" output
+       then
+               false
+       fi
+'
+
 test_expect_success 'subdirectory ignore (setup)' '
        mkdir -p top/l1/l2 &&
        (
index d969f0ecd85a6907f219d141cad2c00c4b5a89f8..44ec6a45f473ffe47aca6945c0e0aab445728f67 100755 (executable)
@@ -317,13 +317,13 @@ test_expect_success 'test tracking setup (non-wildcard, matching)' '
        test $(git config branch.my4.merge) = refs/heads/master
 '
 
-test_expect_success 'test tracking setup (non-wildcard, not matching)' '
+test_expect_success 'tracking setup fails on non-matching refspec' '
        git config remote.local.url . &&
        git config remote.local.fetch refs/heads/s:refs/remotes/local/s &&
        (git show-ref -q refs/remotes/local/master || git fetch local) &&
-       git branch --track my5 local/master &&
-       ! test "$(git config branch.my5.remote)" = local &&
-       ! test "$(git config branch.my5.merge)" = refs/heads/master
+       test_must_fail git branch --track my5 local/master &&
+       test_must_fail git config branch.my5.remote &&
+       test_must_fail git config branch.my5.merge
 '
 
 test_expect_success 'test tracking setup via config' '
index 1261dbbdf5869b671e36cd7128bfde61fd67b8de..1019d7b35fcb350761a44cf4ccd5ae156ce8d577 100755 (executable)
@@ -353,4 +353,52 @@ test_expect_failure 'combine diff coalesce three parents' '
        compare_diff_patch expected actual
 '
 
+# Test for a bug reported at
+# http://thread.gmane.org/gmane.comp.version-control.git/224410
+# where a delete lines were missing from combined diff output when they
+# occurred exactly before the context lines of a later change.
+test_expect_success 'combine diff missing delete bug' '
+       git commit -m initial --allow-empty &&
+       cat <<-\EOF >test &&
+       1
+       2
+       3
+       4
+       EOF
+       git add test &&
+       git commit -a -m side1 &&
+       git checkout -B side1 &&
+       git checkout HEAD^ &&
+       cat <<-\EOF >test &&
+       0
+       1
+       2
+       3
+       4modified
+       EOF
+       git add test &&
+       git commit -m side2 &&
+       git branch -f side2 &&
+       test_must_fail git merge --no-commit side1 &&
+       cat <<-\EOF >test &&
+       1
+       2
+       3
+       4modified
+       EOF
+       git add test &&
+       git commit -a -m merge &&
+       git diff-tree -c -p HEAD >actual.tmp &&
+       sed -e "1,/^@@@/d" < actual.tmp >actual &&
+       tr -d Q <<-\EOF >expected &&
+       - 0
+         1
+         2
+         3
+        -4
+        +4modified
+       EOF
+       compare_diff_patch expected actual
+'
+
 test_done
index d574085696e81522669119c9b7480ba4c682c968..fd2598e60190fe04381652c7dfe997e01b4ea0c5 100755 (executable)
@@ -135,6 +135,13 @@ test_expect_success 'clone shallow depth 1' '
        test "`git --git-dir=shallow0/.git rev-list --count HEAD`" = 1
 '
 
+test_expect_success 'clone shallow depth 1 with fsck' '
+       git config --global fetch.fsckobjects true &&
+       git clone --no-single-branch --depth 1 "file://$(pwd)/." shallow0fsck &&
+       test "`git --git-dir=shallow0fsck/.git rev-list --count HEAD`" = 1 &&
+       git config --global --unset fetch.fsckobjects
+'
+
 test_expect_success 'clone shallow' '
        git clone --no-single-branch --depth 2 "file://$(pwd)/." shallow
 '
@@ -373,6 +380,20 @@ test_expect_success 'clone shallow with packed refs' '
        test_cmp count8.expected count8.actual
 '
 
+test_expect_success 'fetch in shallow repo unreachable shallow objects' '
+       (
+               git clone --bare --branch B --single-branch "file://$(pwd)/." no-reflog &&
+               git clone --depth 1 "file://$(pwd)/no-reflog" shallow9 &&
+               cd no-reflog &&
+               git tag -d TAGB1 TAGB2 &&
+               git update-ref refs/heads/B B~~ &&
+               git gc --prune=now &&
+               cd ../shallow9 &&
+               git fetch origin &&
+               git fsck --no-dangling
+       )
+'
+
 test_expect_success 'setup tests for the --stdin parameter' '
        for head in C D E F
        do
index 39b4cb0ecdc8801b355b815a0566c6e2df5c5a39..dd5b0e55d26b0f9258ae47425050083abe385fc0 100755 (executable)
@@ -13,6 +13,9 @@ test_description='--ancestry-path'
 #
 #  D..M -- M.t                 == M
 #  --ancestry-path D..M -- M.t == M
+#
+#  F...I                 == F G H I
+#  --ancestry-path F...I == F H I
 
 . ./test-lib.sh
 
@@ -63,13 +66,29 @@ test_expect_success 'rev-list D..M -- M.t' '
        test_cmp expect actual
 '
 
-test_expect_success 'rev-list --ancestry-patch D..M -- M.t' '
+test_expect_success 'rev-list --ancestry-path D..M -- M.t' '
        echo M >expect &&
        git rev-list --ancestry-path --format=%s D..M -- M.t |
        sed -e "/^commit /d" >actual &&
        test_cmp expect actual
 '
 
+test_expect_success 'rev-list F...I' '
+       for c in F G H I; do echo $c; done >expect &&
+       git rev-list --format=%s F...I |
+       sed -e "/^commit /d" |
+       sort >actual &&
+       test_cmp expect actual
+'
+
+test_expect_success 'rev-list --ancestry-path F...I' '
+       for c in F H I; do echo $c; done >expect &&
+       git rev-list --ancestry-path --format=%s F...I |
+       sed -e "/^commit /d" |
+       sort >actual &&
+       test_cmp expect actual
+'
+
 #   b---bc
 #  / \ /
 # a   X
index 8f3b54d826f5a9c8e7b08df7f6a58398b5a62480..88d60c1ce2933141c0800a76fdebca9037803258 100755 (executable)
@@ -91,12 +91,12 @@ test_expect_success 'update-index --remove' '
        test_cmp expected 1
 '
 
-test_expect_success 'ls-files --delete' '
+test_expect_success 'ls-files --deleted' '
        setup_absent &&
        test -z "$(git ls-files -d)"
 '
 
-test_expect_success 'ls-files --delete' '
+test_expect_success 'ls-files --deleted' '
        setup_dirty &&
        test -z "$(git ls-files -d)"
 '
index be9672e5a0222f0a796f400b2c22c615fff195a4..0c9ec0ad44ef4e3239e67a0c9e9ecc1340dcee8a 100755 (executable)
@@ -431,6 +431,7 @@ test_expect_success 'detach a symbolic link HEAD' '
 
 test_expect_success \
     'checkout with --track fakes a sensible -b <name>' '
+    git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" &&
     git update-ref refs/remotes/origin/koala/bear renamer &&
 
     git checkout --track origin/koala/bear &&
index 436b7b606e3eab09a0dd8c1b67ab90e43c24dffc..bdc1f295030b61fd6d4fc0ef672dffa99c027d8b 100755 (executable)
@@ -13,9 +13,9 @@ commit_msg_is () {
        expect=commit_msg_is.expect
        actual=commit_msg_is.actual
 
-       printf "%s" "$(git log --pretty=format:%s%b -1)" >$expect &&
-       printf "%s" "$1" >$actual &&
-       test_i18ncmp $expect $actual
+       printf "%s" "$(git log --pretty=format:%s%b -1)" >"$actual" &&
+       printf "%s" "$1" >"$expect" &&
+       test_i18ncmp "$expect" "$actual"
 }
 
 # A sanity check to see if commit is working at all.
index a4938b1e4549d5082362ec3f5513ffe91f210d39..6313da2cdd979c6264e7a255711c6e444b768b96 100755 (executable)
@@ -361,6 +361,23 @@ test_expect_success !AUTOIDENT 'do not fire editor when committer is bogus' '
        test_cmp expect .git/result
 '
 
+test_expect_success 'do not fire editor if -m <msg> was given' '
+       echo tick >file &&
+       git add file &&
+       echo "editor not started" >.git/result &&
+       (GIT_EDITOR="\"$(pwd)/.git/FAKE_EDITOR\"" git commit -m tick) &&
+       test "$(cat .git/result)" = "editor not started"
+'
+
+test_expect_success 'do not fire editor if -m "" was given' '
+       echo tock >file &&
+       git add file &&
+       echo "editor not started" >.git/result &&
+       (GIT_EDITOR="\"$(pwd)/.git/FAKE_EDITOR\"" \
+        git commit -m "" --allow-empty-message) &&
+       test "$(cat .git/result)" = "editor not started"
+'
+
 test_expect_success 'do not fire editor in the presence of conflicts' '
 
        git clean -f &&
index d46f0411bd9a08b38035c8fb5ca611723b8baed2..2418528487624bf5497af71c9958a84e0a50328f 100755 (executable)
@@ -385,6 +385,25 @@ test_expect_success PERL,SYMLINKS 'difftool --dir-diff --symlink without unstage
        test_cmp actual expect
 '
 
+write_script modify-right-file <<\EOF
+echo "new content" >"$2/file"
+EOF
+
+run_dir_diff_test 'difftool --dir-diff syncs worktree with unstaged change' '
+       test_when_finished git reset --hard &&
+       echo "orig content" >file &&
+       git difftool -d $symlinks --extcmd "$(pwd)/modify-right-file" branch &&
+       echo "new content" >expect &&
+       test_cmp expect file
+'
+
+run_dir_diff_test 'difftool --dir-diff syncs worktree without unstaged change' '
+       test_when_finished git reset --hard &&
+       git difftool -d $symlinks --extcmd "$(pwd)/modify-right-file" branch &&
+       echo "new content" >expect &&
+       test_cmp expect file
+'
+
 write_script modify-file <<\EOF
 echo "new content" >file
 EOF
index 3077851015879fc147ded9bb573d02c13967eec9..f524d2f383212c7d5fb02103cc08c3cdde2519fc 100755 (executable)
@@ -48,7 +48,7 @@ test_expect_success 'setup svn repository' '
 test_expect_success 'setup git mirror and merge' '
        git svn init "$svnrepo" -t tags -T trunk -b branches &&
        git svn fetch &&
-       git checkout --track -b svn remotes/trunk &&
+       git checkout -b svn remotes/trunk &&
        git checkout -b merge &&
        echo new file > new_file &&
        git add new_file &&
index 083b319ed11132ae03c1f653f1ba13149f5a1ebe..15521cc4f9be68ccd105916cee1322041682e8d5 100755 (executable)
@@ -276,7 +276,7 @@ test_expect_success 'prompt - rebase merge' '
 '
 
 test_expect_success 'prompt - rebase' '
-       printf " ((t2)|REBASE 1/3)" > expected &&
+       printf " (b2|REBASE 1/3)" > expected &&
        git checkout b2 &&
        test_when_finished "git checkout master" &&
        test_must_fail git rebase b1 b2 &&
old mode 100644 (file)
new mode 100755 (executable)
index bfa6279cc418278079bd95854adfe8d8301b6788..127e59a6037a14ad63648a727e873fe4a9e38381 100644 (file)
@@ -592,7 +592,7 @@ static void receive_needs(void)
                                die("invalid shallow line: %s", line);
                        object = parse_object(sha1);
                        if (!object)
-                               die("did not find object for %s", line);
+                               continue;
                        if (object->type != OBJ_COMMIT)
                                die("invalid shallow object %s", sha1_to_hex(sha1));
                        if (!(object->flags & CLIENT_SHALLOW)) {
index bac59d2c41bae7441038b30728c696b6280f4c2d..dd7ecbb115edd979f657e2e209126d364e6ccfac 100644 (file)
--- a/wrapper.c
+++ b/wrapper.c
@@ -408,18 +408,24 @@ void warn_on_inaccessible(const char *path)
        warning(_("unable to access '%s': %s"), path, strerror(errno));
 }
 
-int access_or_warn(const char *path, int mode)
+static int access_error_is_ok(int err, unsigned flag)
+{
+       return err == ENOENT || err == ENOTDIR ||
+               ((flag & ACCESS_EACCES_OK) && err == EACCES);
+}
+
+int access_or_warn(const char *path, int mode, unsigned flag)
 {
        int ret = access(path, mode);
-       if (ret && errno != ENOENT && errno != ENOTDIR)
+       if (ret && !access_error_is_ok(errno, flag))
                warn_on_inaccessible(path);
        return ret;
 }
 
-int access_or_die(const char *path, int mode)
+int access_or_die(const char *path, int mode, unsigned flag)
 {
        int ret = access(path, mode);
-       if (ret && errno != ENOENT && errno != ENOTDIR)
+       if (ret && !access_error_is_ok(errno, flag))
                die_errno(_("unable to access '%s'"), path);
        return ret;
 }