diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-04-10 10:28:23 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-04-10 10:28:23 +0300 |
commit | 9aa3a4c406e1db08269cc8f6e8757555bd771120 (patch) | |
tree | 21d4d27b791a09d5f2e5dc635b490adc31bbc6b0 /git-filter-branch.sh | |
parent | e8cb62f1908aef40d6ea9265c480b5f597493327 (diff) | |
parent | f78ab355e7d91c70faf41ddad9577cffc3b4ee60 (diff) |
Merge branch 'yk/filter-branch-non-committish-refs'
when refs that do not point at committish are given, "git
filter-branch" gave a misleading error messages. This has been
corrected.
* yk/filter-branch-non-committish-refs:
filter-branch: fix errors caused by refs that point at non-committish
Diffstat (limited to 'git-filter-branch.sh')
-rwxr-xr-x | git-filter-branch.sh | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/git-filter-branch.sh b/git-filter-branch.sh index 2587a01b9b..64f21547c1 100755 --- a/git-filter-branch.sh +++ b/git-filter-branch.sh @@ -251,8 +251,18 @@ done < "$tempdir"/backup-refs # The refs should be updated if their heads were rewritten git rev-parse --no-flags --revs-only --symbolic-full-name \ - --default HEAD "$@" > "$tempdir"/raw-heads || exit -sed -e '/^^/d' "$tempdir"/raw-heads >"$tempdir"/heads + --default HEAD "$@" > "$tempdir"/raw-refs || exit +while read ref +do + case "$ref" in ^?*) continue ;; esac + + if git rev-parse --verify "$ref"^0 >/dev/null 2>&1 + then + echo "$ref" + else + warn "WARNING: not rewriting '$ref' (not a committish)" + fi +done >"$tempdir"/heads <"$tempdir"/raw-refs test -s "$tempdir"/heads || die "You must specify a ref to rewrite." |