Skip to content

Commit

Permalink
git-rebase--interactive.sh: replace cut with ${v%% *}
Browse files Browse the repository at this point in the history
Some versions of cut do not cope well with lines that do not end in
an LF. In this case, we can completely avoid cut by using the
${var%% *} parameter expansion (suggested by Brandon Casey).

I found this problem when t3404's "avoid unnecessary reset" failed
due to the "rebase -i" not avoiding updating the tested timestamp.

On a Mac OS X 10.4.11 system:

    % printf '%s' 'foo bar' | /usr/bin/cut -d ' ' -f 1
    cut: stdin: Illegal byte sequence

Signed-off-by: Chris Johnsen <chris_johnsen@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Chris Johnsen authored and Junio C Hamano committed Sep 17, 2010
1 parent 84d6940 commit 14d8729
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion git-rebase--interactive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ skip_unnecessary_picks () {
case "$fd,$command" in
3,pick|3,p)
# pick a commit whose parent is current $ONTO -> skip
sha1=$(printf '%s' "$rest" | cut -d ' ' -f 1)
sha1=${rest%% *}
case "$(git rev-parse --verify --quiet "$sha1"^)" in
"$ONTO"*)
ONTO=$sha1
Expand Down

0 comments on commit 14d8729

Please sign in to comment.