git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ed Avis <ed.avis@qmaw.com>
To: Junio C Hamano <gitster@pobox.com>,
	Philip Oakley <philipoakley@iee.email>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: git log --name-only improvement: show old file name in rename
Date: Mon, 15 Jun 2020 07:36:44 +0000	[thread overview]
Message-ID: <BL0PR11MB34608AE271344D508676D17A9D9C0@BL0PR11MB3460.namprd11.prod.outlook.com> (raw)
In-Reply-To: <xmqqh7vg2p4p.fsf@gitster.c.googlers.com>

Thanks all for your replies to this.  I hoped that --name-only could show when
a filename was removed, as well as when it was added.  If you delete a 
file in one commit then add it with a new name in the next, both 
filenames appear in the log.  If these happen in a single commit, only 
one does.  And in fact it's not predictable whether you will get one 
filename or two: it depends on rename detection.  Sometimes if a file is
changed and moved to a new name, git log --name-only will show only the
new name in the log, but at other times, if git doesn't detect it as a 
rename, both filenames appear.  This feels more like an implementation 
detail than a deliberate choice.

I accept that scripts may rely on the current behaviour, though I would 
be surprised to find a script that depended on *not* seeing the old 
filename printed.

Anyway, if it shouldn't change, or if it cannot change because of backwards compatibility, the manual page could be improved:

           --name-only
           Show only names of changed or added files.
           If a file is removed, its name is also printed, unless this is detected
           as a rename, in which case only the new name is printed.

That would be enough to direct users towards something more suitable like --compact-summary.

      reply	other threads:[~2020-06-15  7:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11 11:19 git log --name-only improvement: show old file name in rename Ed Avis
2020-06-11 23:16 ` 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 [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=BL0PR11MB34608AE271344D508676D17A9D9C0@BL0PR11MB3460.namprd11.prod.outlook.com \
    --to=ed.avis@qmaw.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=philipoakley@iee.email \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).