Hashar has uploaded a new change for review.
https://gerrit.wikimedia.org/r/60844
Change subject: use git show instead of git diff to find changed files
......................................................................
use git show instead of git diff to find changed files
git diff was using HEAD^ which would not exist on the initial commit.
We also want to make sure we list the files introduced by a merge
commit, something I am not sure diff handled fine.
Change-Id: I58089552a0f192e50d5a4ff92a169c54bbe74acc
---
M bin/git-changed-in-head
1 file changed, 18 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/integration/jenkins
refs/changes/44/60844/1
diff --git a/bin/git-changed-in-head b/bin/git-changed-in-head
index 20da6dc..d711bbb 100755
--- a/bin/git-changed-in-head
+++ b/bin/git-changed-in-head
@@ -27,4 +27,21 @@
for ext in "$@"; do
PATH_ARGS+=("*.$ext")
done;
-git diff HEAD^..HEAD --name-only --diff-filter=ACM -- "${PATH_ARGS[@]}"
+
+# Some explanations for the git command below:
+# HEAD^ will not exist for an initial commit, we thus need `git show`
+# --name-only : strip the patch payload, only report the file being altered
+# --diff-filter=ACM : only care about files Added, Copied or Modified
+# -m : show differences for merge commits ...
+# --first-parent : ... but only follow the first parent commit
+# --format=format: : strip out the commit summary
+#
+# Then we pass the wildcard generated above
+# And finally we need to strip out the empty line generated by format:
+git show HEAD \
+ --name-only \
+ --diff-filter=ACM \
+ -m \
+ --first-parent \
+ --format=format: \
+ -- "${PATH_ARGS[@]}" | egrep -v '^$'
--
To view, visit https://gerrit.wikimedia.org/r/60844
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I58089552a0f192e50d5a4ff92a169c54bbe74acc
Gerrit-PatchSet: 1
Gerrit-Project: integration/jenkins
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits