Skip to content

pre-receive fails due to empty oldrev #49

@2twong

Description

@2twong

oldrev is empty at line 54 which causes git diff on line 57 of pre-receive to fail.

If I checkout master to a new branch, and push the new branch to origin/newbranchname, oldrev == 0{40} in pre-receive, newrev gets set to master, but oldrev gets set to empty and so the git diff on line 57 fails, due to the grep -v master

Reproducer with excerpt from pre-receive with set -x:

$ git branch
* master
$ git checkout -b p/newname
$ git push origin p/newname
..
remote: + oldrev=
remote: ++ git diff --name-only master --diff-filter=ACM
remote: fatal: This operation must be run in a work tree 
..

You can see oldrev is empty because of line 54:

oldrev=`git show-branch | grep -v '\*' | grep -v "master"...`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions