All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabian Ruch <bafain@gmail.com>
To: git@vger.kernel.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH 4/4] git-ack: record an ack
Date: Wed, 04 Jun 2014 01:53:22 +0200	[thread overview]
Message-ID: <538E5FF2.2080506@gmail.com> (raw)
In-Reply-To: <1400447743-18513-5-git-send-email-mst@redhat.com>

Hi Michael,

I have some inline comments below. Also, some parts of the patch do not
adhere to the style rules

 - tabs for indentation
 - $(...) for command substitution
 - no space after redirection operators
 - double-quotes around redirection targets

for shell scripts (from the file `Documentation/CodingGuidelines`).

On 05/18/2014 11:17 PM, Michael S. Tsirkin wrote:
> diff --git a/contrib/git-ack b/contrib/git-ack
> new file mode 100755
> index 0000000..4aeb16a
> --- /dev/null
> +++ b/contrib/git-ack
> @@ -0,0 +1,84 @@
> +msg=`mktemp`
> +patch=`mktemp`
> +info=`git mailinfo $msg $patch`
> +subj=`echo "$info"|sed -n 's/^Subject: //p'`
> +author=`echo "$info"|sed -n 's/^Author: //p'`
> +email=`echo "$info"|sed -n 's/^Email: //p'`
> +auth="$author <$email>"
> +date=`echo "$info"|sed -n 's/^Date: //p'`
> +sign=`mktemp`
> +echo "ack! $subj" > $sign
> +echo "" >> $sign
> +if
> +    git diff --cached HEAD

If I am not mistaken, the exit code of `git-diff(1)` doesn't change
according to whether there are differences or not, unless the option
`--exit-code` is given.

> +then
> +    nop < /dev/null

Is it correct that this is a do-nothing operation? Is that a common
idiom? I found the null command (`:`, colon) to be used in many places
instead.

> +else
> +    echo "DIFF in cache. Not acked, reset or commit!"
> +    exit 1
> +fi
> +GIT_DIR=`pwd`/${GIT_DIR}

This seems incorrect to me. If `GIT_DIR` is already set, it might point
to an absolute path and not `.git`. If the environment variable is not
set, the state file `ACKS` ends up in the working directory.

Maybe `git-sh-setup(1)` can be of help. It uses

    git rev-parse --git-dir

to probe the path to the .git directory.

> +
> +usage () {
> +	echo "Usage: git ack " \
> +            "[-s|--save|-a|--append|-r|--restore |-c|--clear]\n" >& 2;
> +        exit 1;
> +}
> +
> +append=
> +save=
> +clear=

The restore flag seems to be missing from this list of declarations.

> +
> +while test $# != 0
> +do
> +	case "$1" in
> +	-a|--append)
> +		append="y"
> +		;;
> +	-s|--s)
> +		save="y"
> +		;;
> +	-r|--restore)
> +		restore="y"
> +		;;
> +	-c|--clear)
> +		clear="y"
> +                ;;
> +	*)
> +		usage ;;
> +	esac
> +	shift
> +done
> +
> +if
> +    test "$clear"
> +then
> +    rm -f "${GIT_DIR}/ACKS"
> +fi
> +
> +if
> +    test "$save"
> +then
> +    if
> +        test "$append"
> +    then
> +        cat $msg >> "${GIT_DIR}/ACKS"
> +    else
> +        cat $msg > "${GIT_DIR}/ACKS"
> +    fi
> +fi
> +
> +if
> +    test "$restore"
> +then
> +    msg = ${GIT_DIR}/ACKS
> +fi
> +
> +if
> +    grep '^[A-Z][A-Za-z-]*-by:' $msg >> $sign
> +then
> +    git commit --allow-empty -F $sign --author="$auth" --date="$date"
> +else
> +    echo "No signature found!"
> +    exit 2
> +fi

   Fabian

  reply	other threads:[~2014-06-03 23:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-18 21:17 [PATCH 0/4] ack recoding in commit log Michael S. Tsirkin
2014-05-18 21:17 ` [PATCH 1/4] rebase -i: add ack action Michael S. Tsirkin
2014-05-18 21:17 ` [PATCH 2/4] git-rebase: document ack Michael S. Tsirkin
2014-05-18 23:43   ` Eric Sunshine
2014-05-18 21:17 ` [PATCH 3/4] rebase: test ack Michael S. Tsirkin
2014-05-19 21:34   ` Junio C Hamano
2014-05-19 22:40     ` Michael S. Tsirkin
2014-05-20 14:38     ` Michael S. Tsirkin
2014-05-20 15:13       ` Junio C Hamano
2014-05-21 12:52         ` Michael S. Tsirkin
2014-05-21 16:54           ` Junio C Hamano
2014-05-21 17:39             ` Michael S. Tsirkin
2014-05-21 18:30               ` Junio C Hamano
2014-05-18 21:17 ` [PATCH 4/4] git-ack: record an ack Michael S. Tsirkin
2014-06-03 23:53   ` Fabian Ruch [this message]
2014-06-11  8:05 ` [PATCH 0/4] ack recoding in commit log Fabian Ruch
2014-06-11  8:46   ` Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2016-04-10 13:54 [PATCH 0/4] support for ack commits Michael S. Tsirkin
2016-04-10 13:54 ` [PATCH 4/4] git-ack: record an ack Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=538E5FF2.2080506@gmail.com \
    --to=bafain@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=mst@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.