ref: 073882f6a2a8c065375b94dc77c59eb7d8b2091f
parent: f12b2f1cd7cd26033457a54454456158e1572834
author: sirjofri <[email protected]>
date: Tue Jun 11 14:03:01 EDT 2024
comments and README
--- /dev/null
+++ b/README
@@ -1,0 +1,35 @@
+libgit
+
+COMMANDS
+
+/* initialize git system */
+int initgit(char* dir);
+
+/* git commands. files must be relative within repository. The last
+ name must be nil. */
+int gitcommit(char *msg, char* file, ...);
+int gitadd(char* file, ...);
+int gitrm(char* file, ...);
+
+
+NOTES
+
+gitrm and gitadd add files directly.
+gitcommit calls "/bin/git/commit" under the hood.
+
+initgit is called like that to allow for a future gitinit command
+for initializing new repos.
+
+
+EXAMPLE PROGRAM
+
+void
+main(int argc, char **argv)
+{
+ if (!initgit("/path/to/my/repo"))
+ sysfatal("%r");
+
+ gitadd("relative/path/to/file", "file2", "file3", nil);
+ gitrm("relative/path/to/filerm", "filerm2", "filerm3", nil);
+ gitcommit("commit message", "relative/path/to/file", "file2", "file3", "relative/path/to/filerm", "filerm2", filerm3", nil);
+}
--- a/git.h
+++ b/git.h
@@ -2,9 +2,10 @@
#pragma src "/sys/src/libgit"
/* initialize git system */
-int initgit(char*);
+int initgit(char* dir);
-/* git commands. files must be relative within repository */
+/* git commands. files must be relative within repository. The last
+ name must be nil. */
int gitcommit(char *msg, char* file, ...);
int gitadd(char* file, ...);
int gitrm(char* file, ...);