All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Hilco Wijbenga <hilco.wijbenga@gmail.com>
Cc: Git Users <git@vger.kernel.org>
Subject: Re: Rebase & Trailing Whitespace
Date: Wed, 31 Aug 2011 22:31:27 -0400	[thread overview]
Message-ID: <20110901023127.GB31838@sigill.intra.peff.net> (raw)
In-Reply-To: <CAE1pOi0rY4kRR4rvEdFhzzTgfhUczHMX=H5_9+o5aHnv4vTadw@mail.gmail.com>

On Wed, Aug 31, 2011 at 04:55:03PM -0700, Hilco Wijbenga wrote:

> hilco@centaur ~/workspaces/project-next project-next (next $)$ git rebase master
> [...]
> <stdin>:721810: trailing whitespace.
> [...]
> Note the trailing whitespace warnings. How do I find out which file(s)
> generated these warnings? Would it be possible to add the file name
> causing the warnings to be output? By default? (Using --verbose
> doesn't seem to make any difference where the whitespace warnings are
> concerned.)

You can see any whitespace warnings in your repository (and in which
commit they were introduced) by doing something like:

  git log --oneline --check

The "--check" option is just another diff output format, so you use it
with "log" or "diff". For example, if you want to see just whitespace
problems that still exist in your current tree, you can diff against the
empty tree with --check, like:

  git diff --check 4b825dc642cb6eb9a060e54bf8d69288fbee4904

where "4b825dc..." is the well-known sha1 of an empty tree[1].

> Furthermore, why didn't I get these or similar warnings when I
> committed/pushed that particular commit ("Use static WAR for SWF files
> and assets.")? I did just find "[core] whitespace = trailing-space"
> which I will add to my .gitconfig, I suppose. So I guess what I really
> mean to ask is, why do rebase (and merge?) behave differently from
> commit?

Because these warnings are only triggered by default when applying
patches. And the idea of rebase is to apply patches from one place to
another. I thought we squelched whitespace warnings for rebase these
days (since they are somewhat pointless; you are moving around your own
commits, not applying commits from some other contributor), but maybe I
am misremembering. Or maybe you have an older version of git. Which
version are you using?

If you want to enforce whitespace checks during commit or push, you can
do so with a hook. The sample "pre-commit" hook, for example, uses "diff
--check" for just this purpose. See "git help hooks" for more
information.

-Peff

[1] If you don't remember the empty tree sha1, you can always derive it
    with:

        git hash-object -t tree /dev/null

  reply	other threads:[~2011-09-01  2:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-31 23:55 Rebase & Trailing Whitespace Hilco Wijbenga
2011-09-01  2:31 ` Jeff King [this message]
2011-09-01 21:00   ` Philip Oakley
2011-09-01 21:26     ` Jeff King
2011-09-02  7:32       ` Michael J Gruber
2011-09-02  8:28         ` Jeff King
2011-09-03 20:18           ` Clemens Buchacher
2011-09-09 19:38             ` Jeff King

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=20110901023127.GB31838@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=hilco.wijbenga@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.