summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-06-20 10:00:34 +0200
committerJens Axboe <jens.axboe@oracle.com>2007-06-20 10:00:34 +0200
commit44316791d2057bff6cd33eb2a2c8d62f7af97e76 (patch)
tree322f5b654af49b3ac9bad63f4b34777507cc7c63
parent3f95f0834ec99acaf6ce1bfbfccadd566494275a (diff)
downloadag-44316791d2057bff6cd33eb2a2c8d62f7af97e76.tar.gz
ag-44316791d2057bff6cd33eb2a2c8d62f7af97e76.tar.bz2
Missed update of scripts with ag-common helper
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rwxr-xr-xag-apply-dir9
-rwxr-xr-xag-branch-cp14
-rwxr-xr-xag-branch-cur7
-rwxr-xr-xag-branch-ls7
-rwxr-xr-xag-branch-new4
-rwxr-xr-xag-branch-rm7
-rwxr-xr-xag-branch-switch4
-rwxr-xr-xag-checkout-head7
-rwxr-xr-xag-commit6
-rwxr-xr-xag-remote-cp7
-rwxr-xr-xag-repack7
-rwxr-xr-xag-request-pull7
-rwxr-xr-xag-unedit7
-rwxr-xr-xag-update-cache4
14 files changed, 54 insertions, 43 deletions
diff --git a/ag-apply-dir b/ag-apply-dir
index 09293a3..54c4df3 100755
--- a/ag-apply-dir
+++ b/ag-apply-dir
@@ -1,5 +1,9 @@
#!/bin/bash
+. ag-common
+
+check_git_dir
+
# Runs git-applymbox on the directory given as the first argument.
# If it breaks in the middle, specify a restart point as the 2nd arg.
@@ -8,11 +12,6 @@ if [ ! -x $(which git-applymbox) ]; then
exit 1
fi
-if [ ! -d .git ]; then
- echo Does not appear to be a git tree
- exit 1
-fi
-
DIR=$1
if [ x$1 == "x" ]; then
echo Need directory with patches as argument
diff --git a/ag-branch-cp b/ag-branch-cp
index 5ef266a..bba9264 100755
--- a/ag-branch-cp
+++ b/ag-branch-cp
@@ -1,9 +1,8 @@
#!/bin/bash
-if [ ! -d .git ]; then
- echo Does not appear to be a git tree
- exit 1
-fi
+. ag-common
+
+check_git_dir
if [ "$1"x == x ]; then
echo Need source branch as first argument
@@ -22,4 +21,9 @@ if [ ! -f .git/refs/heads/$SRC ]; then
exit 2
fi
-cp .git/refs/heads/$SRC .git/refs/heads/
+if [ $SRC == $DST ]; then
+ echo Source and destination are identical
+ exit 3
+fi
+
+cp .git/refs/heads/$SRC .git/refs/heads/$DST
diff --git a/ag-branch-cur b/ag-branch-cur
index f573267..96e2248 100755
--- a/ag-branch-cur
+++ b/ag-branch-cur
@@ -1,9 +1,8 @@
#!/bin/bash
-if [ ! -d .git ]; then
- echo Does not appear to be a git tree
- exit 1
-fi
+. ag-common
+
+check_git_dir
if [ -L .git/HEAD ]; then
HEAD=$(file -b .git/HEAD | cut -d '`' -f2 | sed s/"'"//g)
diff --git a/ag-branch-ls b/ag-branch-ls
index 3c0f98b..96efeee 100755
--- a/ag-branch-ls
+++ b/ag-branch-ls
@@ -1,9 +1,8 @@
#!/bin/bash
-if [ ! -d .git ]; then
- echo Does not appear to be a git tree
- exit 1
-fi
+. ag-common
+
+check_git_dir
HEADS=$(cd .git/refs/heads && ls)
diff --git a/ag-branch-new b/ag-branch-new
index 8fb8acd..213ee44 100755
--- a/ag-branch-new
+++ b/ag-branch-new
@@ -1,5 +1,9 @@
#!/bin/bash
+. ag-common
+
+check_git_dir
+
if [ x$1 == 'x' ]; then
echo "ag-new branch <branch>"
exit 1
diff --git a/ag-branch-rm b/ag-branch-rm
index 0402866..6dc14b6 100755
--- a/ag-branch-rm
+++ b/ag-branch-rm
@@ -1,9 +1,8 @@
#!/bin/bash
-if [ ! -d .git ]; then
- echo Does not appear to be a git tree
- exit 1
-fi
+. ag-common
+
+check_git_dir
if [ ! -f .git/refs/heads/$1 ]; then
echo $1 does not appear to be a valid branch
diff --git a/ag-branch-switch b/ag-branch-switch
index 7b82e56..25c1d0b 100755
--- a/ag-branch-switch
+++ b/ag-branch-switch
@@ -1,5 +1,9 @@
#!/bin/sh
+. ag-common
+
+check_git_dir
+
if [ "x$1" == "x" ]; then
echo "Usage: ag-branch-switch <branch>"
exit 1
diff --git a/ag-checkout-head b/ag-checkout-head
index 6b3c722..a421407 100755
--- a/ag-checkout-head
+++ b/ag-checkout-head
@@ -1,8 +1,7 @@
#!/bin/bash
-if [ ! -d .git ]; then
- echo Does not appear to be a git tree
- exit 1
-fi
+. ag-common
+
+check_git_dir
git-read-tree -m HEAD && git checkout -f
diff --git a/ag-commit b/ag-commit
index be27105..258d16c 100755
--- a/ag-commit
+++ b/ag-commit
@@ -1,5 +1,9 @@
#!/bin/bash
+. ag-common
+
+check_git_dir
+
TEMP=`getopt -o a:c: --long a-long:,c-long:: -- "$@"`
eval set -- "$TEMP"
@@ -55,7 +59,7 @@ if [ -f changelog.txt ]; then
git commit -m changelog.txt
rm -rf changelog.txt
else
- git commit -s "Jens Axboe <jens.axboe@oracle.com>"
+ git commit -s
fi
unset GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL
diff --git a/ag-remote-cp b/ag-remote-cp
index 1727ddd..4a28c58 100755
--- a/ag-remote-cp
+++ b/ag-remote-cp
@@ -1,9 +1,8 @@
#!/bin/bash
-if [ ! -d .git ]; then
- echo Does not appear to be a git tree
- exit 1
-fi
+. ag-common
+
+check_git_dir
if [ "$1"x == x ]; then
echo Need remote branch
diff --git a/ag-repack b/ag-repack
index c365af7..bf65974 100755
--- a/ag-repack
+++ b/ag-repack
@@ -1,9 +1,8 @@
#!/bin/bash
-if [ ! -d .git ]; then
- echo Does not appear to be a git tree
- exit 1
-fi
+. ag-common
+
+check_git_dir
git repack -a -d -l
git gc --prune
diff --git a/ag-request-pull b/ag-request-pull
index d4ea3bf..2440a45 100755
--- a/ag-request-pull
+++ b/ag-request-pull
@@ -1,9 +1,8 @@
#!/bin/bash
-if [ ! -d .git ]; then
- echo Does not appear to be a git tree
- exit 1
-fi
+. ag-common
+
+check_git_dir
if [ x"$1" == "x" ]; then
echo Need branch or commit as argument
diff --git a/ag-unedit b/ag-unedit
index d42a4b3..203eee5 100755
--- a/ag-unedit
+++ b/ag-unedit
@@ -1,8 +1,7 @@
#!/bin/bash
-if [ ! -d .git ]; then
- echo Does not appear to be a git tree
- exit 1
-fi
+. ag-common
+
+check_git_dir
git checkout $@
diff --git a/ag-update-cache b/ag-update-cache
index 3b2fd35..f3c5884 100755
--- a/ag-update-cache
+++ b/ag-update-cache
@@ -1,5 +1,9 @@
#!/bin/bash
+. ag-common
+
+check_git_dir
+
eval commitfiles=($(git diff-index -r -m HEAD -- "${ARGS[@]}" | sed 's/^\([^ ]*\)\(. .*\)\( .*\)*$/"\2"/'))
for line in "${commitfiles[@]}"; do