Skip to content

Get an error during snapshot if a .gitignored directory is under a results resource #71

@jfischer

Description

@jfischer

Example: Have .DS_Store under the workspace's main .gitignore. The "report" results resource has these directories due to .png files it contains. When the code tries to move the files under snapshots and add them to git, get the following error:

dws snapshot -m 'Initial version of reporting' 2020-APRIL-30
The following paths are ignored by one of your .gitignore files:
reports/snapshots/jf-mbp-2017-2020-APRIL-30/.DS_Store
Use -f if you really want to add them.


The following paths are ignored by one of your .gitignore files:
reports/snapshots/jf-mbp-2017-2020-APRIL-30/.DS_Store
Use -f if you really want to add them.

Traceback (most recent call last):
  File "/Users/jfischer/code/data-workspaces-core/dataworkspaces/__main__.py", line 15, in main
    cli()
  File "/Users/jfischer/anaconda3/envs/ml-framework-analysis-ws/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/jfischer/anaconda3/envs/ml-framework-analysis-ws/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/jfischer/anaconda3/envs/ml-framework-analysis-ws/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/jfischer/anaconda3/envs/ml-framework-analysis-ws/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/jfischer/anaconda3/envs/ml-framework-analysis-ws/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/jfischer/anaconda3/envs/ml-framework-analysis-ws/lib/python3.8/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/jfischer/code/data-workspaces-core/dataworkspaces/dws.py", line 645, in snapshot
    snapshot_command(workspace, tag, message)
  File "/Users/jfischer/code/data-workspaces-core/dataworkspaces/commands/snapshot.py", line 84, in snapshot_command
    (md, manifest) = mixin.snapshot(tag, message)
 File "/Users/jfischer/code/data-workspaces-core/dataworkspaces/workspace.py", line 1233, in snapshot
    file_mixin.results_move_current_files(
  File "/Users/jfischer/code/data-workspaces-core/dataworkspaces/resources/git_resource.py", line 847, in results_move_current_files
    moved_files = move_current_files_local_fs(
  File "/Users/jfischer/code/data-workspaces-core/dataworkspaces/utils/snapshot_utils.py", line 213, in move_current_files_local_fs
    move_fn(abs_src_file, abs_dest_file)
  File "/Users/jfischer/code/data-workspaces-core/dataworkspaces/resources/git_resource.py", line 853, in <lambda>
    move_fn=lambda src, dest: git_move_and_add(
  File "/Users/jfischer/code/data-workspaces-core/dataworkspaces/resources/git_resource.py", line 99, in git_move_and_add
    git_add(git_root, [destrelpath], verbose)
  File "/Users/jfischer/code/data-workspaces-core/dataworkspaces/utils/git_utils.py", line 119, in git_add
    call_subprocess([GIT_EXE_PATH, "add"] + relative_paths, cwd=repo_dir, verbose=verbose)
  File "/Users/jfischer/code/data-workspaces-core/dataworkspaces/utils/subprocess_utils.py", line 21, in call_subprocess
    cp.check_returncode()
  File "/Users/jfischer/anaconda3/envs/ml-framework-analysis-ws/lib/python3.8/subprocess.py", line 444, in check_returncode
    raise CalledProcessError(self.returncode, self.args, self.stdout,
subprocess.CalledProcessError: Command '['/usr/bin/git', 'add', 'snapshots/jf-mbp-2017-2020-APRIL-30/.DS_Store']' returned non-zero exit status 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions