git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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-.} \"$@\"' -"
Previous: David Kastrup
Message 5 of 5 in “Make the global packed_git variable static to sha1_file.c.”
  1. Make the global packed_git variable static to sha1_file.c.Stefan Zager, Feb 12, 2014
  2. Chris PackhamFeb 12, 2014
  3. Stefan ZagerFeb 12, 2014
  4. David KastrupFeb 12, 2014
  5. Junio C HamanoFeb 12, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.