git @ Cat's Eye Technologies shelf / 7a9d909
Introduce `shelf_mirror_from_git`. Chris Pressey 6 years ago
2 changed file(s) with 31 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
120120
121121 Given a directory *DIR* containing tarballs of the project listed in
122122 *CATALOG*, extract each of those tarballs to a directory of the same
123 name in the current directory (assumed to be on `SHELF_PATH`.)
123 name in the current directory.
124
125 The current directory is assumed to be on `SHELF_PATH`.
124126
125127 * `shelf_populate_from_git` *PREFIX* < *CATALOG*
126128
127129 For each of the projects listed in *CATALOG*, prefix *PREFIX* to its
128 name and attempt to clone that named object with `git` to a repository
129 directory in the current directory (assumed to be on `SHELF_PATH`.)
130 name and, if a corresponding directory exists in the current directory,
131 update the repository in that corresponding directory using `git pull`,
132 otherwise attempt to `git clone` the repository to that corresponding
133 directory in the current directory.
134
135 The current directory is assumed to be on `SHELF_PATH`.
136
137 * `shelf_mirror_from_git` *PREFIX* < *CATALOG*
138
139 The same as `shelf_populate_from_git`, but uses `git clone --mirror` to
140 clone each new repo directory, and `git remote update` to update it.
130141
131142 * `shelf_cast` *DIR* < *CATALOG*
132143
175186
176187 * Changed `shelf_which` to [not use the which command][] and to produce
177188 cleaner output (only show the target executable file).
189 * Introduced `shelf_mirror_from_git`.
178190
179191 #### 0.4
180192
410410 elif [ -e "$src_dir/$project.tgz" ]; then
411411 tar zxvf $src_dir/$project.tgz
412412 fi
413 #shelf_build $project
414 #shelf_link $project
415413 done
416414 }
417415
438436 if [ "X$tag" != X ]; then
439437 (cd $dest && git checkout $tag)
440438 fi
441
442 #shelf_build $project
443 #shelf_link $project
439 done
440 }
441
442 shelf_mirror_from_git() {
443 git_prefix="$1"
444 while read -r line; do
445 project=`echo $line | awk '{split($0,a,"@"); print a[1]}'`
446 tag=`echo $line | awk '{split($0,a,"@"); print a[2]}'`
447
448 url="$git_prefix$project"
449 dest=`basename $url`
450
451 if [ ! -d $dest ]; then
452 git clone --mirror $url $dest
453 fi
454 (cd $dest && git remote update)
444455 done
445456 }
446457