pybamm-team / pybamm-cookie

A copier template for battery modeling projects using PyBaMM
BSD 3-Clause "New" or "Revised" License
12 stars 3 forks source link

Issue with `git config user.name` #53

Closed brosaplanella closed 2 months ago

brosaplanella commented 2 months ago

I tried the most recent version, both using copier and the PyPI package and I get an error when configuring the git user name. I suspect it is because my name is 3 words so there should be quotation marks somewhere.

Full error log:

 > Running task 1 of 3: git init -b main
Initialized empty Git repository in /home/brosaplanella/battery_modelling/supercapacitors/.git/
 > Running task 2 of 3: git config user.name Ferran Brosa Planella
error: no action specified
Traceback (most recent call last):
  File "/home/brosaplanella/.local/bin/copier", line 8, in <module>
    sys.exit(copier_app_run())
             ^^^^^^^^^^^^^^^^
  File "/home/brosaplanella/.local/lib/python3.11/site-packages/plumbum/cli/application.py", line 638, in run
    inst, retcode = subapp.run(argv, exit=False)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brosaplanella/.local/lib/python3.11/site-packages/plumbum/cli/application.py", line 633, in run
    retcode = inst.main(*tailargs)
              ^^^^^^^^^^^^^^^^^^^^
  File "/home/brosaplanella/.local/lib/python3.11/site-packages/copier/cli.py", line 281, in main
    return _handle_exceptions(inner)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/brosaplanella/.local/lib/python3.11/site-packages/copier/cli.py", line 70, in _handle_exceptions
    method()
  File "/home/brosaplanella/.local/lib/python3.11/site-packages/copier/cli.py", line 272, in inner
    with self._worker(
  File "/home/brosaplanella/.local/lib/python3.11/site-packages/copier/main.py", line 228, in __exit__
    raise value
  File "/home/brosaplanella/.local/lib/python3.11/site-packages/copier/cli.py", line 279, in inner
    worker.run_copy()
  File "/home/brosaplanella/.local/lib/python3.11/site-packages/copier/main.py", line 832, in run_copy
    self._execute_tasks(self.template.tasks)
  File "/home/brosaplanella/.local/lib/python3.11/site-packages/copier/main.py", line 323, in _execute_tasks
    subprocess.run(task_cmd, shell=use_shell, check=True, env=local.env)
  File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'git config user.name Ferran Brosa Planella' returned non-zero exit status 129.
agriyakhetarpal commented 2 months ago

Personally I think we should remove the git config commands entirely so that we can let them be inferred from the global config, what do you think, @santacodes?

santacodes commented 2 months ago

Personally I think we should remove the git config commands entirely so that we can let them be inferred from the global config, what do you think, @santacodes?

That would be good, but in the case of a user who hasn't set up their credentials how would it work for them? I guess it wouldn't let them commit without a username and an email. Maybe we could do something like infer if they have a global username and email, if they don't we can configure them with the ones they prompted in copier.

santacodes commented 2 months ago

@brosaplanella I don't believe it is a quotation mark issue because I remember I fixed it in this PR.

agriyakhetarpal commented 2 months ago

That would be good, but in the case of a user who hasn't set up their credentials how would it work for them? I guess it wouldn't let them commit without a username and an email. Maybe we could do something like infer if they have a global username and email, if they don't we can configure them with the ones they prompted in copier.

I would think anyone working on a project on a VCS platform would have credentials set up. If they don't, at that point, it lies outside the scope of pybamm-cookie as a "project generation" tool. I opine that removing the commands entirely would be better, since there are no extra steps needed for inferring their global defaults.