git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Is the -w option for git blame bugged?
@ 2018-02-16  9:47 hgfds jhgfds
  2018-02-16 10:57 ` Konstantin Khomoutov
  0 siblings, 1 reply; 2+ messages in thread
From: hgfds jhgfds @ 2018-02-16  9:47 UTC (permalink / raw)
  To: git

Hi,

I recently asked a question on stackoverflow regarding what seemed to
be erroneous output from git blame when the -w option is specified.
However, no one answered my question, so I decided to ask here
instead.

The question is available at
https://stackoverflow.com/questions/48808281/git-blame-ignore-whitespace-option-bugged

Hope someone can help to shed light on this issue soon.

Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Is the -w option for git blame bugged?
  2018-02-16  9:47 Is the -w option for git blame bugged? hgfds jhgfds
@ 2018-02-16 10:57 ` Konstantin Khomoutov
  0 siblings, 0 replies; 2+ messages in thread
From: Konstantin Khomoutov @ 2018-02-16 10:57 UTC (permalink / raw)
  To: hgfds jhgfds; +Cc: git

On Fri, Feb 16, 2018 at 05:47:41PM +0800, hgfds jhgfds wrote:

> I recently asked a question on stackoverflow regarding what seemed to
> be erroneous output from git blame when the -w option is specified.
> However, no one answered my question, so I decided to ask here
> instead.
> 
> The question is available at
> https://stackoverflow.com/questions/48808281/git-blame-ignore-whitespace-option-bugged
> 
> Hope someone can help to shed light on this issue soon.

This is indeed the correct place to ask such questions.
Still, the next time please literally ask the question - inclusing its
full text - rather than dropping a link: few people bother do to that,
and even fewer of them have an SO account to actually answer it.
So it's both just basic netiquette and increasing the circle of the
potentional helpers ;-)

In order to remove the churn, I've copied and pasted your question here;
hope you have no issues with me doing this.

--------------------------------8<--------------------------------
Based on my understanding, the command `git blame` is supposed to show, for
each line in a file, the author and the commit in which the line was last
modified.  So for example, if I run

git blame -- "<filename>"

and get the following output for line 5:

106b77db (Walrus 2016-03-24 10:01:36 +0800   5) .root {

it means the line

.root {

originated from the author Walrus in the commit 106b77db.
In other words, if I inspect the patch produced by 106b77db using
`git show -p 106b77db`, I would expect the line

+.root {

to show up in the diff. Indeed, this is the case.

Snippet from 106b77db's diff for <filename>:

 /* JavaFX CSS - Leave this comment until you have at least create one rule       which uses -fx-Property */
+.root {
+   -fx-background-color: transparent;
+}
+

Now, when I run

git blame -w -- "<filename>"

(the -w option ignores whitespace changes, i.e. traces each line backwards in
time to find the last author which introduced non-whitespace changes to that
line), I now get the following output for line 5:

b6a6e8a2 (Walrus 2016-03-31 23:32:50 +0800   5) .root {

However, when I inspect the patch for b6a6e8a2 using

git show -p b6a6e8a2

the diff shows

.root {

rather than

+.root {

as expected.

Snippet from b6a6e8a2's diff for <filename>:

+
+/* setting window to be transparent================================ */
 .root {
    -fx-background-color: transparent;
-}
-

Has Git given me erroneous output, because according to the diff, the line
.root { was not modified at all in the commit b6a6e8a2?

I am using Git 2.13.3.windows.1.

EDIT: the repository is https://github.com/cs2103jan2016-f14-2j/main,
and the file is JimplePlanner/src/application.css.
After upgrading to Git 2.16.1.windows.4, the issue still persists.
--------------------------------8<--------------------------------


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-16 10:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-16  9:47 Is the -w option for git blame bugged? hgfds jhgfds
2018-02-16 10:57 ` Konstantin Khomoutov

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).