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

Re: Fetching SHA id's instead of named references?

From
KLKlas Lindberg <klas.lindberg@gmail.com>
Date
Apr 8, 2009, 20:03 UTC
Message-ID
<4CBB910C-24F5-4F51-A02D-7760839CCE18@gmail.com>
In-Reply-To
<alpine.LFD.2.00.0904062214170.6741@xanadu.home>
7 apr 2009 kl. 04.34 skrev Nicolas Pitre:
> In git terms, this is called "history rewriting".  And you really  
> don't
> want to do that if your repository is pulled by other people, unless
> there is an explicit statement about that fact.

I thought you had to use filter-branch to qualify for history rewriting? Anyway, the scenario I have in mind is when a new branch is created from the old one, the old one deleted and then the name of the old one gets reused. The deltas are still there, intact, but now you have to use a different named reference to reach them :-(

Show 8 quoted lines
> Thing is, with the distributed nature of git, nothing prevents you  
> from
> keeping a local version of the commit you're interested in.  Unlike  
> with
> a central repository where someone else might delete a branch you  
> need,
> with git you will still have access to that particular commit locally
> regardless if the remote repository has deleted it or not.

This is true, and Git is indeed very good at saving your ass on the client side. Other systems spend much more effort on saving your ass on the server side. My problem is that "my" people responsible for the overall system are mostly interested in the server side. At least that is where they put the tough requirements on perpetual availability.

However, it is good enough if there is some way to somehow guarantee that a branch or tag will never be misused as outlined above. This could be solved through basic file system mechanisms (like write protecting the refs/tags files perhaps?) or a backup mechanism that raises an alarm on forbidden manipulations, or a host of other more or less weird mechanisms. Git doesn't have to provide the mechanism directly, but it would be nice for enterprise users if it did.

Show 7 quoted lines
> There is nothing a tool can do for you if someone is determined to be
> stupid with it.  In other words, don't delete a branch if it contains
> important stuff.  You may rename it if you wish.  And if you don't  
> want
> to fetch everything then you may always find out about the right  
> branch
> to pull with "git branch --contains <SHA1>".

This is all very true. And I wasn't aware of the --contains switch before. That one covers an entire scenario for me. Thanks!!

BR / Klas
Previous: Nicolas PitreNext: Nicolas Pitre
Message 14 of 15 in “Fetching SHA id's instead of named references?”
  1. Klas LindbergApr 6, 2009
  2. Johannes SchindelinApr 6, 2009
  3. Klas LindbergApr 6, 2009
  4. Johannes SchindelinApr 6, 2009
  5. Dmitry PotapovApr 6, 2009
  6. Matthieu MoyApr 6, 2009
  7. Klas LindbergApr 6, 2009
  8. Finn Arne GangstadApr 6, 2009
  9. Shawn O. PearceApr 6, 2009
  10. Klas LindbergApr 6, 2009
  11. Nicolas PitreApr 6, 2009
  12. Klas LindbergApr 6, 2009
  13. Nicolas PitreApr 7, 2009
  14. Klas LindbergApr 8, 2009
  15. Nicolas PitreApr 8, 2009

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.