diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-03-22 14:00:24 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-03-22 14:00:24 -0700 |
commit | f5c73f69fd711f4814a2e8da78a0a2f4dbb46013 (patch) | |
tree | 8189b949645acae74d33f5b3210928b0bb8d58f0 /unpack-trees.c | |
parent | dd4048d1c76f067ad7b339dfb3a5f4765f5ae979 (diff) | |
parent | 0af760e26191acd3c5957841461ff224b80b43f7 (diff) | |
download | git-f5c73f69fd711f4814a2e8da78a0a2f4dbb46013.tar.gz |
Merge branch 'dl/stash-show-untracked'
"git stash show" learned to optionally show untracked part of the
stash.
* dl/stash-show-untracked:
stash show: learn stash.showIncludeUntracked
stash show: teach --include-untracked and --only-untracked
Diffstat (limited to 'unpack-trees.c')
-rw-r--r-- | unpack-trees.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/unpack-trees.c b/unpack-trees.c index 9298fe1d9b..9af8e796b3 100644 --- a/unpack-trees.c +++ b/unpack-trees.c @@ -2563,3 +2563,25 @@ int oneway_merge(const struct cache_entry * const *src, } return merged_entry(a, old, o); } + +/* + * Merge worktree and untracked entries in a stash entry. + * + * Ignore all index entries. Collapse remaining trees but make sure that they + * don't have any conflicting files. + */ +int stash_worktree_untracked_merge(const struct cache_entry * const *src, + struct unpack_trees_options *o) +{ + const struct cache_entry *worktree = src[1]; + const struct cache_entry *untracked = src[2]; + + if (o->merge_size != 2) + BUG("invalid merge_size: %d", o->merge_size); + + if (worktree && untracked) + return error(_("worktree and untracked commit have duplicate entries: %s"), + super_prefixed(worktree->name)); + + return merged_entry(worktree ? worktree : untracked, NULL, o); +} |