diff --git a/git_authorship/export.py b/git_authorship/export.py index 5526128..934b0de 100644 --- a/git_authorship/export.py +++ b/git_authorship/export.py @@ -84,7 +84,7 @@ def as_csv( with io_handle(output) as f: writer = csv.writer(f) writer.writerow(["path", "author", "lines"]) - for path, authors in authorship.items(): + for path, authors in sorted(authorship.items(), key=lambda x: x[0]): for author, lines in sorted( authors.items(), key=lambda x: x[1], reverse=True ): diff --git a/test/snapshots/test_e2e/test_full_workflow/authorship.csv b/test/snapshots/test_e2e/test_full_workflow/authorship.csv index a07b5df..3823b8e 100644 --- a/test/snapshots/test_e2e/test_full_workflow/authorship.csv +++ b/test/snapshots/test_e2e/test_full_workflow/authorship.csv @@ -2,28 +2,9 @@ path,author,lines .,Joseph Hale ,241532 .,dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>,116 .,Joseph Hale <47901316+thehale@users.noreply.github.com>,74 -git_authorship,Joseph Hale ,171 -git_authorship/__main__.py,Joseph Hale ,166 -git_authorship/__init__.py,Joseph Hale ,5 -.gitignore,Joseph Hale ,169 -LICENSE,Joseph Hale ,373 -README.md,Joseph Hale ,139 -README.md,Joseph Hale <47901316+thehale@users.noreply.github.com>,5 .devcontainer,Joseph Hale ,41 -.devcontainer/devcontainer.json,Joseph Hale ,32 .devcontainer/Dockerfile,Joseph Hale ,9 -pyproject.toml,Joseph Hale ,45 -pyproject.toml,dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>,7 -docs,Joseph Hale ,240056 -docs/git-authorship-demo-cubingjs.gif,Joseph Hale ,238279 -docs/git-authorship-social-preview.svg,Joseph Hale ,1111 -docs/git-authorship-social-preview.png,Joseph Hale ,666 -config,Joseph Hale ,12 -config/.gitignore,Joseph Hale ,8 -config/pseudonyms.txt.dist,Joseph Hale ,2 -config/author-licenses.txt.dist,Joseph Hale ,2 -poetry.lock,Joseph Hale ,433 -poetry.lock,dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>,109 +.devcontainer/devcontainer.json,Joseph Hale ,32 .github,Joseph Hale <47901316+thehale@users.noreply.github.com>,69 .github,Joseph Hale ,13 .github/dependabot.yml,Joseph Hale <47901316+thehale@users.noreply.github.com>,22 @@ -32,9 +13,28 @@ poetry.lock,dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>, .github/workflows/auto-merge-dependabot.yml,Joseph Hale <47901316+thehale@users.noreply.github.com>,23 .github/workflows/precommit.yml,Joseph Hale <47901316+thehale@users.noreply.github.com>,24 .github/workflows/precommit.yml,Joseph Hale ,13 -test,Joseph Hale ,9 -test/test_authorship_analyzer.py,Joseph Hale ,9 +.gitignore,Joseph Hale ,169 +.pre-commit-config.yaml,Joseph Hale ,42 .vscode,Joseph Hale ,16 .vscode/launch.json,Joseph Hale ,16 +LICENSE,Joseph Hale ,373 Makefile,Joseph Hale ,13 -.pre-commit-config.yaml,Joseph Hale ,42 +README.md,Joseph Hale ,139 +README.md,Joseph Hale <47901316+thehale@users.noreply.github.com>,5 +config,Joseph Hale ,12 +config/.gitignore,Joseph Hale ,8 +config/author-licenses.txt.dist,Joseph Hale ,2 +config/pseudonyms.txt.dist,Joseph Hale ,2 +docs,Joseph Hale ,240056 +docs/git-authorship-demo-cubingjs.gif,Joseph Hale ,238279 +docs/git-authorship-social-preview.png,Joseph Hale ,666 +docs/git-authorship-social-preview.svg,Joseph Hale ,1111 +git_authorship,Joseph Hale ,171 +git_authorship/__init__.py,Joseph Hale ,5 +git_authorship/__main__.py,Joseph Hale ,166 +poetry.lock,Joseph Hale ,433 +poetry.lock,dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>,109 +pyproject.toml,Joseph Hale ,45 +pyproject.toml,dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>,7 +test,Joseph Hale ,9 +test/test_authorship_analyzer.py,Joseph Hale ,9