Skip to content

Commit

Permalink
Merge branch 'js/transport-helper-error-reporting-fix'
Browse files Browse the repository at this point in the history
Finishing touches to fc/transport-helper-error-reporting topic.

* js/transport-helper-error-reporting-fix:
  git-remote-testgit: build it to run under $SHELL_PATH
  git-remote-testgit: further remove some bashisms
  git-remote-testgit: avoid process substitution
  • Loading branch information
Junio C Hamano committed May 29, 2013
2 parents 766f0f8 + 709a957 commit 1ccb22d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
/git-remote-ftps
/git-remote-fd
/git-remote-ext
/git-remote-testgit
/git-remote-testpy
/git-remote-testsvn
/git-repack
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ SCRIPT_SH += git-mergetool.sh
SCRIPT_SH += git-pull.sh
SCRIPT_SH += git-quiltimport.sh
SCRIPT_SH += git-rebase.sh
SCRIPT_SH += git-remote-testgit.sh
SCRIPT_SH += git-repack.sh
SCRIPT_SH += git-request-pull.sh
SCRIPT_SH += git-stash.sh
Expand Down
26 changes: 16 additions & 10 deletions git-remote-testgit → git-remote-testgit.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/bin/sh
# Copyright (c) 2012 Felipe Contreras

alias=$1
Expand All @@ -23,7 +23,6 @@ then
testgitmarks="$dir/testgit.marks"
test -e "$gitmarks" || >"$gitmarks"
test -e "$testgitmarks" || >"$testgitmarks"
testgitmarks_args=( "--"{import,export}"-marks=$testgitmarks" )
fi

while read line
Expand Down Expand Up @@ -70,7 +69,10 @@ do
fi

echo "feature done"
git fast-export "${testgitmarks_args[@]}" $refs |
git fast-export \
${testgitmarks:+"--import-marks=$testgitmarks"} \
${testgitmarks:+"--export-marks=$testgitmarks"} \
$refs |
sed -e "s#refs/heads/#${prefix}/heads/#g"
echo "done"
;;
Expand All @@ -87,17 +89,21 @@ do
exit 1
fi

before=$(git for-each-ref --format='%(refname) %(objectname)')
before=$(git for-each-ref --format=' %(refname) %(objectname) ')

git fast-import "${testgitmarks_args[@]}" --quiet

after=$(git for-each-ref --format='%(refname) %(objectname)')
git fast-import \
${testgitmarks:+"--import-marks=$testgitmarks"} \
${testgitmarks:+"--export-marks=$testgitmarks"} \
--quiet

# figure out which refs were updated
join -e 0 -o '0 1.2 2.2' -a 2 <(echo "$before") <(echo "$after") |
while read ref a b
git for-each-ref --format='%(refname) %(objectname)' |
while read ref a
do
test $a == $b && continue
case "$before" in
*" $ref $a "*)
continue ;; # unchanged
esac
if test -z "$GIT_REMOTE_TESTGIT_PUSH_ERROR"
then
echo "ok $ref"
Expand Down
5 changes: 0 additions & 5 deletions t/t5801-remote-helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ test_description='Test remote-helper import and export commands'
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-gpg.sh

if ! type "${BASH-bash}" >/dev/null 2>&1; then
skip_all='skipping remote-testgit tests, bash not available'
test_done
fi

compare_refs() {
git --git-dir="$1/.git" rev-parse --verify $2 >expect &&
git --git-dir="$3/.git" rev-parse --verify $4 >actual &&
Expand Down

0 comments on commit 1ccb22d

Please sign in to comment.