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

Re: [PATCH] update-index: add --swap to swap index and worktree content

From
Jeff King <peff@peff.net>
Date
Aug 17, 2011, 02:17 UTC
Message-ID
<20110817021727.GA29585@sigill.intra.peff.net>
In-Reply-To
<CACsJy8Ad4xPz79jT3O64c3XsCeM8XETJ9bnjK0aisagrYN0CMA@mail.gmail.com>
On Wed, Aug 17, 2011 at 09:11:32AM +0700, Nguyen Thai Ngoc Duy wrote:
> I blame git for training me always do "git diff" before update index.
> But if we add "add -e", I could also make "add -e -p" work, (edit
> temporary file first, then fall back to interactive mode and let me
> review my changes).

Yeah, that would be cool. But note that "git add -e" already exists for patch editing.

> Two reasons. I already mentioned the ability to quickly checkout index
> for a quick test (though there could be more problems down that road).

That's a good thought. However, in practice, I find I also need other files from the index to do a successful test. So I end up just committing what I think is right, and then afterwards do:

  GIT_EDITOR='sed -i "/^pick .*/aexec make test/"' git rebase -i
to test and fixup each commit individually.

You could probably use "checkout-index" to create a pristine workspace to test. It's a little inefficient to write out all of the files again, but probably the actual build and test procedure would be much more expensive, anyway.

-Peff
Previous: Nguyen Thai Ngoc DuyNext: Martin von Zweigbergk
Message 11 of 16 in “update-index: add --swap to swap index and worktree content”
  1. update-index: add --swap to swap index and worktree contentNguyễn Thái Ngọc Duy, Aug 12, 2011
  2. Michael J GruberAug 16, 2011
  3. Nguyen Thai Ngoc DuyAug 16, 2011
  4. Junio C HamanoAug 16, 2011
  5. Jeff KingAug 16, 2011
  6. Junio C HamanoAug 16, 2011
  7. Jeff KingAug 16, 2011
  8. Junio C HamanoAug 16, 2011
  9. Jeff KingAug 16, 2011
  10. Nguyen Thai Ngoc DuyAug 17, 2011
  11. Jeff KingAug 17, 2011
  12. Martin von ZweigbergkAug 17, 2011
  13. Nguyen Thai Ngoc DuyAug 17, 2011
  14. Junio C HamanoAug 17, 2011
  15. Jeff KingAug 17, 2011
  16. Martin von ZweigbergkAug 18, 2011

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.