Repository: alan-turing-institute/repro-catalogue

Issue:
Warning not given if untracked files are present
Running `catalogue engage --input_data data/ --code .` with uncommitted changes to a file results in the expected warning:
```
Working directory contains uncommitted changes.
Do you want to stage and commit all changes? (y/[n])
```
but the warning is not generated if there are only untracked files present.

Is this expected behaviour? It's not what I would personally expect, as someone developing their analysis could have added new functionality in the untracked files.

Discussion:

Patch:
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
deleted file mode 100644
index 6cc75fd..0000000
--- a/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,66 +0,0 @@
-# Code of Conduct
-
-We value the participation of every member of our community and want to ensure 
-that every contributer has an enjoyable and fulfilling experience. Accordingly, 
-everyone who participates in the `repro-catalogue` project is expected to show respect and 
-courtesy to other community members at all time.
-
-In the interest of fostering an open and welcoming environment, we as
-contributors and maintainers are dedicated to making participation in our project 
-a harassment-free experience for everyone, regardless of age, body
-size, disability, ethnicity, sex characteristics, gender identity and expression,
-level of experience, education, socio-economic status, nationality, personal
-appearance, race, religion, or sexual identity and orientation. 
-
-## Our Standards
-
-Examples of behavior that contributes to creating a positive environment
-include:
-
-- Using welcoming and inclusive language
-- Being respectful of differing viewpoints and experiences
-- Gracefully accepting constructive criticism
-- Focusing on what is best for the community
-- Showing empathy towards other community members
-
-Examples of unacceptable behavior by participants include:
-
-- The use of sexualized language or imagery and unwelcome sexual attention or
- advances
-- Trolling, insulting/derogatory comments, and personal or political attacks
-- Public or private harassment
-- Publishing others' private information, such as a physical or electronic
- address, without explicit permission
-- Other conduct which could reasonably be considered inappropriate in a
- professional setting
-
-## Our Responsibilities
-
-Project maintainers are responsible for clarifying the standards of acceptable
-behavior and are expected to take appropriate and fair corrective action in
-response to any instances of unacceptable behavior.
-
-Project maintainers have the right and responsibility to remove, edit, or
-reject comments, commits, code, wiki edits, issues, and other contributions
-that are not aligned to this Code of Conduct, or to ban temporarily or
-permanently any contributor for other behaviors that they deem inappropriate,
-threatening, offensive, or harmful.
-
-## Enforcement
-
-Instances of abusive, harassing, or otherwise unacceptable behavior may be
-reported by contacting the project team at [rjersakova@turing.ac.uk](mailto:rjersakova@turing.ac.uk). All
-complaints will be reviewed and investigated and will result in a response that
-is deemed necessary and appropriate to the circumstances. The project team is
-obligated to maintain confidentiality with regard to the reporter of an incident.
-Further details of specific enforcement policies may be posted separately.
-
-Project maintainers who do not follow or enforce the Code of Conduct in good
-faith may face temporary or permanent repercussions as determined by other
-members of the project's leadership.
-
-## Attribution
-
-This Code of Conduct is adapted from the [scona project Code of Conduct](https://github.com/WhitakerLab/scona/blob/master/CODE_OF_CONDUCT.md) 
-and the [Contributor Covenant][https://www.contributor-covenant.org], version [1.4](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html)
-
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
deleted file mode 100644
index 57648e7..0000000
--- a/CONTRIBUTING.md
+++ /dev/null
@@ -1,153 +0,0 @@
-# Contributing to repro-catalogue
-
- **Welcome to the repro-catalogue repository!**
- We're excited you're here and want to contribute.
-
- We hope that these guidelines make it as easy as possible to get involved.
- If you have any questions that aren't discussed below, please let us know by opening an [issue](https://github.com/alan-turing-institute/repro-catalogue/issues).
-
- We welcome all contributions from documentation to testing to writing code.
- Don't let trying to be perfect get in the way of being good - exciting ideas are more important than perfect pull requests.
-
- ## Table of contents
-
- - [Where to start: issues](#where-to-start-issues)
- - [Making a change with a pull request](#making-a-change-with-a-pull-request)
-   - [1. Comment on an existing issue or open a new issue referencing your addition](#1-comment-on-an-existing-issue-or-open-a-new-issue-referencing-your-addition)
-   - [2. Fork the repro-catalogue repository to your profile](#2-fork-the-repro-catalogue-repository-to-your-profile)
-   - [3. Make the changes you've discussed](#3-make-the-changes-youve-discussed)
-   - [4. Submit a pull request](#4-submit-a-pull-request)
- - [Style guide](#style-guide)
-
- ## Where to start: issues
-
- * **Issues** are individual pieces of work that need to be completed to move the project forwards.
- A general guideline: if you find yourself tempted to write a great big issue that
- is difficult to describe as one unit of work, please consider splitting it into two or more issues.
-
- Before you open a new issue, please check if any of our [open issues](https://github.com/alan-turing-institute/repro-catalogue/issues) covers your idea already.
-
- The list of labels for current issues includes:
-
- - [![help-wanted](https://img.shields.io/badge/-help%20wanted-159818.svg)][labels-helpwanted] _These issues contain a task that a member of the team has determined we need additional help with._
-
-   If you feel that you can contribute to one of these issues, we especially encourage you to do so!
-
- - [![question](https://img.shields.io/badge/-question-cc317c.svg)][labels-question] _These issues contain a question that you'd like to have answered._
-
-   Opening an issue is a great way to start a conversation and get your answer.
-
- - [![good-first-issue](https://img.shields.io/badge/-good%20first%20issue-1b3487.svg)][labels-firstissue] _These issues are particularly appropriate if it is your first contribution to repro-catalogue, or to GitHub overall._
-
-- [![documentation](https://img.shields.io/badge/-documentation-blue)][labels-documentation] _These issues relate to improving or updating the documentation._
-
- - [![enhancement](https://img.shields.io/badge/-enhancement-84b6eb.svg)][labels-enhancement] _These issues are suggesting new features that can be added to the project._
-
-   If you want to ask for something new, please try to make sure that your request is distinct from any others that are already in the queue (or part of repro-catalogue).
-   If you find one that's similar but there are subtle differences please reference the other enhancement in your issue.
-
- - [![bug](https://img.shields.io/badge/-bug-d73a4a.svg)][labels-bug] _These issues are reporting a problem or a mistake in the project._
-
-   The more details you can provide the better!
-   If you know how to fix the bug, please open an issue first and then submit a pull request.
-
- ## Making a change with a pull request
-
- We appreciate all contributions to repro-catalogue.
- **THANK YOU** for helping us.
-
- All project management, conversations and questions related to the repro-catalogue project happens here in the [repro-catalogue repository][repro-catalogue-repo].
-
- The following steps are a guide to help you contribute in a way that will be easy for everyone to review and accept with ease.
-
- ### 1. Comment on an [existing issue](https://github.com/alan-turing-institute/repro-catalogue/issues) or open a new issue referencing your addition
-
- This allows other members of the repro-catalogue team to confirm that you aren't overlapping with work that's currently underway and that everyone is on the same page with the goal of the work you're going to carry out.
-
- [This blog](https://www.igvita.com/2011/12/19/dont-push-your-pull-requests/) is a nice explanation of why putting this work in up front is so useful to everyone involved.
-
- ### 2. [Fork][github-fork] the [repro-catalogue repository][repro-catalogue-repo] to your profile
-
- This is now your own unique copy of repro-catalogue.
- Changes here won't affect anyone else's work, so it's a safe space to explore edits to the code!
-
- Make sure to [keep your fork up to date][github-syncfork] with the master repository, otherwise you can end up with lots of dreaded [merge conflicts][github-mergeconflicts].
-
- ### 3. Make the changes you've discussed
-
- Try to keep the changes focused.
- If you submit a large amount of work all in one go it will be much more work for whomever is reviewing your pull request.
-
- While making your changes, commit often and write good, detailed commit messages.
- [This blog](https://chris.beams.io/posts/git-commit/) explains how to write a good Git commit message and why it matters.
- It is also perfectly fine to have a lot of commits - including ones that break code.
- A good rule of thumb is to push up to GitHub when you _do_ have passing tests then the continuous integration (CI) has a good chance of passing everything.
-
- If you feel tempted to "branch out" then please make a [new branch][github-branches] and a [new issue][repro-catalogue-issues] to go with it. [This blog](https://nvie.com/posts/a-successful-git-branching-model/) details the different Git branching models.
-
- Please do not re-write history!
- That is, please do not use the [rebase](https://help.github.com/en/articles/about-git-rebase) command to edit previous commit messages, combine multiple commits into one, or delete or revert commits that are no longer necessary.
-
- ### 4. Submit a [pull request][github-pullrequest]
-
- We encourage you to open a pull request as early in your contributing process as possible.
- This allows everyone to see what is currently being worked on.
- It also provides you, the contributor, feedback in real time from both the community and the continuous integration as you make commits (which will help prevent stuff from breaking).
-
- When you are ready to submit a pull request, make sure the contents of the pull request body do the following:
- - Describe the problem you're trying to fix in the pull request, reference any related issues and use keywords fixes/close to automatically close them, if pertinent.
- - List changes proposed in the pull request.
- - Describe what the reviewer should concentrate their feedback on.
-
- If you have opened the pull request early and know that its contents are not ready for review or to be merged, add "[WIP]" at the start of the pull request title, which stands for "Work in Progress".
- When you are happy with it and are happy for it to be merged into the main repository, change the "[WIP]" in the title of the pull request to "[Ready for review]".
-
- A member of the repro-catalogue team will then review your changes to confirm that they can be merged into the main repository.
- A [review][github-review] will probably consist of a few questions to help clarify the work you've done.
- Keep an eye on your GitHub notifications and be prepared to join in that conversation.
-
- You can update your [fork][github-fork] of repro-catalogue [repository][repro-catalogue-repo] and the pull request will automatically update with those changes.
- You don't need to submit a new pull request when you make a change in response to a review.
-
- You can also submit pull requests to other contributors' branches!
- Do you see an [open pull request](https://github.com/alan-turing-institute/repro-catalogue/pulls) that you find interesting and want to contribute to?
- Simply make your edits on their files and open a pull request to their branch!
-
- What happens if the continuous integration (CI) fails (for example, if the pull request notifies you that "Some checks were not successful")?
- The CI could fail for a number of reasons.
- At the bottom of the pull request, where it says whether your build passed or failed, you can click “Details” next to the test, which takes you to the Travis page.
- You can view the log or rerun the checks if you have write access to the repo by clicking the “Restart build” button in the top right (you must be logged in to Travis CI with your GitHub account see the “Restart build” button).
-
- GitHub has a [nice introduction][github-flow] to the pull request workflow, but please get in touch if you have any questions.
-
- ## Style Guide
-
- Docstrings should follow [numpydoc][link_numpydoc] convention.
- We encourage extensive documentation.
-
- The python code itself should follow [PEP8][link_pep8] convention whenever possible, with at most about 500 lines of code (not including docstrings) per script.
-
- ---
-
- _These Contributing Guidelines have been adapted from [The Turing Way Contributing Guidelines](https://github.com/alan-turing-institute/the-turing-way/blob/master/CONTRIBUTING.md)! (License: MIT)_
-
- [repro-catalogue-repo]: https://github.com/alan-turing-institute/repro-catalogue/
- [repro-catalogue-issues]: https://github.com/alan-turing-institute/repro-catalogue/issues
- [git]: https://git-scm.com
- [github]: https://github.com
- [github-branches]: https://help.github.com/articles/creating-and-deleting-branches-within-your-repository
- [github-fork]: https://help.github.com/articles/fork-a-repo
- [github-flow]: https://guides.github.com/introduction/flow
- [github-mergeconflicts]: https://help.github.com/articles/about-merge-conflicts
- [github-pullrequest]: https://help.github.com/articles/creating-a-pull-request
- [github-review]: https://help.github.com/articles/about-pull-request-reviews
- [github-syncfork]: https://help.github.com/articles/syncing-a-fork
- [labels-bug]: https://github.com/alan-turing-institute/repro-catalogue/labels/bug
- [labels-enhancement]: https://github.com/alan-turing-institute/repro-catalogue/labels/enhancement
- [labels-firstissue]: https://github.com/alan-turing-institute/repro-catalogue/labels/good%20first%20issue
- [labels-helpwanted]: https://github.com/alan-turing-institute/repro-catalogue/labels/help%20wanted
- [labels-project-management]: https://github.com/alan-turing-institute/repro-catalogue/labels/project%20management
- [labels-question]: https://github.com/alan-turing-institute/repro-catalogue/labels/question
- [labels-documentation]: https://github.com/alan-turing-institute/repro-catalogue/labels/documentation
- [link_numpydoc]: https://numpydoc.readthedocs.io/en/latest/format.html
- [link_pep8]: https://www.python.org/dev/peps/pep-0008/
diff --git a/catalogue/catalogue.py b/catalogue/catalogue.py
index abca5b2..2d0847f 100644
--- a/catalogue/catalogue.py
+++ b/catalogue/catalogue.py
@@ -5,6 +5,8 @@ from itertools import chain
 import hashlib
 import git
 from git import InvalidGitRepositoryError, RepositoryDirtyError
+from .utils import prune_files
+
 
 def hash_file(filepath, m=None):
     '''
@@ -170,17 +172,21 @@ def hash_output(output_data):
         raise AssertionError("Provided input {} is not a file or directory".format(output_data))
 
 
-def hash_code(repo_path):
+def hash_code(repo_path, catalogue_dir):
     """
     Get commit digest for current HEAD commit
 
-    Returns the current HEAD commit digest for the code that is run. If the current working
-    directory is not clean, it raises a `RepositoryDirtyError`.
+    Returns the current HEAD commit digest for the code that is run.
+
+    If the current working directory is dirty (or has untracked files other
+    than those held in `catalogue_dir`), it raises a `RepositoryDirtyError`.
 
     Parameters
     ----------
     repo_path: str
         Path to analysis directory git repository.
+    catalogue_dir: str
+        Path to directory with catalogue output files.
 
     Returns
     -------
@@ -193,7 +199,8 @@ def hash_code(repo_path):
     except InvalidGitRepositoryError:
         raise InvalidGitRepositoryError("provided code directory is not a valid git repository")
 
-    if repo.is_dirty():
+    untracked = prune_files(repo.untracked_files, catalogue_dir)
+    if repo.is_dirty() or len(untracked) != 0:
         raise RepositoryDirtyError(repo, "git repository contains uncommitted changes")
 
     return repo.head.commit.hexsha
@@ -223,7 +230,7 @@ def construct_dict(timestamp, args):
             args.input_data : hash_input(args.input_data)
         },
         "code": {
-            args.code : hash_code(args.code)
+            args.code : hash_code(args.code, args.catalogue_results)
         }
     }
     if hasattr(args, 'output_data'):
@@ -253,7 +260,7 @@ def store_hash(hash_dict, timestamp, store, ext="json"):
     """
 
     os.makedirs(store, exist_ok=True)
-    
+
     with open(os.path.join(store, "{}.{}".format(timestamp, ext)),"w") as f:
         json.dump(hash_dict, f)
 
diff --git a/catalogue/engage.py b/catalogue/engage.py
index 53d4e97..388f9c9 100644
--- a/catalogue/engage.py
+++ b/catalogue/engage.py
@@ -6,29 +6,32 @@ from git import InvalidGitRepositoryError
 
 from . import catalogue as ct
 from .compare import compare_hashes, print_comparison
-from .utils import create_timestamp, check_paths_exists
+from .utils import create_timestamp, check_paths_exists, prune_files
 
 
-def git_query(repo_path, commit_changes=False):
+def git_query(repo_path, catalogue_dir, commit_changes=False):
     """
     Check status of a git repository
 
     Checks the git status of the repository on the provided path
     - if clean, returns true
-    - if there are uncommitted changes, and the `commit_changes` flag is
-        `True`, ask for the users offer to stage and commit all and continue
-        (returning `True`)
+    - if there are uncommitted changes (including untracked files other than
+        those held in `catalogue_dir`), and the `commit_changes` flag is
+        `True`, offer the user to stage and commit all tracked (and untracked)
+        files and continue (returns `True`)
         otherwise, returns `False`
 
     If the `commit_changes` flag is `True` and the user accepts the offer
     to commit changes, a new branch is created with the name
     `"catalogue-%Y%m%d-%H%M%S"` and all tracked files that have been
-    changed will be staged and committed.
+    changed & any untracked files will be staged and committed.
 
     Parameters:
     ------------
     repo_path : str
         path to the code directory
+    catalogue_dir : str
+        path to directory with catalogue output files
     commit_changes : bool
         boolean indicating if the user should be prompted to stage and commit changes
         (optional, default is False)
@@ -43,7 +46,9 @@ def git_query(repo_path, commit_changes=False):
     except InvalidGitRepositoryError:
         raise InvalidGitRepositoryError("provided code directory is not a valid git repository")
 
-    if repo.is_dirty():
+    untracked = prune_files(repo.untracked_files, catalogue_dir)
+
+    if repo.is_dirty() or (len(untracked) != 0):
         if commit_changes:
             print("Working directory contains uncommitted changes.")
             print("Do you want to stage and commit all changes? (y/[n])")
@@ -53,6 +58,7 @@ def git_query(repo_path, commit_changes=False):
                 new_branch = repo.create_head("catalogue-" + timestamp)
                 new_branch.checkout()
                 changed_files = [ item.a_path for item in repo.index.diff(None) ]
+                changed_files.extend(untracked)
                 repo.index.add(changed_files)
                 repo.index.commit("repro-catalogue tool auto commit at " + timestamp)
                 return True
@@ -76,15 +82,25 @@ def engage(args):
 
     The engage command:
         - does a `git_query()` check of the `code` repo
+            (engage does not proceed unless the repo is clean)
         - gets hashes for the input_data and code (from `construct_dict()`)
         - saves the hashes to a `.lock` file
 
     Once engaged (a `.lock` file exists), the command cannot be run again until
     `disengage` has been run.
+
+    Parameters:
+    ------------
+    args : obj
+        Command line input arguments (argparse.Namespace).
+
+    Returns:
+    ---------
+    None
     """
     assert check_paths_exists(args), 'Not all provided filepaths exist.'
 
-    if git_query(args.code, True):
+    if git_query(args.code, args.catalogue_results, True):
         try:
             assert not os.path.exists(os.path.join(args.catalogue_results, ".lock"))
         except AssertionError:
@@ -108,8 +124,18 @@ def disengage(args):
     The disengage command:
         - reads hashes stored in the `.lock` file created during `engage`
         - gets hashes for the `input_data`, `code` and `output_data` (from `construct_dict()`)
-        - compares the two sets of hashes (if the same, saves the hashes)
+        - compares the two sets of hashes
+            (if `input_data` and `code` hashes match, saves the hashes to a file)
         - prints the results of the comparison
+
+    Parameters:
+    ------------
+    args : obj
+        Command line input arguments (argparse.Namespace).
+
+    Returns:
+    ---------
+    None
     """
     assert check_paths_exists(args), 'Not all provided filepaths exist.'
 
diff --git a/catalogue/parser.py b/catalogue/parser.py
index 913ff73..7e46b79 100644
--- a/catalogue/parser.py
+++ b/catalogue/parser.py
@@ -75,7 +75,8 @@ def main():
         type=str,
         metavar='catalogue_results',
         help=textwrap.dedent("This argument should be the path (full or relative) to the directory where any" +
-                            " files created by catalogue should be stored. Default is catalogue_results."),
+                            " files created by catalogue should be stored. It cannot be the same as the `code`" +
+                            " directory. Default is catalogue_results."),
         default='catalogue_results'
     )
 
@@ -116,7 +117,9 @@ def main():
     disengage_parser.set_defaults(func=disengage)
 
     args = parser.parse_args()
+    assert args.code != args.catalogue_results, "The 'catalogue_results' and 'code' paths cannot be the same"
     args.func(args)
 
+
 if __name__ == "__main__":
     main()
diff --git a/catalogue/utils.py b/catalogue/utils.py
index 792befd..aa9e9e3 100644
--- a/catalogue/utils.py
+++ b/catalogue/utils.py
@@ -25,3 +25,21 @@ def check_paths_exists(args):
             if key not in ["command", "func", "csv", "catalogue_results"]]
     path_checks = [os.path.exists(path) for path in paths]
     return all(path_checks)
+
+
+def prune_files(files, dir):
+    """
+    Return files that do not have `dir` as last directory in the file path.
+
+    Parameters:
+    ------------
+    files : list of str
+        list of file paths
+    dir : str
+        directory name, files in this directory are removed
+
+    Returns:
+    ---------
+    list of str
+    """
+    return [f for f in files if dir != os.path.basename(os.path.dirname(f))]


Test patch:
diff --git a/tests/test_catalogue.py b/tests/test_catalogue.py
index 199baf1..cd7c2eb 100644
--- a/tests/test_catalogue.py
+++ b/tests/test_catalogue.py
@@ -137,22 +137,39 @@ def test_hash_output(fixtures_dir, copy_fixtures_dir, fixture1, fixture2, fixtur
 def test_hash_code(git_repo, git_hash, workspace):
 
     # correct functioning
-    assert ct.hash_code(git_repo) == git_hash
+    assert ct.hash_code(git_repo, 'catalogue_results') == git_hash
+
+    # directory has untracked file in `catalogue_results`
+    workspace.run("mkdir catalogue_results")
+    workspace.run("touch catalogue_results/test.csv")
+    assert ct.hash_code(git_repo, 'catalogue_results') == git_hash
+
+    # directory has untracked file; file path includes `catalogue_results` but
+    # it is not the directory name
+    workspace.run("touch catalogue_results.csv")
+    with pytest.raises(RepositoryDirtyError):
+        ct.hash_code(git_repo, 'catalogue_results')
 
     # directory has uncommited file
-    workspace.run("touch test.csv")
     workspace.run("git add .")
     with pytest.raises(RepositoryDirtyError):
-        ct.hash_code(git_repo)
+        ct.hash_code(git_repo, 'catalogue_results')
 
-    # invalid path
+    # all files committed
+    repo = git.Repo(git_repo)
+    repo.index.commit("Add new file")
+    new_git_hash = repo.head.commit.hexsha
+    assert ct.hash_code(git_repo, 'catalogue_results') != git_hash
+    assert ct.hash_code(git_repo, 'catalogue_results') == new_git_hash
+
+    # missing arguments
     with pytest.raises(TypeError):
         ct.hash_code()
 
     # path not a git repo
     workspace.run("rm -rf .git")
     with pytest.raises(InvalidGitRepositoryError):
-        ct.hash_code(git_repo)
+        ct.hash_code(git_repo, 'catalogue_results')
 
 
 def test_construct_dict(git_repo, git_hash, test_args):
diff --git a/tests/test_engage.py b/tests/test_engage.py
index 36ebbf6..a883b33 100644
--- a/tests/test_engage.py
+++ b/tests/test_engage.py
@@ -13,27 +13,34 @@ def test_git_query(git_repo, capsys, workspace, monkeypatch):
 
     repo = git.Repo(git_repo)
     git_hash_0 = repo.head.commit.hexsha
+    catalogue_results = 'catalogue_results'
 
     #==================================================
     # 1: use with default commit_changes=False
     #==================================================
 
     # repo is clean
-    assert git_query(git_repo) == True
+    assert git_query(git_repo, catalogue_results) == True
 
-    # create new file -- untracked
-    workspace.run("touch test.csv")
-    assert git_query(git_repo) == True
+    # create new file -- untracked; file path includes `catalogue_results` but
+    # it is not the directory name
+    workspace.run("touch catalogue_results.json")
+    assert git_query(git_repo, catalogue_results) == False
 
     # git add file without commit
     workspace.run("git add .")
-    assert git_query(git_repo) == False
+    assert git_query(git_repo, catalogue_results) == False
 
     # commit new file
     repo.index.commit("Add new file")
     git_hash_1 = repo.head.commit.hexsha
     assert git_hash_0 != git_hash_1
-    assert git_query(git_repo) == True
+    assert git_query(git_repo, catalogue_results) == True
+
+    # create new file in `catalogue_results` dir
+    workspace.run("mkdir catalogue_results")
+    workspace.run("touch catalogue_results/test.json")
+    assert git_query(git_repo, catalogue_results) == True
 
     #==================================================
     # 2: use with commit_changes=True
@@ -41,18 +48,22 @@ def test_git_query(git_repo, capsys, workspace, monkeypatch):
     #==================================================
 
     # repo is clean
-    assert git_query(git_repo, True) == True
+    assert git_query(git_repo, catalogue_results, True) == True
+
+    # create new file (untracked) --> wil ask for user input
+    # file path includes `catalogue_results` but it is not the directory name
+    workspace.run("touch new_catalogue_results.json")
 
-    # create new file -- untracked
-    workspace.run("touch test2.csv")
-    assert git_query(git_repo, True) == True
+    # user responds no
+    monkeypatch.setattr('builtins.input', lambda: "n")
+    assert git_query(git_repo, catalogue_results, True) == False
 
     # git add file without commit -> will ask for user input
     workspace.run("git add .")
 
     # A: user responds no
     monkeypatch.setattr('builtins.input', lambda: "n")
-    assert git_query(git_repo, True) == False
+    assert git_query(git_repo, catalogue_results, True) == False
 
     captured = capsys.readouterr()
     assert "uncommitted changes" in captured.out
@@ -60,7 +71,7 @@ def test_git_query(git_repo, capsys, workspace, monkeypatch):
 
     # B: user gives other response
     monkeypatch.setattr('builtins.input', lambda: "x")
-    assert git_query(git_repo, True) == False
+    assert git_query(git_repo, catalogue_results, True) == False
 
     captured = capsys.readouterr()
     assert "uncommitted changes" in captured.out
@@ -68,7 +79,7 @@ def test_git_query(git_repo, capsys, workspace, monkeypatch):
 
     # C: user responds yes
     monkeypatch.setattr('builtins.input', lambda: "y")
-    assert git_query(git_repo, True) == True
+    assert git_query(git_repo, catalogue_results, True) == True
 
     captured = capsys.readouterr()
     assert "uncommitted changes" in captured.out
@@ -84,7 +95,7 @@ def test_git_query(git_repo, capsys, workspace, monkeypatch):
     workspace.run("rm -rf .git")
 
     with pytest.raises(InvalidGitRepositoryError):
-        git_query(git_repo)
+        git_query(git_repo, catalogue_results)
     with pytest.raises(TypeError):
         git_query()