Skip to contentSkip to conversation

APIs for automatic patch generation

DISCUSSION Markus Elfring 2 participants 6 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hello,

I would like to generate patches in the Git format for some other software automatically. Which application programming interfaces do you recommend for this purpose if I am going to integrate this into a small C++ class library?
http://www.kernel.org/pub/software/scm/git/docs/v1.7.0/technical/api-index.html
http://git.wiki.kernel.org/index.php/Interfaces,_frontends,_and_tools

Specific use cases:
- Which functions or commands should I call to retrieve the required informations for a line like "index 8d16832..358c98b 100644"?
- Can any functions help to construct proper range specifications for difference hunks?

Regards,
Markus

#1 lore raw

Hello,

The commands "git diff" and "git format-patch" contain functionality that I would like to reuse for my little application in a C++ class library.

Which functions exist in a C API that can provide the following data?
- a line like "index 8d16832..358c98b 100644"
- range specifications for difference hunks
- mail construction

Regards,
Markus

#3 lore raw
Quoted 1 line

Until libgit2 is done, just shell out and call 'git format-patch'.

Thanks for the link.

I do not need the whole functionality of these commands for my library. I am looking if the mentioned data items can also be really retrieved by command line parameters.

Regards,
Markus

#4 lore raw

Heya,

Quoted 1 line · Markus Elfring

I do not need the whole functionality of these commands for my library.

My answer still holds.

Signature · 3 lines
Cheers,

Sverre Rabbelier
#5 lore raw
In reply to Markus Elfring
Quoted 2 lines

The commands "git diff" and "git format-patch" contain functionality that I would like to reuse for my little application in a C++ class library.

Which functions exist in the recently published C API (http://libgit2.github.com/) that can provide the following data?
* a line like "index 8d16832..358c98b 100644"
* range specifications for difference hunks
* mail construction

Regards,
Markus