threads / discuss / 19517

git log missing last line of output

Subject: git log missing last line of output

## tl;dr

7 messages between May 26, 2009 and Jun 1, 2009.

replies: 6people: 4as markdown or json

Neal Kreitzinger· May 26, 2009, 22:57 UTC · lore

Git log is not displaying the last line of output (for a plain "$ git log" the last line of output should be the title line of the initial commit). (I'm using git 1.5.5.6 on rhel 5.3.) This missing last line also occurs with "git log --since" in which the last line of output should be the title line of the first commit after the specified date, but it is missing in this scenario also. I've searched the release notes for 1.5.6 thru 1.6.3.1 and did not find this mentioned. Does this also happen in newer versions of git after 1.5.5.6?

v/r, Neal

Michael J Gruber· May 27, 2009, 15:42 UTC · re: Neal Kreitzinger · lore

Re: git log missing last line of output

Neal Kreitzinger venit, vidit, dixit 27.05.2009 00:57:
> Git log is not displaying the last line of output (for a plain "$ git log" 
> the last line of output should be the title line of the initial commit). 

It should be the last line of the commit message, which is the "title line" (subject) if and only if the message consists of the subject line only.

Show 6 quoted lines
> (I'm using git 1.5.5.6 on rhel 5.3.)  This missing last line also occurs 
> with "git log --since" in which the last line of output should be the title 
> line of the first commit after the specified date, but it is missing in this 
> scenario also.  I've searched the release notes for 1.5.6 thru 1.6.3.1 and 
> did not find this mentioned.  Does this also happen in newer versions of git 
> after 1.5.5.6?

I can't reproduce this with git 1.5.5.6 (vanilla, not rhel). Do you have a minimal reproducible test case?

Michael
Neal Kreitzinger· May 27, 2009, 17:17 UTC · re: Michael J Gruber · lore

Re: git log missing last line of output

Here is a 'copy and paste' of a testcase scenario that I recreated/executed in response to your reply (with comments added):

***CREATE NEW PROJECT SOURCE*** $ mkdir tstcase1 $ cd tstcase1 $ vi file1 $ cat file1 test1 ***MAKE IT A GIT REPO*** $ git config --global user.name 'tstuser1' $ git config --global user.name 'tstuser1@tstuser.com' $ git config --list user.name=tstuser1 user.email=tstuser1@tstuser.com $ git init Initialized empty Git repository in .git/ $ git add . $ git status # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # # new file: file1 # ***INITIAL COMMIT*** $ git commit

initial commit
# Please enter the commit message for your changes.
# (Comment lines starting with '#' will not be included)
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#       new file: file1
#
~
~
~
~
~
~
~
~
~
~
~
".git/COMMIT_EDITMSG" 12L, 262C written
Created initial commit bee2e0f: initial commit
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 file1
***FIRST MODIFICATION TO REPO***
$ vi file1
$ cat file1
test1 mod1
$ git add file1
$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   file1
#
***FIRST COMMIT AFTER INITIAL COMMIT***
$ git commit
1st commit after initial commit
# Please enter the commit message for your changes.
# (Comment lines starting with '#' will not be included)
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   file1
#
~
~
~
~
~
~
~
~
~
~
~
~
~
~
".git/COMMIT_EDITMSG" 9L, 259C written
Created commit 9f9ed56: 1st commit after initial commit
 1 files changed, 1 insertions(+), 1 deletions(-)
***MODIFY THE REPO AGAIN FOR GOOD MEASURE***
$ vi file1
$ cat file1
test1 mod2
$ git add file1
$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   file1
#
***SECOND COMMIT AFTER INITIAL COMMIT***
$ git commit
2nd commit after initial commit
# Please enter the commit message for your changes.
# (Comment lines starting with '#' will not be included)
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   file1
#
~
~
~
~
~
~
~
~
~
~
~
~
~
~
".git/COMMIT_EDITMSG" 9L, 259C written
Created commit 7317049: 2nd commit after initial commit
 1 files changed, 1 insertions(+), 1 deletions(-)
$ clear

***EXECUTE GIT LOG*** $ git log

commit 73170498d68a0011b37d7ee095bf88b8dcb6fbb5
Author: tstuser1 <tstuser1@tstuser.com>
Date:   Wed May 27 11:48:30 2009 -0500
    2nd commit after initial commit
commit 9f9ed5663d180caefd0bcaff4578fdb2c542bf17
Author: tstuser1 <tstuser1@tstuser.com>
Date:   Wed May 27 11:14:38 2009 -0500
    1st commit after initial commit
commit bee2e0fa066aaa9fed99c15c2ab58744a34fda48
Author: tstuser1 <tstuser1@tstuser.com>
Date:   Wed May 27 11:13:13 2009 -0500

$ ***NOTE THAT LAST LINE OF OUTPUT IS MISSING ABOVE (SHOULD BE THE TITLE LINE OF THE INITIAL COMMIT -- BUT ITS NOT THERE)*** $ clear ***GIT LOG LAST TWO COMMITS*** $ git log -2

commit 73170498d68a0011b37d7ee095bf88b8dcb6fbb5
Author: tstuser1 <tstuser1@tstuser.com>
Date:   Wed May 27 11:48:30 2009 -0500
    2nd commit after initial commit
commit 9f9ed5663d180caefd0bcaff4578fdb2c542bf17
Author: tstuser1 <tstuser1@tstuser.com>
Date:   Wed May 27 11:14:38 2009 -0500

$ ***NOTE THAT THE LAST LINE OF OUTPUT IS MISSING (SHOULD BE THE TITLE LINE OF THE 1ST COMMIT AFTER INITIAL COMMIT -- BUT ITS NOT THERE)*** $ clear ***GIT LOG LAST COMMIT*** $ git log -1

commit 73170498d68a0011b37d7ee095bf88b8dcb6fbb5
Author: tstuser1 <tstuser1@tstuser.com>
Date:   Wed May 27 11:48:30 2009 -0500

$ ***NOTE THAT LAST LINE OF OUTPUT IS MISSING (SHOULD BE THE TITLE LINE OF THE LAST COMMIT -- BUT ITS NOT THERE)***

Is this the kind of testcase that you are looking for?

v/r, Neal

"Michael J Gruber" <git@drmicha.warpmail.net> wrote in message news:4A1D5F70.4030101@drmicha.warpmail.net...

Show 24 quoted lines
> Neal Kreitzinger venit, vidit, dixit 27.05.2009 00:57:
>> Git log is not displaying the last line of output (for a plain "$ git 
>> log"
>> the last line of output should be the title line of the initial commit).
>
> It should be the last line of the commit message, which is the "title
> line" (subject) if and only if the message consists of the subject line
> only.
>
>> (I'm using git 1.5.5.6 on rhel 5.3.)  This missing last line also occurs
>> with "git log --since" in which the last line of output should be the 
>> title
>> line of the first commit after the specified date, but it is missing in 
>> this
>> scenario also.  I've searched the release notes for 1.5.6 thru 1.6.3.1 
>> and
>> did not find this mentioned.  Does this also happen in newer versions of 
>> git
>> after 1.5.5.6?
>
> I can't reproduce this with git 1.5.5.6 (vanilla, not rhel). Do you have
> a minimal reproducible test case?
>
> Michael 
Johannes Sixt· May 27, 2009, 19:06 UTC · re: Neal Kreitzinger · lore

Re: git log missing last line of output

Please use "Reply to all" so that Cc list remains.
On Mittwoch, 27. Mai 2009, Neal Kreitzinger wrote:
Show 20 quoted lines
> $ git log
> commit 73170498d68a0011b37d7ee095bf88b8dcb6fbb5
> Author: tstuser1 <tstuser1@tstuser.com>
> Date:   Wed May 27 11:48:30 2009 -0500
>
>     2nd commit after initial commit
>
> commit 9f9ed5663d180caefd0bcaff4578fdb2c542bf17
> Author: tstuser1 <tstuser1@tstuser.com>
> Date:   Wed May 27 11:14:38 2009 -0500
>
>     1st commit after initial commit
>
> commit bee2e0fa066aaa9fed99c15c2ab58744a34fda48
> Author: tstuser1 <tstuser1@tstuser.com>
> Date:   Wed May 27 11:13:13 2009 -0500
>
> $
> ***NOTE THAT LAST LINE OF OUTPUT IS MISSING ABOVE (SHOULD BE THE TITLE LINE
> OF THE INITIAL COMMIT -- BUT ITS NOT THERE)***
Please try
   git --no-pager log

Do you see the line? Yes? Then your pager and your terminal do not cooperate correctly.

-- Hannes
Neal Kreitzinger· May 27, 2009, 23:06 UTC · re: Johannes Sixt · lore

Re: git log missing last line of output

$ git --no-pager log

...does display the last line of output. (The missing last line occurs in the SmarTerm terminal emulator.)

$ git log

...does display the last line of output on the same server's desktop when connecting via VNC.

Thanks for the help. (Not sure how to 'reply to all' in Outlook newsreader. It only has 'reply to group' and 'reply to sender' options...)

Neal

"Johannes Sixt" <j6t@kdbg.org> wrote in message news:200905272106.31036.j6t@kdbg.org...

Show 34 quoted lines
> Please use "Reply to all" so that Cc list remains.
>
> On Mittwoch, 27. Mai 2009, Neal Kreitzinger wrote:
>> $ git log
>> commit 73170498d68a0011b37d7ee095bf88b8dcb6fbb5
>> Author: tstuser1 <tstuser1@tstuser.com>
>> Date:   Wed May 27 11:48:30 2009 -0500
>>
>>     2nd commit after initial commit
>>
>> commit 9f9ed5663d180caefd0bcaff4578fdb2c542bf17
>> Author: tstuser1 <tstuser1@tstuser.com>
>> Date:   Wed May 27 11:14:38 2009 -0500
>>
>>     1st commit after initial commit
>>
>> commit bee2e0fa066aaa9fed99c15c2ab58744a34fda48
>> Author: tstuser1 <tstuser1@tstuser.com>
>> Date:   Wed May 27 11:13:13 2009 -0500
>>
>> $
>> ***NOTE THAT LAST LINE OF OUTPUT IS MISSING ABOVE (SHOULD BE THE TITLE 
>> LINE
>> OF THE INITIAL COMMIT -- BUT ITS NOT THERE)***
>
> Please try
>
>   git --no-pager log
>
> Do you see the line? Yes? Then your pager and your terminal do not 
> cooperate
> correctly.
>
> -- Hannes 
Neal Kreitzinger· Jun 1, 2009, 20:50 UTC · re: Johannes Sixt · lore

Re: git log missing last line of output

Here is the summary I wrote up for my teammates:
Problem:  Git log does not display the last line of output.
Solution:

Linux uses a command called 'less' to control the pagination of command line output. 'less' is an enhanced version of the command 'more'. For some reason, it is not compatible with SmarTerm when running the 'git log' command which causes the last line of output to be truncated. Git log works fine when executed on the desktop command line using VNC.

Git has the option '--no-pager' to overcome incompatibility issues. Since I do not know if the pager is having problems with any commands besides 'git log', I will focus on 'git log' only. The command 'git --no-pager log' can be executed in lieu of 'git log' to display the log correctly. A git alias can be setup to create a shorter command to accomplish this. I've created the command 'git logr' as a system alias on the git testbox so you can use that command instead of 'git log'. A system alias applies to all logins and repos on the system.

Add alias:
(Login root)
$ git config --system alias.logr '!git --no-pager log'
Note:  if you add an alias with the same name as a git command then git will 
ignore the alias.  If you create the above with the name 'log' then git will 
not run it even though the entry is in the config file.
View alias:
(Login user)
$ git config --system --list
Remove alias:
(Login root)
$ git config --system --unset alias.logr
Location:  /etc/gitconfig

Aliases can also be created to apply only to certain user logins or only to certain repos:

A global alias applies only to a specific user login and takes precedence over a system alias of the same name.

"global config file" location:
/home/userlogin/.gitconfig
command option:
"git config --global".  Run the option from the user login it applies to.

A file alias applies only to a specific repo and takes precedence over a global alias or a system alias of the same name.

"file config file" location:
/specific-repo/.git/config
command option:

"git config --file". This is the default option so a plain "git config" is the same as "git config --file". Run the option while in the pwd of the repo that it applies to.

v/r, Neal

"Johannes Sixt" <j6t@kdbg.org> wrote in message news:200905272106.31036.j6t@kdbg.org...

Show 34 quoted lines
> Please use "Reply to all" so that Cc list remains.
>
> On Mittwoch, 27. Mai 2009, Neal Kreitzinger wrote:
>> $ git log
>> commit 73170498d68a0011b37d7ee095bf88b8dcb6fbb5
>> Author: tstuser1 <tstuser1@tstuser.com>
>> Date:   Wed May 27 11:48:30 2009 -0500
>>
>>     2nd commit after initial commit
>>
>> commit 9f9ed5663d180caefd0bcaff4578fdb2c542bf17
>> Author: tstuser1 <tstuser1@tstuser.com>
>> Date:   Wed May 27 11:14:38 2009 -0500
>>
>>     1st commit after initial commit
>>
>> commit bee2e0fa066aaa9fed99c15c2ab58744a34fda48
>> Author: tstuser1 <tstuser1@tstuser.com>
>> Date:   Wed May 27 11:13:13 2009 -0500
>>
>> $
>> ***NOTE THAT LAST LINE OF OUTPUT IS MISSING ABOVE (SHOULD BE THE TITLE 
>> LINE
>> OF THE INITIAL COMMIT -- BUT ITS NOT THERE)***
>
> Please try
>
>   git --no-pager log
>
> Do you see the line? Yes? Then your pager and your terminal do not 
> cooperate
> correctly.
>
> -- Hannes 
Brian Gernhardt· Jun 1, 2009, 20:56 UTC · re: Neal Kreitzinger · lore

Re: git log missing last line of output

On Jun 1, 2009, at 4:50 PM, Neal Kreitzinger wrote:
Show 15 quoted lines
> Git has the option '--no-pager' to overcome incompatibility issues.   
> Since I
> do not know if the pager is having problems with any commands  
> besides 'git
> log', I will focus on 'git log' only.  The command 'git --no-pager  
> log' can
> be executed in lieu of 'git log' to display the log correctly.  A  
> git alias
> can be setup to create a shorter command to accomplish this.  I've  
> created
> the command 'git logr' as a system alias on the git testbox so you  
> can use
> that command instead of 'git log'.  A system alias applies to all  
> logins and
> repos on the system.

You could also use the core.pager and/or pager.<cmd> configuration variables. Setting either to "false" or "no" (or "off" in git >= 1.6.3-rc1) will stop git from using the pager without needing an alias. See git-config(1) (or Documentation/config.txt) for details.

~~ Brian

← back to recent threads