* [PATCH RFC] subtree: support subtree -P /path/to/file split
@ 2016-08-30 9:55 Ivan Shapovalov
0 siblings, 0 replies; only message in thread
From: Ivan Shapovalov @ 2016-08-30 9:55 UTC (permalink / raw)
To: git; +Cc: Ivan Shapovalov
Hello,
I'm missing `git subtree split` functionality for the case when prefix
is a single file. Looking at git-subtree, pretty few changes are needed
to handle this. The attached patch works for me in the common case
(no rejoins). As such, I'm looking for comments :)
Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name>
---
contrib/subtree/git-subtree.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index dec085a..464dcf7 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -485,8 +485,12 @@ subtree_for_commit () {
while read mode type tree name
do
assert test "$name" = "$dir"
- assert test "$type" = "tree" -o "$type" = "commit"
+ assert test "$type" = "tree" -o "$type" = "commit" -o "$type" = "blob"
test "$type" = "commit" && continue # ignore submodules
+ test "$type" = "blob" && { # handle if $dir is a file
+ printf "%s %s %s\t%s\0" "$mode" "$type" "$tree" "${file##*/}" | git mktree
+ break
+ }
echo $tree
break
done
--
2.9.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-08-30 9:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-30 9:55 [PATCH RFC] subtree: support subtree -P /path/to/file split Ivan Shapovalov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).