git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gaurav Chhabra <varuag.chhabra@gmail.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Error pushing new branch: value too great for base (error token is...
Date: Tue, 11 Aug 2015 12:00:23 +0530	[thread overview]
Message-ID: <CAGDgvc3kA4oC=gp7XoPZJNrQ=p6HoUiXgcECG_xdRR=uJ03+aQ@mail.gmail.com> (raw)
In-Reply-To: <CAPig+cTB0VU6rmLT1H7sPMNBPE0zKvWmMp_obS5VpZBAi2nYLA@mail.gmail.com>

Thanks for the detailed explanation Eric! That really helped clear my
doubts. Also tried with "0x" and it's working fine however, as
suggested by you, i will use '='

Thanks again! :)

On Tue, Aug 11, 2015 at 4:17 AM, Eric Sunshine <sunshine@sunshineco.com> wrote:
> On Mon, Aug 10, 2015 at 6:29 PM, Jacob Keller <jacob.keller@gmail.com> wrote:
>> On Mon, Aug 10, 2015 at 2:54 AM, Gaurav Chhabra
>> <varuag.chhabra@gmail.com> wrote:
>>> Apologies for the delay in reply! I tried your suggestion and it
>>> works. Thanks! :)
>>>
>>> I'm curious why integer comparison is throwing error. Shouldn't i be
>>> comparing numbers with numeric operator?
>>
>> Yes, but shell doesn't treat hex numbers as numbers. So it will work
>> only if the string is a decimal number.
>
> This particular case deserves a bit more explanation. The expression
> in question was this:
>
>     if [[ "$new_sha" -eq "$NULL" ]]; then
>
> where 'new_sha' was 9226289d2416af4cb7365d7aaa5e382bdb3d9a89.
>
> In Bash, inside the [[ .. ]], it did attempt evaluating the SHA1 as a
> *decimal* number, however, when it encountered the "d", it complained
> that it was outside the allowed range of decimal digits ("0"..."9").
> Had the SHA1 been prefixed by a "0x", the [[...]] context would have
> dealt with it just fine.
>
> Outside the [[...]] context, arguments to -eq do need to be base-10 integers.
>
> Nevertheless, a SHA1 is effective an opaque value. There's little, if
> anything, to be gained by treating it as a numeric quantity, hence
> string '=' makes more sense than numeric '-eq'.

      reply	other threads:[~2015-08-11  6:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05 17:32 Error pushing new branch: value too great for base (error token is Gaurav Chhabra
2015-08-05 17:53 ` Eric Sunshine
     [not found]   ` <CAGDgvc2hc+f5CuPXc2pr5uYd9kniVpuffrb6z416CicxBgVxJQ@mail.gmail.com>
2015-08-10  9:54     ` Gaurav Chhabra
2015-08-10 22:29       ` Jacob Keller
2015-08-10 22:47         ` Eric Sunshine
2015-08-11  6:30           ` Gaurav Chhabra [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='CAGDgvc3kA4oC=gp7XoPZJNrQ=p6HoUiXgcECG_xdRR=uJ03+aQ@mail.gmail.com' \
    --to=varuag.chhabra@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).