summaryrefslogtreecommitdiff
path: root/argv-array.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-10-25 06:42:01 -0400
committerJeff King <peff@peff.net>2012-10-25 06:42:02 -0400
commit530f237500ba00c03fee23c2db599870ff62c196 (patch)
tree99a83551dc7c6107adca22d3f7a3b360ccc5909d /argv-array.c
parent8de8f9f656696a3c04e5f0a274b57e4a719a66ce (diff)
parente99d012a6bc8b8647a0389d486b5489557364ea6 (diff)
downloadgit-530f237500ba00c03fee23c2db599870ff62c196.tar.gz
Merge branch 'fa/remote-svn'
A GSoC project. * fa/remote-svn: Add a test script for remote-svn remote-svn: add marks-file regeneration Add a svnrdump-simulator replaying a dump file for testing remote-svn: add incremental import remote-svn: Activate import/export-marks for fast-import Create a note for every imported commit containing svn metadata vcs-svn: add fast_export_note to create notes Allow reading svn dumps from files via file:// urls remote-svn, vcs-svn: Enable fetching to private refs When debug==1, start fast-import with "--stats" instead of "--quiet" Add documentation for the 'bidi-import' capability of remote-helpers Connect fast-import to the remote-helper via pipe, adding 'bidi-import' capability Add argv_array_detach and argv_array_free_detached Add svndump_init_fd to allow reading dumps from arbitrary FDs Add git-remote-testsvn to Makefile Implement a remote helper for svn in C
Diffstat (limited to 'argv-array.c')
-rw-r--r--argv-array.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/argv-array.c b/argv-array.c
index 256741d226..9e960d549c 100644
--- a/argv-array.c
+++ b/argv-array.c
@@ -68,3 +68,23 @@ void argv_array_clear(struct argv_array *array)
}
argv_array_init(array);
}
+
+const char **argv_array_detach(struct argv_array *array, int *argc)
+{
+ const char **argv =
+ array->argv == empty_argv || array->argc == 0 ? NULL : array->argv;
+ if (argc)
+ *argc = array->argc;
+ argv_array_init(array);
+ return argv;
+}
+
+void argv_array_free_detached(const char **argv)
+{
+ if (argv) {
+ int i;
+ for (i = 0; argv[i]; i++)
+ free((char **)argv[i]);
+ free(argv);
+ }
+}