{"thread":{"id":"52742","subject":"sending attachments via git send-email","startedAt":"2020-02-03T06:47:28Z","lastAt":"2020-02-03T08:12:06Z","messageCount":2,"participants":["Shourya Shukla","Pratyush Yadav"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"391024","messageId":"20200203064712.14621-1-shouryashukla.oo@gmail.com","threadId":"52742","inReplyTo":null,"subject":"sending attachments via git send-email","fromName":"Shourya Shukla","fromEmail":"shouryashukla.oo@gmail.com","sentAt":"2020-02-03T06:47:12Z","receivedAt":"2020-02-03T06:47:28Z","isPatch":false,"sender":{"key":"shouryashukla.oo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43680618?v=4"},"body":"Hello everyone,\n\nI was doing some tests on 'git send-email'[1] and noticed a couple of things:\n\n\t1. We are not able to send attachments via 'git send-email' unlike\n\t   various other mail clients such as GMail, Yahoo, etc. Is there\n\t   any particular reason for this (maybe performance issues or code\n\t   compatibility issues etc.)?\n\t\n\t2. Even so, I tried sending an image to myself and noticed that the\n\t   command basically does not check if we are sending a text file or\n\t   not(though I think it should unless there is any key reason behind it).\n\t   On executing the command(when trying to send an image), it asks for the\n\t   encoding (that was odd as it did not ask for any of emails I have sent\n           using the command). I entered the command:\n\t   'git send-email --to=shouryashukla.oo@gmail.com --subject=test_mail me.JPG'\n\t   which prompts:\n\t   'The following files are 8bit, but do not declare a Content-Transfer-Encoding.'\n    \t   'me.JPG'\n\t   'Which 8bit encoding should I declare [UTF-8]?'\n\t   So i enter the encoding as '8BIT', which at the end prompts:\n\t   'No subject line in me.JPG? at /usr/lib/git-core/git-send-email line 687.'\n\t   \n\t   Why is this happening even though I entered the subject in the command itself?\n\n\t3. I looked up at the script of the command and noticed that there are two files,\n\t   namely: 'git-send-email.perl' and 'git-send-email', both are identical except for\n\t   an extra 'use lib (split(/:/, $ENV{GITPERLLIB} || '/home/<<username>>/share/perl5'));'\n\t   on line 3 of 'git-send-email'(my inference is that we are trying to import the perl\n\t   library by splitting the addresses at '/' or something similar). What is the purpose\n\t   of the latter file?(I am new to Perl, if I am missing out on anything please forgive\n\t   my ignorance).\n\nOn an additional note, I noticed that there is a test file called 't9001-send-email.sh' which needs\nvarious style modernisations and maybe other changes too(I glanced at the file so I might have missed\nout on other improvements which could be made). ;-)\n\nI would love to hear from the community what exactly is going on and if any improvements are possible in the command. :-)\n\nRegards,\nShourya Shukla\n\n[1]: https://git-scm.com/docs/git-send-email\n"},{"id":"391025","messageId":"20200203081143.zv6f5tb3prp6kd4v@ti.com","threadId":"52742","inReplyTo":"20200203064712.14621-1-shouryashukla.oo@gmail.com","subject":"Re: sending attachments via git send-email","fromName":"Pratyush Yadav","fromEmail":"p.yadav@ti.com","sentAt":"2020-02-03T08:11:43Z","receivedAt":"2020-02-03T08:12:06Z","isPatch":false,"sender":{"key":"p.yadav@ti.com","avatar":null},"body":"Hi Shourya,\n\nMy $0.02:\n\nOn 03/02/20 12:17PM, Shourya Shukla wrote:\n> Hello everyone,\n> \n> I was doing some tests on 'git send-email'[1] and noticed a couple of things:\n> \n> \t1. We are not able to send attachments via 'git send-email' unlike\n> \t   various other mail clients such as GMail, Yahoo, etc. Is there\n> \t   any particular reason for this (maybe performance issues or code\n> \t   compatibility issues etc.)?\n\nIMO git-send-email shouldn't really be used for sending attachments. \nThat is the job of other mail clients that you mention. git-send-email's \npurpose is to make it easier to send commits/patches via mail in plain \ntext form. Its purpose is not to be a general mail client.\n\n> \t2. Even so, I tried sending an image to myself and noticed that the\n> \t   command basically does not check if we are sending a text file or\n> \t   not(though I think it should unless there is any key reason behind it).\n> \t   On executing the command(when trying to send an image), it asks for the\n> \t   encoding (that was odd as it did not ask for any of emails I have sent\n>            using the command). I entered the command:\n> \t   'git send-email --to=shouryashukla.oo@gmail.com --subject=test_mail me.JPG'\n> \t   which prompts:\n> \t   'The following files are 8bit, but do not declare a Content-Transfer-Encoding.'\n>     \t   'me.JPG'\n> \t   'Which 8bit encoding should I declare [UTF-8]?'\n> \t   So i enter the encoding as '8BIT', which at the end prompts:\n> \t   'No subject line in me.JPG? at /usr/lib/git-core/git-send-email line 687.'\n> \t   \n> \t   Why is this happening even though I entered the subject in the command itself?\n\nI don't know much about the internals of git-send-email (or the JPEG \nimage format), but my guess is git-send-email tries to decode the JPEG \nfile as a text file and then fails to detect encoding, and so asks the \nuser explicitly what the encoding is. I don't necessarily think that is \na bad thing. You shouldn't be sending images via git-send-email.\n\nThat said, maybe it would be a good idea to check the mime type of the \nfile and warn the user.\n \n> \t3. I looked up at the script of the command and noticed that there are two files,\n> \t   namely: 'git-send-email.perl' and 'git-send-email', both are identical except for\n> \t   an extra 'use lib (split(/:/, $ENV{GITPERLLIB} || '/home/<<username>>/share/perl5'));'\n> \t   on line 3 of 'git-send-email'(my inference is that we are trying to import the perl\n> \t   library by splitting the addresses at '/' or something similar). What is the purpose\n> \t   of the latter file?(I am new to Perl, if I am missing out on anything please forgive\n> \t   my ignorance).\n\nRunning 'git ls-files | grep git-send-email' gives me:\n\n  Documentation/git-send-email.txt\n  git-send-email.perl\n\nSo it means the file 'git-send-email' is not tracked and is an output \nfrom the build system. My guess is that the build system inserts this \nline when you run 'make'. Check the file \n'perl/header_templates/fixed_prefix.template.pl'.\n\n-- \nRegards,\nPratyush Yadav\n"}]}