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

Re: [PATCH/v2] git-basis, a script to manage bases for git-bundle

From
Mark Levedahl <mdl123@verizon.net>
Date
Jul 2, 2008, 00:16 UTC
Message-ID
<486AC8E0.60002@verizon.net>
In-Reply-To
<7vzlp1jh1o.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
Show 6 quoted lines
> 
> Well, I have a moderately strong objection to this.
> 
> This very much feels like adding a missing feature to "git bundle" command
> itself.  Why isn't it a new option to it?
> 

I have implemented (in script form) a different approach: basically, I just keep a local copy of the refs pushed out via bundle in refs/remotes/*, just as for any other remote, and then use those as the basis for later bundles. My longer term goal is to integrate this into git push, so that with a properly configured remote "git push foo" will create a bundle based upon the local knowledge of the remote's basis and update the local copy of the refs.

For reference, this is the script I currently use ...
#!/bin/sh
# usage
if test $# -lt 4
then
     echo "usage: $0 repoDirectory bundleName remote [git-for-each-ref args]"
     exit 1
fi

# must be at toplevel cd $1 || exit 1 cd ./$(git rev-parse --show-cdup) || exit 1

bundleName=$2 remote=$3 shift 3

# get list of what we want to bundle up newrefs=$(git for-each-ref --format="%(refname)" $*)

# get list of the current bundle basis=$(git for-each-ref --format="^%(objectname)" refs/remotes/$remote)

# create the bundle
if git bundle create "$bundleName" $newrefs $basis
then
     # update our record of basis from the bundle
     git bundle list-heads "$bundleName" | \
     while read sha1 refname
     do
         git update-ref refs/remotes/"$remote"/"${refname##refs/}" $sha1
     done
else
     rm -f "$bundleName"
fi
Mark
Previous: Junio C HamanoNext: Adam Brewster
Message 17 of 22 in “git-basis, a script to manage bases for git-bundle”
  1. git-basis, a script to manage bases for git-bundleAdam Brewster, Jun 30, 2008
  2. Jeff KingJul 1, 2008
  3. Adam BrewsterJul 2, 2008
  4. Jay SoffianJul 2, 2008
  5. Adam BrewsterJul 2, 2008
  6. Jay SoffianJul 2, 2008
  7. Jeff KingJul 2, 2008
  8. Jakub NarebskiJul 2, 2008
  9. Jeff KingJul 3, 2008
  10. Adam BrewsterJul 3, 2008
  11. Johannes SchindelinJul 4, 2008
  12. Adam BrewsterJul 4, 2008
  13. Mark LevedahlJul 4, 2008
  14. Jakub NarebskiJul 4, 2008
  15. Jeff KingJul 4, 2008
  16. Junio C HamanoJul 1, 2008
  17. Mark LevedahlJul 2, 2008
  18. Adam BrewsterJul 3, 2008
  19. Mark LevedahlJul 4, 2008
  20. Johannes SchindelinJul 4, 2008
  21. Mark LevedahlJul 4, 2008
  22. Adam BrewsterJul 2, 2008

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.