[projects/git-slug: 159/170] adc: Teach move to copy repositories

glen glen at pld-linux.org
Mon Sep 21 21:52:10 CEST 2015


commit cf7b5c9dcec0281a9b70f3ff50ce19d3b480b2c3
Author: Kacper Kornet <draenog at pld-linux.org>
Date:   Fri Dec 21 01:48:17 2012 +0000

    adc: Teach move to copy repositories

 adc/move | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/adc/move b/adc/move
index 08a3e5f..51953e1 100755
--- a/adc/move
+++ b/adc/move
@@ -1,8 +1,9 @@
 #!/bin/sh
 
 . $(dirname $0)/adc.common-functions
+PROG=$(basename $0)
 
-[ "$#" -ne 2 ] && die 'Error: move <repo1> <repo2>'
+[ "$#" -ne 2 ] && die 'Error: $PROG <repo1> <repo2>'
 [ -n "$WATCHDIR" ] || die 'Error: WATCHDIR not set'
 [ -d "$WATCHDIR" ] || die "Error: $WATCHDIR does not exist"
 
@@ -18,9 +19,20 @@ move_to="${2%.git}"
 move_to_full="$GL_REPO_BASE_ABS/packages/${move_to}.git"
 $(dirname $0)/create "$move_to" || die "Error in creating new repo"
 
-echo "Repository moved by $GL_USER to $2" >> $move_from_full/.gitolite.down
 git --git-dir="$move_to_full" fetch "$move_from_full" 'refs/*:refs/*'
-mv "$move_from_full/description" "$move_to_full"
+
+case $PROG in
+    copy)
+        cmd=cp
+        ;;
+    move)
+        cmd=mv
+        echo "Repository moved by $GL_USER to $2" >> $move_from_full/.gitolite.down
+        ;;
+    *)
+        die 'Error: $PROG called with name different from copy or move'
+esac
+$cmd "$move_from_full/description" "$move_to_full"
 
 ( echo $GL_USER
   echo "$move_to"
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/git-slug.git/commitdiff/4ed64f73960519a2f4fd04c42950b2c96ae795c5



More information about the pld-cvs-commit mailing list