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

Creating a tarball out of a directory in a bare git repository

From
Jjateeq <jawad_atiq@hotmail.com>
Date
Mar 1, 2010, 22:47 UTC
Message-ID
<27750115.post@talk.nabble.com>
Hello,

I am developing a web interface, part of which allows the user to download a tarball of a directory (which is in a bare repostitory on the filesystem) on clicking on a link.

This is how I am planning on doing it. Just wanted to assess whether this is efficient enough, or if anyone knows of a better way. I haven't tried this out yet though, so I don't know if it will work at all.

- list all the files/folders in the directory (i have the sha1 hash of the
directory)
- foreach file in the directory, get the file contents (recurse if there are
further subdirectories). Probably store the result in an array. 
- create a file somewhere on the filesystem out of each file output above.
Store it under the directory name.
- create a tarball out of the 'working' directory as usual.

I was wondering if I can get away without having to create a working version out of the bare version of the directory (create each file in the directory and store it somewhere on the filesystem), and then compress it as usual.

I hope someone has a much simpler answer to this problem!

Thanks, Jawad.

-- 
View this message in context: http://old.nabble.com/Creating-a-tarball-out-of-a-directory-in-a-bare-git-repository-tp27750115p27750115.html
Sent from the git mailing list archive at Nabble.com.
Next: Julian Phillips
Message 1 of 3 in “Creating a tarball out of a directory in a bare git repository”
  1. jateeqMar 1, 2010
  2. Julian PhillipsMar 1, 2010
  3. Randal L. SchwartzMar 1, 2010

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.