threads / bug / 35670

Potential bug: truncated diff output

Subject: Potential bug: truncated diff output

## tl;dr

5 messages between Jan 16, 2014 and Jan 16, 2014.

replies: 4people: 3as markdown or json

Misha Penkov· Jan 16, 2014, 06:19 UTC · lore

I have a file in a git repo. It has changed during the last two commits. I want to see the changes made in these two commits. The following command should work:

    git diff HEAD^^
but that doesn't get me the expected results. Read on for details.

Last commit: I changed some stuff towards the end of the file, for example, around line 3145. Here's the full diff (it's here for reference, don't bother reading all of it):

    $git diff HEAD^ HEAD ieicej.cls
    diff --git a/ieicej.cls b/ieicej.cls
    index ecf8beb..01debd9 100644
    --- a/ieicej.cls
    +++ b/ieicej.cls
    @@ -2250,7 +2250,7 @@
     %
     %\renewcommand{\thesection}{\@arabic\c@section.}
     \renewcommand{\thesection}{\@arabic\c@section}
    -\renewcommand{\thesubsection}{\thesection\,\@arabic\c@subsection}
    +\renewcommand{\thesubsection}{\thesection.\,\@arabic\c@subsection}
     \renewcommand{\thesubsubsection}{%
        \thesubsection.\,\@arabic\c@subsubsection}
     \renewcommand{\theparagraph}{% (
    @@ -2369,7 +2369,7 @@
        \inhibitglue #1%
       \else
        \def\@makefnmark{\kern0pt\hbox to \z@{%
    -    $^{\mbox{\tiny \kern-.5zw (注\@thefnmark{})\kern-.5zw}}$\hss}}%
    +    $^{\mbox{\tiny \kern-.5zw (\@thefnmark{})\kern-.5zw}}$\hss}}%
        \kanjiskip\z@ \@plus 1fill \@minus 1fill\xkanjiskip=\kanjiskip
         \jmathkanjiskip=\kanjiskip
        \hbox to 5zw{\inhibitglue #1\hfil}%
    @@ -3145,11 +3145,11 @@
       \kern 2.715\p@}
     \def\@makefnmark{\hbox{$^{\mbox{\tiny \kern-.5zw
    -  (注\kern.1zw\@thefnmark{})\kern-.5zw}}$}}
    +  (\kern.1zw\@thefnmark{})\kern-.5zw}}$}}
     \newcommand\@makefntext[1]{\parindent1zw
      \noindent\hbox{\kern-.5zw
    -  (注\kern.1zw\@thefnmark{})\kern-.5zw\hbox to 1zw{\hss :\hss}}#1}
    +  (\kern.1zw\@thefnmark{})\kern-.5zw\hbox to 1zw{\hss :\hss}}#1}
     \def\thefootnote{\@arabic\c@footnote}
     \def\thempfootnote{\@fnsymbol\c@mpfootnote}

Here's the second-last commit. I changed some things around line 1714. Full commit diff (again, for reference only):

    $git diff -p HEAD^^ HEAD^ ieicej.cls
    diff --git a/ieicej.cls b/ieicej.cls
    index 1c3b947..ecf8beb 100644
    --- a/ieicej.cls
    +++ b/ieicej.cls
    @@ -1714,51 +1714,57 @@
       \setbox\@tempboxa\vbox{%
         \def\baselinestretch{\@titlepagebaselinestretch}%
         \hskip8mm
    -    \vtop{\footnotesize\baselineskip3mm
    -     \hbox{社団法人\hskip1zw 電子情報通信学会}%
    -     \hbox{THE INSTITUTE OF ELECTRONICS,}%
    -     \hbox{INFORMATION AND COMMUNICATION ENGINEERS}%
    -    }\hfill
    -    \vtop{\footnotesize\baselineskip3mm
    -     \hbox{信学技報}%
    -     \hbox{TECHNICAL REPORT OF IEICE.}%
    -     \hbox{}%
    -    }\hskip8mm\hbox{}\par
    +%    \vtop{\footnotesize\baselineskip3mm
    +%     \hbox{社団法人\hskip1zw 電子情報通信学会}%
    +%     \hbox{THE INSTITUTE OF ELECTRONICS,}%
    +%     \hbox{INFORMATION AND COMMUNICATION ENGINEERS}%
    +%    }\hfill
    +%    \vtop{\footnotesize\baselineskip3mm
    +%     \hbox{信学技報}%
    +%     \hbox{TECHNICAL REPORT OF IEICE.}%
    +%     \hbox{}%
    +%    }\hskip8mm\hbox{}\par
         \vskip\baselineskip
    -    \bgroup
    -     \centering
    -     {\fontsize{16}{23}\selectfont
    -      \@jtitle\par
    -     }%
    -     \vskip.25\baselineskip
    -     \ifx\@jsubtitle\empty
    -     \else
    -      {\huge
    -       \@jsubtitle\par
    -      }%
    -      \vskip.25\baselineskip
    -     \fi
    -     {\LARGE
    -       \@outputJauthorlist\par
    -     }%
    -     \vskip.5\baselineskip
    -     {\fontsize{10.5}{15}\selectfont
    -      \J@affiliate\par
    -      \Jp@affiliate\par
    -      \ifx\@MailAddress\empty
    -       \fmt@Ema
    -       \ifx\header@ma\empty
    -        \vskip.5\baselineskip
    -       \else
    - E-mail: \Mail@ddress\par
    - \vskip.5\baselineskip
    -       \fi
    -      \else
    -       E-mail: \@MailAddress
    -       \vskip.5\baselineskip
    -      \fi
    -     }%
    -    \egroup
    +%
    +% My paper doesn't have a Japanese title.
    +% The template still insists on printing author names and
affiliations in Japanese.
    +% Without a title, it author names and affiliations look kind of stupid.
    +% I think this is the part that does it, so I'm commenting it out
in an effort to reduce the amount of stupid in this paper.
    +%
    +%    \bgroup
    +%     \centering
    +%     {\fontsize{16}{23}\selectfont
    +%      \@jtitle\par
    +%     }%
    +%     \vskip.25\baselineskip
    +%     \ifx\@jsubtitle\empty
    +%     \else
    +%      {\huge
    +%       \@jsubtitle\par
    +%      }%
    +%      \vskip.25\baselineskip
    +%     \fi
    +%     {\LARGE
    +%       \@outputJauthorlist\par
    +%     }%
    +%     \vskip.5\baselineskip
    +%     {\fontsize{10.5}{15}\selectfont
    +%      \J@affiliate\par
    +%      \Jp@affiliate\par
    +%      \ifx\@MailAddress\empty
    +%       \fmt@Ema
    +%       \ifx\header@ma\empty
    +%        \vskip.5\baselineskip
    +%       \else
    +% E-mail: \Mail@ddress\par
    +% \vskip.5\baselineskip
    +%       \fi
    +%      \else
    +%       E-mail: \@MailAddress
    +%       \vskip.5\baselineskip
    +%      \fi
    +%     }%
    +%    \egroup
         \bgroup\large
          \leavevmode
          \unhbox\jabstractbox\par
    @@ -2239,7 +2245,11 @@
     \newcounter{subsubsection}[subsection]
     \newcounter{paragraph}[subsubsection]
     \newcounter{subparagraph}[paragraph]
    -\renewcommand{\thesection}{\@arabic\c@section.}
    +%
    +% Whoever thought it's a great idea to place periods after
section numbers should be shot.
    +%
    +%\renewcommand{\thesection}{\@arabic\c@section.}
    +\renewcommand{\thesection}{\@arabic\c@section}
     \renewcommand{\thesubsection}{\thesection\,\@arabic\c@subsection}
     \renewcommand{\thesubsubsection}{%
        \thesubsection.\,\@arabic\c@subsubsection}
    @@ -2359,7 +2369,7 @@
        \inhibitglue #1%
       \else
        \def\@makefnmark{\kern0pt\hbox to \z@{%
    -    $^{\mbox{\tiny \kern-.5zw (\@thefnmark{})\kern-.5zw}}$\hss}}%
    +    $^{\mbox{\tiny \kern-.5zw (注\@thefnmark{})\kern-.5zw}}$\hss}}%
        \kanjiskip\z@ \@plus 1fill \@minus 1fill\xkanjiskip=\kanjiskip
         \jmathkanjiskip=\kanjiskip
        \hbox to 5zw{\inhibitglue #1\hfil}%
    @@ -3135,11 +3145,11 @@
       \kern 2.715\p@}
     \def\@makefnmark{\hbox{$^{\mbox{\tiny \kern-.5zw
    -  (\kern.1zw\@thefnmark{})\kern-.5zw}}$}}
    +  (注\kern.1zw\@thefnmark{})\kern-.5zw}}$}}
     \newcommand\@makefntext[1]{\parindent1zw
      \noindent\hbox{\kern-.5zw
    -  (\kern.1zw\@thefnmark{})\kern-.5zw\hbox to 1zw{\hss :\hss}}#1}
    +  (注\kern.1zw\@thefnmark{})\kern-.5zw\hbox to 1zw{\hss :\hss}}#1}
     \def\thefootnote{\@arabic\c@footnote}
     \def\thempfootnote{\@fnsymbol\c@mpfootnote}

As I mentioned in the first paragraph, I want to generate a patch that includes both commits:

    $git diff HEAD^^ HEAD ieicej.cls
    diff --git a/ieicej.cls b/ieicej.cls
    index 1c3b947..01debd9 100644
    --- a/ieicej.cls
    +++ b/ieicej.cls
    @@ -1714,51 +1714,57 @@
       \setbox\@tempboxa\vbox{%
         \def\baselinestretch{\@titlepagebaselinestretch}%
         \hskip8mm
    -    \vtop{\footnotesize\baselineskip3mm
    -     \hbox{社団法人\hskip1zw 電子情報通信学会}%
    -     \hbox{THE INSTITUTE OF ELECTRONICS,}%
    -     \hbox{INFORMATION AND COMMUNICATION ENGINEERS}%
    -    }\hfill
    -    \vtop{\footnotesize\baselineskip3mm
    -     \hbox{信学技報}%
    -     \hbox{TECHNICAL REPORT OF IEICE.}%
    -     \hbox{}%
    -    }\hskip8mm\hbox{}\par
    +%    \vtop{\footnotesize\baselineskip3mm
    +%     \hbox{社団法人\hskip1zw 電子情報通信学会}%
    +%     \hbox{THE INSTITUTE OF ELECTRONICS,}%
    +%     \hbox{INFORMATION AND COMMUNICATION ENGINEERS}%
    +%    }\hfill
    +%    \vtop{\footnotesize\baselineskip3mm
    +%     \hbox{信学技報}%
    +%     \hbox{TECHNICAL REPORT OF IEICE.}%
    +%     \hbox{}%
    +%    }\hskip8mm\hbox{}\par
         \vskip\baselineskip
    -    \bgroup
    -     \centering
    -     {\fontsize{16}{23}\selectfont
    -      \@jtitle\par
    -     }%
    -     \vskip.25\baselineskip
    -     \ifx\@jsubtitle\empty
    -     \else
    -      {\huge
    -       \@jsubtitle\par
    -      }%
    -      \vskip.25\baselineskip
    -     \fi
    -     {\LARGE
    -       \@outputJauthorlist\par
    -     }%
    -     \vskip.5\baselineskip
    -     {\fontsize{10.5}{15}\selectfont
    -      \J@affiliate\par
    -      \Jp@affiliate\par
    -      \ifx\@MailAddress\empty
    -       \fmt@Ema
    -       \ifx\header@ma\empty
    -        \vskip.5\baselineskip
    -       \else
    - E-mail: \Mail@ddress\par
    - \vskip.5\baselineskip
    -       \fi
    -      \else
    -       E-mail: \@MailAddress
    -       \vskip.5\baselineskip
    -      \fi
    -     }%
    -    \egroup
    +%
    +% My paper doesn't have a Japanese title.
    +% The template still insists on printing author names and
affiliations in Japanese.
    +% Without a title, it author names and affiliations look kind of stupid.
    +% I think this is the part that does it, so I'm commenting it out
in an effort to reduce the amount of stupid in this paper.
    +%
    +%    \bgroup
    +%     \centering
    +%     {\fontsize{16}{23}\selectfont
    +%      \@jtitle\par
    +%     }%
    +%     \vskip.25\baselineskip
    +%     \ifx\@jsubtitle\empty
    +%     \else
    +%      {\huge
    +%       \@jsubtitle\par
    +%      }%
    +%      \vskip.25\baselineskip
    +%     \fi
    +%     {\LARGE
    +%       \@outputJauthorlist\par
    +%     }%
    +%     \vskip.5\baselineskip
    +%     {\fontsize{10.5}{15}\selectfont
    +%      \J@affiliate\par
    +%      \Jp@affiliate\par
    +%      \ifx\@MailAddress\empty
    +%       \fmt@Ema
    +%       \ifx\header@ma\empty
    +%        \vskip.5\baselineskip
    +%       \else
    +% E-mail: \Mail@ddress\par
    +% \vskip.5\baselineskip
    +%       \fi
    +%      \else
    +%       E-mail: \@MailAddress
    +%       \vskip.5\baselineskip
    +%      \fi
    +%     }%
    +%    \egroup
         \bgroup\large
          \leavevmode
          \unhbox\jabstractbox\par
    @@ -2239,8 +2245,12 @@
     \newcounter{subsubsection}[subsection]
     \newcounter{paragraph}[subsubsection]
     \newcounter{subparagraph}[paragraph]
    -\renewcommand{\thesection}{\@arabic\c@section.}
    -\renewcommand{\thesubsection}{\thesection\,\@arabic\c@subsection}
    +%
    +% Whoever thought it's a great idea to place periods after
section numbers should be shot.
    +%
    +%\renewcommand{\thesection}{\@arabic\c@section.}
    +\renewcommand{\thesection}{\@arabic\c@section}
    +\renewcommand{\thesubsection}{\thesection.\,\@arabic\c@subsection}
     \renewcommand{\thesubsubsection}{%
        \thesubsection.\,\@arabic\c@subsubsection}
     \renewcommand{\theparagraph}{% (

This looks wrong, since it doesn't include the last commit. For example, changes to line 3145 are not there. It appears to include changes from the second-last commit (e.g. the stuff around line 1714).

My questions:
1) What am I doing wrong?
2) How can I get the diff to include all the commits in their entirety?
3) Is this a bug?

Cheers, Michael

David Kastrup· Jan 16, 2014, 06:31 UTC · re: Misha Penkov · lore

Re: Potential bug: truncated diff output

Misha Penkov <misha.penkov@gmail.com> writes:
Show 7 quoted lines
> I have a file in a git repo. It has changed during the last two
> commits. I want to see the changes made in these two commits. The
> following command should work:
>
>     git diff HEAD^^
>
> but that doesn't get me the expected results. Read on for details.
> As I mentioned in the first paragraph, I want to generate a patch that
> includes both commits:
>
>     $git diff HEAD^^ HEAD ieicej.cls
Show 7 quoted lines
> This looks wrong, since it doesn't include the last commit. For
> example, changes to line 3145 are not there. It appears to include
> changes from the second-last commit (e.g. the stuff around line 1714).
>
> My questions:
>
> 1) What am I doing wrong?

You did not commit all your changes. Some of them are either only in your working directory, or in working directory and index.

> 2) How can I get the diff to include all the commits in their
> entirety?
It did.
> 3) Is this a bug?
No.
-- 
David Kastrup
Johannes Sixt· Jan 16, 2014, 06:55 UTC · re: Misha Penkov · lore

Re: Potential bug: truncated diff output

Am 1/16/2014 7:19, schrieb Misha Penkov:
Show 30 quoted lines
> I have a file in a git repo. It has changed during the last two
> commits. I want to see the changes made in these two commits. The
> following command should work:
> 
>     git diff HEAD^^
> 
> but that doesn't get me the expected results. Read on for details.
> 
> Last commit: I changed some stuff towards the end of the file, for
> example, around line 3145. Here's the full diff (it's here for
> reference, don't bother reading all of it):
> 
>     $git diff HEAD^ HEAD ieicej.cls
>     diff --git a/ieicej.cls b/ieicej.cls
>     index ecf8beb..01debd9 100644
>     ...
>     @@ -3145,11 +3145,11 @@
>        \kern 2.715\p@}
> 
>      \def\@makefnmark{\hbox{$^{\mbox{\tiny \kern-.5zw
>     -  (注\kern.1zw\@thefnmark{})\kern-.5zw}}$}}
>     +  (\kern.1zw\@thefnmark{})\kern-.5zw}}$}}
> 
>      \newcommand\@makefntext[1]{\parindent1zw
>       \noindent\hbox{\kern-.5zw
>     -  (注\kern.1zw\@thefnmark{})\kern-.5zw\hbox to 1zw{\hss :\hss}}#1}
>     +  (\kern.1zw\@thefnmark{})\kern-.5zw\hbox to 1zw{\hss :\hss}}#1}
> 
>      \def\thefootnote{\@arabic\c@footnote}
>      \def\thempfootnote{\@fnsymbol\c@mpfootnote}
Here, you revert the change...
Show 21 quoted lines
> Here's the second-last commit. I changed some things around line 1714.
> Full commit diff (again, for reference only):
> 
>     $git diff -p HEAD^^ HEAD^ ieicej.cls
>     diff --git a/ieicej.cls b/ieicej.cls
>     index 1c3b947..ecf8beb 100644
>     ...
>     @@ -3135,11 +3145,11 @@
>        \kern 2.715\p@}
> 
>      \def\@makefnmark{\hbox{$^{\mbox{\tiny \kern-.5zw
>     -  (\kern.1zw\@thefnmark{})\kern-.5zw}}$}}
>     +  (注\kern.1zw\@thefnmark{})\kern-.5zw}}$}}
> 
>      \newcommand\@makefntext[1]{\parindent1zw
>       \noindent\hbox{\kern-.5zw
>     -  (\kern.1zw\@thefnmark{})\kern-.5zw\hbox to 1zw{\hss :\hss}}#1}
>     +  (注\kern.1zw\@thefnmark{})\kern-.5zw\hbox to 1zw{\hss :\hss}}#1}
> 
>      \def\thefootnote{\@arabic\c@footnote}
>      \def\thempfootnote{\@fnsymbol\c@mpfootnote}
... that you made here.

Unsurprisingly, the net effect is no change in that area -- and git diff tells you exactly that.

-- Hannes
David Kastrup· Jan 16, 2014, 07:04 UTC · re: Johannes Sixt · lore

Re: Potential bug: truncated diff output

Johannes Sixt <j.sixt@viscovery.net> writes:
Show 13 quoted lines
> Am 1/16/2014 7:19, schrieb Misha Penkov:
>> I have a file in a git repo. It has changed during the last two
>> commits. I want to see the changes made in these two commits. The
>> following command should work:
>> 
>>     git diff HEAD^^
>
> Here, you revert the change...
>
> ... that you made here.
>
> Unsurprisingly, the net effect is no change in that area -- and git diff
> tells you exactly that.

Looks like I should have looked into the diffs before making my guess about what happened.

-- 
David Kastrup
Misha Penkov· Jan 16, 2014, 07:06 UTC · re: Johannes Sixt · lore

Re: Potential bug: truncated diff output

Ah, I see. Thank you.
Michael
On 16 January 2014 15:55, Johannes Sixt <j.sixt@viscovery.net> wrote:
Show 62 quoted lines
> Am 1/16/2014 7:19, schrieb Misha Penkov:
>> I have a file in a git repo. It has changed during the last two
>> commits. I want to see the changes made in these two commits. The
>> following command should work:
>>
>>     git diff HEAD^^
>>
>> but that doesn't get me the expected results. Read on for details.
>>
>> Last commit: I changed some stuff towards the end of the file, for
>> example, around line 3145. Here's the full diff (it's here for
>> reference, don't bother reading all of it):
>>
>>     $git diff HEAD^ HEAD ieicej.cls
>>     diff --git a/ieicej.cls b/ieicej.cls
>>     index ecf8beb..01debd9 100644
>>     ...
>>     @@ -3145,11 +3145,11 @@
>>        \kern 2.715\p@}
>>
>>      \def\@makefnmark{\hbox{$^{\mbox{\tiny \kern-.5zw
>>     -  (注\kern.1zw\@thefnmark{})\kern-.5zw}}$}}
>>     +  (\kern.1zw\@thefnmark{})\kern-.5zw}}$}}
>>
>>      \newcommand\@makefntext[1]{\parindent1zw
>>       \noindent\hbox{\kern-.5zw
>>     -  (注\kern.1zw\@thefnmark{})\kern-.5zw\hbox to 1zw{\hss :\hss}}#1}
>>     +  (\kern.1zw\@thefnmark{})\kern-.5zw\hbox to 1zw{\hss :\hss}}#1}
>>
>>      \def\thefootnote{\@arabic\c@footnote}
>>      \def\thempfootnote{\@fnsymbol\c@mpfootnote}
>
> Here, you revert the change...
>
>> Here's the second-last commit. I changed some things around line 1714.
>> Full commit diff (again, for reference only):
>>
>>     $git diff -p HEAD^^ HEAD^ ieicej.cls
>>     diff --git a/ieicej.cls b/ieicej.cls
>>     index 1c3b947..ecf8beb 100644
>>     ...
>>     @@ -3135,11 +3145,11 @@
>>        \kern 2.715\p@}
>>
>>      \def\@makefnmark{\hbox{$^{\mbox{\tiny \kern-.5zw
>>     -  (\kern.1zw\@thefnmark{})\kern-.5zw}}$}}
>>     +  (注\kern.1zw\@thefnmark{})\kern-.5zw}}$}}
>>
>>      \newcommand\@makefntext[1]{\parindent1zw
>>       \noindent\hbox{\kern-.5zw
>>     -  (\kern.1zw\@thefnmark{})\kern-.5zw\hbox to 1zw{\hss :\hss}}#1}
>>     +  (注\kern.1zw\@thefnmark{})\kern-.5zw\hbox to 1zw{\hss :\hss}}#1}
>>
>>      \def\thefootnote{\@arabic\c@footnote}
>>      \def\thempfootnote{\@fnsymbol\c@mpfootnote}
>
> ... that you made here.
>
> Unsurprisingly, the net effect is no change in that area -- and git diff
> tells you exactly that.
>
> -- Hannes

← back to recent threads