From: Andreas Ericsson <ae@op5.se>
To: Andy Parkins <andyparkins@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] update-hook: fix incorrect use of git-describe and sed for finding previous tag
Date: Fri, 16 Mar 2007 10:06:40 +0100 [thread overview]
Message-ID: <45FA5E20.2050905@op5.se> (raw)
In-Reply-To: <200703141425.53192.andyparkins@gmail.com>
Andy Parkins wrote:
> Previously git-describe would output lines of the form
> v1.1.1-gf509d56
> The update hook found the dash and stripped it off using
> sed 's/-g.*//'
> The remainder was then used as the previous tag name.
>
> However, git-describe has changed format. The output is now of the form
> v1.1.1-23-gf509d56
> The above sed fragment doesn't strip the middle "-23", and so the
> previous tag name used would be "v1.1.1-23". This is incorrect.
>
> Since the hook script was written, git-describe now gained support for
> "--abbrev=0", which it uses as a special flag to tell it not to output
> anything other than the nearest tag name. This patch fixes the problem,
> and prevents any future recurrence by using this new flag rather than
> sed to find the previous tag.
>
> Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Acked-by: Andreas Ericsson <ae@op5.se>
> ---
> templates/hooks--update | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/templates/hooks--update b/templates/hooks--update
> index 5b82b68..8f6c4fe 100644
> --- a/templates/hooks--update
> +++ b/templates/hooks--update
> @@ -210,7 +210,7 @@ case "$refname_type" in
> fi
>
> # If this tag succeeds another, then show which tag it replaces
> - prevtag=$(git describe $newrev^ 2>/dev/null | sed 's/-g.*//')
> + prevtag=$(git describe --abbrev=0 $newrev^ 2>/dev/null)
> if [ -n "$prevtag" ]; then
> echo " replaces $prevtag"
> fi
I just updated git on our repo server and did this exact change to our update
tag 15 minutes ago.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
prev parent reply other threads:[~2007-03-16 9:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-14 14:25 [PATCH] update-hook: fix incorrect use of git-describe and sed for finding previous tag Andy Parkins
2007-03-16 9:06 ` Andreas Ericsson [this message]
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=45FA5E20.2050905@op5.se \
--to=ae@op5.se \
--cc=andyparkins@gmail.com \
--cc=git@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).