git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Rewriting git-repack.sh in C

From
Duy Nguyen <pclouds@gmail.com>
Date
Aug 2, 2013, 14:10 UTC
Message-ID
<CACsJy8CaTA2vT0CxOAm0FacCWjNDJjZhg6mwSyspTChia-5ppQ@mail.gmail.com>
In-Reply-To
<51FBB8CB.8020600@googlemail.com>

On Fri, Aug 2, 2013 at 8:48 PM, Stefan Beller <stefanbeller@googlemail.com> wrote:

Show 20 quoted lines
> 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.

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.

-- 
Duy
Previous: Stefan BellerNext: Duy Nguyen
Message 2 of 17 in “Rewriting git-repack.sh in C”
  1. Stefan BellerAug 2, 2013
  2. Duy NguyenAug 2, 2013
  3. Duy NguyenAug 2, 2013
  4. Fredrik GustafssonAug 3, 2013
  5. Duy NguyenAug 3, 2013
  6. 0/4 Re: Rewriting git-repack.sh in CStefan Beller, Aug 7, 2013
  7. 1/4 Build in git-repackStefan Beller, Aug 7, 2013
  8. Matthieu MoyAug 7, 2013
  9. Junio C HamanoAug 7, 2013
  10. Stefan BellerAug 7, 2013
  11. Duy NguyenAug 8, 2013
  12. 2/4 backup_file dummy functionStefan Beller, Aug 7, 2013
  13. Duy NguyenAug 8, 2013
  14. 3/4 pack-objects: do not print usage when repackingStefan Beller, Aug 7, 2013
  15. Antoine PelisseAug 8, 2013
  16. 4/4 repack: add unpack-unreachableStefan Beller, Aug 7, 2013
  17. Matthieu MoyAug 5, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.