git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* sending attachments via git send-email
@ 2020-02-03  6:47 Shourya Shukla
  2020-02-03  8:11 ` Pratyush Yadav
  0 siblings, 1 reply; 2+ messages in thread
From: Shourya Shukla @ 2020-02-03  6:47 UTC (permalink / raw)
  To: git, gitster, johannes.schindelin, christian.couder, peff
  Cc: newren, Shourya Shukla

Hello everyone,

I was doing some tests on 'git send-email'[1] and noticed a couple of things:

	1. We are not able to send attachments via 'git send-email' unlike
	   various other mail clients such as GMail, Yahoo, etc. Is there
	   any particular reason for this (maybe performance issues or code
	   compatibility issues etc.)?
	
	2. Even so, I tried sending an image to myself and noticed that the
	   command basically does not check if we are sending a text file or
	   not(though I think it should unless there is any key reason behind it).
	   On executing the command(when trying to send an image), it asks for the
	   encoding (that was odd as it did not ask for any of emails I have sent
           using the command). I entered the command:
	   'git send-email --to=shouryashukla.oo@gmail.com --subject=test_mail me.JPG'
	   which prompts:
	   'The following files are 8bit, but do not declare a Content-Transfer-Encoding.'
    	   'me.JPG'
	   'Which 8bit encoding should I declare [UTF-8]?'
	   So i enter the encoding as '8BIT', which at the end prompts:
	   'No subject line in me.JPG? at /usr/lib/git-core/git-send-email line 687.'
	   
	   Why is this happening even though I entered the subject in the command itself?

	3. I looked up at the script of the command and noticed that there are two files,
	   namely: 'git-send-email.perl' and 'git-send-email', both are identical except for
	   an extra 'use lib (split(/:/, $ENV{GITPERLLIB} || '/home/<<username>>/share/perl5'));'
	   on line 3 of 'git-send-email'(my inference is that we are trying to import the perl
	   library by splitting the addresses at '/' or something similar). What is the purpose
	   of the latter file?(I am new to Perl, if I am missing out on anything please forgive
	   my ignorance).

On an additional note, I noticed that there is a test file called 't9001-send-email.sh' which needs
various style modernisations and maybe other changes too(I glanced at the file so I might have missed
out on other improvements which could be made). ;-)

I would love to hear from the community what exactly is going on and if any improvements are possible in the command. :-)

Regards,
Shourya Shukla

[1]: https://git-scm.com/docs/git-send-email

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: sending attachments via git send-email
  2020-02-03  6:47 sending attachments via git send-email Shourya Shukla
@ 2020-02-03  8:11 ` Pratyush Yadav
  0 siblings, 0 replies; 2+ messages in thread
From: Pratyush Yadav @ 2020-02-03  8:11 UTC (permalink / raw)
  To: Shourya Shukla
  Cc: git, gitster, johannes.schindelin, christian.couder, peff, newren

Hi Shourya,

My $0.02:

On 03/02/20 12:17PM, Shourya Shukla wrote:
> Hello everyone,
> 
> I was doing some tests on 'git send-email'[1] and noticed a couple of things:
> 
> 	1. We are not able to send attachments via 'git send-email' unlike
> 	   various other mail clients such as GMail, Yahoo, etc. Is there
> 	   any particular reason for this (maybe performance issues or code
> 	   compatibility issues etc.)?

IMO git-send-email shouldn't really be used for sending attachments. 
That is the job of other mail clients that you mention. git-send-email's 
purpose is to make it easier to send commits/patches via mail in plain 
text form. Its purpose is not to be a general mail client.

> 	2. Even so, I tried sending an image to myself and noticed that the
> 	   command basically does not check if we are sending a text file or
> 	   not(though I think it should unless there is any key reason behind it).
> 	   On executing the command(when trying to send an image), it asks for the
> 	   encoding (that was odd as it did not ask for any of emails I have sent
>            using the command). I entered the command:
> 	   'git send-email --to=shouryashukla.oo@gmail.com --subject=test_mail me.JPG'
> 	   which prompts:
> 	   'The following files are 8bit, but do not declare a Content-Transfer-Encoding.'
>     	   'me.JPG'
> 	   'Which 8bit encoding should I declare [UTF-8]?'
> 	   So i enter the encoding as '8BIT', which at the end prompts:
> 	   'No subject line in me.JPG? at /usr/lib/git-core/git-send-email line 687.'
> 	   
> 	   Why is this happening even though I entered the subject in the command itself?

I don't know much about the internals of git-send-email (or the JPEG 
image format), but my guess is git-send-email tries to decode the JPEG 
file as a text file and then fails to detect encoding, and so asks the 
user explicitly what the encoding is. I don't necessarily think that is 
a bad thing. You shouldn't be sending images via git-send-email.

That said, maybe it would be a good idea to check the mime type of the 
file and warn the user.
 
> 	3. I looked up at the script of the command and noticed that there are two files,
> 	   namely: 'git-send-email.perl' and 'git-send-email', both are identical except for
> 	   an extra 'use lib (split(/:/, $ENV{GITPERLLIB} || '/home/<<username>>/share/perl5'));'
> 	   on line 3 of 'git-send-email'(my inference is that we are trying to import the perl
> 	   library by splitting the addresses at '/' or something similar). What is the purpose
> 	   of the latter file?(I am new to Perl, if I am missing out on anything please forgive
> 	   my ignorance).

Running 'git ls-files | grep git-send-email' gives me:

  Documentation/git-send-email.txt
  git-send-email.perl

So it means the file 'git-send-email' is not tracked and is an output 
from the build system. My guess is that the build system inserts this 
line when you run 'make'. Check the file 
'perl/header_templates/fixed_prefix.template.pl'.

-- 
Regards,
Pratyush Yadav

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-03  8:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-03  6:47 sending attachments via git send-email Shourya Shukla
2020-02-03  8:11 ` Pratyush Yadav

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).