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

Re: The git newbie experience

From
Junio C Hamano <junkio@cox.net>
Date
May 15, 2006, 20:47 UTC
Message-ID
<7vhd3rhv6t.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20060515164610.GA24295@hpsvcnb.fc.hp.com>
Carl Baldwin <cnb@fc.hp.com> writes:
Show 7 quoted lines
> My implementation actually wrote the working file state into the object
> store as a tree and stored a reference to the tree under something like
> .git/refs/undo (or .git/refs/stash).  Redo was a simple merge of this
> tree back onto the current working files.
>
> I think I would like something like this better than the 'generate
> binary patch and reapply the patch later.

When you think of the "binary patch" as a human readable representation of your (hierarchical set of) tree objects, you would realize that these two approaches aren't that much different at the tree merge level, and it's just a matter of which representation is more convenient and human readable.

Pros and cons I see are:
 * Branch approach needs to teach users only one thing -- create
   a branch, merge with it, throw it away.  Which is something
   the user needs to know anyway, so it is a plus.
 * Branch approach needs to store a full postimage tree and the
   base commit (so you can use it as a merge base); the
   postimage tree includes paths that are not involved in the
   change being stashed.
 * Patch records only the object names of paths that are relevant
   to the stash.  Instead of keeping the full postimage tree, it
   creates one on the fly when you actually do the unstashing.
 * Patch is human readable and can be used for purposes other
   than falling back to a three-way merge.  When cleanly applies
   apply + write-tree is faster than a tree merge.
 * Patch could be verbose if the change being stashed is large;
   after all the primary information used are the object names
   recorded on the "index" lines and the patch text itself is a
   waste from storage point of view.  This is a disadvantage of
   the "patch" approach, but its readability might offset it.
   If a change being stashed is large, the user had better be
   doing it on a separate topic branch anyway, so this might not
   be a big issue.
Previous: Carl BaldwinNext: Carl Worth
Message 9 of 12 in “The git newbie experience”
  1. Tommi VirtanenMay 14, 2006
  2. Junio C HamanoMay 14, 2006
  3. Junio C HamanoMay 14, 2006
  4. Tommi VirtanenMay 15, 2006
  5. Junio C HamanoMay 15, 2006
  6. Shawn PearceMay 15, 2006
  7. Junio C HamanoMay 15, 2006
  8. Carl BaldwinMay 15, 2006
  9. Junio C HamanoMay 15, 2006
  10. Carl WorthMay 15, 2006
  11. Junio C HamanoMay 15, 2006
  12. Shawn PearceMay 15, 2006

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.