top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Rewriting git-repack.sh in C

+1 vote
303 views

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.

posted Aug 2, 2013 by Mandeep Sehgal

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

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.

answer Aug 2, 2013 by Luv Kumar
Similar Questions
+2 votes

Is it possible to use a git library in a C Program?
Does someone know, if it is possible to include GIT source as part of my program?

0 votes

When I update my branch from master it pulls down several files, including some sass files. When I compile, however, gulp alerts me that I am missing .scss files.

I tested this by creating a new fresh branch and running gulp sass. This time there were no errors and I saw the missing .scss had been brought in.

Would anyone know why, on update, I am only getting some of the files from master?

0 votes

I work on some files and push/merge them to the remote server. Sometimes I get merge conflicts on those files and have to fix them. That's completely fine. I get that.

What I don't understand is that sometimes during this process I will get merge conflicts in files _I have never touched_. In fact they are in a completely different series of directories to the one I am working on and someone else project entirely. How am I meant to know how to fix these? I dont know what the other developer wanted to do and if they have done it right.

I thought git only merged/pushed the files you have changed? If someone else has changed Group A files on the remote repo, why must I change my local Group A files when I am _pushing _completely different set of Group B files?

Sure, Id understand if I were pulling files down to my local and had to resolve merge conflicts then, but this isn't happening when I push the files up.

Any help or advice is much appreciated. Sorry if I sound frustrated - I am really trying hard to get my head round this whole git thing but its just so weird.

...