Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InfoCommand improvements #1562

Merged
merged 3 commits into from
Sep 3, 2018
Merged

InfoCommand improvements #1562

merged 3 commits into from
Sep 3, 2018

Conversation

dsevillamartin
Copy link
Member

Changes proposed in this pull request:

  • Ignore error output of git rev-parse-head
    • Would output the following if a git repository existed but had no commits:
      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>...]'
  • Pad extension id & version to make look cleaner

Screenshot

Before:
image

After:
image

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run php vendor/bin/phpunit).

Copy link
Contributor

@franzliedke franzliedke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Nice changes.

Could you use Symfon's table helper instead of the padding?

@dsevillamartin
Copy link
Member Author

dsevillamartin commented Sep 3, 2018

@franzliedke I added a new heading & formatted all the text to use <info> color.

image


I tried to make the first row heading to use all 3 cells, but with the formatting it extends a bit too far.

Failed attempt

@franzliedke franzliedke merged commit 7e39807 into flarum:master Sep 3, 2018
@dsevillamartin dsevillamartin deleted the info-command-improvements branch September 3, 2018 22:27
{
if (file_exists("$path/.git")) {
$cwd = getcwd();
chdir($path);

$output = [];
$status = null;
exec('git rev-parse HEAD', $output, $status);
exec('git rev-parse HEAD 2> /dev/null', $output, $status);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, how does this behave on Windows?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I hadn't thought about Windows 😕.

Seems like in Windows one can do > NUL, but to support both at the same time is probably not possible.
I tried to find how I could suppress STDERR from exec, but was unable to find anything. I may have been approaching that fix wrong.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@datitisev See commit 96045ca, that should fix it, I think.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@franzliedke Looks like it still works on macOS. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants