summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2766ce2)
raw | patch | inline | side by side (parent: 2766ce2)
author | Johannes Sixt <johannes.sixt@telecom.at> | |
Wed, 6 Jun 2007 18:38:35 +0000 (20:38 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 6 Jun 2007 19:49:16 +0000 (12:49 -0700) |
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>
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>
git-filter-branch.sh | patch | blob | history |
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 29e0d027cae84c10055fe7383d9fbd000eba35ea..9d61b7fff6670bcf40e4135749cec9bdb3fd10ae 100755 (executable)
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
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"
}
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")"