git-backup icon indicating copy to clipboard operation
git-backup copied to clipboard

Fetch the remote branches into local branches

Open schoentoon opened this issue 2 years ago • 2 comments

I don't consider this quite done yet just so you know.

So, I run this tool with bare repositories (probably obvious as I added that previously). I then run a gitweb instance pointing to it. I recently realized that some repositories that were actually very active, never seemed to have any activity (despite git-backup running every 3 hours). After some investigating I realized that due to the call to Fetch() without anything really special, it was just getting fetched into ref/remotes/heads/... and not into refs/heads/... meaning that the data was actually there, but the head wasn't moved properly. After quite some experimenting and testing, I found that fetching with +refs/heads/*:refs/heads/* seemed to do precisely what one would except. Although this could very well be argued, as this would fetch all remote branches. Not just 'the default' branch, maybe this could be an option?

After testing all this without bare repositories (to make sure that wouldn't break). I realized that calling pull before fetch is kind of silly, as pull basically does a fetch followed by a merge/checkout. I couldn't quite get checkout to work (at this point at least), hence why it is currently still a pull.

Input on this would be nice :)

schoentoon avatar May 21 '22 00:05 schoentoon

Thanks for all the changes btw. I really appreciate it.

ChappIO avatar May 22 '22 16:05 ChappIO

I actually almost forgot about this pull request, but I've had it running for a while now in my own setup with no issues. So I'm just going to mark it as ready for review.

schoentoon avatar Jun 14 '22 16:06 schoentoon