Use reflog to calculate diff and allow 'git://' repo addresses (#198)

* use reflog instead of ORIG_HEAD to get the changes

* Allow git:// URLS too

Requiring url in repo only allows for https addresses

* trying to fix the tests and regex match

* fix lint
This commit is contained in:
Delio Castillo
2017-11-14 03:36:13 -07:00
committed by Pascal Vizeli
parent fcb9a37c78
commit c077c9fb8d
2 changed files with 3 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "Git pull", "name": "Git pull",
"version": "2.0", "version": "2.1",
"slug": "git_pull", "slug": "git_pull",
"description": "Simple git pull to update the local configuration", "description": "Simple git pull to update the local configuration",
"url": "https://home-assistant.io/addons/git_pull/", "url": "https://home-assistant.io/addons/git_pull/",
@@ -21,7 +21,7 @@
"schema": { "schema": {
"deployment_key": ["str"], "deployment_key": ["str"],
"deployment_key_protocol": "match(rsa|dsa|ecdsa|ed25519|rsa)", "deployment_key_protocol": "match(rsa|dsa|ecdsa|ed25519|rsa)",
"repository": "url", "repository": "match((?:git|ssh|https?|git@[-\\w.]+):(\/\/)?(.*?)(\\.git)(\/?|\\#[-\\d\\w._]+?))",
"auto_restart": "bool", "auto_restart": "bool",
"repeat": { "repeat": {
"active": "bool", "active": "bool",

View File

@@ -43,7 +43,7 @@ while true; do
# Enable autorestart of homeassistant # Enable autorestart of homeassistant
if [ "$AUTO_RESTART" == "true" ]; then if [ "$AUTO_RESTART" == "true" ]; then
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" changed_files="$(git diff-tree -r --name-only --no-commit-id 'HEAD@{1}' HEAD)"
# Files have changed & check config # Files have changed & check config
if [ ! -z "$changed_files" ]; then if [ ! -z "$changed_files" ]; then