git @ Cat's Eye Technologies shelf / fa9535b
Have shelf_populate_from_git and shelf_pin track failures and fail. Chris Pressey 3 years ago
1 changed file(s) with 33 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
415415
416416 shelf_populate_from_git() {
417417 git_prefix="$1"
418 failures=""
418419 while read -r line; do
419420 project=`echo $line | awk '{split($0,a,"@"); print a[1]}'`
420421 tag=`echo $line | awk '{split($0,a,"@"); print a[2]}'`
425426 dest=`basename $url`
426427
427428 if [ ! -d $dest ]; then
428 echo -n "$dest: " && git clone $url $dest
429 (echo -n "$dest: " && git clone $url $dest)
430 if [ $? -ne 0 ]; then
431 failures="$failures $base"
432 fi
429433 fi
430434
431435 branch=`cd $dest && git rev-parse --abbrev-ref HEAD`
432436 if [ "X$branch" != "XHEAD" ]; then
433437 (echo -n "$dest: " && cd $dest && git pull)
438 if [ $? -ne 0 ]; then
439 failures="$failures $base"
440 fi
434441 fi
435442
436443 if [ "X$tag" != X ]; then
437444 (echo -n "$dest: " && cd $dest && git checkout $tag)
438 fi
439 done
445 if [ $? -ne 0 ]; then
446 failures="$failures $base"
447 fi
448 fi
449 done
450
451 if [ "X$failures" = X ]; then
452 return 0
453 else
454 echo "Failures: $failures"
455 return 1
456 fi
440457 }
441458
442459 shelf_mirror_from_git() {
473490 }
474491
475492 shelf_pin() {
493 failures=""
476494 while read -r line; do
477495 project=`echo $line | awk '{split($0,a,"@"); print a[1]}'`
478496 tag=`echo $line | awk '{split($0,a,"@"); print a[2]}'`
481499 if [ -d $dest ]; then
482500 if [ "X$tag" != X ]; then
483501 (echo -n "$dest: " && cd $dest && git checkout $tag)
484 fi
485 fi
486 done
502 if [ $? -ne 0 ]; then
503 failures="$failures $base"
504 fi
505 fi
506 fi
507 done
508 if [ "X$failures" = X ]; then
509 return 0
510 else
511 echo "Failures: $failures"
512 return 1
513 fi
487514 }
488515
489516 shelf_unpin() {