z/OS Tools & Language

Expand all | Collapse all

Git status shows entire working tree is modified immediately after git clone

  • 1.  Git status shows entire working tree is modified immediately after git clone

    Posted 11-08-2018 17:34

    I am using rocket git port on z/OS. I’ve noticed that when I clone a repository and immediately run git st, the entire working tree is “modified”. Running ‘git diff’ indicates no changes, but the subsequent git st indicates a clean working directory. See attached screenshot for details.

    I thought it may be related to line-endings, but that does not seem to be the case. I have line-endings configured properly.

    user:git ls-files -s --eol
    100644 1561467227212850a7cdb9af5e78d3d63fcca8dd 0 i/lf w/lf attr/text hello.c



  • 2.  RE: Git status shows entire working tree is modified immediately after git clone

    Posted 11-09-2018 12:50

    Can you please run the following commands in the cloned (hello_world) directory and post the results? You may edit/filter any content that you consider sensitive.

    Thanks!

     git --version
     ls -laT
     set


  • 3.  RE: Git status shows entire working tree is modified immediately after git clone

    Posted 11-12-2018 11:03

    git version 2.14.4_zos_b06

    drwx------   3 JJMURO   DEPTD60     8192 Nov  8 16:30 .
    drwx------   3 JJMURO   DEPTD60     8192 Nov  9 10:24 ..
    drwx------   8 JJMURO   DEPTD60     8192 Nov  8 16:31 .git
    t ISO8859-1   T=on  -rw-------   1 JJMURO   DEPTD60      391 Nov  8 16:30 .gitattributes
    t IBM-1047    T=on  -rw-------   1 JJMURO   DEPTD60      176 Nov  8 16:30 README.md
    t IBM-1047    T=on  -rw-------   1 JJMURO   DEPTD60       79 Nov  8 16:30 hello.c
    
    BASH=/usrbin/bash43/bash
    BASH43_HOME=/usrbin/bash43
    BASHOPTS=cmdhist:complete_fullquote:expand_aliases:extquote:force_fignore:histappend:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
    BASH_VERSINFO=([0]="4" [1]="3" [2]="48" [3]="10" [4]="release" [5]="i370-ibm-openedition")
    BASH_VERSION='4.3.48(10)-release'
    EDITOR=vi
    GIT_EXEC_PATH=/usrbin/git/libexec/git-core
    GIT_ROOT=/usrbin/git
    GIT_SHELL=/usrbin/bash43/bash
    GIT_TEMPLATE_DIR=/usrbin/git/share/git-core/templates
    PATH=.:/u/jjmuro/bin:/usrbin/bash43:/bin:/usr/bin:/java/J8.0_64/bin:/usr/lpp/cbclib/xlc/bin:/usr/lpp/cobol/bin:/usr/lpp/jazz/v6.0.6/scmtools/eclipse:/u/mvsbuild/nirvana-git/git/bin
    PER5LIB=:/u/mvsbuild/nirvana-git/git/lib/perl5
    PIPESTATUS=([0]="0")
    SHELLOPTS=braceexpand:hashall:histexpand:history:interactive-comments:monitor:vi
    SHLVL=1
    STEPLIB=none
    TZ=EST5EDT
    _BPXK_AUTOCVT=ON
    _BPX_SHAREAS=YES
    _CEE_RUNOPTS='FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)'
    _TAG_REDIR_ERR=txt
    _TAG_REDIR_IN=txt
    _TAG_REDIR_OUT=txt


  • 4.  RE: Git status shows entire working tree is modified immediately after git clone

    Posted 11-12-2018 11:40

    Thanks. Can I ask for a bit more information?

    • Can you provide the content of the .gitattributes file?
    • Can you run these commands in order? I want to see if the working tree is actually changing between the two invocations of git status:
         type git
         git clone git@github.ibm.com:joewmuro/hello-world.git
         cd hello-world
         ls -lTa .
         git st
         ls -lTa .
         git st
    

    Also, does this problem occur when cloning other repos? Could you try it with either this (if you have an account on github.com with an SSH key):

     git@github.com:zorts/hello_world.git
    

    or this:

     git clone https://github.com/zorts/hello_world.git
    

    Note that, for the latter, you will have to set the environment variable GIT_SSL_CAINFO to point to your cacert.pem file, or else disable SSL checking (not recommended except for testing…) with:

     git config --global http.sslVerify false
    

    – Jerry



  • 5.  RE: Git status shows entire working tree is modified immediately after git clone

    Posted 11-16-2018 12:35

    Interesting, the problem does not appear when cloning the public git repo hello_world.

    Here is my .gitattributes:

        JJMURO>cat .gitattributes 
    
        # These files are text and should be normalized (convert crlf => lf)
    
        *.c text
        *.h text
    
        # encode all files as EBCDIC unless mentioned elsewhere
        * git-encoding=iso8859-1 zos-working-tree-encoding=ibm-1047
    
        # encode selected files as ascii 
        .gitattributes git-encoding=ISO8859-1 zos-working-tree-encoding=iso8859-1
        .gitignore git-encoding=iso8859-1 zos-working-tree-encoding=iso8859-1
    

    Here is output of commands:

    JJMURO>type git
    git is hashed (/u/mvsbuild/nirvana-git/git/bin/git)
    JJMURO>git --version
    git version 2.14.4_zos_b06
    JJMURO>git clone git@github.ibm.com:joemuro/hello-world.git 
    Cloning into 'hello-world'...
    remote: Counting objects: 13, done.
    remote: Total 13 (delta 0), reused 0 (delta 0), pack-reused 13
    Receiving objects: 100% (13/13), done.
    Resolving deltas: 100% (1/1), done.
    JJMURO>cd hello-world/
    JJMURO>lt
    total 48
                        drwx------   3 JJMURO   DEPTABC     8192 Nov 16 11:32 .
                        drwx------   4 JJMURO   DEPTABC     8192 Nov 16 11:32 ..
                        drwx------   8 JJMURO   DEPTABC     8192 Nov 16 11:32 .git
    t ISO8859-1   T=on  -rw-------   1 JJMURO   DEPTABC      391 Nov 16 11:32 .gitattributes
    t IBM-1047    T=on  -rw-------   1 JJMURO   DEPTABC      176 Nov 16 11:32 README.md
    t IBM-1047    T=on  -rw-------   1 JJMURO   DEPTABC       79 Nov 16 11:32 hello.c
    JJMURO>git st
    On branch master
    Your branch is up-to-date with 'origin/master'.
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git checkout -- <file>..." to discard changes in working directory)
    
    	modified:   README.md
    	modified:   hello.c
    
    no changes added to commit (use "git add" and/or "git commit -a")
    JJMURO>lt
    total 48
                        drwx------   3 JJMURO   DEPTABC     8192 Nov 16 11:32 .
                        drwx------   4 JJMURO   DEPTABC     8192 Nov 16 11:32 ..
                        drwx------   8 JJMURO   DEPTABC     8192 Nov 16 11:32 .git
    t ISO8859-1   T=on  -rw-------   1 JJMURO   DEPTABC      391 Nov 16 11:32 .gitattributes
    t IBM-1047    T=on  -rw-------   1 JJMURO   DEPTABC      176 Nov 16 11:32 README.md
    t IBM-1047    T=on  -rw-------   1 JJMURO   DEPTABC       79 Nov 16 11:32 hello.c
    JJMURO>git diff
    JJMURO>lt
    total 48
                        drwx------   3 JJMURO   DEPTABC     8192 Nov 16 11:32 .
                        drwx------   4 JJMURO   DEPTABC     8192 Nov 16 11:32 ..
                        drwx------   8 JJMURO   DEPTABC     8192 Nov 16 11:32 .git
    t ISO8859-1   T=on  -rw-------   1 JJMURO   DEPTABC      391 Nov 16 11:32 .gitattributes
    t IBM-1047    T=on  -rw-------   1 JJMURO   DEPTABC      176 Nov 16 11:32 README.md
    t IBM-1047    T=on  -rw-------   1 JJMURO   DEPTABC       79 Nov 16 11:32 hello.c
    JJMURO>git st
    
    On branch master
    
    Your branch is up-to-date with 'origin/master'.
    
    nothing to commit, working directory clean
    
    JJMURO>
    

    (I have lt aliased to ls -lTa)