git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Passing revs to git-bundle-create via stdin
@ 2017-05-22 23:44 ch
  2017-05-23 16:46 ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: ch @ 2017-05-22 23:44 UTC (permalink / raw)
  To: git

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-05-25  2:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-22 23:44 Passing revs to git-bundle-create via stdin ch
2017-05-23 16:46 ` Jeff King
2017-05-24  1:44   ` Junio C Hamano
2017-05-25  2:55     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).