threads / rfc / 53051

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

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

## tl;dr

2 messages between Mar 21, 2020 and Mar 21, 2020.

replies: 1people: 2as markdown or json

Shourya Shukla· Mar 21, 2020, 18:35 UTC · lore
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· Mar 21, 2020, 19:41 UTC · re: Shourya Shukla · lore

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

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.

← back to recent threads