#!/bin/sh

FOLDER='bfs_fuse'

mkdir "$FOLDER"
cd "$FOLDER"
git init
git remote add origin git://git.haiku-os.org/haiku
git config core.sparsecheckout true
# ==============================================================================
echo /src/add-ons/kernel/file_systems/bfs/					>  .git/info/sparse-checkout	# almost all files in this folder are needed (except Jamfile and ToDo)
echo /src/add-ons/kernel/file_systems/shared/				>> .git/info/sparse-checkout	# all files in this folder are needed
echo /src/build/libroot/									>> .git/info/sparse-checkout	# almost all files in this folder are needed (except fs_attr_bsdxattr.h fs_attr_untyped.cpp fs_freebsd.cpp fs_attr_extattr.h fs_attr_xattr.h fs_freebsd.h)
echo /src/tools/bfs_shell/									>> .git/info/sparse-checkout	# all files in this folder are needed (contains only Jamfile)
echo /src/tools/fs_shell/									>> .git/info/sparse-checkout	# almost all files in this folder are needed (except external_commands_beos.cpp fs_shell_command_beos.h fs_shell_command_unix.cpp fssh.cpp fs_shell_command.cpp fs_shell_command_beos.cpp fs_shell_command.h)

echo /src/system/kernel/cache/file_map.cpp					>> .git/info/sparse-checkout
echo /src/system/kernel/fs/rootfs.cpp						>> .git/info/sparse-checkout
echo /src/system/kernel/messaging/KMessage.cpp				>> .git/info/sparse-checkout
echo /src/system/libroot/os/driver_settings.cpp				>> .git/info/sparse-checkout
echo /src/system/libroot/posix/string/strlcat.c				>> .git/info/sparse-checkout
echo /src/system/libroot/posix/string/strlcpy.c				>> .git/info/sparse-checkout
echo /src/system/libroot/posix/string/strnlen.cpp			>> .git/info/sparse-checkout
# ==============================================================================
echo /headers/build/config_build/							>> .git/info/sparse-checkout	# all files in this folder are needed
echo /headers/build/os/kernel/								>> .git/info/sparse-checkout	# almost all files in this folder are needed (except fs_info.h)
echo /headers/private/fs_shell/								>> .git/info/sparse-checkout	# all files in this folder are needed

echo /headers/build/BeOSBuildCompatibility.h				>> .git/info/sparse-checkout
echo /headers/build/HaikuBuildCompatibility.h				>> .git/info/sparse-checkout
echo /headers/build/os/BeBuild.h							>> .git/info/sparse-checkout
echo /headers/build/os/app/AppDefs.h						>> .git/info/sparse-checkout
echo /headers/build/os/app/Message.h						>> .git/info/sparse-checkout
echo /headers/build/os/app/Messenger.h						>> .git/info/sparse-checkout
echo /headers/build/os/drivers/driver_settings.h			>> .git/info/sparse-checkout
echo /headers/build/os/drivers/KernelExport.h				>> .git/info/sparse-checkout
echo /headers/build/os/interface/Point.h					>> .git/info/sparse-checkout
echo /headers/build/os/interface/Rect.h						>> .git/info/sparse-checkout
echo /headers/build/os/interface/Size.h						>> .git/info/sparse-checkout
echo /headers/build/os/storage/DiskDeviceDefs.h				>> .git/info/sparse-checkout
echo /headers/build/os/storage/FindDirectory.h				>> .git/info/sparse-checkout
echo /headers/build/os/storage/Node.h						>> .git/info/sparse-checkout
echo /headers/build/os/storage/NodeMonitor.h				>> .git/info/sparse-checkout
echo /headers/build/os/storage/Statable.h					>> .git/info/sparse-checkout
echo /headers/build/os/storage/StorageDefs.h				>> .git/info/sparse-checkout
echo /headers/build/os/support/ByteOrder.h					>> .git/info/sparse-checkout
echo /headers/build/os/support/DataIO.h						>> .git/info/sparse-checkout
echo /headers/build/os/support/Debug.h						>> .git/info/sparse-checkout
echo /headers/build/os/support/Errors.h						>> .git/info/sparse-checkout
echo /headers/build/os/support/Flattenable.h				>> .git/info/sparse-checkout
echo /headers/build/os/support/SupportDefs.h				>> .git/info/sparse-checkout
echo /headers/build/os/support/TypeConstants.h				>> .git/info/sparse-checkout
echo /headers/build/private/kernel/syscalls.h				>> .git/info/sparse-checkout
echo /headers/build/private/kernel/util/KMessage.h			>> .git/info/sparse-checkout
echo /headers/build/private/system/directories.h			>> .git/info/sparse-checkout
echo /headers/build/private/system/find_directory_private.h	>> .git/info/sparse-checkout
echo /headers/os/app/AppDefs.h								>> .git/info/sparse-checkout
echo /headers/os/interface/Point.h							>> .git/info/sparse-checkout
echo /headers/os/interface/Rect.h							>> .git/info/sparse-checkout
echo /headers/os/interface/Size.h							>> .git/info/sparse-checkout
echo /headers/os/kernel/OS.h								>> .git/info/sparse-checkout
echo /headers/os/storage/DiskDeviceDefs.h					>> .git/info/sparse-checkout
echo /headers/os/storage/FindDirectory.h					>> .git/info/sparse-checkout
echo /headers/os/storage/NodeMonitor.h						>> .git/info/sparse-checkout
echo /headers/os/storage/StorageDefs.h						>> .git/info/sparse-checkout
echo /headers/os/support/ByteOrder.h						>> .git/info/sparse-checkout
echo /headers/os/support/DataIO.h							>> .git/info/sparse-checkout
echo /headers/os/support/Debug.h							>> .git/info/sparse-checkout
echo /headers/os/support/Flattenable.h						>> .git/info/sparse-checkout
echo /headers/os/support/SupportDefs.h						>> .git/info/sparse-checkout
echo /headers/os/support/TypeConstants.h					>> .git/info/sparse-checkout
echo /headers/private/file_systems/QueryParser.h			>> .git/info/sparse-checkout
echo /headers/private/file_systems/QueryParserUtils.h		>> .git/info/sparse-checkout
echo /headers/private/kernel/util/KMessage.h				>> .git/info/sparse-checkout
echo /headers/private/shared/AutoDeleter.h					>> .git/info/sparse-checkout
echo /headers/private/shared/EntryFilter.h					>> .git/info/sparse-checkout
echo /headers/private/shared/TypeOperation.h				>> .git/info/sparse-checkout
echo /headers/private/storage/query_private.h				>> .git/info/sparse-checkout
echo /headers/private/system/directories.h					>> .git/info/sparse-checkout
echo /headers/private/system/find_directory_private.h		>> .git/info/sparse-checkout
# ==============================================================================
echo /build/												>> .git/info/sparse-checkout

echo /configure												>> .git/info/sparse-checkout
echo /Jamfile												>> .git/info/sparse-checkout
echo /Jamrules												>> .git/info/sparse-checkout
echo /src/Jamfile											>> .git/info/sparse-checkout
echo /src/build/Jamfile										>> .git/info/sparse-checkout
echo /src/tools/Jamfile										>> .git/info/sparse-checkout
# ==============================================================================
git pull --no-tags origin HEAD
# ==============================================================================
./configure --host-only --target=host
