├── README ├── LICENSE └── git-export /README: -------------------------------------------------------------------------------- 1 | 2 | git-export 3 | ========== 4 | 5 | Export the contents of a git index 6 | 7 | 8 | Contributors 9 | ============ 10 | 11 | * Daniel Schierbeck 12 | * Abhishek Mukherjee 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2009 Daniel Schierbeck 2 | 3 | This program is free software; you can redistribute it and/or 4 | modify it under the terms of the GNU General Public License 5 | as published by the Free Software Foundation; either version 2 6 | of the License, or (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 16 | -------------------------------------------------------------------------------- /git-export: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (c) 2008 Daniel Schierbeck 4 | # 5 | # Export the contents of the git index to a specified directory 6 | 7 | USAGE="[-f | --force] " 8 | LONG_USAGE="Export the contents of the git index to the specified directory" 9 | SUBDIRECTORY_OK=Yes 10 | OPTIONS_SPEC= 11 | . "`git --exec-path`/git-sh-setup" 12 | 13 | force=0 14 | destination= 15 | 16 | args=`getopt -o fh -l force,help,he,hel -- "$@"` 17 | if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi 18 | 19 | eval set -- "$args" 20 | 21 | while true ; do 22 | case "$1" in 23 | -f|--force) 24 | force=1 25 | shift 26 | ;; 27 | -h|--h|--he|--hel|--help) 28 | usage 29 | shift 30 | ;; 31 | --) 32 | shift; break ;; 33 | *) 34 | die "Invalid argument found!" 35 | exit 2; 36 | ;; 37 | esac 38 | done 39 | 40 | if [ $# -ne 1 ] 41 | then 42 | die "You can only export to a single destination" 43 | exit 1 44 | fi 45 | 46 | if [ -e $1 -a $force -ne 1 ] 47 | then 48 | die "$1 already exists. Use --force to overwrite any existing files." 49 | exit 1 50 | fi 51 | 52 | destination=$1 53 | 54 | cd_to_toplevel 55 | 56 | echo "Exporting git repository to ${destination}" 57 | 58 | git checkout-index -a --prefix=${destination}/ 59 | --------------------------------------------------------------------------------