Repository: spack/spack

Issue:
Remove git messages when cloning repositories
   I find this type of output annoying and unnecessary for users. Having to wade through tons of this stuff seems unproductive.

```
######################################################################## 
100.0%
==> Staging archive: /Users/barrysmith/Src/spack/var/spack/stage/veclibfort-0.4.2-yhwtrkestcxarpsqiciyizj3gdjhc6zr/0.4.2.tar.gz
==> Created stage in /Users/barrysmith/Src/spack/var/spack/stage/veclibfort-0.4.2-yhwtrkestcxarpsqiciyizj3gdjhc6zr
==> No patches needed for veclibfort

Cloning into 'superlu_dist'...
remote: Counting objects: 290, done.
remote: Compressing objects: 100% (228/228), done.
remote: Total 290 (delta 139), reused 95 (delta 60), pack-reused 0
Receiving objects: 100% (290/290), 1.38 MiB | 0 bytes/s, done.
Resolving deltas: 100% (139/139), done.
==> No checksum needed when fetching with git
==> Already staged superlu-dist-xsdk-0.2.0-o2kfsovjppappoxtlsvfuaeuhcuxbsae in /Users/barrysmith/Src/spack/var/spack/stage/superlu-dist-xsdk-0.2.0-o2kfsovjppappoxtlsvfuaeuhcuxbsae
==> No patches needed for superlu-dist
```



Discussion:
I think
```
Cloning into 'superlu_dist'...
remote: Counting objects: 290, done.
remote: Compressing objects: 100% (228/228), done.
remote: Total 290 (delta 139), reused 95 (delta 60), pack-reused 0
Receiving objects: 100% (290/290), 1.38 MiB | 0 bytes/s, done.
Resolving deltas: 100% (139/139), done.
```
can be removed, but I would keep the rest (with `==>`). 

I don't recall what's the source of `superlu_dist`, but i recently made `svn` fetching quite https://github.com/LLNL/spack/pull/3070

p.s. @BarrySmith i edited your OP to have a code block which makes it look better.
Looks like it's a `git` checkout. I agree that we can probably hide this like we did `svn`.
I don't think we need to print `No patches needed` or `No checksum needed when fetching with git`.
> I don't think we need to print No patches needed or No checksum needed when fetching with git.

agree.
Can these git messages also be eliminated from the output?

```
==> Trying to clone git repository: https://github.com/LLNL/hypre at tag xsdk-0.2.0-rc2
Note: checking out '82828f22df56dc9e6b9acf70f4a621bcbb593ce0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>
```


Can you give us an example package that prints this information?
Are you sure you rebased/ merged in develop?
> Can you give us an example package that prints this information?

In the branch barry/xsdk

$ ./bin/spack install hypre@xsdk-0.2.0

> Are you sure you rebased/ merged in develop?

Yes, barry/xsdk was just merged with develop.

I can confirm that this is still present in develop. If I steal `xsdk-0.2.0` from `barry/xsdk` and modify the hypre package to add:
```python
version('xsdk-0.2.0', git='https://github.com/LLNL/hypre', tag='xsdk-0.2.0-rc2')
```
I get:
```
$ spack fetch hypre@xsdk-0.2.0
==> Trying to clone git repository: https://github.com/LLNL/hypre at tag xsdk-0.2.0-rc2
Note: checking out '82828f22df56dc9e6b9acf70f4a621bcbb593ce0'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

==> No checksum needed when fetching with git
```

Resolving patch:
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -776,6 +776,12 @@ def git(self):
         if not self._git:
             self._git = which('git', required=True)
 
+            # Disable advice for a quieter fetch
+            # https://github.com/git/git/blob/master/Documentation/RelNotes/1.7.2.txt
+            if self.git_version >= Version('1.7.2'):
+                self._git.add_default_arg('-c')
+                self._git.add_default_arg('advice.detachedHead=false')
+
             # If the user asked for insecure fetching, make that work
             # with git as well.
             if not spack.config.get('config:verify_ssl'):


Test patch: