]> code.ossystems Code Review - openembedded-core.git/commitdiff
combo-layer: handle empty commits during "init --history"
authorPatrick Ohly <patrick.ohly@intel.com>
Mon, 29 Feb 2016 11:59:09 +0000 (12:59 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 2 Mar 2016 22:39:05 +0000 (22:39 +0000)
When importing the components during the "combo-layer init" with full
history and relocation into a destination directory, components with
empty commits were not handled because the "mv" command was invoked
with just one parameter.

Replacing that with a find/xargs pair avoids the problem and should
also fix the handling of filenames with special characters (in
particular spaces).

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/combo-layer

index f028098cbb8107cc978b60e2e582d714333dee9f..09a53a27e4bf50361f1d72b59171cfbe0d319771 100755 (executable)
@@ -380,7 +380,7 @@ tail -c +18 $tmpname | head -c -4
                             if not parent:
                                 parent = '.'
                             # May run outside of the current directory, so do not assume that .git exists.
-                            filter_branch.extend(['--tree-filter', 'mkdir -p .git/tmptree && mv $(ls -1 -a | grep -v -e ^.git$ -e ^.$ -e ^..$) .git/tmptree && mkdir -p %s && mv .git/tmptree %s' % (parent, dest_dir)])
+                            filter_branch.extend(['--tree-filter', 'mkdir -p .git/tmptree && find . -mindepth 1 -maxdepth 1 ! -name .git -print0 | xargs -0 -I SOURCE mv SOURCE .git/tmptree && mkdir -p %s && mv .git/tmptree %s' % (parent, dest_dir)])
                         filter_branch.append('HEAD')
                         runcmd(filter_branch)
                         runcmd('git update-ref -d refs/original/refs/heads/%s' % name)