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

Re-Transmission of blobs?

From
JWJosef Wolf <jw@raven.inka.de>
Date
Sep 10, 2013, 13:08 UTC
Message-ID
<20130910130837.GA14259@raven.wolf.lan>
Hello,

as we all know, files are identified by their SHA. Thus I had the impression that when transfering files, git would know by the SHA whether a given file is already available in the destination repository and the transfer would be of no use. But this don't seem to be tha case. Lets see this example:

  $ cat t.sh
  #! /bin/sh -ex
  
  LANG=
  
  rm -rf 1 2
  git init 1
  git clone 1 2
  
  cd 1
  git commit --allow-empty -m "initial structure"
  git co -b somebranch
  dd if=/dev/urandom count=10 bs=1024k >t
  git add t
  git commit -m "blah"
  
  cd ../2
  git pull
  git cherry-pick origin/somebranch
  git push -v
  
  $ ./t.sh
  + LANG=
  + rm -rf 1 2
  + git init 1
  Initialized empty Git repository in /home/jw/test/1/.git/
  + git clone 1 2
  Cloning into '2'...
  warning: You appear to have cloned an empty repository.
  done.
  + cd 1
  + git commit --allow-empty -m 'initial structure'
  [master (root-commit) 97e52e2] initial structure
  + git co -b somebranch
  Switched to a new branch 'somebranch'
  + dd if=/dev/urandom count=10 bs=1024k
  10+0 records in
  10+0 records out
  10485760 bytes (10 MB) copied, 1.3202 s, 7.9 MB/s
  + git add t
  + git commit -m blah
  [somebranch b11cf51] blah
   1 file changed, 0 insertions(+), 0 deletions(-)
   create mode 100644 t
  + cd ../2
  + git pull
  remote: Counting objects: 5, done.
  remote: Compressing objects: 100% (3/3), done.
  remote: Total 5 (delta 0), reused 0 (delta 0)
  Unpacking objects: 100% (5/5), done.
  From /home/jw/test/1
   * [new branch]      master     -> origin/master
   * [new branch]      somebranch -> origin/somebranch
  + git cherry-pick origin/somebranch
  [master 9e8f1c6] blah
   1 file changed, 0 insertions(+), 0 deletions(-)
   create mode 100644 t
  + git push -v
  warning: push.default is unset; its implicit value is changing in
  Git 2.0 from 'matching' to 'simple'. To squelch this message
  and maintain the current behavior after the default changes, use:
  
    git config --global push.default matching
  
  To squelch this message and adopt the new behavior now, use:
  
    git config --global push.default simple
  
  See 'git help config' and search for 'push.default' for further information.
  (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
  'current' instead of 'simple' if you sometimes use older versions of Git)
  
  Pushing to /home/jw/test/1
  Counting objects: 4, done.
  Delta compression using up to 2 threads.
  Compressing objects: 100% (2/2), done.
  Writing objects: 100% (3/3), 10.00 MiB, done.
  Total 3 (delta 0), reused 0 (delta 0)
  To /home/jw/test/1
     97e52e2..9e8f1c6  master -> master
  updating local tracking ref 'refs/remotes/origin/master'
  $

As we can see in this example, the big file is tranferred back to the first repository, although it is already available there. This is very annoying if you have a very slow connection.

Am I missing some important point here?
-- 
Josef Wolf
jw@raven.inka.de
Next: Junio C Hamano
Message 1 of 19 in “Re-Transmission of blobs?”
  1. Josef WolfSep 10, 2013
  2. Junio C HamanoSep 10, 2013
  3. Josef WolfSep 11, 2013
  4. Junio C HamanoSep 11, 2013
  5. Josef WolfSep 12, 2013
  6. Jeff KingSep 12, 2013
  7. Josef WolfSep 12, 2013
  8. Jeff KingSep 12, 2013
  9. Josef WolfSep 13, 2013
  10. Jeff KingSep 16, 2013
  11. Josef WolfSep 20, 2013
  12. Jeff KingSep 24, 2013
  13. Josef WolfSep 24, 2013
  14. Pyeron, Jason J CTR (US)Sep 12, 2013
  15. Jeff KingSep 12, 2013
  16. Pyeron, Jason J CTR (US)Sep 12, 2013
  17. Josef WolfSep 13, 2013
  18. Jason PyeronSep 13, 2013
  19. Duy NguyenSep 13, 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.