kas icon indicating copy to clipboard operation
kas copied to clipboard

gitconfig zdiff3 breaks kas checkout

Open kwalker-plxs opened this issue 8 months ago • 3 comments

I am running kas within a docker image to manage my Yocto project configuration. I recently updated my global gitconfig to set the merge.conflictstyle to zdiff3.

While performing a kas checkout of my project, I ran into this error:

2025-05-06 22:15:14 - ERROR - Command "git checkout -q a82f138b140f613a06bf9ac60101e4bb511c309f -B scarthgap" failed with error 128

If I navigate to the appropriate layer that is being checked out and run the above git checkout, I do not have any issues.

I found that commenting out the conflictstyle or replacing zdiff3 with diff3 in my gitconfig makes the issue go away.

Version Information:

  • kas 4.7
  • git 2.45.2

Simple inputs for reproduction:

  • kas-git-conflictstyle.yml
header:
  version: 8

repos:

  meta-freescale:
    url: https://github.com/Freescale/meta-freescale
    branch: scarthgap
    path: layers/meta-freescale
  • gitconfig
[merge]
        conflictstyle = zdiff3

kwalker-plxs avatar May 06 '25 22:05 kwalker-plxs

Hi, I tried to reproduce this both with a local kas, as well as with kas-container. However, for me this properly works (except that the example does not provide a init-build-env script).

Please try to reproduce this in kas-container:

export GITCONFIG_FILE=~/.gitconfig
kas-container checkout kas-git-conflictstyle.yml

fmoessbauer avatar May 07 '25 15:05 fmoessbauer

I was not able to reproduce this issue within kas-container.

kas-container debug output

default@ubuntu22:~/yocto-project-template$ kas-container -l debug checkout kas-git-conflictstyle.yml 
+ docker run -v /home/default/yocto-project-template:/repo:ro -v /home/default/yocto-project-template:/work:rw -e KAS_WORK_DIR=/work -v /home/default/yocto-project-template/build:/build:rw --workdir=/repo -e KAS_BUILD_DIR=/build -e USER_ID=1000 -e GROUP_ID=1000 --rm --init -v /home/default/.gitconfig:/var/kas/userdata/.gitconfig:ro -e GITCONFIG_FILE=/var/kas/userdata/.gitconfig -t -i -e TERM=xterm-256color -e SHELL=/bin/bash --log-driver=none --user=root ghcr.io/siemens/kas/kas:4.7 -l debug checkout /repo/kas-git-conflictstyle.yml
2025-05-27 14:51:52 - INFO     - kas 4.7 started
2025-05-27 14:51:52 - DEBUG    - Using selector: EpollSelector
2025-05-27 14:51:52 - DEBUG    - /repo$ git rev-parse --show-toplevel --show-superproject-working-tree
2025-05-27 14:51:52 - DEBUG    - /repo$ git rev-parse --show-toplevel --show-superproject-working-tree
2025-05-27 14:51:52 - DEBUG    - execute setup_dir
2025-05-27 14:51:52 - DEBUG    - execute setup_home
2025-05-27 14:51:52 - DEBUG    - execute init_setup_repos
2025-05-27 14:51:52 - DEBUG    - execute repo_setup_loop
2025-05-27 14:51:52 - DEBUG    - Loop repo_setup_loop: execute setup_repos_step
2025-05-27 14:51:52 - DEBUG    - execute finish_setup_repos
2025-05-27 14:51:52 - INFO     - Cloning repository meta-freescale
2025-05-27 14:51:52 - DEBUG    - /work$ git clone -q https://github.com/Freescale/meta-freescale /work/layers/meta-freescale
2025-05-27 14:52:04 - DEBUG    - /work/layers/meta-freescale$ git remote set-url origin https://github.com/Freescale/meta-freescale
2025-05-27 14:52:04 - DEBUG    - /work/layers/meta-freescale$ git cat-file -t scarthgap
2025-05-27 14:52:04 - DEBUG    - /work/layers/meta-freescale$ git fetch -q
2025-05-27 14:52:05 - INFO     - Repository meta-freescale updated
2025-05-27 14:52:05 - DEBUG    - Configuration from config file:
{'header': {'version': 8},
 'repos': {'meta-freescale': {'url': 'https://github.com/Freescale/meta-freescale',
                              'branch': 'scarthgap',
                              'path': 'layers/meta-freescale'}}}
2025-05-27 14:52:05 - DEBUG    - execute repos_checkout
2025-05-27 14:52:05 - DEBUG    - /work/layers/meta-freescale$ git diff --stat
2025-05-27 14:52:05 - DEBUG    - /work/layers/meta-freescale$ git rev-parse --verify -q origin/scarthgap
2025-05-27 14:52:05 - DEBUG    - /work/layers/meta-freescale$ git checkout -q a82f138b140f613a06bf9ac60101e4bb511c309f -B scarthgap
2025-05-27 14:52:05 - INFO     - Repository meta-freescale checked out to a82f138b140f613a06bf9ac60101e4bb511c309f
2025-05-27 14:52:05 - DEBUG    - execute repos_apply_patches
2025-05-27 14:52:05 - DEBUG    - execute setup_environ
2025-05-27 14:52:05 - ERROR    - Did not find any init-build-env script

kas debug output

default@ubuntu22:~/yocto-project-template$ kas -l debug checkout kas-git-conflictstyle.yml 
2025-05-27 09:52:39 - INFO     - kas 4.7 started
2025-05-27 09:52:39 - DEBUG    - Using selector: EpollSelector
2025-05-27 09:52:39 - DEBUG    - /home/default/yocto-project-template$ git rev-parse --show-toplevel --show-superproject-working-tree
2025-05-27 09:52:39 - DEBUG    - /home/default/yocto-project-template$ git rev-parse --show-toplevel --show-superproject-working-tree
2025-05-27 09:52:39 - DEBUG    - execute setup_dir
2025-05-27 09:52:39 - DEBUG    - execute setup_home
2025-05-27 09:52:39 - DEBUG    - execute init_setup_repos
2025-05-27 09:52:39 - DEBUG    - execute repo_setup_loop
2025-05-27 09:52:39 - DEBUG    - Loop repo_setup_loop: execute setup_repos_step
2025-05-27 09:52:39 - DEBUG    - execute finish_setup_repos
2025-05-27 09:52:39 - INFO     - Cloning repository meta-freescale
2025-05-27 09:52:39 - DEBUG    - /home/default/yocto-project-template$ git clone -q https://github.com/Freescale/meta-freescale /home/default/yocto-project-template/layers/meta-freescale
2025-05-27 09:52:41 - DEBUG    - /home/default/yocto-project-template/layers/meta-freescale$ git remote set-url origin https://github.com/Freescale/meta-freescale
2025-05-27 09:52:41 - DEBUG    - /home/default/yocto-project-template/layers/meta-freescale$ git cat-file -t scarthgap
2025-05-27 09:52:41 - DEBUG    - /home/default/yocto-project-template/layers/meta-freescale$ git fetch -q
2025-05-27 09:52:42 - INFO     - Repository meta-freescale updated
2025-05-27 09:52:42 - DEBUG    - Configuration from config file:
{'header': {'version': 8},
 'repos': {'meta-freescale': {'url': 'https://github.com/Freescale/meta-freescale',
                              'branch': 'scarthgap',
                              'path': 'layers/meta-freescale'}}}
2025-05-27 09:52:42 - DEBUG    - execute repos_checkout
2025-05-27 09:52:42 - DEBUG    - /home/default/yocto-project-template/layers/meta-freescale$ git diff --stat
2025-05-27 09:52:42 - DEBUG    - /home/default/yocto-project-template/layers/meta-freescale$ git rev-parse --verify -q origin/scarthgap
2025-05-27 09:52:42 - DEBUG    - /home/default/yocto-project-template/layers/meta-freescale$ git checkout -q a82f138b140f613a06bf9ac60101e4bb511c309f -B scarthgap
2025-05-27 09:52:42 - ERROR    - Command "git checkout -q a82f138b140f613a06bf9ac60101e4bb511c309f -B scarthgap" failed with error 128

kwalker-plxs avatar May 27 '25 14:05 kwalker-plxs

It looks like this boils down to a failing checkout:

/home/default/yocto-project-template/layers/meta-freescale$
git checkout -q a82f138b140f613a06bf9ac60101e4bb511c309f -B scarthgap

Please try to run this command directly on the terminal (without kas) and check if that works. I'm wondering how zdiff3 is even involved in a git checkout.

fmoessbauer avatar May 27 '25 15:05 fmoessbauer