git diff --cc bug

2 messages, 1 author, 2016-06-15 · open the first message on its own page

git diff --cc bug

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:44:44

While resolving a conflict, I noticed this output of 'git diff':

@@@ -109,7 -130,8 +114,8 @@@ void CValuesView::UpdateValues...
  	lvc.mask = LVCF_TEXT;
  	lvc.pszText = const_cast<LPTSTR>(static_cast<LPCTST...
 -	m_table.SetColumn(1, &lvc);
 +	GetListCtrl().SetColumn(1, &lvc);
+ 	m_columnTitles[1].id = valuesHeader;
  }


@@@ -635,31 -865,171 +641,169 @@@ void CValuesView::EraseVa...
 -LRESULT CValuesView::OnOptionsChanged(WPARAM, LPARAM)
 -{
 -	if (GetDocument()->ShowPointerValues()) {
 -		// invalidate values in the display
 -		CPoint pt(m_x, m_y);	// will be erased
 -		InvalidateValues();
 -		FindFmtStrings();
 -		Update(pt.x, pt.y);
 -	}
 -	return 0;
 -}
 -
  void CValuesView::OnUpdate(CView* pSender, LPARAM lHint, ...
  {
  	switch (lHint) {
++<<<<<<< HEAD:SomUI/ValuesWnd.cpp
++=======
+ 	case UPDATE_MONITORFRAME:
+ 		{
(hunk truncated for exposition)

Notice that there are no context lines at the beginning of the second
hunk. I would not have expected this, and I think it's a bug in git diff.

I don't feel like diving into the diff machinery, and would appreciate if
someone could have a closer look. I have prepared a small repository to
reproduce the behavior, but I don't want to post it to the public.

-- Hannes

Re: git diff --cc bug

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:44:46

Johannes Sixt schrieb:
@@@ -635,31 -865,171 +641,169 @@@ void CValuesView::EraseVa...
 -LRESULT CValuesView::OnOptionsChanged(WPARAM, LPARAM)
 -{
 -	if (GetDocument()->ShowPointerValues()) {
 -		// invalidate values in the display
 -		CPoint pt(m_x, m_y);	// will be erased
 -		InvalidateValues();
 -		FindFmtStrings();
 -		Update(pt.x, pt.y);
 -	}
 -	return 0;
 -}
 -
  void CValuesView::OnUpdate(CView* pSender, LPARAM lHint, ...
  {
  	switch (lHint) {
++<<<<<<< HEAD:SomUI/ValuesWnd.cpp
++=======
+ 	case UPDATE_MONITORFRAME:
+ 		{
(hunk truncated for exposition)

Notice that there are no context lines at the beginning of the second
hunk. I would not have expected this, and I think it's a bug in git diff.
Attached is a tar.gz of a repository the exposes the bug when a simple
'git diff' is run. If -U2 is added, the removals at the beginning of the
hunk are not shown, as expected. If -U4 is added, more changes are shown
at the beginning of the hunk, which happen to be separated by 3 lines of
context from the part that is unexpectedly visible with -U3.

-- Hannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help