{"thread":{"id":"39517","subject":"bug \"$message\" literal in commit message","startedAt":"2015-06-03T16:51:10Z","lastAt":"2015-06-03T18:19:13Z","messageCount":3,"participants":["Yauheni Zablotski","Junio C Hamano","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"262879","messageId":"CAF-5DQ+WGhHq0OZZh+90iuD1qrffcYyuprzW9m7XC6NGXPZzSQ@mail.gmail.com","threadId":"39517","inReplyTo":null,"subject":"bug \"$message\" literal in commit message","fromName":"Yauheni Zablotski","fromEmail":"e.zablotski@gmail.com","sentAt":"2015-06-03T16:51:10Z","receivedAt":"2015-06-03T16:51:10Z","isPatch":false,"sender":{"key":"e.zablotski@gmail.com","avatar":null},"body":"Hello,\n\nI think I found a bug(or strange behavior) in the git.\nIf commit message contains literal \"$message\" than that literal\ndisappears from commit message.\n\nFor example:\n-------------\nuser@comp ~/cc $ git commit -am \"1$message1\"\n[master (root-commit) d36a841] 1\n 1 file changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 1\n\nuser@comp ~/cc $ git log\ncommit d36a841ae25510ada80246a78225446083fcb3e1\nAuthor: user <e.zablotski@gmail.com>\nDate:   Wed Jun 3 18:21:45 2015 +0200\n\n    file\n----------------\n\nSorry for having disturbed you\n"},{"id":"262899","messageId":"xmqqzj4gwtbr.fsf@gitster.dls.corp.google.com","threadId":"39517","inReplyTo":"CAF-5DQ+WGhHq0OZZh+90iuD1qrffcYyuprzW9m7XC6NGXPZzSQ@mail.gmail.com","subject":"Re: bug \"$message\" literal in commit message","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-06-03T18:16:40Z","receivedAt":"2015-06-03T18:16:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Yauheni Zablotski <e.zablotski@gmail.com> writes:\n\n> Hello,\n>\n> I think I found a bug(or strange behavior) in the git.\n> If commit message contains literal \"$message\" than that literal\n> disappears from commit message.\n>\n> For example:\n> -------------\n> user@comp ~/cc $ git commit -am \"1$message1\"\n> [master (root-commit) d36a841] 1\n>  1 file changed, 0 insertions(+), 0 deletions(-)\n>  create mode 100644 1\n>\n> user@comp ~/cc $ git log\n> commit d36a841ae25510ada80246a78225446083fcb3e1\n> Author: user <e.zablotski@gmail.com>\n> Date:   Wed Jun 3 18:21:45 2015 +0200\n>\n>     file\n> ----------------\n>\n> Sorry for having disturbed you\n\nLearn shell ;-)\n\nInstead of \"git commit -am\", try \"echo\" and repeat your exercise,\nand you would see:\n\n\t$ echo \"1$message1\"\n        1\n\nIf you prepare a shell variable message1 beforehand, e.g.\n\n\t$ message1='This is the contents of message1 variable'\n        $ echo \"1$message1\"\n        1This is the contents of message1 variable\n\nYour shell interpolates the value of message1 variable if you write\n\"$message1\" on your command line, way before individual commands\n(e.g. echo and git above) that receive the string as its parameter\nsees them.\n\nContrast the above with this invocation after understanding the\nabove.\n\n\t$ git commit -a -m '1$message1'\n\t$ git log\n"},{"id":"262901","messageId":"vpqiob47izi.fsf@anie.imag.fr","threadId":"39517","inReplyTo":"CAF-5DQ+WGhHq0OZZh+90iuD1qrffcYyuprzW9m7XC6NGXPZzSQ@mail.gmail.com","subject":"Re: bug \"$message\" literal in commit message","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-06-03T18:19:13Z","receivedAt":"2015-06-03T18:19:13Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Yauheni Zablotski <e.zablotski@gmail.com> writes:\n\n> Hello,\n>\n> I think I found a bug(or strange behavior) in the git.\n> If commit message contains literal \"$message\" than that literal\n> disappears from commit message.\n>\n> For example:\n> -------------\n> user@comp ~/cc $ git commit -am \"1$message1\"\n\nNot a Git issue, but a user-error that Git cannot recover.\n\nYour shell is doing the variable expansion before calling git, and\n$message1 is considered as a shell variable here. Git does not know that\nyou used $message1.\n\nSolution:\n\ngit commit -am '1$message1'\n\nor\n\ngit commit -am \"1\\$message1\"\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}