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

Potential bug: truncated diff output

From
MPMisha Penkov <misha.penkov@gmail.com>
Date
Jan 16, 2014, 06:19 UTC
Message-ID
<CAAyYaWo7wtsVGGxUeE3wwG6UHZ_qc8wcPu4Dk6=DsF8JtyF6_w@mail.gmail.com>

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

Next: David Kastrup
Message 1 of 5 in “Potential bug: truncated diff output”
  1. Misha PenkovJan 16, 2014
  2. David KastrupJan 16, 2014
  3. Johannes SixtJan 16, 2014
  4. David KastrupJan 16, 2014
  5. Misha PenkovJan 16, 2014

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.