{"thread":{"id":"3027","subject":"[PATCH] GIT-VERSION-GEN: detect dirty tree and mark the version accordingly.","startedAt":"2006-01-10T02:53:15Z","lastAt":"2006-01-10T02:53:15Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"14388","messageId":"7vlkxobxpg.fsf@assigned-by-dhcp.cox.net","threadId":"3027","inReplyTo":null,"subject":"[PATCH] GIT-VERSION-GEN: detect dirty tree and mark the version accordingly.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-10T02:53:15Z","receivedAt":"2006-01-10T02:53:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"If we are building from a working tree with local modifications,\nmark the version accordingly.\n\nDeliberately uses '-' to prevent RPM from being built from such\na tree.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n * This is a useful precaution and should be safe, so planned to\n   go into 1.1.1.\n\n GIT-VERSION-GEN |    6 ++++++\n 1 files changed, 6 insertions(+), 0 deletions(-)\n\n339b684aa42ac80964ef0d9049445dad7f83848c\ndiff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN\nindex c878819..cb393b5 100755\n--- a/GIT-VERSION-GEN\n+++ b/GIT-VERSION-GEN\n@@ -11,6 +11,14 @@ set)\n \t;;\n esac\n \n+dirty=$(sh -c 'git-diff-files --name-only HEAD' 2>/dev/null) || dirty=\n+case \"$dirty\" in\n+'')\n+\t;;\n+*)\n+\tVN=\"$VN-dirty\" ;;\n+esac\n+\n if test -r $GVF\n then\n \tVC=$(sed -e 's/^GIT_VERSION = //' <$GVF)\n-- \n1.1.0\n"}]}