Title: Exception when handling "copied" status · Issue #482 · atom/github · GitHub
Open Graph Title: Exception when handling "copied" status · Issue #482 · atom/github
X Title: Exception when handling "copied" status · Issue #482 · atom/github
Description: $ git status On branch mkt-gql-login Your branch is up-to-date with 'origin/mkt-gql-login'. Changes to be committed: (use "git reset HEAD
Open Graph Description: $ git status On branch mkt-gql-login Your branch is up-to-date with 'origin/mkt-gql-login'. Changes to be committed: (use "git reset HEAD
X Description: $ git status On branch mkt-gql-login Your branch is up-to-date with 'origin/mkt-gql-login'. Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: li...
Opengraph URL: https://github.com/atom/github/issues/482
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Exception when handling \"copied\" status","articleBody":"```\r\n$ git status\r\nOn branch mkt-gql-login\r\nYour branch is up-to-date with 'origin/mkt-gql-login'.\r\nChanges to be committed:\r\n (use \"git reset HEAD \u003cfile\u003e...\" to unstage)\r\n\r\n\tmodified: lib/controllers/github-controller.js\r\n\tmodified: lib/git-shell-out-strategy.js\r\n\tnew file: lib/models/github-login-model.js\r\n\tmodified: package.json\r\n\tnew file: styles/github-controller.less\r\n\tcopied: styles/github-panel.less -\u003e styles/github-login-view.less\r\n\tmodified: styles/github-panel.less\r\n```\r\n\r\n`GSOS#getStatusesForChangedFiles` is getting the output\r\n\r\n```\r\nM lib/controllers/github-controller.js\r\nMM lib/git-shell-out-strategy.js\r\nA lib/models/github-login-model.js\r\nM package.json\r\nA styles/github-controller.less\r\nC styles/github-login-view.less\r\nstyles/github-panel.less\r\nM styles/github-panel.less\r\n```\r\n\r\nThe second to last line, which is the file that the file on the line before it was copied *from*, is causing the regex to fail. The following diff fixes:\r\n\r\n```diff\r\ndiff --git a/lib/git-shell-out-strategy.js b/lib/git-shell-out-strategy.js\r\nindex e92a35f..d60fbb0 100644\r\n--- a/lib/git-shell-out-strategy.js\r\n+++ b/lib/git-shell-out-strategy.js\r\n@@ -164,6 +164,7 @@ export default class GitShellOutStrategy {\r\n \r\n const statusMap = {\r\n 'A': 'added',\r\n+ 'C': 'added', // technically copied, but we'll treat as added\r\n 'M': 'modified',\r\n 'D': 'deleted',\r\n 'U': 'modified',\r\n@@ -205,6 +206,10 @@ export default class GitShellOutStrategy {\r\n if (x !== ' ' \u0026\u0026 x !== '?') {\r\n stagedFiles[filePath] = statusMap[x];\r\n }\r\n+ if (x === 'C') {\r\n+ // skip the next line, which is the copied file\r\n+ i++\r\n+ }\r\n }\r\n }\r\n```","author":{"url":"https://github.com/BinaryMuse","@type":"Person","name":"BinaryMuse"},"datePublished":"2017-01-25T05:31:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/482/github/issues/482"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1b8afc0e-4b35-aa59-19c9-002cbb35a7e1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E7BE:179A4C:FD5F6F:1730426:6A4E3582 |
| html-safe-nonce | 27544a88fd90d39e8cb91805ff8fbb1d124d8345c2faf3d8a8ac92329b6cffad |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFN0JFOjE3OUE0QzpGRDVGNkY6MTczMDQyNjo2QTRFMzU4MiIsInZpc2l0b3JfaWQiOiI2MzQ2ODA3NzkyMjQyNjY4OTMwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 694f710940b9f697db4d0b57747e3859dbe8abc5bb8dc1a7a5ee902d7de12107 |
| hovercard-subject-tag | issue:203016508 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/atom/github/482/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1be3957c4b1730ff77371832ab2b0eb8e49d3dda1417b398f2947e2e24fe05ef/atom/github/issues/482 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1be3957c4b1730ff77371832ab2b0eb8e49d3dda1417b398f2947e2e24fe05ef/atom/github/issues/482 |
| og:image:alt | $ git status On branch mkt-gql-login Your branch is up-to-date with 'origin/mkt-gql-login'. Changes to be committed: (use "git reset HEAD |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | BinaryMuse |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/atom/github git https://github.com/atom/github.git |
| octolytics-dimension-user_id | 1089146 |
| octolytics-dimension-user_login | atom |
| octolytics-dimension-repository_id | 46155786 |
| octolytics-dimension-repository_nwo | atom/github |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 46155786 |
| octolytics-dimension-repository_network_root_nwo | atom/github |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 42a6d378d7587a44c93aca255096cd66b7c8eb2d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width