[PATCH] Repack should try to prevent itself from running twice, concurrently.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Ryan Anderson <ryan@xxxxxxxxxxxxxx>
---
 git-repack.sh |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/git-repack.sh b/git-repack.sh
index eb75c8c..20f9b55 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -24,6 +24,15 @@ do
 	shift
 done
 
+if [ -f $GIT_DIR/repack.lock ]
+then
+	echo "Existing repack job appears to be running."
+	echo "Remove $GIT_DIR/repack.lock if this is not the case."
+	exit 1
+else
+	echo $$ > $GIT_DIR/repack.lock
+fi
+
 rm -f .tmp-pack-*
 PACKDIR="$GIT_OBJECT_DIRECTORY/pack"
 
@@ -83,3 +92,5 @@ case "$no_update_info" in
 t) : ;;
 *) git-update-server-info ;;
 esac
+
+rm $GIT_DIR/repack.lock
-- 
1.4.1.rc1.gacb70

-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]