diff options
Diffstat (limited to 'libs/git')
-rwxr-xr-x | libs/git | 48 |
1 files changed, 29 insertions, 19 deletions
@@ -169,7 +169,7 @@ git_commit() { ) } -git_apply() { +git_am() { local repository_path=$1 local branch=$2 local patch=$3 @@ -182,50 +182,60 @@ git_apply() { git checkout "$branch" >/dev/null 2>&1 if git_apply_check "$repository_path" "$branch" "$patch"; then - git apply --index "$patch" + git am "$patch" || git am --abort fi ) } -git_apply_check() { +git_apply() { local repository_path=$1 local branch=$2 local patch=$3 ( + export GIT_COMMITTER_NAME=$GIT_NAME + export GIT_COMMITTER_EMAIL=$GIT_EMAIL + cd "$repository_path" git checkout "$branch" >/dev/null 2>&1 - git apply --check "$patch" + if git_apply_check "$repository_path" "$branch" "$patch"; then + git apply --index "$patch" + fi ) } -git_patch() { +git_apply_check() { local repository_path=$1 local branch=$2 local patch=$3 ( - export GIT_COMMITTER_NAME=$GIT_NAME - export GIT_COMMITTER_EMAIL=$GIT_EMAIL - cd "$repository_path" git checkout "$branch" >/dev/null 2>&1 - case $patch in - *.patch) - git am "$patch" || git am --abort - ;; - *.diff) - git_apply "$repository_path" "$branch" "$patch" && - git_commit "$repository_path" "Applied ${patch##*/}" - ;; - *) - ;; - esac + git apply --check "$patch" ) } +git_patch() { + local repository_path=$1 + local branch=$2 + local patch=$3 + + case $patch in + *.patch) + git_am "$repository_path" "$branch" "$patch" + ;; + *.diff) + git_apply "$repository_path" "$branch" "$patch" && + git_commit "$repository_path" "Applied ${patch##*/}" + ;; + *) + ;; + esac +} + git_revision() { local repository_path=$1 |