From: Junio C Hamano <gitster@pobox.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/2] version-gen: cleanup
Date: Sun, 08 Sep 2013 23:03:45 -0700 [thread overview]
Message-ID: <7vppsiila6.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1378702889-21638-2-git-send-email-felipe.contreras@gmail.com> (Felipe Contreras's message of "Mon, 9 Sep 2013 00:01:28 -0500")
Felipe Contreras <felipe.contreras@gmail.com> writes:
> No functional changes.
>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> ---
> GIT-VERSION-GEN | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
> index 06026ea..b0db139 100755
> --- a/GIT-VERSION-GEN
> +++ b/GIT-VERSION-GEN
> @@ -7,21 +7,24 @@ LF='
> '
>
> # First see if there is a version file (included in release tarballs),
> -# then try git-describe, then default.
> +# then try 'git describe', then default.
> if test -f version
> then
> VN=$(cat version) || VN="$DEF_VER"
> elif test -d ${GIT_DIR:-.git} -o -f .git &&
> - VN=$(git describe --match "v[0-9]*" --abbrev=7 HEAD 2>/dev/null) &&
> + VN=$(git describe --match "v[0-9]*" --abbrev=7 HEAD 2>/dev/null)
> +then
> case "$VN" in
> - *$LF*) (exit 1) ;;
> + *$LF*)
> + exit 1
The funnily written "false" is misleading and a clean-up may be a
good idea to turn it to a straight "false".
I however think this actually changes the behaviour.
In any case, if you want to keep this step a "no functional change"
rewrite, this section has to be part of the condition of this "elif"
(because it logically is). If describe couldn't describe HEAD, or
even if it could, if its output was multi-line for any reason, we
wanted to punt and let the DEF_VER in the last "else" clause kick
in.
After the update, describe output that is not a single-liner will
fail the entire script, instead of falling back to DEF_VER. I
actually think it is a good change to fail it (even though it is
unlikely that the "describe" command give above would give more than
one line).
> + ;;
> v[0-9]*)
> git update-index -q --refresh
> test -z "$(git diff-index --name-only HEAD --)" ||
> - VN="$VN-dirty" ;;
> + VN="$VN-dirty"
> + ;;
> esac
> -then
> - VN=$(echo "$VN" | sed -e 's/-/./g');
> + VN=$(echo "$VN" | sed -e 's/-/./g')
> else
> VN="$DEF_VER"
> fi
next prev parent reply other threads:[~2013-09-09 6:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-09 5:01 [PATCH 0/2] version-gen: fixes and cleanups Felipe Contreras
2013-09-09 5:01 ` [PATCH 1/2] version-gen: cleanup Felipe Contreras
2013-09-09 6:03 ` Junio C Hamano [this message]
2013-09-09 5:01 ` [PATCH 2/2] version-gen: avoid messing the version Felipe Contreras
2013-09-09 5:51 ` Junio C Hamano
2013-09-09 7:00 ` Felipe Contreras
2013-09-09 23:30 ` brian m. carlson
2013-09-10 1:13 ` Felipe Contreras
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=7vppsiila6.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=felipe.contreras@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).