4930061
To: vim-dev@vim.org
4930061
Subject: Patch 7.2.086
4930061
Fcc: outbox
4930061
From: Bram Moolenaar <Bram@moolenaar.net>
4930061
Mime-Version: 1.0
4930061
Content-Type: text/plain; charset=ISO-8859-1
4930061
Content-Transfer-Encoding: 8bit
4930061
------------
4930061
4930061
Patch 7.2.086
4930061
Problem:    Using ":diffget 1" in buffer 1 corrupts the text.
4930061
Solution:   Don't do anything when source and destination of ":diffget" or
4930061
	    ":diffput" is the same buffer. (Dominique Pelle)
4930061
Files:	    src/diff.c
4930061
4930061
4930061
*** ../vim-7.2.085/src/diff.c	Sun Nov 30 15:15:56 2008
4930061
--- src/diff.c	Wed Jan 14 20:40:25 2009
4930061
***************
4930061
*** 8,14 ****
4930061
   */
4930061
  
4930061
  /*
4930061
!  * diff.c: code for diff'ing two or three buffers.
4930061
   */
4930061
  
4930061
  #include "vim.h"
4930061
--- 8,14 ----
4930061
   */
4930061
  
4930061
  /*
4930061
!  * diff.c: code for diff'ing two, three or four buffers.
4930061
   */
4930061
  
4930061
  #include "vim.h"
4930061
***************
4930061
*** 116,122 ****
4930061
   * Add a buffer to make diffs for.
4930061
   * Call this when a new buffer is being edited in the current window where
4930061
   * 'diff' is set.
4930061
!  * Marks the current buffer as being part of the diff and requireing updating.
4930061
   * This must be done before any autocmd, because a command may use info
4930061
   * about the screen contents.
4930061
   */
4930061
--- 116,122 ----
4930061
   * Add a buffer to make diffs for.
4930061
   * Call this when a new buffer is being edited in the current window where
4930061
   * 'diff' is set.
4930061
!  * Marks the current buffer as being part of the diff and requiring updating.
4930061
   * This must be done before any autocmd, because a command may use info
4930061
   * about the screen contents.
4930061
   */
4930061
***************
4930061
*** 929,935 ****
4930061
  	goto theend;
4930061
  
4930061
  #ifdef UNIX
4930061
!     /* Temporaraly chdir to /tmp, to avoid patching files in the current
4930061
       * directory when the patch file contains more than one patch.  When we
4930061
       * have our own temp dir use that instead, it will be cleaned up when we
4930061
       * exit (any .rej files created).  Don't change directory if we can't
4930061
--- 929,935 ----
4930061
  	goto theend;
4930061
  
4930061
  #ifdef UNIX
4930061
!     /* Temporarily chdir to /tmp, to avoid patching files in the current
4930061
       * directory when the patch file contains more than one patch.  When we
4930061
       * have our own temp dir use that instead, it will be cleaned up when we
4930061
       * exit (any .rej files created).  Don't change directory if we can't
4930061
***************
4930061
*** 2129,2134 ****
4930061
--- 2129,2136 ----
4930061
  	    EMSG2(_("E102: Can't find buffer \"%s\""), eap->arg);
4930061
  	    return;
4930061
  	}
4930061
+ 	if (buf == curbuf)
4930061
+ 	    return;		/* nothing to do */
4930061
  	idx_other = diff_buf_idx(buf);
4930061
  	if (idx_other == DB_COUNT)
4930061
  	{
4930061
*** ../vim-7.2.085/src/version.c	Thu Jan 22 18:32:55 2009
4930061
--- src/version.c	Thu Jan 22 20:46:54 2009
4930061
***************
4930061
*** 678,679 ****
4930061
--- 678,681 ----
4930061
  {   /* Add new patch number below this line */
4930061
+ /**/
4930061
+     86,
4930061
  /**/
4930061
4930061
-- 
4930061
Shift happens.
4930061
                -- Doppler
4930061
4930061
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
4930061
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
4930061
\\\        download, build and distribute -- http://www.A-A-P.org        ///
4930061
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///