Merge branch 'jc/mergetool-tool-help' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 6 Aug 2012 22:30:18 +0000 (15:30 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Aug 2012 22:30:18 +0000 (15:30 -0700)
* jc/mergetool-tool-help:
mergetool: support --tool-help option like difftool does

19 files changed:
Documentation/RelNotes/1.7.11.4.txt [new file with mode: 0644]
Documentation/config.txt
Documentation/git-commit-tree.txt
Documentation/git-commit.txt
Documentation/git.txt
GIT-VERSION-GEN
RelNotes
advice.c
builtin/commit-tree.c
date.c
diff.c
git-am.sh
git-filter-branch.sh
git-submodule.sh
t/t1100-commit-tree-options.sh
t/t4020-diff-external.sh
t/t7003-filter-branch.sh
t/t7406-submodule-update.sh
t/test-lib-functions.sh
diff --git a/Documentation/RelNotes/1.7.11.4.txt b/Documentation/RelNotes/1.7.11.4.txt
new file mode 100644 (file)
index 0000000..3a640c2
--- /dev/null
@@ -0,0 +1,31 @@
+Git v1.7.11.4 Release Notes
+===========================
+
+Fixes since v1.7.11.3
+---------------------
+
+ * "$GIT_DIR/COMMIT_EDITMSG" file that is used to hold the commit log
+   message user edits was not documented.
+
+ * The advise() function did not use varargs correctly to format
+   its message.
+
+ * When "git am" failed, old timers knew to check .git/rebase-apply/patch
+   to see what went wrong, but we never told the users about it.
+
+ * "git commit-tree" learned a more natural "-p <parent> <tree>" order
+   of arguments long time ago, but recently forgot it by mistake.
+
+ * "git diff --no-ext-diff" did not output anything for a typechange
+   filepair when GIT_EXTERNAL_DIFF is in effect.
+
+ * In 1.7.9 era, we taught "git rebase" about the raw timestamp format
+   but we did not teach the same trick to "filter-branch", which rolled
+   a similar logic on its own.
+
+ * When "git submodule add" clones a submodule repository, it can get
+   confused where to store the resulting submodule repository in the
+   superproject's .git/ directory when there is a symbolic link in the
+   path to the current directory.
+
+Also contains minor typofixes and documentation updates.
index 915cb5a547896966377e9f39059527e3142b27c8..b49feb582ef6c780a9dd1831bcd7e013e774b7c6 100644 (file)
@@ -176,6 +176,9 @@ advice.*::
                Advice shown when you used linkgit:git-checkout[1] to
                move to the detach HEAD state, to instruct how to create
                a local branch after the fact.
+       amWorkDir::
+               Advice that shows the location of the patch file when
+               linkgit:git-am[1] fails to apply it.
 --
 
 core.fileMode::
index ff73286509782bf3c7d6168066358b02830db797..6d5a04c83b6461396b44b3972a539eaae6368a19 100644 (file)
@@ -10,7 +10,7 @@ SYNOPSIS
 --------
 [verse]
 'git commit-tree' <tree> [(-p <parent>)...] < changelog
-'git commit-tree' <tree> [(-p <parent>)...] [(-m <message>)...] [(-F <file>)...]
+'git commit-tree' [(-p <parent>)...] [(-m <message>)...] [(-F <file>)...] <tree>
 
 DESCRIPTION
 -----------
index 2d695f619ceff358a3bc7c1e66532cc077ca3065..81853e9646dbe657e89e353785c4beda01c545b3 100644 (file)
@@ -399,6 +399,15 @@ This command can run `commit-msg`, `prepare-commit-msg`, `pre-commit`,
 and `post-commit` hooks.  See linkgit:githooks[5] for more
 information.
 
+FILES
+-----
+
+`$GIT_DIR/COMMIT_EDITMSG`::
+       This file contains the commit message of a commit in progress.
+       If `git commit` exits due to an error before creating a commit,
+       any commit message that has been provided by the user (e.g., in
+       an editor session) will be available in this file, but will be
+       overwritten by the next invocation of `git commit`.
 
 SEE ALSO
 --------
index bf22ad527c7b19eecf7338a83ad12d40cf07b948..7af8aaa0478239ec14446854bcb52adbd73fc2cf 100644 (file)
@@ -44,9 +44,10 @@ unreleased) version of git, that is available from 'master'
 branch of the `git.git` repository.
 Documentation for older releases are available here:
 
-* link:v1.7.11.3/git.html[documentation for release 1.7.11.3]
+* link:v1.7.11.4/git.html[documentation for release 1.7.11.4]
 
 * release notes for
+  link:RelNotes/1.7.11.4.txt[1.7.11.4],
   link:RelNotes/1.7.11.3.txt[1.7.11.3],
   link:RelNotes/1.7.11.2.txt[1.7.11.2],
   link:RelNotes/1.7.11.1.txt[1.7.11.1],
index 9f0d5507f2f63ee332519370f4a68c0d72bbd61d..a9dea5c023d8b0d98ba877ab0f0a1caed4b3505a 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v1.7.11.3
+DEF_VER=v1.7.11.4
 
 LF='
 '
index 8f994bcfa03bb1a92ca833d16cfd5db53ab3519a..9f0b313a19f38194dad3995cced06e21d103aec7 120000 (symlink)
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes/1.7.11.3.txt
\ No newline at end of file
+Documentation/RelNotes/1.7.11.4.txt
\ No newline at end of file
index a492eea24f71ad2d2082efce9d1d925a5766b111..edfbd4a6fb01a6905671d6d842d22c4869fad729 100644 (file)
--- a/advice.c
+++ b/advice.c
@@ -32,7 +32,7 @@ void advise(const char *advice, ...)
        const char *cp, *np;
 
        va_start(params, advice);
-       strbuf_addf(&buf, advice, params);
+       strbuf_vaddf(&buf, advice, params);
        va_end(params);
 
        for (cp = buf.buf; *cp; cp = np) {
index 164b655df93fea1ec2f63f5238c1ad7a377c8385..a0df12ce16abda416fc9f33448bc895e74f4b0d1 100644 (file)
@@ -48,9 +48,6 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
        if (argc < 2 || !strcmp(argv[1], "-h"))
                usage(commit_tree_usage);
 
-       if (get_sha1(argv[1], tree_sha1))
-               die("Not a valid object name %s", argv[1]);
-
        for (i = 1; i < argc; i++) {
                const char *arg = argv[i];
                if (!strcmp(arg, "-p")) {
diff --git a/date.c b/date.c
index 1fdcf7c6eae0386552c5d7e069f5242fca3c2e0e..57331ed406e2391e0a2bf327fbb86d3b62012324 100644 (file)
--- a/date.c
+++ b/date.c
@@ -624,7 +624,7 @@ static int match_object_header_date(const char *date, unsigned long *timestamp,
        unsigned long stamp;
        int ofs;
 
-       if (*date < '0' || '9' <= *date)
+       if (*date < '0' || '9' < *date)
                return -1;
        stamp = strtoul(date, &end, 10);
        if (*end != ' ' || stamp == ULONG_MAX || (end[1] != '+' && end[1] != '-'))
diff --git a/diff.c b/diff.c
index 208096fe461b483a0646bb583fd2158c3179823f..62cbe141efb411e831484fc36c0cba95a2b8846b 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -2992,9 +2992,8 @@ static void run_diff_cmd(const char *pgm,
        int complete_rewrite = (p->status == DIFF_STATUS_MODIFIED) && p->score;
        int must_show_header = 0;
 
-       if (!DIFF_OPT_TST(o, ALLOW_EXTERNAL))
-               pgm = NULL;
-       else {
+
+       if (DIFF_OPT_TST(o, ALLOW_EXTERNAL)) {
                struct userdiff_driver *drv = userdiff_find_by_path(attr_path);
                if (drv && drv->external)
                        pgm = drv->external;
@@ -3074,6 +3073,9 @@ static void run_diff(struct diff_filepair *p, struct diff_options *o)
        if (o->prefix_length)
                strip_prefix(o->prefix_length, &name, &other);
 
+       if (!DIFF_OPT_TST(o, ALLOW_EXTERNAL))
+               pgm = NULL;
+
        if (DIFF_PAIR_UNMERGED(p)) {
                run_diff_cmd(pgm, name, NULL, attr_path,
                             NULL, NULL, NULL, o, p);
index f8b7a0cb602d2d2425f68f8c27338cc003b70f6b..9abad36abdea89c88d7d0378fd2d556057bc065b 100755 (executable)
--- a/git-am.sh
+++ b/git-am.sh
@@ -855,6 +855,11 @@ did you forget to use 'git add'?"
        if test $apply_status != 0
        then
                eval_gettextln 'Patch failed at $msgnum $FIRSTLINE'
+               if test "$(git config --bool advice.amworkdir)" != false
+               then
+                       eval_gettextln "The copy of the patch that failed is found in:
+   $dotest/patch"
+               fi
                stop_here_user_resolve $this
        fi
 
index add2c0247fa91e0f629428c295fc581f19cf85e1..178e45305d2b66bbe5a0c0902d989ea66888869b 100755 (executable)
@@ -84,7 +84,7 @@ set_ident () {
                        s/.*/GIT_'$uid'_EMAIL='\''&'\''; export GIT_'$uid'_EMAIL/p
 
                        g
-                       s/^'$lid' [^<]* <[^>]*> \(.*\)$/\1/
+                       s/^'$lid' [^<]* <[^>]*> \(.*\)$/@\1/
                        s/'\''/'\''\'\'\''/g
                        s/.*/GIT_'$uid'_DATE='\''&'\''; export GIT_'$uid'_DATE/p
 
index fbf2fafaaf49ec65090ec4eadb33d1ccedc60436..30fa93a8a0a4985f7ce980d4abf69410af22976c 100755 (executable)
@@ -150,8 +150,10 @@ module_clone()
                die "$(eval_gettext "Clone of '\$url' into submodule path '\$sm_path' failed")"
        fi
 
-       a=$(cd "$gitdir" && pwd)/
-       b=$(cd "$sm_path" && pwd)/
+       # We already are at the root of the work tree but cd_to_toplevel will
+       # resolve any symlinks that might be present in $PWD
+       a=$(cd_to_toplevel && cd "$gitdir" && pwd)/
+       b=$(cd_to_toplevel && cd "$sm_path" && pwd)/
        # normalize Windows-style absolute paths to POSIX-style absolute paths
        case $a in [a-zA-Z]:/*) a=/${a%%:*}${a#*:} ;; esac
        case $b in [a-zA-Z]:/*) b=/${b%%:*}${b#*:} ;; esac
index c4414ff576fc03b3234c532bfdcd0f2c8eca9c09..a3b77239f48ade053c3514c9ba65cd72286d0783 100755 (executable)
@@ -7,6 +7,9 @@ test_description='git commit-tree options test
 
 This test checks that git commit-tree can create a specific commit
 object by defining all environment variables that it understands.
+
+Also make sure that command line parser understands the normal
+"flags first and then non flag arguments" command line.
 '
 
 . ./test-lib.sh
@@ -42,4 +45,18 @@ test_expect_success \
     'compare commit' \
     'test_cmp expected commit'
 
+
+test_expect_success 'flags and then non flags' '
+       echo comment text |
+       git commit-tree $(cat treeid) >commitid &&
+       echo comment text |
+       git commit-tree $(cat treeid) -p $(cat commitid) >childid-1 &&
+       echo comment text |
+       git commit-tree -p $(cat commitid) $(cat treeid) >childid-2 &&
+       test_cmp childid-1 childid-2 &&
+       git commit-tree $(cat treeid) -m foo >childid-3 &&
+       git commit-tree -m foo $(cat treeid) >childid-4 &&
+       test_cmp childid-3 childid-4
+'
+
 test_done
index 533afc1185114e8ea7e7e5e9315ceaf7816e32c2..2e7d73f0906e6a2808706236328470b2d855e9f9 100755 (executable)
@@ -48,7 +48,53 @@ test_expect_success 'GIT_EXTERNAL_DIFF environment and --no-ext-diff' '
 
 '
 
+test_expect_success SYMLINKS 'typechange diff' '
+       rm -f file &&
+       ln -s elif file &&
+       GIT_EXTERNAL_DIFF=echo git diff  | {
+               read path oldfile oldhex oldmode newfile newhex newmode &&
+               test "z$path" = zfile &&
+               test "z$oldmode" = z100644 &&
+               test "z$newhex" = "z$_z40" &&
+               test "z$newmode" = z120000 &&
+               oh=$(git rev-parse --verify HEAD:file) &&
+               test "z$oh" = "z$oldhex"
+       } &&
+       GIT_EXTERNAL_DIFF=echo git diff --no-ext-diff >actual &&
+       git diff >expect &&
+       test_cmp expect actual
+'
+
+test_expect_success 'diff.external' '
+       git reset --hard &&
+       echo third >file &&
+       test_config diff.external echo &&
+       git diff | {
+               read path oldfile oldhex oldmode newfile newhex newmode &&
+               test "z$path" = zfile &&
+               test "z$oldmode" = z100644 &&
+               test "z$newhex" = "z$_z40" &&
+               test "z$newmode" = z100644 &&
+               oh=$(git rev-parse --verify HEAD:file) &&
+               test "z$oh" = "z$oldhex"
+       }
+'
+
+test_expect_success 'diff.external should apply only to diff' '
+       test_config diff.external echo &&
+       git log -p -1 HEAD |
+       grep "^diff --git a/file b/file"
+'
+
+test_expect_success 'diff.external and --no-ext-diff' '
+       test_config diff.external echo &&
+       git diff --no-ext-diff |
+       grep "^diff --git a/file b/file"
+'
+
 test_expect_success 'diff attribute' '
+       git reset --hard &&
+       echo third >file &&
 
        git config diff.parrot.command echo &&
 
@@ -113,6 +159,19 @@ test_expect_success 'diff attribute and --no-ext-diff' '
 
 '
 
+test_expect_success 'GIT_EXTERNAL_DIFF trumps diff.external' '
+       >.gitattributes &&
+       test_config diff.external "echo ext-global" &&
+       GIT_EXTERNAL_DIFF="echo ext-env" git diff | grep ext-env
+'
+
+test_expect_success 'attributes trump GIT_EXTERNAL_DIFF and diff.external' '
+       test_config diff.foo.command "echo ext-attribute" &&
+       test_config diff.external "echo ext-global" &&
+       echo "file diff=foo" >.gitattributes &&
+       GIT_EXTERNAL_DIFF="echo ext-env" git diff | grep ext-attribute
+'
+
 test_expect_success 'no diff with -diff' '
        echo >.gitattributes "file -diff" &&
        git diff | grep Binary
index e0227730deb88413301b37501fdb165a2c90460e..4d13e10de1f2594ab304b3a2b7b5905d75d6ff84 100755 (executable)
@@ -5,7 +5,8 @@ test_description='git filter-branch'
 
 test_expect_success 'setup' '
        test_commit A &&
-       test_commit B &&
+       GIT_COMMITTER_DATE="@0 +0000" GIT_AUTHOR_DATE="@0 +0000" &&
+       test_commit --notick B &&
        git checkout -b branch B &&
        test_commit D &&
        mkdir dir &&
index dcb195b4cf67af3cf5ce94d0f5ca75bf94664b9a..ce61d4c0fa3d916757e09224ed79bc191fb0cb3d 100755 (executable)
@@ -636,4 +636,17 @@ test_expect_success 'submodule update properly revives a moved submodule' '
        )
 '
 
+test_expect_success SYMLINKS 'submodule update can handle symbolic links in pwd' '
+       mkdir -p linked/dir &&
+       ln -s linked/dir linkto &&
+       (
+               cd linkto &&
+               git clone "$TRASH_DIRECTORY"/super_update_r2 super &&
+               (
+                       cd super &&
+                       git submodule update --init --recursive
+               )
+       )
+'
+
 test_done
index 16397691d951864f760b832ee066a63cd83f64fc..80daaca7806cbe1a6de0ddeba40400c8a811328e 100644 (file)
@@ -143,10 +143,19 @@ test_pause () {
 # Both <file> and <contents> default to <message>.
 
 test_commit () {
-       file=${2:-"$1.t"}
+       notick= &&
+       if test "z$1" = "z--notick"
+       then
+               notick=yes
+               shift
+       fi &&
+       file=${2:-"$1.t"} &&
        echo "${3-$1}" > "$file" &&
        git add "$file" &&
-       test_tick &&
+       if test -z "$notick"
+       then
+               test_tick
+       fi &&
        git commit -m "$1" &&
        git tag "$1"
 }