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

Re: [FAQ?] Rationale for git's way to manage the index

From
Shawn O. Pearce <spearce@spearce.org>
Date
May 8, 2007, 14:52 UTC
Message-ID
<20070508145249.GP11311@spearce.org>
In-Reply-To
<20070508073739.GA24409@diana.vm.bytemark.co.uk>
Karl Hasselstr??m <kha@treskal.com> wrote:
> It's currently possible to split some hunks by
> reducing the number of content lines, but if the changes aren't
> separated by any unchanged lines at all, that doesn't work.

Yea, I've played that game before too (reduce content lines) to try and simulate a hunk splitter. ;-) Doesn't always work.

Right now I feel like a huge chunk of the git-gui code is simply not maintainable. The 0.7.0 release is really more about refactoring the code to make it more maintainable, than it is about actual features (though there are some new things, like vi-keys).

The hunk selection stuff is just one part of the 2,000 lines still left in git-gui.sh itself, and that still uses a lot of messy globals. I want to get the code better organized before I take on major new additions to it.

Show 5 quoted lines
> > I also want to let you revert hunks from the working directory copy.
> 
> That would be handy. But unlike stage/unstage, this can lose
> information, so there'd need to be some kind of "are you _really_
> sure? [Yes] [No]" safety hatch, which would make it less convenient.

True, but that beats the tar out of copying the - lines to your clipboard and pasting them into your text editor, then deleting the - prefix. Especially if its a couple of hunks that you want to revert. Which I find myself doing all to often.

Actually I work around it today by staging what I care about, then reverting the file. Since the revert comes out of the index, I get (mostly) the same action as reverting a particular hunk. But it does mean that I lose my index state, if that happened to be of any particular interest.

> I assume that shelves would be implemented as branches that are
> precisely one commit on top of HEAD? If so, I'd just like to point out
> that they're exactly like unapplied patches in StGIT.
I haven't looked at StGIT in a while.  I've seen noise on the list
about nifty features being added, but I haven't kept up with what
those features actually are.  I think you are right about this and
maybe git-gui should try to be compatible with StGIT's unapplied
patches, should I get into actually implementing a shelving system.
 
Show 5 quoted lines
> Hmm. I find it inconsistent to force or strongly encourage the user to
> commit precisely the working directory changes and not a subset
> thereof, which the shelf idea seems to encourage, while at the same
> time not committing straight from the working directory but from a
> specific staging area (the index).

Indeed; I was thinking that this very morning. Making an index that you stage things into, but then also saying you cannot really do that and instead have to shelve what you don't want - that's just evil. I'll have to think about it more.

The blame interface in git-gui needs help more than the index
staging features.  The colors suck.  ;-)
 
-- 
Shawn.
Previous: Karl HasselströmNext: Johannes Schindelin
Message 29 of 71 in “[FAQ?] Rationale for git's way to manage the index”
  1. Matthieu MoyMay 6, 2007
  2. Johannes SchindelinMay 6, 2007
  3. Matthieu MoyMay 6, 2007
  4. Junio C HamanoMay 6, 2007
  5. Petr BaudisMay 9, 2007
  6. Johannes SchindelinMay 9, 2007
  7. git-commit: Reformat log messages provided on commandlinePetr Baudis, May 9, 2007
  8. Matthieu MoyMay 9, 2007
  9. Petr BaudisMay 9, 2007
  10. Matthieu MoyMay 9, 2007
  11. Johannes SchindelinMay 9, 2007
  12. Junio C HamanoMay 10, 2007
  13. Jakub NarebskiMay 12, 2007
  14. Dana HowMay 6, 2007
  15. Johannes SchindelinMay 6, 2007
  16. Linus TorvaldsMay 6, 2007
  17. Matthieu MoyMay 6, 2007
  18. Linus TorvaldsMay 6, 2007
  19. Julian PhillipsMay 6, 2007
  20. Karl HasselströmMay 7, 2007
  21. Shawn O. PearceMay 8, 2007
  22. Johannes SixtMay 8, 2007
  23. Karl HasselströmMay 8, 2007
  24. J. Bruce FieldsMay 8, 2007
  25. Karl HasselströmMay 8, 2007
  26. J. Bruce FieldsMay 9, 2007
  27. Johannes SchindelinMay 9, 2007
  28. Karl HasselströmMay 8, 2007
  29. Shawn O. PearceMay 8, 2007
  30. Johannes SchindelinMay 6, 2007
  31. Matthieu MoyMay 7, 2007
  32. Johannes SchindelinMay 7, 2007
  33. Petr BaudisMay 9, 2007
  34. Martin LanghoffMay 8, 2007
  35. Linus TorvaldsMay 8, 2007
  36. Martin LanghoffMay 8, 2007
  37. Petr BaudisMay 9, 2007
  38. Linus TorvaldsMay 9, 2007
  39. Carl WorthMay 9, 2007
  40. Jakub NarebskiMay 11, 2007
  41. Dana HowMay 9, 2007
  42. J. Bruce FieldsMay 9, 2007
  43. Petr BaudisMay 9, 2007
  44. J. Bruce FieldsMay 9, 2007
  45. Daniel BarkalowMay 9, 2007
  46. Linus TorvaldsMay 9, 2007
  47. Junio C HamanoMay 10, 2007
  48. Steven GrimmMay 10, 2007
  49. Linus TorvaldsMay 10, 2007
  50. Matthieu MoyMay 10, 2007
  51. Shawn O. PearceMay 10, 2007
  52. Petr BaudisMay 10, 2007
  53. Johannes SchindelinMay 8, 2007
  54. David KågedalMay 15, 2007
  55. Johannes SchindelinMay 15, 2007
  56. Matthieu MoyMay 9, 2007
  57. Guilhem BonnefilleMay 7, 2007
  58. Karl HasselströmMay 7, 2007
  59. David KastrupMay 7, 2007
  60. Johannes SchindelinMay 7, 2007
  61. Junio C HamanoMay 7, 2007
  62. Petr BaudisMay 9, 2007
  63. Daniel BarkalowMay 7, 2007
  64. David KågedalMay 15, 2007
  65. Karl HasselströmMay 15, 2007
  66. Jakub NarebskiMay 11, 2007
  67. Junio C HamanoMay 11, 2007
  68. Jakub NarebskiMay 11, 2007
  69. Junio C HamanoMay 12, 2007
  70. Jakub NarebskiMay 12, 2007
  71. Jakub NarebskiMay 12, 2007

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.