archlinux / asp

Arch Build Source Management Tool
MIT License
294 stars 34 forks source link

`asp update PACKAGE` does not recreate the local branch #35

Closed intelfx closed 11 months ago

intelfx commented 3 years ago

If $ASPROOT (~/.cache/asp) has been purged for some reason, asp update PACKAGE does not recreate the local branch for the pkgbase. This creates a problem because any existing asp checkouts become broken until another (pointless) checkout has been made:

$ asp checkout linux 
remote: Enumerating objects: 9771, done.
remote: Counting objects: 100% (1912/1912), done.
remote: Compressing objects: 100% (781/781), done.
remote: Total 9771 (delta 1583), reused 1210 (delta 1131), pack-reused 7859
Receiving objects: 100% (9771/9771), 2.28 MiB | 2.20 MiB/s, done.
Resolving deltas: 100% (3994/3994), done.
From https://github.com/archlinux/svntogit-packages
 * branch            packages/linux -> FETCH_HEAD
 * [new branch]      packages/linux -> packages/packages/linux
Cloning into 'linux'...
done.

$ (cd ~/.cache/asp; git --no-pager branch)
  packages/packages/linux

$ (cd ~/.cache/asp; git --no-pager branch --all)
  packages/packages/linux
  remotes/packages/packages/linux

$ (cd linux; git pull)                    
Already up to date.

After purging the cache:

$ rm -rf ~/.cache/asp

$ asp update linux  
remote: Enumerating objects: 9771, done.
remote: Counting objects: 100% (1912/1912), done.
remote: Compressing objects: 100% (781/781), done.
remote: Total 9771 (delta 1583), reused 1210 (delta 1131), pack-reused 7859
Receiving objects: 100% (9771/9771), 2.28 MiB | 8.86 MiB/s, done.
Resolving deltas: 100% (3994/3994), done.
From https://github.com/archlinux/svntogit-packages
 * branch            packages/linux -> FETCH_HEAD
 * [new branch]      packages/linux -> packages/packages/linux

$ (cd ~/.cache/asp; git --no-pager branch --all)
  remotes/packages/packages/linux

$ (cd ~/.cache/asp; git --no-pager branch)      

$ (cd linux; git pull)
fatal: couldn't find remote ref refs/heads/packages/packages/linux

$ (mkdir tmp; cd tmp; asp checkout linux)
mkdir: created directory 'tmp'
Cloning into 'linux'...
done.

$ (cd linux; git pull)                   
Already up to date.
falconindy commented 3 years ago

Well, this is sort of unfortunate. The difference between 'update' and 'checkout' is such that I only commit to keeping around a copy of the blobs when the user requests the checkout. Everything else asp does is lighter weight and only needs the branches and histories. Whereas the current asp cache is only a few kilobytes, such a change could potentially make the cache hundreds of megabytes.

Thoughts? I'd really like to stay away from the idea of some sort of repository of local checkouts, as well.

intelfx commented 2 years ago

I apologize for not getting back in over a year, but...

I'm not sure what the problem is. Asp already fetches all the blobs on asp update, it simply does not create a local branch out of that history (only a remote one).

https://github.com/intelfx/asp/commit/36ba405952ca1316211622663c88be2a99efb527 fixes the issue for me. Does this make any more sense?