Re: [PATCH] Make the global packed_git variable static to sha1_file.c.
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 12, 2014, 19:28 UTC
- Message-ID
- <xmqq1tz8nn9k.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <CAHOQ7J-2BkQOr+_BF42ja4pWaUWkt8OC-YE0ETwHAYsmrubi=A@mail.gmail.com>
Stefan Zager <szager@google.com> writes:
> If anyone has a recommendation for a less labor-intensive way to do > this in emacs, I'd be very grateful.
This is not "do this in emacs", but here is a possible approach.
You can ask "git diff" about what you changed, and actually apply the change while fixing whitespace errors. I.e.
git diff sha1_file.c | git apply --cached --whitespace=fix git diff git checkout sha1_file.c
The first step will add a cleaned-up version to your index.
The second "diff" (optional) is to see what whitespace errors are introduced when going from that cleaned-up version to what you have in the working tree.
With the last step you would update the working tree version to the cleaned-up version from the index.
[alias]
wsadd = "!sh -c 'git diff -- \"$@\" | git apply --cached --whitespace=fix;\
git co -- ${1-.} \"$@\"' -"