[git-buildpackage] Ignoring untracked files

Inaki Malerba inaki at malerba.space
Sat Feb 23 16:14:08 CET 2019


Hi everyone,

Working on Salsa CI pipeline [0] Otto (cced) found the need to include
ccache on our builds.

Gitlab CI has a feature to do this, but it only allows to cache paths
inside the working directory.

As the cache is restored at the beginning of the job, the gbp doesn't
allow to build packages because the untracked path.

```

gbp:error: You have uncommitted changes in your source tree:
gbp:error: On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    debian/.cache

nothing added to commit but untracked files present (use "git add" to track)

gbp:error: Use --git-ignore-new to ignore.
```

Using the `--git-ignore-new` option seems like a big deal, as we only
need to ignore a certain path. Also, adding the path to the .gitignore
file would not be a good option, as it requires the user to make the
change for every project (even if it doesn't use ccache as the pipeline
tries to be generic).

Looking at gbp's code, the behavior we would like to have is something
like follows.

```

diff --git a/gbp/git/repository.py b/gbp/git/repository.py
index a44c71e1..54daeb7f 100644
--- a/gbp/git/repository.py
+++ b/gbp/git/repository.py
@@ -842,6 +842,10 @@ class GitRepository(object):
         out, ret = self._git_getoutput('status',
                                        args.args + paths,
                                        extra_env={'LC_ALL': 'C'})
+
+        to_ignore = b' ?? debian/.cache\n'
+        [out.remove(item) for item in out if item == to_ignore ]
+
         if ret:
             raise GitRepositoryError("Can't get repository status")
         return out
```

We hope someone has a better suggestion :)

Please keep me cc'ed


Cheers,


0_ https://salsa.debian.org/salsa-ci-team/pipeline/issues/27

-- 
- ina



More information about the git-buildpackage mailing list