# [RFC]rev-parse: rev-parse.h does not exist for rev-parse.c

2 messages from 2020-03-21 to 2020-03-21. Participants: Shourya Shukla, Junio C Hamano.
Thread: https://gitlist.dev/t/53051

## Shourya Shukla, 2020-03-21 18:35

Subject: [RFC]rev-parse: rev-parse.h does not exist for rev-parse.c
Message-ID: <20200321183545.GA17453@konoha>
URL: https://gitlist.dev/e/20200321183545.GA17453%40konoha

```
Hello all,

I was writing the C code for the summary subcommand of 'git submodule'
when I came across this:

I need to use 'git rev-parse' in the main frontend module_status()
function. Now, instead of creating a string for the 'git rev-parse'
using 'argv_array_pushl()', I thought maybe I could call 'rev-parse.h'
and use the 'cmd_rev_parse()' function directly.

The 'rev-parse.h' file does not exist, only its .c counterpart does. Is
there any reason for this? Would you advise creating a 'rev-parse.h'
file?

Thank you so much in advance for the help and comments :)

Regards,
Shourya Shukla

```

## Junio C Hamano, 2020-03-21 19:41

Subject: Re: [RFC]rev-parse: rev-parse.h does not exist for rev-parse.c
Message-ID: <xmqqy2rt8ph7.fsf@gitster.c.googlers.com>
URL: https://gitlist.dev/e/xmqqy2rt8ph7.fsf%40gitster.c.googlers.com
In-Reply-To: <20200321183545.GA17453@konoha>

```
Shourya Shukla <shouryashukla.oo@gmail.com> writes:

> using 'argv_array_pushl()', I thought maybe I could call 'rev-parse.h'
> and use the 'cmd_rev_parse()' function directly.

Never call cmd_foo() from within your program for any value of
foo(), as it is not part of the approved API.  cmd_foo() is meant to
be the entry point of "run once and exit" function, it is not just
allowed but is expected to exit, and it also will do the in-core
repository setup etc.

```
