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

Re: Fwd: Seems to be pushing more than necessary

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 19, 2015, 18:36 UTC
Message-ID
<xmqq3850kf6d.fsf@gitster.dls.corp.google.com>
In-Reply-To
<CAABECY1_L34sq0VPmD9UwRcwb3Fuh95OFcF26LM2eX1z-+8vkQ@mail.gmail.com>
Graham Hay <grahamrhay@gmail.com> writes:
Show 8 quoted lines
> We have a fairly large repo (~2.4GB), mainly due to binary resources
> (for an ios app). I know this can generally be a problem, but I have a
> specific question.
>
> If I cut a branch, and edit a few (non-binary) files, and push, what
> should be uploaded? I assumed it was just the diff (I know whole
> compressed files are used, I mean the differences between my branch
> and where I cut it from). Is that correct?
If you start from this state:
 (the 'origin')                    (you)
    ---Z---A         clone ->    ---Z---A

and edit a few files, say, a/b, a/c and d/e/f, and committed to make the history look like this:

 (the 'origin')                    (you)
    ---Z---A                     ---Z---A---B

i.e. "git diff --name-only A B" would show these three files, then the next push from you to the origin, i.e.

 (the 'origin')                    (you)
    ---Z---A---B    <- push      ---Z---A---B
would involve transferring from you to the origin of the following:
 * The commit object that holds the message, authorship, etc. for B
 * The top-level tree object of commit B (as that is different from
   that of A)
 * The tree object for 'a', 'd', 'd/e' and the blob object for
   'a/b', 'a/c', and 'd/e/f'.

However, that assumes that nothing is happening on the 'origin' side.

If the 'origin', for example, rewound its head to Z before you attempt to push your B, then you may end up sending objects that do not exist in Z that are reachable from B. Just like the above bullet points enumerated what is different between A and B, you can enumerate what is different between Z and A and add that to the above set. That would be what will be sent.

If the 'origin' updated its tip to a commit you do not even know about, normally you will be prevented from pushing B because we would not want you to lose somebody else's work. If you forced such push, then you may end up sending a lot more.

Previous: Duy NguyenNext: Graham Hay
Message 12 of 17 in “Fwd: Seems to be pushing more than necessary”
  1. Graham HayMar 18, 2015
  2. Duy NguyenMar 18, 2015
  3. Graham HayMar 18, 2015
  4. Duy NguyenMar 18, 2015
  5. Graham HayMar 18, 2015
  6. Duy NguyenMar 18, 2015
  7. Duy NguyenMar 18, 2015
  8. Graham HayMar 18, 2015
  9. Duy NguyenMar 18, 2015
  10. Graham HayMar 18, 2015
  11. Duy NguyenMar 19, 2015
  12. Junio C HamanoMar 19, 2015
  13. Graham HayMar 20, 2015
  14. Duy NguyenMar 23, 2015
  15. Graham HayMar 23, 2015
  16. Duy NguyenMar 23, 2015
  17. Graham HayMar 23, 2015

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.