From: Junio C Hamano <gitster@pobox.com>
To: Yauheni Zablotski <e.zablotski@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: bug "$message" literal in commit message
Date: Wed, 03 Jun 2015 11:16:40 -0700 [thread overview]
Message-ID: <xmqqzj4gwtbr.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAF-5DQ+WGhHq0OZZh+90iuD1qrffcYyuprzW9m7XC6NGXPZzSQ@mail.gmail.com> (Yauheni Zablotski's message of "Wed, 3 Jun 2015 18:51:10 +0200")
Yauheni Zablotski <e.zablotski@gmail.com> writes:
> Hello,
>
> I think I found a bug(or strange behavior) in the git.
> If commit message contains literal "$message" than that literal
> disappears from commit message.
>
> For example:
> -------------
> user@comp ~/cc $ git commit -am "1$message1"
> [master (root-commit) d36a841] 1
> 1 file changed, 0 insertions(+), 0 deletions(-)
> create mode 100644 1
>
> user@comp ~/cc $ git log
> commit d36a841ae25510ada80246a78225446083fcb3e1
> Author: user <e.zablotski@gmail.com>
> Date: Wed Jun 3 18:21:45 2015 +0200
>
> file
> ----------------
>
> Sorry for having disturbed you
Learn shell ;-)
Instead of "git commit -am", try "echo" and repeat your exercise,
and you would see:
$ echo "1$message1"
1
If you prepare a shell variable message1 beforehand, e.g.
$ message1='This is the contents of message1 variable'
$ echo "1$message1"
1This is the contents of message1 variable
Your shell interpolates the value of message1 variable if you write
"$message1" on your command line, way before individual commands
(e.g. echo and git above) that receive the string as its parameter
sees them.
Contrast the above with this invocation after understanding the
above.
$ git commit -a -m '1$message1'
$ git log
next prev parent reply other threads:[~2015-06-03 18:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-03 16:51 bug "$message" literal in commit message Yauheni Zablotski
2015-06-03 18:16 ` Junio C Hamano [this message]
2015-06-03 18:19 ` Matthieu Moy
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=xmqqzj4gwtbr.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=e.zablotski@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