question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pass stderr in verbose mode from running git commands?

See original GitHub issue

e.g.

diff --git a/versioneer.py b/versioneer.py
index a48dcce97..da5916f23 100644
--- a/versioneer.py
+++ b/versioneer.py
@@ -1196,7 +1196,7 @@ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
     runner = functools.partial(runner, env=env)
 
     _, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root,
-                   hide_stderr=True)
+                   hide_stderr=not verbose)
     if rc != 0:
         if verbose:
             print("Directory %s not under git control" % root)

since including the fact that I needed -v for pip install to see this verbose, took awhile to troubleshoot the need to overcome recent git’s check for safety:

$ sudo git "rev-parse" "--git-dir"
fatal: unsafe repository ('/home/travis/build/datalad/datalad' is owned by someone else)
To add an exception for this directory, call:

	git config --global --add safe.directory /home/travis/build/datalad/datalad
The command "sudo git "rev-parse" "--git-dir"" exited with 128.

in case of installing via sudo from a local git repo (that is how we test datalad on travis).

More of pains could be shared from https://github.com/datalad/datalad/pull/6913

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
effigiescommented, Aug 23, 2022

Ah, right. Sure. Feel free to submit a patch. It seems we activate that with the verbose flag in setup.cfg.

0reactions
yarikopticcommented, Aug 23, 2022

someone could indeed do that digging, or just observe that there is a verbose option for that function, and thus possibly makes sense to make running of the underlying commands “not hiding errors” if in verbose mode 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Git clone: Redirect stderr to stdout but keep errors being ...
I use this script to run git commands. Since git will write to stderr even ... If the command failed all output is...
Read more >
Git - git Documentation
Run as if git was started in <path> instead of the current working directory. When multiple -C options ... Pass a configuration parameter...
Read more >
Redirect stdout and stderr to the log only in debug modes - ...
Currently stdout and stderr are redirected to the log file in any case. ... so that in verbose mode many commands are run...
Read more >
simple-git
Simple Git. NPM version. A lightweight interface for running git commands in any node.js application. Version 3 - Out Now.
Read more >
How to run git commands in verbose mode
How to increase verbosity and run the git commands in debug mode? Environment. Red Hat Enterprise Linux 8; git. Subscriber exclusive content. A ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found