git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ed Avis <ed.avis@qmaw.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: git log --name-only improvement: show old file name in rename
Date: Thu, 11 Jun 2020 11:19:14 +0000	[thread overview]
Message-ID: <BL0PR11MB3460BEB60550854661B5178B9D800@BL0PR11MB3460.namprd11.prod.outlook.com> (raw)

The git-log manual page says

       --name-only
           Show only names of changed files.

But when a file has been renamed, only the new name is printed, not the 
old.  I think it would be more useful and more correct to print both 
names. 

For example

% git init
Initialized empty Git repository in /home/eda/test/.git/
% touch a
% git add a
% git commit -mx
[master (root-commit) ca81aa7] x
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 a
% git mv a b
% git commit -my
[master 7b3925c] y
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename a => b (100%)
% git log --name-only -n 1
commit 7b3925c1ece26d08d79cf9f06bfcb0b38fea611f (HEAD -> master)
Author: Ed Avis <eda@waniasset.com>
Date:   2020-06-11 11:59:34 +0100

    y

b


I would expect that last log message to show the old filename a as well 
as the new filename b.  If you give --no-renames then both filenames are 
shown, of course, but I think it should be possible to detect the 
rename and print out both old and new names.  There is --name-status 
which will print more info including renames, but again I believe 
--name-only should also show both.  Thank you for considering this 
improvement request.

% git --version
git version 2.26.0

-- 
Ed Avis <ed.avis@qmaw.com>

             reply	other threads:[~2020-06-11 11:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11 11:19 Ed Avis [this message]
2020-06-11 23:16 ` git log --name-only improvement: show old file name in rename Junio C Hamano
2020-06-12 14:18   ` Philip Oakley
2020-06-12 17:03     ` Junio C Hamano
2020-06-15  7:36       ` Ed Avis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BL0PR11MB3460BEB60550854661B5178B9D800@BL0PR11MB3460.namprd11.prod.outlook.com \
    --to=ed.avis@qmaw.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).