git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Bug in Git-Gui - Creates corrupt patch

From
44jxdq6fqee2h@dyweni.com <4jxdq6fqee2h@dyweni.com>
Date
Feb 25, 2009, 15:03 UTC
Message-ID
<20090225090322.301cdb77@family.dyweni.com>
Hi Shawn,

I have stumbled upon a bug in Git-GUi and am providing reproduction steps:

1.  Commit this file into a new git repository:

----------------------------- <?php

class myclass {
	public function funcAbc() {
		echo "line 1";
		echo "line 2";
		echo "line 3";
		echo "line 4";
		echo "line 5";
	}
	
	public function funcBCD() {
		echo "line 1-1";
		echo "line 2-1";
		echo "line 3-1";
		echo "line 4-1";
		echo "line 5-1";
	}
}

?> --------------

Here is the base64 encoded version:

PD9waHAKCmNsYXNzIG15Y2xhc3MgewoJcHVibGljIGZ1bmN0aW9uIGZ1bmNBYmMoKSB7CgkJZWNo byAibGluZSAxIjsKCQllY2hvICJsaW5lIDIiOwoJCWVjaG8gImxpbmUgMyI7CgkJZWNobyAibGlu ZSA0IjsKCQllY2hvICJsaW5lIDUiOwoJfQoJCglwdWJsaWMgZnVuY3Rpb24gZnVuY0JDRCgpIHsK CQllY2hvICJsaW5lIDEtMSI7CgkJZWNobyAibGluZSAyLTEiOwoJCWVjaG8gImxpbmUgMy0xIjsK CQllY2hvICJsaW5lIDQtMSI7CgkJZWNobyAibGluZSA1LTEiOwoJfQp9Cgo/Pg==

2.  Now delete the last function in the class.  Here's the resulting
file, it is not staged or commited yet.

---------------------------- <?php

class myclass {
	public function funcAbc() {
		echo "line 1";
		echo "line 2";
		echo "line 3";
		echo "line 4";
		echo "line 5";
	}
}

?> ----------------------------

Here is the base64 encoded version:

PD9waHAKCmNsYXNzIG15Y2xhc3MgewoJcHVibGljIGZ1bmN0aW9uIGZ1bmNBYmMoKSB7CgkJZWNo byAibGluZSAxIjsKCQllY2hvICJsaW5lIDIiOwoJCWVjaG8gImxpbmUgMyI7CgkJZWNobyAibGlu ZSA0IjsKCQllY2hvICJsaW5lIDUiOwoJfQp9Cgo/Pg==

3. Using git-gui, try to stage *only* the last line marked for removal
(should be '-	}').
I get 'fatal: corrupt patch at line 22'.
4. Now try the same task using git-add -p.   Start 'git-add -p'.  Enter
edit mode (e).  Remove all the '-' lines except the last one (make
them ' ') so that only the last '-' will be removed. Save and exit.
On my system the patch is committed.
I'm running git version 1.6.0.6, 32bit linux, Gentoo OS
Next: 4jxdq6fqee2h@dyweni.com
Message 1 of 7 in “Bug in Git-Gui - Creates corrupt patch”
  1. 4jxdq6fqee2h@dyweni.comFeb 25, 2009
  2. 4jxdq6fqee2h@dyweni.comFeb 25, 2009
  3. Johannes SixtFeb 25, 2009
  4. 4jxdq6fqee2h@dyweni.comFeb 25, 2009
  5. 4jxdq6fqee2h@dyweni.comFeb 25, 2009
  6. Grzegorz KossakowskiMar 2, 2009
  7. Johannes SixtMar 2, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.