Re: [PATCH v2 1/2] t7505: Add tests for cherry-pick and rebase -i/-p

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Phillip Wood <phillip.wood@xxxxxxxxxxxx> writes:

> @@ -31,17 +63,40 @@ mkdir -p "$HOOKDIR"
>  echo "#!$SHELL_PATH" > "$HOOK"
>  cat >> "$HOOK" <<'EOF'
>  
> +GIT_DIR=$(git rev-parse --git-dir)
> +if test -d "$GIT_DIR/rebase-merge"
> +then
> +  rebasing=1
> +else
> +  rebasing=0
> +fi
> +
> +get_last_cmd () {
> +  tail -n1 "$GIT_DIR/rebase-merge/done" | {
> +    read cmd id _
> +    git log --pretty="[$cmd %s]" -n1 $id
> +  }
> +}
> +
>  if test "$2" = commit; then
> -  source=$(git rev-parse "$3")
> +  if test $rebasing = 1
> +  then
> +    source="$3"
> +  else
> +    source=$(git rev-parse "$3")
> +  fi
>  else
>    source=${2-default}
>  fi
> -if test "$GIT_EDITOR" = :; then
> -  sed -e "1s/.*/$source (no editor)/" "$1" > msg.tmp
> +test "$GIT_EDITOR" = : && source="$source (no editor)"
> +
> +if test $rebasing = 1
> +then
> +  echo "$source $(get_last_cmd)" >"$1"
>  else
>    sed -e "1s/.*/$source/" "$1" > msg.tmp
> +  mv msg.tmp "$1"
>  fi

It is somewhat irritating that indentation is screwed up in this
part of the file.  Can we not make it even worse?




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux