summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 80fe82e)
raw | patch | inline | side by side (parent: 80fe82e)
author | Junio C Hamano <gitster@pobox.com> | |
Mon, 20 Oct 2008 23:36:38 +0000 (16:36 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 21 Oct 2008 06:36:31 +0000 (23:36 -0700) |
Jeff King noticed that this series uses non-portable ${var:0:7} syntax
to splice a string, which is not even in POSIX, in the script. A quick
look at around the offending part revealed a few issues, which this commit
fixes:
* Why filter output from "rev-list --left-right A...B" and look for the
ones that begin with ">"? Wouldn't "rev-list A..B" give that?
* The abbreviated SHA-1 are made with "rev-list --abbrev=7" into $TODO in
an earlier invocation, and it can be more than 7 letters to avoid
ambiguity. Not just that "${r:0:7} is not even in POSIX", but use of
it here is actively wrong.
* There is no point in catting a single file and piping it into grep.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
to splice a string, which is not even in POSIX, in the script. A quick
look at around the offending part revealed a few issues, which this commit
fixes:
* Why filter output from "rev-list --left-right A...B" and look for the
ones that begin with ">"? Wouldn't "rev-list A..B" give that?
* The abbreviated SHA-1 are made with "rev-list --abbrev=7" into $TODO in
an earlier invocation, and it can be more than 7 letters to avoid
ambiguity. Not just that "${r:0:7} is not even in POSIX", but use of
it here is actively wrong.
* There is no point in catting a single file and piping it into grep.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-rebase--interactive.sh | patch | blob | history |
index 848fbe7d5913a009c75da2486b7cea3563617b10..a563dea9b5313eaf60bd218cee166e6a17de93c0 100755 (executable)
sed -n "s/^>//p" > "$DOTEST"/not-cherry-picks
# Now all commits and note which ones are missing in
# not-cherry-picks and hence being dropped
- git rev-list $UPSTREAM...$HEAD --left-right | \
- sed -n "s/^>//p" | while read rev
+ git rev-list $UPSTREAM..$HEAD |
+ while read rev
do
if test -f "$REWRITTEN"/$rev -a "$(grep "$rev" "$DOTEST"/not-cherry-picks)" = ""
then
# just the history of its first-parent for others that will
# be rebasing on top of it
git rev-list --parents -1 $rev | cut -d' ' -f2 > "$DROPPED"/$rev
- cat "$TODO" | grep -v "${rev:0:7}" > "${TODO}2" ; mv "${TODO}2" "$TODO"
+ short=$(git rev-list -1 --abbrev-commit --abbrev=7 $rev)
+ grep -v "^[a-z][a-z]* $short" <"$TODO" > "${TODO}2" ; mv "${TODO}2" "$TODO"
rm "$REWRITTEN"/$rev
fi
done