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

Passing revs to git-bundle-create via stdin

From
Cch <cr@onlinehome.de>
Date
May 22, 2017, 23:44 UTC
Message-ID
<76491764-cd43-ef7f-fbfc-939a15f2fb77@onlinehome.de>
Hi,

I'm using git bundles to create (incremental) backups of my local repositories. This works quite well but for certain repositories I'm getting unexpectedly big incremental bundles. I did some testing and from what I can tell it seems git-bundle-create has issues processing revs passed via stdin. To illustrate the problem I have included a small bash script below.

I'm using Git for Windows 2.13.0.windows.1 (64-bit). Unfortunately I don't have access to a non-Windows box to check whether it's a problem specific to the Windows port.

----
add_file()
{
     echo "$1" > "$1"
     git add "$1"
     git commit -m "$1"
}
git init .

add_file "test-1" add_file "test-2" add_file "test-3"

git checkout -b feature add_file "test-4" add_file "test-5" add_file "test-6"

git checkout master add_file "test-7" add_file "test-8" add_file "test-9"

echo -e "\nCreating test.git..." git bundle create test.git --all ^feature ^master^

echo -e "\nCreating test-stdin.git..." echo -e "^feature\n^master^\n" | git bundle create test-stdin.git --all --stdin

echo -e "\nCreating test-2.git..." git bundle create test-2.git --all ^feature^ ^master^

echo -e "\nCreating test-2-stdin.git..." echo -e "^feature^\n^master^\n" | git bundle create test-2-stdin.git --all --stdin

echo -e "\nCreating test-3-stdin.git..." echo -e "feature\nmaster\n" | git bundle create test-3-stdin.git --stdin

echo git branch -D feature git tag -am "Annotated tag" annotated-tag master~2

echo -e "\nCreating annotated.git..." git bundle create annotated.git --all ^annotated-tag

echo -e "\nCreating annotated-stdin.git..." echo -e "^annotated-tag\n" | git bundle create annotated-stdin.git --all --stdin

echo git tag -d annotated-tag git tag lightweight-tag master~2 echo -e "\nCreating lightweight-stdin.git..." echo -e "^lightweight-tag\n" | git bundle create lightweight-stdin.git --all --stdin ----

I'd expect test.git and test-stdin.git to be identical. In fact the contained- and required-refs lists of both bundles are equal but the pack in test-stdin.git is notably larger compared to the one in test.git. Interestingly test-2.git and test-2-stdin.git are identical.

git-bundle-create does not appear to handle includes properly either. In this specific case it won't create test-3-stdin.git and dies with 'error: Refusing to create empty bundle.'.

Last but not least git-bundle-create includes annotated-tag in annotated-stdin.git even though the tag is excluded via stdin. It works alright if the tag is excluded via commandline like in case of annotated.git. The issue also seems to be specific to annotated tags as lightweight-tag is properly excluded from lightweight-stdin.git.

Any help would be appreciated.
Thanks in advance.
Next: Jeff King
Message 1 of 4 in “Passing revs to git-bundle-create via stdin”
  1. chMay 22, 2017
  2. Jeff KingMay 23, 2017
  3. Junio C HamanoMay 24, 2017
  4. Junio C HamanoMay 25, 2017

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.