git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Git internal command line parser
@ 2021-12-24 14:38 Lemuria
  2021-12-24 18:13 ` Philip Oakley
  0 siblings, 1 reply; 11+ messages in thread
From: Lemuria @ 2021-12-24 14:38 UTC (permalink / raw)
  To: git

#=< TLDR: Where's the code for git's internal command line parser? >===#

I'm interested in the internals of git, more specifically it's command
line parser.

Does Git use a library like getopt for it's command line handling, or 
does it use a custom parser?

If possible, I would appreciate being redirected to the source code 
files that handle this.

Sincerely,
Lemuria

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

* Re: Git internal command line parser
  2021-12-24 14:38 Git internal command line parser Lemuria
@ 2021-12-24 18:13 ` Philip Oakley
  2021-12-24 18:30   ` Lemuria
  0 siblings, 1 reply; 11+ messages in thread
From: Philip Oakley @ 2021-12-24 18:13 UTC (permalink / raw)
  To: Lemuria, git

On 24/12/2021 14:38, Lemuria wrote:
> #=< TLDR: Where's the code for git's internal command line parser? >===#
>
> I'm interested in the internals of git, more specifically it's command
> line parser.

One place to start is https://github.com/git/git/blob/master/git.c

>
> Does Git use a library like getopt for it's command line handling, or
> does it use a custom parser?
>
> If possible, I would appreciate being redirected to the source code
> files that handle this.
>
> Sincerely,
> Lemuria

Philip

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

* Re: Git internal command line parser
  2021-12-24 18:13 ` Philip Oakley
@ 2021-12-24 18:30   ` Lemuria
  2021-12-24 18:36     ` Philip Oakley
  0 siblings, 1 reply; 11+ messages in thread
From: Lemuria @ 2021-12-24 18:30 UTC (permalink / raw)
  To: Philip Oakley, git



On 25/12/2021 2:13 am, Philip Oakley wrote:
> On 24/12/2021 14:38, Lemuria wrote:
>> #=< TLDR: Where's the code for git's internal command line parser? >===#
>>
>> I'm interested in the internals of git, more specifically it's command
>> line parser.
> 
> One place to start is https://github.com/git/git/blob/master/git.c
>

Wait, is all of Git just one big executable or are there many 
executables and `git` is just the front-end for accessing the
separate git executables, such as say, the one for processing
commits?

>>
>> Does Git use a library like getopt for it's command line handling, or
>> does it use a custom parser?
>>
>> If possible, I would appreciate being redirected to the source code
>> files that handle this.
>>
>> Sincerely,
>> Lemuria
> 
> Philip
> 

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

* Re: Git internal command line parser
  2021-12-24 18:30   ` Lemuria
@ 2021-12-24 18:36     ` Philip Oakley
  2021-12-24 19:05       ` Lemuria
  2021-12-25  2:55       ` João Victor Bonfim
  0 siblings, 2 replies; 11+ messages in thread
From: Philip Oakley @ 2021-12-24 18:36 UTC (permalink / raw)
  To: Lemuria, git

On 24/12/2021 18:30, Lemuria wrote:
>
>
> On 25/12/2021 2:13 am, Philip Oakley wrote:
>> On 24/12/2021 14:38, Lemuria wrote:
>>> #=< TLDR: Where's the code for git's internal command line parser?
>>> >===#
>>>
>>> I'm interested in the internals of git, more specifically it's command
>>> line parser.
>>
>> One place to start is https://github.com/git/git/blob/master/git.c
>>
>
> Wait, is all of Git just one big executable or are there many
> executables and `git` is just the front-end for accessing the
> separate git executables, such as say, the one for processing
> commits?
>

Yes, `git` is a front end.

If you are on Windows, it gets even more interesting because all the
individual sub-commands are just hard links back to the single git.exe
that then links to those sub-command's code.

>>>
>>> Does Git use a library like getopt for it's command line handling, or
>>> does it use a custom parser?
>>>
>>> If possible, I would appreciate being redirected to the source code
>>> files that handle this.
>>>
>>> Sincerely,
>>> Lemuria
>>
>> Philip
>>


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

* Re: Git internal command line parser
  2021-12-24 18:36     ` Philip Oakley
@ 2021-12-24 19:05       ` Lemuria
  2021-12-25  2:55       ` João Victor Bonfim
  1 sibling, 0 replies; 11+ messages in thread
From: Lemuria @ 2021-12-24 19:05 UTC (permalink / raw)
  To: Philip Oakley, git



On 25/12/2021 2:36 am, Philip Oakley wrote:
> On 24/12/2021 18:30, Lemuria wrote:
>>
>>
>> On 25/12/2021 2:13 am, Philip Oakley wrote:
>>> On 24/12/2021 14:38, Lemuria wrote:
>>>> #=< TLDR: Where's the code for git's internal command line parser?
>>>>> ===#
>>>>
>>>> I'm interested in the internals of git, more specifically it's command
>>>> line parser.
>>>
>>> One place to start is https://github.com/git/git/blob/master/git.c
>>>
>>
>> Wait, is all of Git just one big executable or are there many
>> executables and `git` is just the front-end for accessing the
>> separate git executables, such as say, the one for processing
>> commits?
>>
> 
> Yes, `git` is a front end.
> 
> If you are on Windows, it gets even more interesting because all the
> individual sub-commands are just hard links back to the single git.exe
> that then links to those sub-command's code.
>

I'm on Ubuntu 20.04, just in case you ever want to know.

And I likely will consider this "front-end to many separate
executable apps" approach for my future large projects.

Thanks for your help! I've also cloned the git repository of
git, and I'll take a look through the source code.

I'm also a beginner to C, not quite an expert at it.

>>>>
>>>> Does Git use a library like getopt for it's command line handling, or
>>>> does it use a custom parser?
>>>>
>>>> If possible, I would appreciate being redirected to the source code
>>>> files that handle this.
>>>>
>>>> Sincerely,
>>>> Lemuria
>>>
>>> Philip
>>>
> 

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

* Re: Git internal command line parser
  2021-12-24 18:36     ` Philip Oakley
  2021-12-24 19:05       ` Lemuria
@ 2021-12-25  2:55       ` João Victor Bonfim
  2021-12-25  8:32         ` Lemuria
  2021-12-27 16:43         ` Philip Oakley
  1 sibling, 2 replies; 11+ messages in thread
From: João Victor Bonfim @ 2021-12-25  2:55 UTC (permalink / raw)
  To: Philip Oakley; +Cc: Lemuria, git

> If you are on Windows, it gets even more interesting because all the
> individual sub-commands are just hard links back to the single git.exe
> that then links to those sub-command's code.

That seems undesirable...
I know operating otherwise would be even more complicated and might create undue complexity or diminish performance, but I guess that, if it works, don't mess with it.

> And I likely will consider this "front-end to many separate
executable apps" approach for my future large projects.

Lemuria, please consider those points as, sometimes, what is great at performance might not help with scalability and other matters, therefore, as the designer/engineer of a software system, a choice must be made and an evaluation of the properties of each possibility is a necessity.

Do with that what you will.

> I'm also a beginner to C, not quite an expert at it.

Practice programming a lot and never forget two things: [1] you are working with a man made machine, therefore its limitations and capabilities are by design, so you must consider them every step of the way when developing (like how computers send information, how computers process informations, how machine behaviour can be altered, abused or exploited through alteration of the environment or mechanism and through the use of sleight of hand). [2] Your code always has real life consequences and it is your moral responsibility to consider them and make sure that prejudice isn't codified into them.

Those are my two tid bits about being a responsible and effective programmer.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

Em sexta-feira, 24 de dezembro de 2021 às 15:36, Philip Oakley <philipoakley@iee.email> escreveu:

> On 24/12/2021 18:30, Lemuria wrote:
>
> > On 25/12/2021 2:13 am, Philip Oakley wrote:
> >
> > > On 24/12/2021 14:38, Lemuria wrote:
> > >
> > > > #=< TLDR: Where's the code for git's internal command line parser?
> > > >
> > > > > ===#
> > > >
> > > > I'm interested in the internals of git, more specifically it's command
> > > >
> > > > line parser.
> > >
> > > One place to start is https://github.com/git/git/blob/master/git.c
> >
> > Wait, is all of Git just one big executable or are there many
> >
> > executables and `git` is just the front-end for accessing the
> >
> > separate git executables, such as say, the one for processing
> >
> > commits?
>
> Yes, `git` is a front end.
>
> If you are on Windows, it gets even more interesting because all the
>
> individual sub-commands are just hard links back to the single git.exe
>
> that then links to those sub-command's code.
>
> > > > Does Git use a library like getopt for it's command line handling, or
> > > >
> > > > does it use a custom parser?
> > > >
> > > > If possible, I would appreciate being redirected to the source code
> > > >
> > > > files that handle this.
> > > >
> > > > Sincerely,
> > > >
> > > > Lemuria
> > >
> > > Philip

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

* Re: Git internal command line parser
  2021-12-25  2:55       ` João Victor Bonfim
@ 2021-12-25  8:32         ` Lemuria
  2021-12-26  2:38           ` João Victor Bonfim
  2021-12-27 16:43         ` Philip Oakley
  1 sibling, 1 reply; 11+ messages in thread
From: Lemuria @ 2021-12-25  8:32 UTC (permalink / raw)
  To: João Victor Bonfim, Philip Oakley; +Cc: git



On 25/12/2021 10:55 am, João Victor Bonfim wrote:
>> If you are on Windows, it gets even more interesting because all the
>> individual sub-commands are just hard links back to the single git.exe
>> that then links to those sub-command's code.
> 
> That seems undesirable...
> I know operating otherwise would be even more complicated and might create undue complexity or diminish performance, but I guess that, if it works, don't mess with it.
> 

Was this directed towards Lemuria (me)?

>> And I likely will consider this "front-end to many separate
> executable apps" approach for my future large projects.
> 
> Lemuria, please consider those points as, sometimes, what is great at performance might not help with scalability and other matters, therefore, as the designer/engineer of a software system, a choice must be made and an evaluation of the properties of each possibility is a necessity.
> 
> Do with that what you will.
> 
>> I'm also a beginner to C, not quite an expert at it.
> 
> Practice programming a lot and never forget two things: [1] you are working with a man made machine, therefore its limitations and capabilities are by design, so you must consider them every step of the way when developing (like how computers send information, how computers process informations, how machine behaviour can be altered, abused or exploited through alteration of the environment or mechanism and through the use of sleight of hand). [2] Your code always has real life consequences and it is your moral responsibility to consider them and make sure that prejudice isn't codified into them.

Okay, I understand. I'll do everything to keep my code bias-free.
I'm working on a project in C and if it's okay, I'll link you to
the GitHub repository.

I'm sure the git mailing list isn't the right place for me to get
criticism on that project however.

> Those are my two tid bits about being a responsible and effective programmer.
> 
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
> 
> Em sexta-feira, 24 de dezembro de 2021 às 15:36, Philip Oakley <philipoakley@iee.email> escreveu:
> 
>> On 24/12/2021 18:30, Lemuria wrote:
>>
>>> On 25/12/2021 2:13 am, Philip Oakley wrote:
>>>
>>>> On 24/12/2021 14:38, Lemuria wrote:
>>>>
>>>>> #=< TLDR: Where's the code for git's internal command line parser?
>>>>>
>>>>>> ===#
>>>>>
>>>>> I'm interested in the internals of git, more specifically it's command
>>>>>
>>>>> line parser.
>>>>
>>>> One place to start is https://github.com/git/git/blob/master/git.c
>>>
>>> Wait, is all of Git just one big executable or are there many
>>>
>>> executables and `git` is just the front-end for accessing the
>>>
>>> separate git executables, such as say, the one for processing
>>>
>>> commits?
>>
>> Yes, `git` is a front end.
>>
>> If you are on Windows, it gets even more interesting because all the
>>
>> individual sub-commands are just hard links back to the single git.exe
>>
>> that then links to those sub-command's code.
>>
>>>>> Does Git use a library like getopt for it's command line handling, or
>>>>>
>>>>> does it use a custom parser?
>>>>>
>>>>> If possible, I would appreciate being redirected to the source code
>>>>>
>>>>> files that handle this.
>>>>>
>>>>> Sincerely,
>>>>>
>>>>> Lemuria
>>>>
>>>> Philip

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

* Re: Git internal command line parser
  2021-12-25  8:32         ` Lemuria
@ 2021-12-26  2:38           ` João Victor Bonfim
  2021-12-26  3:40             ` Lemuria
  0 siblings, 1 reply; 11+ messages in thread
From: João Victor Bonfim @ 2021-12-26  2:38 UTC (permalink / raw)
  To: Lemuria; +Cc: git

Saturday, 25, December, 2021, at 05:32, Lemuria <nekadek457@gmail.com> wrote:
> Was this directed towards Lemuria (me)?

 Oh god no, those were more general comments about the way things are done on Git, rather than directed towards you. See it as me reacting to the information received and trying to pull a conversation about it with Philip.

> Okay, I understand. I'll do everything to keep my code bias-free.
> I'm working on a project in C and if it's okay, I'll link you to
> the GitHub repository.
>
> I'm sure the git mailing list isn't the right place for me to get
> criticism on that project however.

 I will do my best to help you out. If you want to contact me, send an e-mail to my address (JoaoVictorBonfim@protonmail.com) and we can talk it out. From experience I learned that, when talking about prejudice, it is better to shut up, pay attention to the conversations in the room and see who is being denied their humanity, who has the power in the situation and who is trying to prop up an emotional response from others. Most of the time, those who are being denied their humanity, those who are restrained in their response, those who have no power or say in the conversation and those who are more emotional than trying to prop emotions are the marginalized in the conversation.

Now, out of curiosity, are you named Lemuria because of Lemurs? You know, the little primates from the Madagascar island?

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

* Re: Git internal command line parser
  2021-12-26  2:38           ` João Victor Bonfim
@ 2021-12-26  3:40             ` Lemuria
  0 siblings, 0 replies; 11+ messages in thread
From: Lemuria @ 2021-12-26  3:40 UTC (permalink / raw)
  To: João Victor Bonfim; +Cc: git



On 26/12/2021 10:38 am, João Victor Bonfim wrote:
> Saturday, 25, December, 2021, at 05:32, Lemuria <nekadek457@gmail.com> wrote:
>> Was this directed towards Lemuria (me)?
> 
>   Oh god no, those were more general comments about the way things are done on Git, rather than directed towards you. See it as me reacting to the information received and trying to pull a conversation about it with Philip.

Alrighty then.

> 
>> Okay, I understand. I'll do everything to keep my code bias-free.
>> I'm working on a project in C and if it's okay, I'll link you to
>> the GitHub repository.
>>
>> I'm sure the git mailing list isn't the right place for me to get
>> criticism on that project however.
> 
>   I will do my best to help you out. If you want to contact me, send an e-mail to my address (JoaoVictorBonfim@protonmail.com) and we can talk it out.
I think I can deal with it on my own. But if you're
curious, it's right here:

https://github.com/a-random-lemurian/randstuff

Mostly random generators, like random ascii and hex.

> From experience I learned that, when talking about prejudice, it is better to shut up, pay attention to the conversations in the room and see who is being denied their humanity, who has the power in the situation and who is trying to prop up an emotional response from others. Most of the time, those who are being denied their humanity, those who are restrained in their response, those who have no power or say in the conversation and those who are more emotional than trying to prop emotions are the marginalized in the conversation.

Alrighty then. I'm also worried about prejudice in say,
machine learning. We humans are biased, so who's to say
the AI training data isn't biased?

In fact, I might be biased right now and I probably
would not realized it.


> Now, out of curiosity, are you named Lemuria because of Lemurs? You know, the little primates from the Madagascar island?

Indirectly. I named myself after the lost continent. It was a
decent name, which is why I use it as my psuedonym on most of
the internet.

And the lost continent in turn was named after... lemurs.


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

* Re: Git internal command line parser
  2021-12-25  2:55       ` João Victor Bonfim
  2021-12-25  8:32         ` Lemuria
@ 2021-12-27 16:43         ` Philip Oakley
  2021-12-29 23:16           ` João Victor Bonfim
  1 sibling, 1 reply; 11+ messages in thread
From: Philip Oakley @ 2021-12-27 16:43 UTC (permalink / raw)
  To: João Victor Bonfim; +Cc: Lemuria, git

Hi João  & Lemuria,

On 25/12/2021 02:55, João Victor Bonfim wrote:
>> If you are on Windows, it gets even more interesting because all the
>> individual sub-commands are just hard links back to the single git.exe
>> that then links to those sub-command's code.
> That seems undesirable...
> I know operating otherwise would be even more complicated and might create undue complexity or diminish performance, but I guess that, if it works, don't mess with it.

The original question didn't say which OS was in use, and had hints that
roughly matched a common Windows user misunderstanding about how the Git
executables coped with the change of OS [1].

My description was a hint, rather than a detailed exposition about what
was happening there. As you note, performance is important.

>> And I likely will consider this "front-end to many separate
> executable apps" approach for my future large projects.
>
> Lemuria, please consider those points as, sometimes, what is great at performance might not help with scalability and other matters, therefore, as the designer/engineer of a software system, a choice must be made and an evaluation of the properties of each possibility is a necessity.
>
> Do with that what you will.
>
>> I'm also a beginner to C, not quite an expert at it.
> Practice programming a lot and never forget two things: [1] you are working with a man made machine, therefore its limitations and capabilities are by design, so you must consider them every step of the way when developing (like how computers send information, how computers process informations, how machine behaviour can be altered, abused or exploited through alteration of the environment or mechanism and through the use of sleight of hand). [2] Your code always has real life consequences and it is your moral responsibility to consider them and make sure that prejudice isn't codified into them.
>
> Those are my two tid bits about being a responsible and effective programmer.
>
> ‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
>
> Em sexta-feira, 24 de dezembro de 2021 às 15:36, Philip Oakley <philipoakley@iee.email> escreveu:
>
>> On 24/12/2021 18:30, Lemuria wrote:
>>
>>> On 25/12/2021 2:13 am, Philip Oakley wrote:
>>>
>>>> On 24/12/2021 14:38, Lemuria wrote:
>>>>
>>>>> #=< TLDR: Where's the code for git's internal command line parser?
>>>>>
>>>>>> ===#
>>>>> I'm interested in the internals of git, more specifically it's command
>>>>>
>>>>> line parser.
>>>> One place to start is https://github.com/git/git/blob/master/git.c
>>> Wait, is all of Git just one big executable or are there many
>>>
>>> executables and `git` is just the front-end for accessing the
>>>
>>> separate git executables, such as say, the one for processing
>>>
>>> commits?
>> Yes, `git` is a front end.
>>
>> If you are on Windows, it gets even more interesting because all the
>>
>> individual sub-commands are just hard links back to the single git.exe
>>
>> that then links to those sub-command's code.

This (over simplified) explanation relates to the differences between
the OS approaches to the performance issues when creating new processes
and the like on Windows. Each OS has strengths and weaknesses.

>>
>>>>> Does Git use a library like getopt for it's command line handling, or
>>>>>
>>>>> does it use a custom parser?
>>>>>
>>>>> If possible, I would appreciate being redirected to the source code
>>>>>
>>>>> files that handle this.
>>>>>
>>>>> Sincerely,
>>>>>
>>>>> Lemuria
>>>> Philip
[1]
https://github.com/git-for-windows/build-extra/blob/main/ReleaseNotes.md?plain=1#L25


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

* Re: Git internal command line parser
  2021-12-27 16:43         ` Philip Oakley
@ 2021-12-29 23:16           ` João Victor Bonfim
  0 siblings, 0 replies; 11+ messages in thread
From: João Victor Bonfim @ 2021-12-29 23:16 UTC (permalink / raw)
  To: Philip Oakley; +Cc: Lemuria, git

> This (over simplified) explanation relates to the differences between
> the OS approaches to the performance issues when creating new processes
> and the like on Windows. Each OS has strengths and weaknesses.

Oakley, to whom did you want to address this and what did you want to say?
I don't get what you meant.

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

end of thread, other threads:[~2021-12-29 23:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-24 14:38 Git internal command line parser Lemuria
2021-12-24 18:13 ` Philip Oakley
2021-12-24 18:30   ` Lemuria
2021-12-24 18:36     ` Philip Oakley
2021-12-24 19:05       ` Lemuria
2021-12-25  2:55       ` João Victor Bonfim
2021-12-25  8:32         ` Lemuria
2021-12-26  2:38           ` João Victor Bonfim
2021-12-26  3:40             ` Lemuria
2021-12-27 16:43         ` Philip Oakley
2021-12-29 23:16           ` João Victor Bonfim

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).