moose icon indicating copy to clipboard operation
moose copied to clipboard

Make stork script resilient to un-initialized git

Open GiudGiud opened this issue 9 months ago • 1 comments

Problem

In the babbler folder created by using the command `./moose/scripts/stork.sh Babbler'.

I try to build a new application, it's still the same.

(moose) kimi@DESKTOP-7APSM1S:~/projects$ ./moose/scripts/stork.sh Abc
Initialized empty Git repository in /home/kimi/projects/abc/.git/

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident name (for <[email protected]>) not allowed
MOOSE app created in '/home/kimi/projects/abc'

To store your changes on GitHub:
    1. Log in to your GitHub account
    2. Create a new repository named 'abc'
    3. In this terminal window, run the following commands:
         cd /home/kimi/projects/abc
         git remote add origin https://github.com/YourGitHubUserName/abc
         git commit -m "Initial code commit"
         git push -u origin main

To automatically enforce MOOSE C++ code style in your commits, run:

    cd /home/kimi/projects/abc
    ./scripts/install-format-hook.sh

To enable software quality assurance (SQA) documentation using MooseDocs, perform the
following steps after adding your git repository remote:

    1. Navigate to /home/kimi/projects/abc/doc
    2. Run './moosedocs.py init sqa --app 'Abc' --category abc'
    3. Commit the initial SQA changes using the following commands:
         git add /home/kimi/projects/abc/doc
         git commit -m "Initial SQA changes"
         git push origin main
    4. Add new SQA content to the forms in /home/kimi/projects/abc/doc/content/sqa

For general assistance in MOOSE-based application SQA, please contact the MOOSE
framework development team. For further info on the MooseDocs code documentation
system, please visit https://mooseframework.inl.gov.
(moose) kimi@DESKTOP-7APSM1S:~/projects$ cd abc/
(moose) kimi@DESKTOP-7APSM1S:~/projects/abc$ make -j6
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Traceback (most recent call last):
  File "/home/kimi/projects/moose/framework/../scripts/premake.py", line 183, in <module>
    PreMake().check()
  File "/home/kimi/projects/moose/framework/../scripts/premake.py", line 18, in __init__
    self.versioner_meta = Versioner().version_meta()
  File "/home/kimi/projects/moose/scripts/versioner.py", line 302, in version_meta
    app_name, _, app_hash = self.get_app()
  File "/home/kimi/projects/moose/scripts/versioner.py", line 352, in get_app
    git_hash = subprocess.check_output(hash_command, encoding='utf-8').rstrip()[0:7]
  File "/home/kimi/miniforge/envs/moose/lib/python3.10/subprocess.py", line 421, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/home/kimi/miniforge/envs/moose/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', 'rev-parse', 'HEAD']' returned non-zero exit status 128.
make: [/home/kimi/projects/moose/framework/moose.mk:388: prebuild] Error 1 (ignored)

Originally posted by @Always-kimi in https://github.com/idaholab/moose/discussions/27575#discussioncomment-9354364

How to reproduce

clean machine, no git activity yet, create a new app

Impact

confused users

GiudGiud avatar May 08 '24 13:05 GiudGiud

Adding this item #27612

GiudGiud avatar May 13 '24 18:05 GiudGiud