Stashes are currently stored using the reflog in a given repository. This is an interesting and novel way to handle them, but there is no way to easily move a stash across machines. For example, stashes cannot be bundled, pushed, or fetched. Let's solve this problem by allowing users to import and export stashes to a chain of commits. The commits used in a stash export contain two parents: one which is the pointer to the next exported stash (or to an empty commit with no parents if there are no more) and the second is the stash commit that would normally be stored in the reflog. Changes from v3: * Fix strbuf handling to avoid leaks and generally be more sensible. * Make use of the error return code more often. * Use oid_array. * Tidy various parts of the code and fix long lines. * Simplify tests using git tag. * Shorten and tidy tests. * Add an additional test covering the base commit OID and importing and exporting empty stashes. Changes from v2: * Fix uninitialized strbuf. * Avoid C99-style initializations. Changes from v1: * Change storage format as suggested by Junio. * Rename to GIT_OID_GENTLY. * Remove unnecessary initializations. * Use ALLOC_GROW_BY. * Ensure completely reproducible exports. * Avoid size_t. * Various other code cleanups. brian m. carlson (4): object-name: make get_oid quietly return an error builtin/stash: factor out revision parsing into a function builtin/stash: provide a way to export stashes to a ref builtin/stash: provide a way to import stashes from a ref Documentation/git-stash.txt | 29 +++- builtin/stash.c | 321 ++++++++++++++++++++++++++++++++++-- cache.h | 1 + object-name.c | 6 +- t/t3903-stash.sh | 63 +++++++ 5 files changed, 406 insertions(+), 14 deletions(-)