Thread (11 messages) flat view 11 messages, 3 authors, 2021-12-29

Re: Git internal command line parser

From: Lemuria <hidden>
Date: 2021-12-24 19:05:47


On 25/12/2021 2:36 am, Philip Oakley wrote:
On 24/12/2021 18:30, Lemuria wrote:
quoted

On 25/12/2021 2:13 am, Philip Oakley wrote:
quoted
On 24/12/2021 14:38, Lemuria wrote:
quoted
#=< TLDR: Where's the code for git's internal command line parser?
quoted
===#
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.
quoted
quoted
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help