Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Sixt <johannes.sixt@telecom.at>2007-06-06 22:38:35 +0400
committerJunio C Hamano <gitster@pobox.com>2007-06-06 23:49:16 +0400
commit3520e1e86878c6787c3abfe677e6472ce2c97f66 (patch)
tree6cb404834d1eee587438759d5985906cffe0a446 /git-filter-branch.sh
parent2766ce28150597677bb91c424e6033a298c71510 (diff)
filter-branch: also don't fail in map() if a commit cannot be mapped
The map() function can be used by filters to map a commit id to its rewritten id. Such a mapping may not exist, in which case the identity mapping is used (the commit is returned unchanged). In the rewrite loop, this mapping is also needed, but was done explicitly in the same way. Use the map() function instead. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-filter-branch.sh')
-rwxr-xr-xgit-filter-branch.sh14
1 files changed, 5 insertions, 9 deletions
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 29e0d027ca..9d61b7fff6 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -184,7 +184,8 @@ USAGE="git-filter-branch [-d TEMPDIR] [FILTERS] DESTBRANCH [REV-RANGE]"
map()
{
- [ -r "$workdir/../map/$1" ] || return 1
+ # if it was not rewritten, take the original
+ test -r "$workdir/../map/$1" || echo "$1"
cat "$workdir/../map/$1"
}
@@ -347,14 +348,9 @@ while read commit; do
parentstr=
for parent in $(get_parents $commit); do
- if [ -r "../map/$parent" ]; then
- for reparent in $(cat "../map/$parent"); do
- parentstr="$parentstr -p $reparent"
- done
- else
- # if it was not rewritten, take the original
- parentstr="$parentstr -p $parent"
- fi
+ for reparent in $(map "$parent"); do
+ parentstr="$parentstr -p $reparent"
+ done
done
if [ "$filter_parent" ]; then
parentstr="$(echo "$parentstr" | eval "$filter_parent")"