support de git-annex pour pp et pdev

This commit is contained in:
Jephté Clain 2015-05-19 10:27:15 +04:00
parent 9b4f5b965c
commit 89ad130dc3
2 changed files with 29 additions and 3 deletions

View File

@ -11,6 +11,7 @@ function is_any_branch() {
if [ -z "$branch" ]; then if [ -z "$branch" ]; then
branch="$(git_get_branch)" || return 2 branch="$(git_get_branch)" || return 2
fi fi
local annex; git_have_annex && annex=1
local spec r local spec r
for spec in "$@"; do for spec in "$@"; do
case "$spec" in case "$spec" in
@ -36,6 +37,10 @@ function is_any_branch() {
[ "$branch" == "develop" ] && continue [ "$branch" == "develop" ] && continue
[[ "$branch" == release-* ]] && continue [[ "$branch" == release-* ]] && continue
[[ "$branch" == hotfix-* ]] && continue [[ "$branch" == hotfix-* ]] && continue
if [ -n "$annex" ]; then
[ "$branch" == "git-annex" ] && continue
[[ "$branch" == synced/* ]] && continue
fi
return 0 return 0
;; ;;
-m|-master) -m|-master)
@ -56,6 +61,10 @@ function is_any_branch() {
[ "$branch" == "develop" ] && continue [ "$branch" == "develop" ] && continue
[[ "$branch" == release-* ]] && continue [[ "$branch" == release-* ]] && continue
[[ "$branch" == hotfix-* ]] && continue [[ "$branch" == hotfix-* ]] && continue
if [ -n "$annex" ]; then
[ "$branch" == "git-annex" ] && continue
[[ "$branch" == synced/* ]] && continue
fi
return 1 return 1
;; ;;
esac esac
@ -82,7 +91,13 @@ function list_feature_branches() {
grep -vF master | grep -vF master |
grep -vF develop | grep -vF develop |
grep -v '^release-' | grep -v '^release-' |
grep -v '^hotfix-' grep -v '^hotfix-' |
if git_have_annex; then
grep -vF git-annex |
grep -v '^synced/'
else
cat
fi
} }
################################################################################ ################################################################################

View File

@ -369,6 +369,9 @@ function git_getrepos() {
function git_geturl() { function git_geturl() {
git config --get remote.origin.url git config --get remote.origin.url
} }
function git_have_annex() {
[ -n "$(git config --get annex.uuid)" ]
}
function git_add() { function git_add() {
git add "$@" git add "$@"
} }
@ -450,13 +453,14 @@ function git_update() {
git pull "$@" git pull "$@"
} }
function git_push() { function git_push() {
local all all_branches all_tags auto force args local all all_branches all_tags auto force args no_annex
parse_opts + "${PRETTYOPTS[@]}" \ parse_opts + "${PRETTYOPTS[@]}" \
-a,--all all=1 \ -a,--all all=1 \
-b,--branches,--all-branches all_branches=1 \ -b,--branches,--all-branches all_branches=1 \
-t,--tags,--all-tags all_tags=1 \ -t,--tags,--all-tags all_tags=1 \
--auto auto=1 \ --auto auto=1 \
-f,--force force=1 \ -f,--force force=1 \
-n,--no-annex no_annex=1 \
@ args -- "$@" && set -- "${args[@]}" || { @ args -- "$@" && set -- "${args[@]}" || {
eerror "$args" eerror "$args"
return 1 return 1
@ -479,6 +483,13 @@ function git_push() {
# On a demandé à pusher tous les tags # On a demandé à pusher tous les tags
git push --tags git push --tags
return $? return $?
elif git_have_annex; then
# Si une annexe existe dans le dépôt, demander à git-annex de faire la
# synchronisation, sauf si --no-annex est spécifié
if [ -z "$no_annex" ]; then
git annex sync
return $?
fi
fi fi
# sinon on push vers origin. vérifier la présence du remote # sinon on push vers origin. vérifier la présence du remote
@ -690,7 +701,7 @@ function git_annex_initial() {
local GIT_DIR GIT_WORK_TREE local GIT_DIR GIT_WORK_TREE
[ "$(cd "$repodir"; git rev-parse --is-bare-repository)" == false ] || return 0 [ "$(cd "$repodir"; git rev-parse --is-bare-repository)" == false ] || return 0
[ -n "$(GIT_DIR="$repodir/.git" git config annex.uuid)" ] && return 0 [ -n "$(GIT_DIR="$repodir/.git" git config --get annex.uuid)" ] && return 0
# ici, on sait que git annex n'a pas encore été configuré # ici, on sait que git annex n'a pas encore été configuré
# vérifier s'il existe des fichiers annexés # vérifier s'il existe des fichiers annexés