Sync with GIT 1.5.3.4
authorJunio C Hamano <gitster@pobox.com>
Wed, 3 Oct 2007 10:03:15 +0000 (03:03 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 3 Oct 2007 10:03:15 +0000 (03:03 -0700)
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 files changed:
Documentation/RelNotes-1.5.3.4.txt
Documentation/config.txt
Documentation/diff-options.txt
Documentation/git-branch.txt
Documentation/git-checkout.txt
INSTALL
builtin-for-each-ref.c
builtin-ls-files.c
configure.ac
diff.c
diffcore-rename.c
diffcore.h
git-commit.sh
git-pull.sh
t/t3060-ls-files-with-tree.sh [new file with mode: 0755]

index 47ba287..b04b3a4 100644 (file)
@@ -4,25 +4,32 @@ GIT v1.5.3.4 Release Notes
 Fixes since v1.5.3.3
 --------------------
 
- * Sample 'post-receive-hook' incorrectly sent out push
+ * Change to "git-ls-files" in v1.5.3.3 that was introduced to support
+   partial commit of removal better had a segfaulting bug, which was
+   diagnosed and fixed by Keith and Carl.
+
+ * Performance improvements for rename detection has been backported
+   from the 'master' branch.
+
+ * "git-for-each-ref --format='%(numparent)'" was not working
+   correctly at all, and --format='%(parent)' was not working for
+   merge commits.
+
+ * Sample "post-receive-hook" incorrectly sent out push
    notification e-mails marked as "From: " the committer of the
    commit that happened to be at the tip of the branch that was
    pushed, not from the person who pushed.
 
- * git-remote did not exit non-zero status upon error.
+ * "git-remote" did not exit non-zero status upon error.
 
  * "git-add -i" did not respond very well to EOF from tty nor
    bogus input.
 
- * "git rebase -i" squash subcommand incorrectly made the
+ * "git-rebase -i" squash subcommand incorrectly made the
    author of later commit the author of resulting commit,
    instead of taking from the first one in the squashed series.
 
- * "git stash apply --index" was not documented.
-
+ * "git-stash apply --index" was not documented.
 
---
-exec >/var/tmp/1
-O=v1.5.3.3-6-g0bdcac5
-echo O=`git describe refs/heads/maint`
-git shortlog --no-merges $O..refs/heads/maint
+ * autoconfiguration learned that "ar" command is found as "gas" on
+   some systems.
index 015910f..f59fbb3 100644 (file)
@@ -579,7 +579,7 @@ merge.summary::
 
 merge.tool::
        Controls which merge resolution program is used by
-       gitlink:git-mergetool[l].  Valid values are: "kdiff3", "tkdiff",
+       gitlink:git-mergetool[1].  Valid values are: "kdiff3", "tkdiff",
        "meld", "xxdiff", "emerge", "vimdiff", "gvimdiff", and "opendiff".
 
 merge.verbosity::
index 228ccaf..b1f528a 100644 (file)
 
 --ext-diff::
        Allow an external diff helper to be executed. If you set an
-       external diff driver with gitlink:gitattributes(5), you need
-       to use this option with gitlink:git-log(1) and friends.
+       external diff driver with gitlink:gitattributes[5], you need
+       to use this option with gitlink:git-log[1] and friends.
 
 --no-ext-diff::
        Disallow external diff drivers.
index 33bc31b..b7285bc 100644 (file)
@@ -26,6 +26,10 @@ It will start out with a head equal to the one given as <start-point>.
 If no <start-point> is given, the branch will be created with a head
 equal to that of the currently checked out branch.
 
+Note that this will create the new branch, but it will not switch the
+working tree to it; use "git checkout <newbranch>" to switch to the
+new branch.
+
 When a local branch is started off a remote branch, git can setup the
 branch so that gitlink:git-pull[1] will appropriately merge from that
 remote branch.  If this behavior is desired, it is possible to make it
@@ -91,6 +95,21 @@ OPTIONS
 --no-abbrev::
        Display the full sha1s in output listing rather than abbreviating them.
 
+--track::
+       Set up configuration so that git-pull will automatically
+       retrieve data from the remote branch.  Use this if you always
+       pull from the same remote branch into the new branch, or if you
+       don't want to use "git pull <repository> <refspec>" explicitly.  Set the
+       branch.autosetupmerge configuration variable to true if you
+       want git-checkout and git-branch to always behave as if
+       '--track' were given.
+
+--no-track::
+       When -b is given and a branch is created off a remote branch,
+       set up configuration so that git-pull will not retrieve data
+       from the remote branch, ignoring the branch.autosetupmerge
+       configuration variable.
+
 <branchname>::
        The name of the branch to create or delete.
        The new branch name must pass all checks defined by
index 734928b..2e58481 100644 (file)
@@ -50,7 +50,9 @@ OPTIONS
 --track::
        When -b is given and a branch is created off a remote branch,
        set up configuration so that git-pull will automatically
-       retrieve data from the remote branch.  Set the
+       retrieve data from the remote branch.  Use this if you always
+       pull from the same remote branch into the new branch, or if you
+       don't want to use "git pull <repository> <refspec>" explicitly.  Set the
        branch.autosetupmerge configuration variable to true if you
        want git-checkout and git-branch to always behave as if
        '--track' were given.
diff --git a/INSTALL b/INSTALL
index 289b046..f1eb404 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -79,6 +79,9 @@ Issues of note:
        - "perl" and POSIX-compliant shells are needed to use most of
          the barebone Porcelainish scripts.
 
+       - "cpio" is used by git-merge for saving and restoring the index,
+         and by git-clone when doing a local (possibly hardlinked) clone.
+
  - Some platform specific issues are dealt with Makefile rules,
    but depending on your specific installation, you may not
    have all the libraries/tools needed, or you may have
index 0afa1c5..29f70aa 100644 (file)
@@ -43,7 +43,7 @@ static struct {
        { "objectsize", FIELD_ULONG },
        { "objectname" },
        { "tree" },
-       { "parent" }, /* NEEDSWORK: how to address 2nd and later parents? */
+       { "parent" },
        { "numparent", FIELD_ULONG },
        { "object" },
        { "type" },
@@ -262,24 +262,26 @@ static void grab_commit_values(struct atom_value *val, int deref, struct object
                }
                if (!strcmp(name, "numparent")) {
                        char *s = xmalloc(40);
+                       v->ul = num_parents(commit);
                        sprintf(s, "%lu", v->ul);
                        v->s = s;
-                       v->ul = num_parents(commit);
                }
                else if (!strcmp(name, "parent")) {
                        int num = num_parents(commit);
                        int i;
                        struct commit_list *parents;
-                       char *s = xmalloc(42 * num);
+                       char *s = xmalloc(41 * num + 1);
                        v->s = s;
                        for (i = 0, parents = commit->parents;
                             parents;
-                            parents = parents->next, i = i + 42) {
+                            parents = parents->next, i = i + 41) {
                                struct commit *parent = parents->item;
                                strcpy(s+i, sha1_to_hex(parent->object.sha1));
                                if (parents->next)
                                        s[i+40] = ' ';
                        }
+                       if (!i)
+                               *s = '\0';
                }
        }
 }
index 6c1db86..171d449 100644 (file)
@@ -280,7 +280,8 @@ static void prune_cache(const char *prefix)
 
        if (pos < 0)
                pos = -pos-1;
-       active_cache += pos;
+       memmove(active_cache, active_cache + pos,
+               (active_nr - pos) * sizeof(struct cache_entry *));
        active_nr -= pos;
        first = 0;
        last = active_nr;
index 84fd7f1..ed7cc89 100644 (file)
@@ -104,7 +104,7 @@ AC_MSG_NOTICE([CHECKS for programs])
 #
 AC_PROG_CC([cc gcc])
 #AC_PROG_INSTALL               # needs install-sh or install.sh in sources
-AC_CHECK_TOOL(AR, ar, :)
+AC_CHECK_TOOLS(AR, [gar ar], :)
 AC_CHECK_PROGS(TAR, [gtar tar])
 # TCLTK_PATH will be set to some value if we want Tcl/Tk
 # or will be empty otherwise.
diff --git a/diff.c b/diff.c
index 35e3c61..71b340c 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -1675,7 +1675,7 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
        return 0;
 }
 
-void diff_free_filespec_data_large(struct diff_filespec *s)
+void diff_free_filespec_blob(struct diff_filespec *s)
 {
        if (s->should_free)
                free(s->data);
@@ -1690,7 +1690,7 @@ void diff_free_filespec_data_large(struct diff_filespec *s)
 
 void diff_free_filespec_data(struct diff_filespec *s)
 {
-       diff_free_filespec_data_large(s);
+       diff_free_filespec_blob(s);
        free(s->cnt_data);
        s->cnt_data = NULL;
 }
index 4fc2000..142e537 100644 (file)
@@ -378,10 +378,10 @@ void diffcore_rename(struct diff_options *options)
                        m->score = estimate_similarity(one, two,
                                                       minimum_score);
                        m->name_score = basename_same(one, two);
-                       diff_free_filespec_data_large(one);
+                       diff_free_filespec_blob(one);
                }
                /* We do not need the text anymore */
-               diff_free_filespec_data_large(two);
+               diff_free_filespec_blob(two);
                dst_cnt++;
        }
        /* cost matrix sorted by most to least similar pair */
index 4bf175b..eb618b1 100644 (file)
@@ -48,7 +48,7 @@ extern void fill_filespec(struct diff_filespec *, const unsigned char *,
 
 extern int diff_populate_filespec(struct diff_filespec *, int);
 extern void diff_free_filespec_data(struct diff_filespec *);
-extern void diff_free_filespec_data_large(struct diff_filespec *);
+extern void diff_free_filespec_blob(struct diff_filespec *);
 extern int diff_filespec_is_binary(struct diff_filespec *);
 
 struct diff_filepair {
index cb14f06..c3b881b 100755 (executable)
@@ -25,6 +25,7 @@ refuse_partial () {
        exit 1
 }
 
+TMP_INDEX=
 THIS_INDEX="$GIT_DIR/index"
 NEXT_INDEX="$GIT_DIR/next-index$$"
 rm -f "$NEXT_INDEX"
index c3f05f5..74bfc16 100755 (executable)
@@ -97,10 +97,24 @@ case "$merge_head" in
        esac
        curr_branch=${curr_branch#refs/heads/}
 
-       echo >&2 "Warning: No merge candidate found because value of config option
-         \"branch.${curr_branch}.merge\" does not match any remote branch fetched."
-       echo >&2 "No changes."
-       exit 0
+       echo >&2 "You asked me to pull without telling me which branch you"
+       echo >&2 "want to merge with, and 'branch.${curr_branch}.merge' in"
+       echo >&2 "your configuration file does not tell me either.  Please"
+       echo >&2 "name which branch you want to merge on the command line and"
+       echo >&2 "try again (e.g. 'git pull <repository> <refspec>')."
+       echo >&2 "See git-pull(1) for details on the refspec."
+       echo >&2
+       echo >&2 "If you often merge with the same branch, you may want to"
+       echo >&2 "configure the following variables in your configuration"
+       echo >&2 "file:"
+       echo >&2
+       echo >&2 "    branch.${curr_branch}.remote = <nickname>"
+       echo >&2 "    branch.${curr_branch}.merge = <remote-ref>"
+       echo >&2 "    remote.<nickname>.url = <url>"
+       echo >&2 "    remote.<nickname>.fetch = <refspec>"
+       echo >&2
+       echo >&2 "See git-config(1) for details."
+       exit 1
        ;;
 ?*' '?*)
        if test -z "$orig_head"
diff --git a/t/t3060-ls-files-with-tree.sh b/t/t3060-ls-files-with-tree.sh
new file mode 100755 (executable)
index 0000000..68eb266
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# Copyright (c) 2007 Carl D. Worth
+#
+
+test_description='git ls-files test (--with-tree).
+
+This test runs git ls-files --with-tree and in particular in
+a scenario known to trigger a crash with some versions of git.
+'
+. ./test-lib.sh
+
+test_expect_success setup '
+
+       # The bug we are exercising requires a fair number of entries
+       # in a sub-directory so that add_index_entry will trigger a
+       # realloc.
+
+       echo file >expected &&
+       mkdir sub &&
+       bad= &&
+       for n in 0 1 2 3 4 5
+       do
+               for m in 0 1 2 3 4 5 6 7 8 9
+               do
+                       num=00$n$m &&
+                       >sub/file-$num &&
+                       echo file-$num >>expected || {
+                               bad=t
+                               break
+                       }
+               done && test -z "$bad" || {
+                       bad=t
+                       break
+               }
+       done && test -z "$bad" &&
+       git add . &&
+       git commit -m "add a bunch of files" &&
+
+       # We remove them all so that we will have something to add
+       # back with --with-tree and so that we will definitely be
+       # under the realloc size to trigger the bug.
+       rm -rf sub &&
+       git commit -a -m "remove them all" &&
+
+       # The bug also requires some entry before our directory so that
+       # prune_path will modify the_index.cache
+
+       mkdir a_directory_that_sorts_before_sub &&
+       >a_directory_that_sorts_before_sub/file &&
+       mkdir sub &&
+       >sub/file &&
+       git add .
+'
+
+# We have to run from a sub-directory to trigger prune_path
+# Then we finally get to run our --with-tree test
+cd sub
+
+test_expect_success 'git -ls-files --with-tree should succeed from subdir' '
+
+       git ls-files --with-tree=HEAD~1 >../output
+
+'
+
+cd ..
+test_expect_success \
+    'git -ls-files --with-tree should add entries from named tree.' \
+    'diff -u expected output'
+
+test_done