Merge branch 'maint' to sync with 1.6.0.1
authorJunio C Hamano <gitster@pobox.com>
Sun, 24 Aug 2008 21:48:36 +0000 (14:48 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 24 Aug 2008 21:50:44 +0000 (14:50 -0700)
1  2 
Documentation/config.txt
Documentation/git.txt
Makefile
builtin-merge.c
combine-diff.c
t/t4015-diff-whitespace.sh
diff --combined Documentation/config.txt
index 9020675866e6af6252b83d7df0bb8bc78249f4a6,81f981509a2b9c129b31772dee5b859b3f1a2315..af57d943049d5cf39b9681004cb0c7fd30a70c94
@@@ -358,8 -358,13 +358,13 @@@ core.editor:
        `EDITOR` environment variables and then finally `vi`.
  
  core.pager::
-       The command that git will use to paginate output.  Can be overridden
-       with the `GIT_PAGER` environment variable.
+       The command that git will use to paginate output.  Can
+       be overridden with the `GIT_PAGER` environment
+       variable.  Note that git sets the `LESS` environment
+       variable to `FRSX` if it is unset when it runs the
+       pager.  One can change these settings by setting the
+       `LESS` variable to some other value or by giving the
+       `core.pager` option a value such as "`less -+FRSX`".
  
  core.whitespace::
        A comma separated list of common whitespace problems to
@@@ -567,10 -572,6 +572,10 @@@ diff.autorefreshindex:
        affects only 'git-diff' Porcelain, and not lower level
        'diff' commands, such as 'git-diff-files'.
  
 +diff.suppress-blank-empty::
 +      A boolean to inhibit the standard behavior of printing a space
 +      before each empty output line. Defaults to false.
 +
  diff.external::
        If this config variable is set, diff generation is not
        performed using the internal diff machinery, but using the
@@@ -983,9 -984,11 +988,11 @@@ pack.packSizeLimit:
        linkgit:git-repack[1].
  
  pager.<cmd>::
-       Allows to set your own pager preferences for each command, overriding
-       the default. If `\--pager` or `\--no-pager` is specified on the command
-       line, it takes precedence over this option.
+       Allows turning on or off pagination of the output of a
+       particular git subcommand when writing to a tty.  If
+       `\--paginate` or `\--no-pager` is specified on the command line,
+       it takes precedence over this option.  To disable pagination for
+       all commands, set `core.pager` or 'GIT_PAGER' to "`cat`".
  
  pull.octopus::
        The default merge strategy to use when pulling multiple branches
diff --combined Documentation/git.txt
index 1bc295dd547b5375fb7c915efbc91de9130aea2c,363a785452ec13c3e8bd8bd744eb4a4db7fcc991..e178fb581323adaa5f490fb67732f98147ec460f
@@@ -43,9 -43,9 +43,10 @@@ unreleased) version of git, that is ava
  branch of the `git.git` repository.
  Documentation for older releases are available here:
  
--* link:v1.6.0/git.html[documentation for release 1.6.0]
++* link:v1.6.1/git.html[documentation for release 1.6.1]
  
  * release notes for
++  link:RelNotes-1.6.1.txt[1.6.1],
    link:RelNotes-1.6.0.txt[1.6.0].
  
  * link:v1.5.6.5/git.html[documentation for release 1.5.6.5]
@@@ -497,7 -497,8 +498,8 @@@ othe
  'GIT_PAGER'::
        This environment variable overrides `$PAGER`. If it is set
        to an empty string or to the value "cat", git will not launch
-       a pager.
+       a pager.  See also the `core.pager` option in
+       linkgit:git-config[1].
  
  'GIT_SSH'::
        If this environment variable is set then 'git-fetch'
diff --combined Makefile
index 5e944d8a161851a360a9bc61503b1ef11ee00af1,2cef0187d1d28ef2b466c1231499409f5cc1532f..e5a4985a1d9d212d5458356f21fc133db6fe23ab
+++ b/Makefile
@@@ -124,9 -124,6 +124,9 @@@ all:
  # Define USE_STDEV below if you want git to care about the underlying device
  # change being considered an inode change from the update-index perspective.
  #
 +# Define NO_ST_BLOCKS_IN_STRUCT_STAT if your platform does not have st_blocks
 +# field that counts the on-disk footprint in 512-byte blocks.
 +#
  # Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
  #
  # Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.
@@@ -578,11 -575,9 +578,11 @@@ EXTLIBS 
  
  ifeq ($(uname_S),Linux)
        NO_STRLCPY = YesPlease
 +      THREADED_DELTA_SEARCH = YesPlease
  endif
  ifeq ($(uname_S),GNU/kFreeBSD)
        NO_STRLCPY = YesPlease
 +      THREADED_DELTA_SEARCH = YesPlease
  endif
  ifeq ($(uname_S),UnixWare)
        CC = cc
@@@ -680,7 -675,6 +680,7 @@@ ifeq ($(uname_S),FreeBSD
        BASIC_CFLAGS += -I/usr/local/include
        BASIC_LDFLAGS += -L/usr/local/lib
        DIR_HAS_BSD_GROUP_SEMANTICS = YesPlease
 +      THREADED_DELTA_SEARCH = YesPlease
  endif
  ifeq ($(uname_S),OpenBSD)
        NO_STRCASESTR = YesPlease
        NEEDS_LIBICONV = YesPlease
        BASIC_CFLAGS += -I/usr/local/include
        BASIC_LDFLAGS += -L/usr/local/lib
 +      THREADED_DELTA_SEARCH = YesPlease
  endif
  ifeq ($(uname_S),NetBSD)
        ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2)
        BASIC_CFLAGS += -I/usr/pkg/include
        BASIC_LDFLAGS += -L/usr/pkg/lib
        ALL_LDFLAGS += -Wl,-rpath,/usr/pkg/lib
 +      THREADED_DELTA_SEARCH = YesPlease
  endif
  ifeq ($(uname_S),AIX)
        NO_STRCASESTR=YesPlease
@@@ -735,6 -727,7 +735,7 @@@ ifeq ($(uname_S),HP-UX
        NO_UNSETENV = YesPlease
        NO_HSTRERROR = YesPlease
        NO_SYS_SELECT_H = YesPlease
+       SNPRINTF_RETURNS_BOGUS = YesPlease
  endif
  ifneq (,$(findstring MINGW,$(uname_S)))
        NO_MMAP = YesPlease
        NO_SVN_TESTS = YesPlease
        NO_PERL_MAKEMAKER = YesPlease
        NO_POSIX_ONLY_PROGRAMS = YesPlease
 +      NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
        COMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat
        COMPAT_CFLAGS += -DSNPRINTF_SIZE_CORR=1
        COMPAT_CFLAGS += -DSTRIP_EXTENSION=\".exe\"
@@@ -872,9 -864,6 +873,9 @@@ endi
  ifdef NO_D_INO_IN_DIRENT
        BASIC_CFLAGS += -DNO_D_INO_IN_DIRENT
  endif
 +ifdef NO_ST_BLOCKS_IN_STRUCT_STAT
 +      BASIC_CFLAGS += -DNO_ST_BLOCKS_IN_STRUCT_STAT
 +endif
  ifdef NO_C99_FORMAT
        BASIC_CFLAGS += -DNO_C99_FORMAT
  endif
@@@ -1227,9 -1216,7 +1228,9 @@@ endi
  git-%$X: %.o $(GITLIBS)
        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
  
 -git-imap-send$X: imap-send.o $(LIB_FILE)
 +git-imap-send$X: imap-send.o $(GITLIBS)
 +      $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 +              $(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL)
  
  http.o http-walker.o http-push.o transport.o: http.h
  
diff --combined builtin-merge.c
index 7759a0b1e9a21148a69bbd1f2dc24902ba5651b5,b280444e10d67355da6fd0d9e1a2dd2d7a29d440..0bff26e8332f44bad12b391bb811442c9c93731e
@@@ -564,8 -564,6 +564,6 @@@ static int checkout_fast_forward(unsign
        struct dir_struct dir;
        struct lock_file *lock_file = xcalloc(1, sizeof(struct lock_file));
  
-       if (read_cache_unmerged())
-               die("you need to resolve your current index first");
        refresh_cache(REFRESH_QUIET);
  
        fd = hold_locked_index(lock_file, 1);
@@@ -651,13 -649,15 +649,15 @@@ static void add_strategies(const char *
  static int merge_trivial(void)
  {
        unsigned char result_tree[20], result_commit[20];
-       struct commit_list parent;
+       struct commit_list *parent = xmalloc(sizeof(struct commit_list *));
  
        write_tree_trivial(result_tree);
        printf("Wonderful.\n");
-       parent.item = remoteheads->item;
-       parent.next = NULL;
-       commit_tree(merge_msg.buf, result_tree, &parent, result_commit);
+       parent->item = lookup_commit(head);
+       parent->next = xmalloc(sizeof(struct commit_list *));
+       parent->next->item = remoteheads->item;
+       parent->next->next = NULL;
+       commit_tree(merge_msg.buf, result_tree, parent, result_commit);
        finish(result_commit, "In-index merge");
        drop_save();
        return 0;
@@@ -743,6 -743,7 +743,7 @@@ static int evaluate_result(void
        int cnt = 0;
        struct rev_info rev;
  
+       discard_cache();
        if (read_cache() < 0)
                die("failed to read the cache");
  
@@@ -776,7 -777,7 +777,7 @@@ int cmd_merge(int argc, const char **ar
        struct commit_list **remotes = &remoteheads;
  
        setup_work_tree();
-       if (unmerged_cache())
+       if (read_cache_unmerged())
                die("You are in the middle of a conflicted merge.");
  
        /*
                if (argc != 1)
                        die("Can merge only exactly one commit into "
                                "empty head");
 +              if (squash)
 +                      die("Squash commit into empty head not supported yet");
 +              if (!allow_fast_forward)
 +                      die("Non-fast-forward commit does not make sense into "
 +                          "an empty head");
                remote_head = peel_to_type(argv[0], 0, NULL, OBJ_COMMIT);
                if (!remote_head)
                        die("%s - not something we can merge", argv[0]);
                }
  
                /* Automerge succeeded. */
+               discard_cache();
                write_tree_trivial(result_tree);
                automerge_was_ok = 1;
                break;
diff --combined combine-diff.c
index 31ec0c5165fec5e26b14c2b8eb5df4dc2f63604a,4dfc33086755e7ae03310baabd0060149f323f4c..0cf2a830b5dad5c82d8a127cd57c8a8cba195631
@@@ -143,6 -143,8 +143,6 @@@ static void append_lost(struct sline *s
  }
  
  struct combine_diff_state {
 -      struct xdiff_emit_state xm;
 -
        unsigned int lno;
        int ob, on, nb, nn;
        unsigned long nmask;
@@@ -215,15 -217,17 +215,15 @@@ static void combine_diff(const unsigne
        parent_file.size = sz;
        xpp.flags = XDF_NEED_MINIMAL;
        memset(&xecfg, 0, sizeof(xecfg));
 -      ecb.outf = xdiff_outf;
 -      ecb.priv = &state;
        memset(&state, 0, sizeof(state));
 -      state.xm.consume = consume_line;
        state.nmask = nmask;
        state.sline = sline;
        state.lno = 1;
        state.num_parent = num_parent;
        state.n = n;
  
 -      xdi_diff(&parent_file, result_file, &xpp, &xecfg, &ecb);
 +      xdi_diff_outf(&parent_file, result_file, consume_line, &state,
 +                    &xpp, &xecfg, &ecb);
        free(parent_file.ptr);
  
        /* Assign line numbers for this parent.
@@@ -723,6 -727,18 +723,18 @@@ static void show_patch_diff(struct comb
                                die("early EOF '%s'", elem->path);
  
                        result[len] = 0;
+                       /* If not a fake symlink, apply filters, e.g. autocrlf */
+                       if (is_file) {
+                               struct strbuf buf;
+                               strbuf_init(&buf, 0);
+                               if (convert_to_git(elem->path, result, len, &buf, safe_crlf)) {
+                                       free(result);
+                                       result = strbuf_detach(&buf, &len);
+                                       result_size = len;
+                               }
+                       }
                }
                else {
                deleted_file:
index f9eb67d8351e608ec213a330f63a94ac0d3b81be,b1cbd36d1710a38b94838a2fdf08e0e5ded431f8..fc2307eaa3b4e8b1481fd7aa5ae0f93d085338af
@@@ -7,7 -7,7 +7,7 @@@ test_description='Test special whitespa
  
  '
  . ./test-lib.sh
 -. ../diff-lib.sh
 +. "$TEST_DIRECTORY"/diff-lib.sh
  
  # Ray Lehtiniemi's example
  
@@@ -352,4 -352,20 +352,20 @@@ test_expect_success 'checkdiff allows n
        git diff --check
  '
  
+ test_expect_success 'combined diff with autocrlf conversion' '
+       git reset --hard &&
+       echo >x hello &&
+       git commit -m "one side" x &&
+       git checkout HEAD^ &&
+       echo >x goodbye &&
+       git commit -m "the other side" x &&
+       git config core.autocrlf true &&
+       test_must_fail git merge master &&
+       git diff | sed -e "1,/^@@@/d" >actual &&
+       ! grep "^-" actual
+ '
  test_done