Search code examples
gitzos

git clone --sparse on Z/OS USS causes "you have unstaged changes" error


I am running on Z/OS Unix System Services and attempting to git clone a single directory from a repository, but am getting an "unstaged changes" error.

The cause is a don't in the README.md, but I don't know how to work round it. Is there a git attributes setting that I can use?

The initial command is for a sparse clone.

git clone --sparse https://github.com/myrepo

That clones and checks out the top level directory and top level files.

I cd into the cloned directory and run

git sparse-checkout add JustThisDir 

To checkout out JustThisDir. These commands work on my MacOS laptop, but on Z/OS USS I get an error

error: cannot set sparse-checkout patterns: You have unstaged changes.

Turns out the README.md file is showing as updated, and I need to run

git commit -am "readme fudge"

before the

git sparse-checkout add JustThisDir 

works.

There are other top level files in the directory, but it is only the README.md that shows as having untagged changes.

git diff

shows

-When your application needs messaging, you don’t 
+When your application needs messaging, you dont 

The repo has don't, but the git copy has dont


Solution

  • Someone just spotted that the apostrophe in the readme didn't look right.

    The fix was the change don’t to don't