Rewriting git-repack.sh in C
Hello,
I'd like to rewrite the repack shell script in C.
So I tried the naive approach reading the man page and the script itself and write C program by matching each block/line of the script with a function in C
Now I stumble upon other git commands (git pack-objects). What's the best way to approach such a plumbing command?
I don't think just calling cmd_pack_objects(argc, **argv) would be the right thing to do, as we're not using all the command line parameters, so some of the logic in cmd_pack_object could be skipped.
Another approach would be to use some of the functions as used by cmd_pack_objects, but these mostly reside in builtin/pack_objects.c They'd need to be moved up to pack.h/pack.c.
So my question is, how you'd generally approach rewriting a shell script in C.
Stefan
Quoted 18 lines · Stefan Beller
Hello,
I'd like to rewrite the repack shell script in C.
So I tried the naive approach reading the man page and the script itself and write C program by matching each block/line of the script with a function in CNow I stumble upon other git commands (git pack-objects). What's the best way to approach such a plumbing command?
I don't think just calling
cmd_pack_objects(argc, **argv)would be the right thing to do, as we're not using all the command line parameters, so some of the logic incmd_pack_objectcould be skipped.
Another approach would be to use some of the functions as used bycmd_pack_objects, but these mostly reside inbuiltin/pack_objects.cThey'd need to be moved up topack.h/pack.c.
Quoted 2 lines
So my question is, how you'd generally approach rewriting a shell script in C.
Start a new process via start_command/run_command interface. It's safer to retain the process boundary at this stage. You can try to integrate further later.
Signature · 1 line
Duy
Quoted 9 lines · Duy Nguyen
Quoted 7 lines · Stefan Beller
Hello,
I'd like to rewrite the repack shell script in C.
So I tried the naive approach reading the man page and the script itself and write C program by matching each block/line of the script with a function in C
Quoted 8 lines
Quoted 4 lines
...
So my question is, how you'd generally approach rewriting a shell script in C.
Start a new process via start_command/run_command interface. It's safer to retain the process boundary at this stage. You can try to integrate further later.
I was in the middle of something and somehow read this as "rewriting git-rebase.sh" :-X
For git-repack, because it ends with a single pack-objects call, we might not need a new process after all (very much like tail call optimization). This is what I got for some time, but still not polish it for submission (and it may be a bit broken after the last rebase). Maybe you can work off this, or from scratch if you think it's too messy. It basically teaches pack-objects extra features that repack needs, then make repack a wrapper of pack-objects.
-- 8< --
commit 25569a3958c3272b3eb5fa50dea680948f7a2768 (build-in-repack)
Author: Nguyễn Thái Ngọc Duy <[email protected]> Date: Wed Nov 9 19:21:39 2011 +0700
Build in git-repack
pack-objects learns a few more options to take over what's been done by git-repack.sh. cmd_repack() becomes a wrapper around cmd_pack_objects().
Makefile +1 -1
@@ -460,7 +460,6 @@ SCRIPT_SH += git-mergetool.sh SCRIPT_SH += git-pull.sh SCRIPT_SH += git-quiltimport.sh SCRIPT_SH += git-rebase.sh -SCRIPT_SH += git-repack.sh SCRIPT_SH += git-request-pull.sh SCRIPT_SH += git-stash.sh SCRIPT_SH += git-submodule.sh
@@ -584,6 +583,7 @@ BUILT_INS += git-init$X BUILT_INS += git-merge-subtree$X BUILT_INS += git-peek-remote$X BUILT_INS += git-repo-config$X +BUILT_INS += git-repack$X BUILT_INS += git-show$X BUILT_INS += git-stage$X BUILT_INS += git-status$X
builtin.h +1 -0
@@ -117,6 +117,7 @@ extern int cmd_reflog(int argc, const char **argv, const char *prefix);extern int cmd_remote (int argc,const char **argv,const char *prefix);extern int cmd_remote_ext (int argc,const char **argv,const char *prefix);extern int cmd_remote_fd (int argc,const char **argv,const char *prefix); +extern int cmd_repack (int argc,const char **argv,const char *prefix);extern int cmd_repo_config (int argc,const char **argv,const char *prefix);extern int cmd_rerere (int argc,const char **argv,const char *prefix);extern int cmd_reset (int argc,const char **argv,const char *prefix);
builtin/pack-objects.c +275 -4
341 lines not on this page · raw message
bulk-checkin.c +1 -1
@@ -46,7 +46,7 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state)sprintf (packname,"%s/pack/pack-" ,get_object_directory ());finish_tmp_packfile (packname, state->pack_tmp_name, state->written, state->nr_written, - &state->pack_idx_opts, sha1); + &state->pack_idx_opts, sha1,NULL );for (i =0 ; i < state->nr_written; i++)free (state->written[i]);
contrib/examples/git-repack.sh renamed from git-repack.sh +0 -0
git.c +1 -0
@@ -389,6 +389,7 @@ static void handle_internal_command(int argc, const char **argv) { "remote-ext", cmd_remote_ext }, { "remote-fd", cmd_remote_fd }, { "replace", cmd_replace, RUN_SETUP }, + { "repack", cmd_repack, RUN_SETUP }, { "repo-config", cmd_repo_config, RUN_SETUP_GENTLY }, { "rerere", cmd_rerere, RUN_SETUP }, { "reset", cmd_reset, RUN_SETUP },
pack-write.c +12 -1
@@ -1,6 +1,7 @@#include "cache.h" #include "pack.h" #include "csum-file.h" +#include "string-list.h" void reset_pack_idx_option (struct pack_idx_option *opts) {
@@ -348,10 +349,12 @@ void finish_tmp_packfile(char *name_buffer,struct pack_idx_entry **written_list, uint32_t nr_written, struct pack_idx_option *pack_idx_opts, - unsigned char sha1[]) + unsigned char sha1[], + struct string_list *backup_files) { const char *idx_tmp_name;char *end_of_name_prefix =strrchr (name_buffer,0 ); +struct stat st;if (adjust_shared_perm (pack_tmp_name))die_errno ("unable to make temporary pack file readable" );
@@ -368,6 +371,14 @@ void finish_tmp_packfile(char *name_buffer,die_errno ("unable to rename temporary pack file" );sprintf (end_of_name_prefix,"%s.idx" ,sha1_to_hex (sha1)); +if (backup_files && !stat (name_buffer, &st)) { +struct strbuf old =STRBUF_INIT ; +strbuf_addf (&old,"%s.old" , name_buffer); +if (rename (name_buffer, old.buf)) +die_errno ("unable to rename pack %s" , name_buffer); +string_list_append (backup_files,strbuf_detach (&old,NULL )); + } +backup_file (name_buffer);if (rename (idx_tmp_name, name_buffer))die_errno ("unable to rename temporary index file" );
pack.h +3 -1
@@ -90,7 +90,9 @@ extern int encode_in_pack_object_header(enum object_type, uintmax_t, unsigned ch#define PH_ERROR_PROTOCOL (-3)extern int read_pack_header (int fd,struct pack_header *); +struct string_list ; +extern struct sha1file *create_tmp_packfile (char **pack_tmp_name); -extern void finish_tmp_packfile (char *name_buffer,const char *pack_tmp_name,struct pack_idx_entry **written_list,uint32_t nr_written,struct pack_idx_option *pack_idx_opts,unsigned char sha1[]); +extern void finish_tmp_packfile (char *name_buffer,const char *pack_tmp_name,struct pack_idx_entry **written_list,uint32_t nr_written,struct pack_idx_option *pack_idx_opts,unsigned char sha1[],struct string_list *backup_files);#endif
-- 8< --
Quoted 6 lines · Duy Nguyen
Quoted 2 lines
So my question is, how you'd generally approach rewriting a shell script in C.
Start a new process via start_command/run_command interface. It's safer to retain the process boundary at this stage. You can try to integrate further later.
Is it really the right approach to just replace sh with C? IMHO forking and wait for the result should not be done if it can be avoided. It just adds overhead.
Of course you can argue that just replace sh with C is a good first step towards to actually do the command in "full C". Altough I'm afraid that that will get such low priority that it won't be done.
Signature · 5 lines
Med vänliga hälsningar Fredrik Gustafsson tel: 0733-608274 e-post: [email protected]
Quoted 11 lines · Fredrik Gustafsson
Quoted 6 lines · Duy Nguyen
Quoted 2 lines
So my question is, how you'd generally approach rewriting a shell script in C.
Start a new process via start_command/run_command interface. It's safer to retain the process boundary at this stage. You can try to integrate further later.
Is it really the right approach to just replace sh with C? IMHO forking and wait for the result should not be done if it can be avoided. It just adds overhead.
Agreed. As I said in another post, I misread this as rewriting git-rebase.sh, which is a lot more complicated.
Quoted 3 lines
Of course you can argue that just replace sh with C is a good first step towards to actually do the command in "full C". Altough I'm afraid that that will get such low priority that it won't be done.
One of the reasons I started porting git-repack.sh since 2011 and never finished it.
Signature · 1 line
Duy
Hi Duy,
I applied your patch on the current master and added 3 patches, so git compiles and the testsuite works without additional breakages.
The functionality is obviously not yet completed as the backup_file function is still empty. What do you intend that function will do?
Stefan
Nguyễn Thái Ngọc Duy (1):
Build in git-repack
Stefan Beller (3):
backup_file dummy function
pack-objects: do not print usage when repacking
repack: add unpack-unreachable
Makefile | 2 +- builtin.h | 1 + builtin/pack-objects.c | 284 ++++++++++++++++++++++++++++++++++++++++- bulk-checkin.c | 2 +- contrib/examples/git-repack.sh | 194 ++++++++++++++++++++++++++++ git-repack.sh | 194 ---------------------------- git.c | 1 + pack-write.c | 18 ++- pack.h | 4 +- 9 files changed, 497 insertions(+), 203 deletions(-) create mode 100755 contrib/examples/git-repack.sh delete mode 100755 git-repack.sh
Signature · 1 line
1.8.4.rc1.25.g2793d0a
PATCH 1/4 Build in git-repack
From: Nguyễn Thái Ngọc Duy <[email protected]>
pack-objects learns a few more options to take over what's been done by git-repack.sh. cmd_repack() becomes a wrapper around cmd_pack_objects().
--- Makefile | 2 +- builtin.h | 1 + builtin/pack-objects.c | 279 ++++++++++++++++++++++++++++++++++++++++- bulk-checkin.c | 2 +- contrib/examples/git-repack.sh | 194 ++++++++++++++++++++++++++++ git-repack.sh | 194 ---------------------------- git.c | 1 + pack-write.c | 13 +- pack.h | 4 +- 9 files changed, 488 insertions(+), 202 deletions(-) create mode 100755 contrib/examples/git-repack.sh delete mode 100755 git-repack.sh
Makefile +1 -1
@@ -464,7 +464,6 @@ SCRIPT_SH += git-pull.sh SCRIPT_SH += git-quiltimport.sh SCRIPT_SH += git-rebase.sh SCRIPT_SH += git-remote-testgit.sh -SCRIPT_SH += git-repack.sh SCRIPT_SH += git-request-pull.sh SCRIPT_SH += git-stash.sh SCRIPT_SH += git-submodule.sh
@@ -596,6 +595,7 @@ BUILT_INS += git-get-tar-commit-id$X BUILT_INS += git-init$X BUILT_INS += git-merge-subtree$X BUILT_INS += git-peek-remote$X +BUILT_INS += git-repack$X BUILT_INS += git-repo-config$X BUILT_INS += git-show$X BUILT_INS += git-stage$X
builtin.h +1 -0
@@ -102,6 +102,7 @@ extern int cmd_reflog(int argc, const char **argv, const char *prefix);extern int cmd_remote (int argc,const char **argv,const char *prefix);extern int cmd_remote_ext (int argc,const char **argv,const char *prefix);extern int cmd_remote_fd (int argc,const char **argv,const char *prefix); +extern int cmd_repack (int argc,const char **argv,const char *prefix);extern int cmd_repo_config (int argc,const char **argv,const char *prefix);extern int cmd_rerere (int argc,const char **argv,const char *prefix);extern int cmd_reset (int argc,const char **argv,const char *prefix);
builtin/pack-objects.c +275 -4
341 lines not on this page · raw message
bulk-checkin.c +1 -1
@@ -46,7 +46,7 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state)sprintf (packname,"%s/pack/pack-" ,get_object_directory ());finish_tmp_packfile (packname, state->pack_tmp_name, state->written, state->nr_written, - &state->pack_idx_opts, sha1); + &state->pack_idx_opts, sha1,NULL );for (i =0 ; i < state->nr_written; i++)free (state->written[i]);
contrib/examples/git-repack.sh new file +194 -0
194 lines not on this page · raw message
git-repack.sh deleted +0 -194
194 lines not on this page · raw message
git.c +1 -0
@@ -397,6 +397,7 @@ static void handle_internal_command(int argc, const char **argv) { "remote-ext", cmd_remote_ext }, { "remote-fd", cmd_remote_fd }, { "replace", cmd_replace, RUN_SETUP }, + { "repack", cmd_repack, RUN_SETUP }, { "repo-config", cmd_repo_config, RUN_SETUP_GENTLY }, { "rerere", cmd_rerere, RUN_SETUP }, { "reset", cmd_reset, RUN_SETUP },
pack-write.c +12 -1
@@ -1,6 +1,7 @@#include "cache.h" #include "pack.h" #include "csum-file.h" +#include "string-list.h" void reset_pack_idx_option (struct pack_idx_option *opts) {
@@ -348,10 +349,12 @@ void finish_tmp_packfile(char *name_buffer,struct pack_idx_entry **written_list, uint32_t nr_written, struct pack_idx_option *pack_idx_opts, - unsigned char sha1[]) + unsigned char sha1[], + struct string_list *backup_files) { const char *idx_tmp_name;char *end_of_name_prefix =strrchr (name_buffer,0 ); +struct stat st;if (adjust_shared_perm (pack_tmp_name))die_errno ("unable to make temporary pack file readable" );
@@ -368,6 +371,14 @@ void finish_tmp_packfile(char *name_buffer,die_errno ("unable to rename temporary pack file" );sprintf (end_of_name_prefix,"%s.idx" ,sha1_to_hex (sha1)); +if (backup_files && !stat (name_buffer, &st)) { +struct strbuf old =STRBUF_INIT ; +strbuf_addf (&old,"%s.old" , name_buffer); +if (rename (name_buffer, old.buf)) +die_errno ("unable to rename pack %s" , name_buffer); +string_list_append (backup_files,strbuf_detach (&old,NULL )); + } +backup_file (name_buffer);if (rename (idx_tmp_name, name_buffer))die_errno ("unable to rename temporary index file" );
pack.h +3 -1
@@ -90,7 +90,9 @@ extern int encode_in_pack_object_header(enum object_type, uintmax_t, unsigned ch#define PH_ERROR_PROTOCOL (-3)extern int read_pack_header (int fd,struct pack_header *); +struct string_list ; +extern struct sha1file *create_tmp_packfile (char **pack_tmp_name); -extern void finish_tmp_packfile (char *name_buffer,const char *pack_tmp_name,struct pack_idx_entry **written_list,uint32_t nr_written,struct pack_idx_option *pack_idx_opts,unsigned char sha1[]); +extern void finish_tmp_packfile (char *name_buffer,const char *pack_tmp_name,struct pack_idx_entry **written_list,uint32_t nr_written,struct pack_idx_option *pack_idx_opts,unsigned char sha1[],struct string_list *backup_files);#endif
Signature · 1 line
1.8.4.rc1.25.g2793d0a
Re: [PATCH 1/4] Build in git-repack
[ It's cool you're working on this, I'd really like a git-repack in C.
That would fix this
http://thread.gmane.org/gmane.comp.version-control.git/226458 ]
Quoted 5 lines · Stefan Beller
From: Nguyễn Thái Ngọc Duy <[email protected]>
pack-objects learns a few more options to take over what's been done by
git-repack.sh.cmd_repack()becomes a wrapper aroundcmd_pack_objects().
I think the patch would read easier if these were split into two
patches: one doing the real stuff in pack-objects, and then getting rid of git-repack.sh to replace it with a trivial built-in.
Actually, I'm wondering why pack-objects requires so much changes. git-repack.sh was already a relatively small wrapper around pack-objects, and did not need the new options you add, so why are they needed? In particular adding the new --update-info option that just does
builtin/pack-objects.c int cmd_pack_objects(int argc, const char **argv, const char *prefix) · line 2756
Quoted 2 lines
builtin/pack-objects.c +2
-0+if (repack_flags &REPACK_UPDATE_INFO ) +update_server_info (0 );
seems overkill to me: why don't you just let cmd_repack call update_server_info(0)?
Signature · 2 lines
Matthieu Moy http://www-verimag.imag.fr/~moy/
Re: [PATCH 1/4] Build in git-repack
Quoted 21 lines · Matthieu Moy
[ It's cool you're working on this, I'd really like a git-repack in C.
That would fix this
http://thread.gmane.org/gmane.comp.version-control.git/226458 ]Quoted 5 lines · Stefan Beller
From: Nguyễn Thái Ngọc Duy <[email protected]>
pack-objects learns a few more options to take over what's been done by
git-repack.sh.cmd_repack()becomes a wrapper aroundcmd_pack_objects().I think the patch would read easier if these were split into two
patches: one doing the real stuff in pack-objects, and then getting rid ofgit-repack.shto replace it with a trivial built-in.Actually, I'm wondering why pack-objects requires so much changes.
git-repack.shwas already a relatively small wrapper around pack-objects, and did not need the new options you add, so why are they needed? In particular adding the new --update-info option that just does
Quoted 5 lines
builtin/pack-objects.c int cmd_pack_objects(int argc, const char **argv, const char *prefix) · line 2756
Quoted 2 lines
builtin/pack-objects.c +2
-0+if (repack_flags &REPACK_UPDATE_INFO ) +update_server_info (0 );seems overkill to me: why don't you just let
cmd_repackcallupdate_server_info(0)?
My feeling exactly. I would rather see a patch that does not touch pack-objects at all, and use run_command() interface to spawn it. Once we do have to pack, the necessary processing cycle will dwarf the fork/exec latency anyway, no?
Re: [PATCH 1/4] Build in git-repack
Quoted 10 lines · Junio C Hamano
Quoted 3 lines · Matthieu Moy
seems overkill to me: why don't you just let
cmd_repackcallupdate_server_info(0)?My feeling exactly. I would rather see a patch that does not touch pack-objects at all, and use
run_command()interface to spawn it. Once we do have to pack, the necessary processing cycle will dwarf the fork/exec latency anyway, no?
Thanks for clarification. That was my initial idea as well, to not touch the pack-objects logic.
However Duy send that patch (basically as is,
I just made it apply again),
and I guessed that I'd get to results
faster with an already existing approach.
I will reconsider and try to remove the additional logic from pack-objects again (so it will not get touched) and move it to the repack itself. It is just a way to understand, 'what needs to be done'.
Stefan
Re: [PATCH 1/4] Build in git-repack
In reply to Junio C HamanoQuoted 26 lines · Junio C Hamano
Quoted 24 lines · Matthieu Moy
[ It's cool you're working on this, I'd really like a git-repack in C.
That would fix this
http://thread.gmane.org/gmane.comp.version-control.git/226458 ]Quoted 5 lines · Stefan Beller
From: Nguyễn Thái Ngọc Duy <[email protected]>
pack-objects learns a few more options to take over what's been done by
git-repack.sh.cmd_repack()becomes a wrapper aroundcmd_pack_objects().I think the patch would read easier if these were split into two
patches: one doing the real stuff in pack-objects, and then getting rid ofgit-repack.shto replace it with a trivial built-in.Actually, I'm wondering why pack-objects requires so much changes.
git-repack.shwas already a relatively small wrapper around pack-objects, and did not need the new options you add, so why are they needed? In particular adding the new --update-info option that just doesQuoted 2 lines
builtin/pack-objects.c +2
-0+if (repack_flags &REPACK_UPDATE_INFO ) +update_server_info (0 );
Quoted 7 lines
Quoted 2 lines
seems overkill to me: why don't you just let
cmd_repackcallupdate_server_info(0)?My feeling exactly. I would rather see a patch that does not touch pack-objects at all, and use
run_command()interface to spawn it. Once we do have to pack, the necessary processing cycle will dwarf the fork/exec latency anyway, no?
I'm not opposed to run_command(). I think the reason I wanted to move repack functionality to pack-objects is to avoid reading sha-1 from pack-objects and reconstruct the paths again from the sha-1. But for simplicity, perhaps we should not touch pack-objects at all. Then we could have builtin/repack.c instead of stuffing cmd_repack in builtin/pack-objects.c
@Stefan, if you want to push this work, feel free to take it as _your_ patch, rewrite as will. You don't need to retain my name.
Signature · 1 line
Duy
PATCH 2/4 backup_file dummy function
In reply to Stefan Beller--- pack-write.c | 5 +++++ 1 file changed, 5 insertions(+)
pack-write.c +5 -0
@@ -344,6 +344,11 @@ struct sha1file *create_tmp_packfile(char **pack_tmp_name)return sha1fd (fd, *pack_tmp_name); } +void backup_file (char *filename) +{ + +} + void finish_tmp_packfile(char *name_buffer, const char *pack_tmp_name, struct pack_idx_entry **written_list,
Signature · 1 line
1.8.4.rc1.25.g2793d0a
Re: [PATCH 2/4] backup_file dummy function
Quoted 9 lines · Stefan Beller
--- pack-write.c | 5 +++++ 1 file changed, 5 insertions(+)pack-write.c +0
-0
pack-write.c struct sha1file *create_tmp_packfile(char **pack_tmp_name) · line 351
Quoted 8 lines
pack-write.c +5
-0@@ -344,6 +344,11 @@ struct sha1file *create_tmp_packfile(char **pack_tmp_name)return sha1fd (fd, *pack_tmp_name); } +void backup_file (char *filename) +{ + +} +
I think the function looks like this (before it got lost after rebase)
+static void backup_file(const char *path)
+{
+ struct stat st;
+ if (repack_flags & REPACK_IN_PROGRESS &&
+ !stat(path, &st)) {
+ struct strbuf old = STRBUF_INIT; + strbuf_addf(&old, "%s.old", path); + if (rename(path, old.buf))
+ die_errno("unable to rename pack %s", path);
+ string_list_append(&backup_files, strbuf_detach(&old, NULL));
+ }
+}
+
Signature · 1 line
Duy
PATCH 3/4 pack-objects: do not print usage when repacking
In reply to Stefan Beller--- builtin/pack-objects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
builtin/pack-objects.c +1 -1
@@ -2585,7 +2585,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) base_name = argv[0 ]; argc--; } -if (pack_to_stdout != !base_name || argc) +if (!(repack_flags &REPACK_IN_PROGRESS ) && (pack_to_stdout != !base_name || argc))usage_with_options (pack_usage, pack_objects_options); rp_av[rp_ac++] ="pack-objects" ;
Signature · 1 line
1.8.4.rc1.25.g2793d0a
Re: [PATCH 3/4] pack-objects: do not print usage when repacking
Quoted 9 lines · Stefan Beller
--- builtin/pack-objects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)builtin/pack-objects.c +0
-0
builtin/pack-objects.c int cmd_pack_objects(int argc, const char **argv, const char *prefix) · line 2591
Quoted 8 lines
builtin/pack-objects.c +1
-1@@ -2585,7 +2585,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) base_name = argv[0 ]; argc--; } -if (pack_to_stdout != !base_name || argc) +if (!(repack_flags &REPACK_IN_PROGRESS ) && (pack_to_stdout != !base_name || argc))usage_with_options (pack_usage, pack_objects_options); rp_av[rp_ac++] ="pack-objects" ;
Hello Stefan,
I'm not sure I understand that and why it's needed, would you mind explain it to me ? (and/or maybe add it to the commit message)
Thanks,
PATCH 4/4 repack: add unpack-unreachable
In reply to Stefan Beller--- builtin/pack-objects.c | 3 +++ 1 file changed, 3 insertions(+)
builtin/pack-objects.c +3 -0
@@ -2795,6 +2795,9 @@ int cmd_repack(int argc, const char **argv, const char *prefix)OPT_BOOL ('q' ,NULL , &quiet,"be quiet" ),OPT_BOOL ('l' ,NULL , &local,"pass --local to git-pack-objects" ), + { OPTION_CALLBACK, 0, "unpack-unreachable", NULL, N_("time"), +N_ ("unpack unreachable objects newer than <time>" ), + PARSE_OPT_OPTARG, option_parse_unpack_unreachable }, { OPTION_ARGUMENT, 0, "window", NULL, "n", "size of the window used for delta compression", 0 }, { OPTION_ARGUMENT, 0, "window-memory", NULL, "n",
Signature · 1 line
1.8.4.rc1.25.g2793d0a
Quoted 6 lines · Stefan Beller
Hello,
I'd like to rewrite the repack shell script in C.
So I tried the naive approach reading the man page and the script itself and write C program by matching each block/line of the script with a function in C
You should add one step here: check that tests are good, and possibly add some to improve coverage. It's easier to add tests when you already have a reference implementation.
Signature · 2 lines
Matthieu Moy http://www-verimag.imag.fr/~moy/