eli-schwartz / aurpublish

PKGBUILD management framework for the Arch User Repository
GNU General Public License v2.0
246 stars 18 forks source link

Impossible to start by pulling a package #3

Closed ArchangeGabriel closed 5 years ago

ArchangeGabriel commented 5 years ago

To repro:

mkdir test && cd test
git init
aurpublish -p <anypackage>

This results in:

fatal: Not a valid object name HEAD
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Working tree has modifications.  Cannot add.
eli-schwartz commented 5 years ago

git doesn't work like this, you cannot pull (a subtree) from a repository without any commits. This was fixed by 2d4274caf25d61aa4ef6faa761a991ce216989ba (by aborting with a helpful error) but I never pushed a new package to [community]...

ArchangeGabriel commented 5 years ago

OK, I wanted to avoid commiting anything, seems that won’t be possible.

eli-schwartz commented 5 years ago

You could commit a README.md, your first new PKGBUILD, a .gitignore... :)

ArchangeGabriel commented 5 years ago

Don’t need a README, I have no new PKGBUILD, and don’t need a .gitignore. :p OK maybe the */**/ one for vcs package actually (for anything else, I actually want git to tell me I have those untracked files around).

I was starting anew to get rid of old the old packages staying in the git history, I’m trying a git filter-tree approach and wanted to compare to starting from scratch.

rafasc commented 5 years ago

git doesn't work like this, you cannot pull from a repository without any commits.

Let me pedantic for a second and clarify this as it isn't 100% true.

git init
git pull https://github.com/eli-schwartz/aurpublish/

git will gladly fetch and merge the default remote branch into your unborn branch master. Resulting in your local master becoming whatever the default branch in the remote is. (Or any branch you pass as a second parameter to git pull).

However, the contrib/ git-subtree script used by aurpublish isn't as nice with this edge case.

git init 
git subtree add --prefix somesubtree https://github.com/eli-schwartz/aurpublish master

Will fail with complaints that it can't figure it out what HEAD is. Due to the fact it isn't handling the unborn branch case. (Does it make sense to add a subtree if the parent tree doesn't exist in the first place?)

But as Eli mentioned, it's easier to just get around it by committing something else first.

@ArchangeGabriel

Don’t need a README, I have no new PKGBUILD, and don’t need a .gitignore.

Not sure if it helps at all, but yet another option is to just add a dummy commit with: git commit --allow-empty.

ArchangeGabriel commented 5 years ago

Did not know about the ability to do an empty commit, that would work to, yes. Thanks!