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

Repo status overview #1017

Merged
merged 3 commits into from
Jan 13, 2023
Merged

Repo status overview #1017

merged 3 commits into from
Jan 13, 2023

Conversation

guenhter
Copy link
Contributor

@guenhter guenhter commented Jan 9, 2023

Fix #1006

This changes allow to print the summary of all the repositories in a table like this:

git bulk -q summary --oneline | column -t -s /                                                                                                                                   
Core command "summary" accepted.
keycloak-cxf-admin-client            age: 6 years                last active: 1 year, 2 months ago    active on 4 days      commits: 16      uncommitted: 0
dev-infrastructure-automation        age: 5 weeks                last active: 2 hours ago             active on 8 days      commits: 13      uncommitted: 0
gitlab-project-settings-corrector    age: 3 months               last active: 3 months ago            active on 1 days      commits: 2       uncommitted: 0
gitlab-k8s-cleaner                   age: 3 months               last active: 3 months ago            active on 2 days      commits: 7       uncommitted: 0
ci-docker-images                     age: 3 months               last active: 3 months ago            active on 3 days      commits: 8       uncommitted: 0
fid-python                           age: 7 weeks                last active: 3 weeks ago             active on 11 days     commits: 22      uncommitted: 0
deployment-management                age: 3 months               last active: 3 weeks ago             active on 28 days     commits: 140     uncommitted: 0

Additionally, the age info was fixed in the summary command. Using git log --reversed -n 1 actually gives the latest commit, not the oldest.

@@ -101,6 +105,11 @@ Shows a summary of the repository or a path within it.
authors :
...

Online summary
Copy link
Collaborator

Choose a reason for hiding this comment

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

oneline?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

:) typo. Fixed.

@@ -145,7 +149,7 @@ format_authors() {
# fetch repository age from oldest commit
#
repository_age() {
git log --reverse --pretty=oneline --format="%ar" -n 1 | LC_ALL=C sed 's/ago//'
git log --reverse --pretty=oneline --format="%ar" | head -n 1 | LC_ALL=C sed 's/ago//'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why revert it to an old version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe you can confirm that it seems that git first resolves the -n 1 and then it resolves --reverse what ends up in not getting the first commit but the latest.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My tests gave me the following:

$  git log --reverse --pretty=oneline --format="%ar" -n 1
6 days ago

$ git log --reverse --pretty=oneline --format="%ar" | head -n 1
12 years ago

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also the git-log documentation says so:

Commit Limiting
...
Note that these are applied before commit ordering and formatting options, such as --reverse.

-, -n , --max-count=
Limit the number of commits to output.

@spacewander spacewander merged commit 04eb5c0 into tj:master Jan 13, 2023
@guenhter guenhter deleted the repo-status-overview branch January 16, 2023 06:41
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.

Feature: List all repos of a workspace with one line per repo
2 participants