Skip to content

Commit

Permalink
Replace instances of export VAR=VAL with VAR=VAL; export VAR
Browse files Browse the repository at this point in the history
It might be POSIX, but there are shells that do not like the
expression 'export VAR=VAL'.  To be on the safe side, rewrite them
into 'VAR=VAL' and 'export VAR'.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Nov 29, 2007
1 parent d25430c commit 3addc94
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion git-clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ cleanup() {
trap cleanup 0
mkdir -p "$dir" && D=$(cd "$dir" && pwd) || usage
test -n "$GIT_WORK_TREE" && mkdir -p "$GIT_WORK_TREE" &&
W=$(cd "$GIT_WORK_TREE" && pwd) && export GIT_WORK_TREE="$W"
W=$(cd "$GIT_WORK_TREE" && pwd) && GIT_WORK_TREE="$W" && export GIT_WORK_TREE
if test yes = "$bare" || test -n "$GIT_WORK_TREE"; then
GIT_DIR="$D"
else
Expand Down
20 changes: 12 additions & 8 deletions git-filter-branch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,25 @@ set_ident () {
h
s/^'$lid' \([^<]*\) <[^>]*> .*$/\1/
s/'\''/'\''\'\'\''/g
s/.*/export GIT_'$uid'_NAME='\''&'\''/p
s/.*/GIT_'$uid'_NAME='\''&'\''; export GIT_'$uid'_NAME/p
g
s/^'$lid' [^<]* <\([^>]*\)> .*$/\1/
s/'\''/'\''\'\'\''/g
s/.*/export GIT_'$uid'_EMAIL='\''&'\''/p
s/.*/GIT_'$uid'_EMAIL='\''&'\''; export GIT_'$uid'_EMAIL/p
g
s/^'$lid' [^<]* <[^>]*> \(.*\)$/\1/
s/'\''/'\''\'\'\''/g
s/.*/export GIT_'$uid'_DATE='\''&'\''/p
s/.*/GIT_'$uid'_DATE='\''&'\''; export GIT_'$uid'_DATE/p
q
}
'

LANG=C LC_ALL=C sed -ne "$pick_id_script"
# Ensure non-empty id name.
echo "[ -n \"\$GIT_${uid}_NAME\" ] || export GIT_${uid}_NAME=\"\${GIT_${uid}_EMAIL%%@*}\""
echo "case \"\$GIT_${uid}_NAME\" in \"\") GIT_${uid}_NAME=\"\${GIT_${uid}_EMAIL%%@*}\" && export GIT_${uid}_NAME;; esac"
}

USAGE="[--env-filter <command>] [--tree-filter <command>] \
Expand Down Expand Up @@ -206,7 +206,8 @@ done < "$tempdir"/backup-refs
ORIG_GIT_DIR="$GIT_DIR"
ORIG_GIT_WORK_TREE="$GIT_WORK_TREE"
ORIG_GIT_INDEX_FILE="$GIT_INDEX_FILE"
export GIT_DIR GIT_WORK_TREE=.
GIT_WORK_TREE=.
export GIT_DIR GIT_WORK_TREE

# These refs should be updated if their heads were rewritten

Expand All @@ -231,7 +232,8 @@ done > "$tempdir"/heads
test -s "$tempdir"/heads ||
die "Which ref do you want to rewrite?"

export GIT_INDEX_FILE="$(pwd)/../index"
GIT_INDEX_FILE="$(pwd)/../index"
export GIT_INDEX_FILE
git read-tree || die "Could not seed the index"

ret=0
Expand Down Expand Up @@ -267,7 +269,8 @@ while read commit parents; do
git read-tree -i -m $commit:"$filter_subdir"
esac || die "Could not initialize the index"

export GIT_COMMIT=$commit
GIT_COMMIT=$commit
export GIT_COMMIT
git cat-file commit "$commit" >../commit ||
die "Cannot read commit $commit"

Expand Down Expand Up @@ -401,7 +404,8 @@ if [ "$filter_tag_name" ]; then

[ -f "../map/$sha1" ] || continue
new_sha1="$(cat "../map/$sha1")"
export GIT_COMMIT="$sha1"
GIT_COMMIT="$sha1"
export GIT_COMMIT
new_ref="$(echo "$ref" | eval "$filter_tag_name")" ||
die "tag name filter failed: $filter_tag_name"

Expand Down
10 changes: 6 additions & 4 deletions git-quiltimport.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ for patch_name in $(grep -v '^#' < "$QUILT_PATCHES/series" ); do
}

# Parse the author information
export GIT_AUTHOR_NAME=$(sed -ne 's/Author: //p' "$tmp_info")
export GIT_AUTHOR_EMAIL=$(sed -ne 's/Email: //p' "$tmp_info")
GIT_AUTHOR_NAME=$(sed -ne 's/Author: //p' "$tmp_info")
GIT_AUTHOR_EMAIL=$(sed -ne 's/Email: //p' "$tmp_info")
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
while test -z "$GIT_AUTHOR_EMAIL" && test -z "$GIT_AUTHOR_NAME" ; do
if [ -n "$quilt_author" ] ; then
GIT_AUTHOR_NAME="$quilt_author_name";
Expand All @@ -104,8 +105,9 @@ for patch_name in $(grep -v '^#' < "$QUILT_PATCHES/series" ); do
GIT_AUTHOR_EMAIL="$patch_author_email"
fi
done
export GIT_AUTHOR_DATE=$(sed -ne 's/Date: //p' "$tmp_info")
export SUBJECT=$(sed -ne 's/Subject: //p' "$tmp_info")
GIT_AUTHOR_DATE=$(sed -ne 's/Date: //p' "$tmp_info")
SUBJECT=$(sed -ne 's/Subject: //p' "$tmp_info")
export GIT_AUTHOR_DATE SUBJECT
if [ -z "$SUBJECT" ] ; then
SUBJECT=$(echo $patch_name | sed -e 's/.patch$//')
fi
Expand Down

0 comments on commit 3addc94

Please sign in to comment.