From 642284106c58ce8818b8a9e9101a109bc29db32d Mon Sep 17 00:00:00 2001 From: Chirayu Desai Date: Tue, 8 Nov 2022 22:35:43 +0530 Subject: [PATCH] aosp-merger: Run git diff with --no-ext-diff * In case one is using an external diff program such as difftastic, this won't work as expected * thread 'main' panicked at 'Hunk lines should be present in matched lines', /home/$USER/.cargo/registry/src/github.com-1ecc6299db9ec823/difftastic-0.37.0/src/display/hunks.rs:637:31 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace fatal: external diff died, stopping at core/Makefile Change-Id: Ie455016fa24b6e00ea021088cc5fc1e4bca3bf94 --- aosp-merger/_merge_helper.sh | 4 ++-- aosp-merger/_subtree_merge_helper.sh | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/aosp-merger/_merge_helper.sh b/aosp-merger/_merge_helper.sh index f22f2f7..b8fb735 100755 --- a/aosp-merger/_merge_helper.sh +++ b/aosp-merger/_merge_helper.sh @@ -80,7 +80,7 @@ chmod +x .git/hooks/prepare-commit-msg if [ ! -z "${OLDTAG}" ]; then # Was there any change upstream? Skip if not. - if [[ -z "$(git diff ${OLDTAG} ${NEWTAG})" ]]; then + if [[ -z "$(git diff --no-ext-diff ${OLDTAG} ${NEWTAG})" ]]; then echo -e "nochange\t\t${PROJECTPATH}" | tee -a "${MERGEDREPOS}" repo abandon "${STAGINGBRANCH}" . exit 0 @@ -102,7 +102,7 @@ if [[ "${OPERATION}" == "merge" ]]; then # Check if we've actually changed anything after the merge # If we haven't, just abandon the branch - if [[ -z "$(git diff HEAD m/${os_branch})" && -z "$(git status --porcelain)" ]]; then + if [[ -z "$(git diff --no-ext-diff HEAD m/${os_branch})" && -z "$(git status --porcelain)" ]]; then echo -e "nochange\t\t${PROJECTPATH}" | tee -a "${MERGEDREPOS}" repo abandon "${STAGINGBRANCH}" . exit 0 diff --git a/aosp-merger/_subtree_merge_helper.sh b/aosp-merger/_subtree_merge_helper.sh index a935284..a384a91 100755 --- a/aosp-merger/_subtree_merge_helper.sh +++ b/aosp-merger/_subtree_merge_helper.sh @@ -80,7 +80,7 @@ chmod +x .git/hooks/prepare-commit-msg if [ ! -z "${OLDTAG}" ]; then # Was there any change upstream? Skip if not. - if [[ -z "$(git diff ${OLDTAG} ${NEWTAG})" ]]; then + if [[ -z "$(git diff --no-ext-diff ${OLDTAG} ${NEWTAG})" ]]; then echo -e "nochange\t\t${PROJECTPATH}" | tee -a "${MERGEDREPOS}" repo abandon "${STAGINGBRANCH}" . exit 0 @@ -101,7 +101,7 @@ CONFLICT="" echo "#### Merging ${NEWTAG} into ${PROJECTPATH} ####" git merge --no-commit --log "${NEWTAG}" -if [[ -z "$(git diff HEAD)" ]]; then +if [[ -z "$(git diff --no-ext-diff HEAD)" ]]; then echo "#### Skipping empty merge ####" git reset --hard else @@ -119,7 +119,7 @@ for subtree in `find -mindepth 2 -type f -name .gitupstream | cut -d / -f 2- | s git fetch -q --force --tags "$(cat ${gitupstream})" "${NEWTAG}" git merge -X subtree="$subtree" --no-commit --log "${NEWTAG}" - if [[ -z "$(git diff HEAD)" ]]; then + if [[ -z "$(git diff --no-ext-diff HEAD)" ]]; then echo "#### Skipping empty merge on ${subtree} ####" git reset --hard continue @@ -138,7 +138,7 @@ done # Check if we've actually changed anything after the merge # If we haven't, just abandon the branch -if [[ -z "$(git diff HEAD m/${os_branch})" && -z "$(git status --porcelain)" ]]; then +if [[ -z "$(git diff --no-ext-diff HEAD m/${os_branch})" && -z "$(git status --porcelain)" ]]; then echo -e "nochange\t\t${PROJECTPATH}" | tee -a "${MERGEDREPOS}" repo abandon "${STAGINGBRANCH}" . exit 0