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 16, 2011, 23:06 UTC
Message-ID
<20110816230654.GA21793@sigill.intra.peff.net>
In-Reply-To
<7vzkj9eza2.fsf@alter.siamese.dyndns.org>
On Tue, Aug 16, 2011 at 04:01:57PM -0700, Junio C Hamano wrote:
Show 5 quoted lines
> > No. The point is that I _already_ did it in the working tree version
> 
> But that does not change that you have to do that twice. You may already
> have done so in the working tree, and then redo it in the old indexed
> version again.

Right. The point is that the changes are tangled, to the point that it is simpler to recreate them on one side than it is to instruct a tool about how to untangle them. If they weren't tangled, then I would simply make the change in the working tree, and then "add -p" it into the index.

It's certainly not the dominant case. I'd say I run into it no more frequently than once every week or so. I usually end up using "add -e" to do what I want, but it's very error prone and annoying.

Show 9 quoted lines
> > while doing my s/hello/goodbye/ change (let's call this the "new
> > change"). And ideally I would just use "git add -p" to stage only the
> > s/word/world/ change (let's call this the "fixup"). But they're tangled
> > in a single hunk, and I need some way of splitting them.
> 
> As a way to punt from making "add -e" usable, I'd think it would be a
> workable q&d workaround, even though it feels wrong, and I would imagine
> that normal people would probably prefer the "check out to a temporary
> file to be edited" solution you wrote in your previous message.

Yeah, I think that is the sanest of the options brought up in this thread. I'm curious if Duy had another use case, though, that made him think of --swap.

-Peff
Previous: Junio C HamanoNext: Nguyen Thai Ngoc Duy
Message 9 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.