{"modulePath":"github.com/LF-Engineering/insights-datasource-git","version":"v0.2.38","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package main\n\n## Constants\n\n```go\nconst (\n\t// GitBackendVersion - backend version\n\tGitBackendVersion = \"0.1.1\"\n\t// GitDefaultReposPath - default path where git repository clones\n\tGitDefaultReposPath = \"/tmp/git-repositories\"\n\t// GitDefaultCachePath - default path where gitops cache files are stored\n\tGitDefaultCachePath = \"/tmp/git-cache\"\n\t// GitOpsCommand - command that maintains git stats cache\n\t// GitOpsCommand = \"gitops.py\"\n\tGitOpsCommand = \"gitops\"\n\t// GitOpsFailureFatal - is GitOpsCommand failure fatal?\n\tGitOpsFailureFatal = true\n\t// OrphanedCommitsCommand - command to list orphaned commits\n\tOrphanedCommitsCommand = \"detect-removed-commits.sh\"\n\t// OrphanedCommitsFailureFatal - is OrphanedCommitsCommand failure fatal?\n\tOrphanedCommitsFailureFatal = true\n\t// GitParseStateInit - init parser state\n\tGitParseStateInit = 0\n\t// GitParseStateCommit - commit parser state\n\tGitParseStateCommit = 1\n\t// GitParseStateHeader - header parser state\n\tGitParseStateHeader = 2\n\t// GitParseStateMessage - message parser state\n\tGitParseStateMessage = 3\n\t// GitParseStateFile - file parser state\n\tGitParseStateFile = 4\n\t// GitCommitDateField - date field in the commit structure\n\tGitCommitDateField = \"CommitDate\"\n\t// GitDefaultSearchField - default search field\n\tGitDefaultSearchField = \"item_id\"\n\t// GitHubURL - GitHub URL\n\tGitHubURL = \"https://github.com/\"\n\t// GitMaxCommitProperties - maximum properties that can be set on the commit object\n\tGitMaxCommitProperties = 1000\n\t// GitMaxMsgLength - maximum message length\n\tGitMaxMsgLength = 0x4000\n\t// GitGenerateFlatDocs - do we want to generate flat commit co-authors docs, like docs with type: commit_co_author, commit_signer etc.?\n\tGitGenerateFlatDocs = true\n\t// GitDefaultStream - Stream To Publish\n\tGitDefaultStream = \"PUT-S3-git-commits\"\n\t// GitDataSource - constant for git source\n\tGitDataSource = \"git\"\n\t// UnknownExtension - Empty file extension type\n\tUnknownExtension = \"UNKNOWN\"\n\t// CommitCreated commit created event\n\tCommitCreated = \"commit.created\"\n\t// CommitUpdated commit updated event\n\tCommitUpdated = \"commit.updated\"\n\t// InProgress status\n\tInProgress = \"in_progress\"\n\t// Failed status\n\tFailed = \"failed\"\n\t// Success status\n\tSuccess = \"success\"\n\t// GitConnector ...\n\tGitConnector   = \"git-connector\"\n\tPackSize       = 1000\n\tHotRepoCount   = 50000\n\tYearFirstHalf  = \"first-half\"\n\tYearSecondHalf = \"second-half\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\t// GitCategories - categories defined for git\n\tGitCategories = map[string]struct{}{\"commit\": {}}\n\t// GitDefaultEnv - default git command environment\n\tGitDefaultEnv = map[string]string{\"LANG\": \"C\", \"PAGER\": \"\"}\n\t// GitLogOptions - default git log options\n\tGitLogOptions = []string{\n\t\t\"--raw\",\n\t\t\"--numstat\",\n\t\t\"--pretty=fuller\",\n\t\t\"--decorate=full\",\n\t\t\"--parents\",\n\t\t\"-M\",\n\t\t\"-C\",\n\t\t\"-c\",\n\t}\n\t// GitCommitPattern - pattern to match a commit\n\tGitCommitPattern = regexp.MustCompile(`^commit[ \\t](?P\u003ccommit\u003e[a-f0-9]{40})(?:[ \\t](?P\u003cparents\u003e[a-f0-9][a-f0-9 \\t]+))?(?:[ \\t]\\((?P\u003crefs\u003e.+)\\))?$`)\n\t// GitHeaderPattern - pattern to match a commit\n\tGitHeaderPattern = regexp.MustCompile(`^(?P\u003cname\u003e[a-zA-z0-9\\-]+)\\:[ \\t]+(?P\u003cvalue\u003e.+)$`)\n\t// GitMessagePattern - message patterns\n\tGitMessagePattern = regexp.MustCompile(`^[\\s]{4}(?P\u003cmsg\u003e.*)$`)\n\t// GitTrailerPattern - message trailer pattern\n\tGitTrailerPattern = regexp.MustCompile(`^(?P\u003cname\u003e[a-zA-z0-9\\-]+)\\:[ \\t]+(?P\u003cvalue\u003e.+)$`)\n\t// GitActionPattern - action pattern - note that original used `\\.{,3}` which is not supported in go - you must specify from=0: `\\.{0,3}`\n\tGitActionPattern = regexp.MustCompile(`^(?P\u003csc\u003e\\:+)(?P\u003cmodes\u003e(?:\\d{6}[ \\t])+)(?P\u003cindexes\u003e(?:[a-f0-9]+\\.{0,3}[ \\t])+)(?P\u003caction\u003e[^\\t]+)\\t+(?P\u003cfile\u003e[^\\t]+)(?:\\t+(?P\u003cnewfile\u003e.+))?$`)\n\t// GitStatsPattern - stats pattern\n\tGitStatsPattern = regexp.MustCompile(`^(?P\u003cadded\u003e\\d+|-)[ \\t]+(?P\u003cremoved\u003e\\d+|-)[ \\t]+(?P\u003cfile\u003e.+)$`)\n\t// GitAuthorsPattern - author pattern\n\t// Example: David Woodhouse \u003cdwmw2@infradead.org\u003e and Tilman Schmidt \u003ctilman@imap.cc\u003e\n\tGitAuthorsPattern = regexp.MustCompile(`(?P\u003cfirst_authors\u003e.* .*) and (?P\u003clast_author\u003e.* .*) (?P\u003cemail\u003e.*)`)\n\t// GitCoAuthorsPattern - author pattern\n\t// Example: Co-authored-by: Andi Kleen \u003cak@suse.de\u003e\n\tGitCoAuthorsPattern = regexp.MustCompile(`Co-authored-by:(?P\u003cfirst_authors\u003e.* .*)\u003c(?P\u003cemail\u003e.*)\u003e\\n?`)\n\t// GitDocFilePattern - files matching this pattern are detected as documentation files, so commit will be marked as doc_commit\n\tGitDocFilePattern = regexp.MustCompile(`(?i)(\\.md$|\\.rst$|\\.docx?$|\\.txt$|\\.pdf$|\\.jpe?g$|\\.png$|\\.svg$|\\.img$|^docs/|^documentation/|^readme)`)\n\t// GitCommitRoles - roles to fetch affiliation data\n\tGitCommitRoles = []string{\"Author\", \"Commit\"}\n\t// GitAllowedTrailers - allowed commit trailer flags (lowercase/case insensitive -\u003e correct case)\n\tGitAllowedTrailers = map[string][]string{\n\t\t\"about-fscking-timed-by\":                 {\"Reviewed-by\"},\n\t\t\"accked-by\":                              {\"Reviewed-by\"},\n\t\t\"aced-by\":                                {\"Reviewed-by\"},\n\t\t\"ack\":                                    {\"Reviewed-by\"},\n\t\t\"ack-by\":                                 {\"Reviewed-by\"},\n\t\t\"ackde-by\":                               {\"Reviewed-by\"},\n\t\t\"acked\":                                  {\"Reviewed-by\"},\n\t\t\"acked-and-reviewed\":                     {\"Reviewed-by\"},\n\t\t\"acked-and-reviewed-by\":                  {\"Reviewed-by\"},\n\t\t\"acked-and-tested-by\":                    {\"Reviewed-by\", \"Tested-by\"},\n\t\t\"acked-b\":                                {\"Reviewed-by\"},\n\t\t\"acked-by\":                               {\"Reviewed-by\"},\n\t\t\"acked-by-stale-maintainer\":              {\"Reviewed-by\"},\n\t\t\"acked-by-with-comments\":                 {\"Reviewed-by\"},\n\t\t\"acked-by-without-testing\":               {\"Reviewed-by\"},\n\t\t\"acked-for-mfd-by\":                       {\"Reviewed-by\"},\n\t\t\"acked-for-now-by\":                       {\"Reviewed-by\"},\n\t\t\"acked-off-by\":                           {\"Reviewed-by\"},\n\t\t\"acked-the-net-bits-by\":                  {\"Reviewed-by\"},\n\t\t\"acked-the-tulip-bit-by\":                 {\"Reviewed-by\"},\n\t\t\"acked-with-apologies-by\":                {\"Reviewed-by\"},\n\t\t\"acked_by\":                               {\"Reviewed-by\"},\n\t\t\"ackedby\":                                {\"Reviewed-by\"},\n\t\t\"ackeded-by\":                             {\"Reviewed-by\"},\n\t\t\"acknowledged-by\":                        {\"Reviewed-by\"},\n\t\t\"acted-by\":                               {\"Reviewed-by\"},\n\t\t\"actually-written-by\":                    {\"Co-authored-by\"},\n\t\t\"additional-author\":                      {\"Co-authored-by\"},\n\t\t\"all-the-fault-of\":                       {\"Informed-by\"},\n\t\t\"also-analyzed-by\":                       {\"Reviewed-by\"},\n\t\t\"also-fixed-by\":                          {\"Co-authored-by\"},\n\t\t\"also-posted-by\":                         {\"Reported-by\"},\n\t\t\"also-reported-and-tested-by\":            {\"Reported-by\", \"Tested-by\"},\n\t\t\"also-reported-by\":                       {\"Reported-by\"},\n\t\t\"also-spotted-by\":                        {\"Reported-by\"},\n\t\t\"also-suggested-by\":                      {\"Reviewed-by\"},\n\t\t\"also-written-by\":                        {\"Co-authored-by\"},\n\t\t\"analysed-by\":                            {\"Reviewed-by\"},\n\t\t\"analyzed-by\":                            {\"Reviewed-by\"},\n\t\t\"aoled-by\":                               {\"Reviewed-by\"},\n\t\t\"apology-from\":                           {\"Informed-by\"},\n\t\t\"appreciated-by\":                         {\"Informed-by\"},\n\t\t\"approved\":                               {\"Approved-by\"},\n\t\t\"approved-by\":                            {\"Approved-by\"},\n\t\t\"architected-by\":                         {\"Influenced-by\"},\n\t\t\"assisted-by\":                            {\"Co-authored-by\"},\n\t\t\"badly-reviewed-by \":                     {\"Reviewed-by\"},\n\t\t\"based-in-part-on-patch-by\":              {\"Influenced-by\"},\n\t\t\"based-on\":                               {\"Influenced-by\"},\n\t\t\"based-on-a-patch-by\":                    {\"Influenced-by\"},\n\t\t\"based-on-code-by\":                       {\"Influenced-by\"},\n\t\t\"based-on-code-from\":                     {\"Influenced-by\"},\n\t\t\"based-on-comments-by\":                   {\"Influenced-by\"},\n\t\t\"based-on-idea-by\":                       {\"Influenced-by\"},\n\t\t\"based-on-original-patch-by\":             {\"Influenced-by\"},\n\t\t\"based-on-patch-by\":                      {\"Influenced-by\"},\n\t\t\"based-on-patch-from\":                    {\"Influenced-by\"},\n\t\t\"based-on-patches-by\":                    {\"Influenced-by\"},\n\t\t\"based-on-similar-patches-by\":            {\"Influenced-by\"},\n\t\t\"based-on-suggestion-from\":               {\"Influenced-by\"},\n\t\t\"based-on-text-by\":                       {\"Influenced-by\"},\n\t\t\"based-on-the-original-screenplay-by\":    {\"Influenced-by\"},\n\t\t\"based-on-the-true-story-by\":             {\"Influenced-by\"},\n\t\t\"based-on-work-by\":                       {\"Influenced-by\"},\n\t\t\"based-on-work-from\":                     {\"Influenced-by\"},\n\t\t\"belatedly-acked-by\":                     {\"Reviewed-by\"},\n\t\t\"bisected-and-acked-by\":                  {\"Reviewed-by\"},\n\t\t\"bisected-and-analyzed-by\":               {\"Reviewed-by\"},\n\t\t\"bisected-and-reported-by\":               {\"Reported-by\"},\n\t\t\"bisected-and-tested-by\":                 {\"Reported-by\", \"Tested-by\"},\n\t\t\"bisected-by\":                            {\"Reviewed-by\"},\n\t\t\"bisected-reported-and-tested-by\":        {\"Reviewed-by\", \"Tested-by\"},\n\t\t\"bitten-by-and-tested-by\":                {\"Reviewed-by\", \"Tested-by\"},\n\t\t\"bitterly-acked-by\":                      {\"Reviewed-by\"},\n\t\t\"blame-taken-by\":                         {\"Informed-by\"},\n\t\t\"bonus-points-awarded-by\":                {\"Reviewed-by\"},\n\t\t\"boot-tested-by\":                         {\"Tested-by\"},\n\t\t\"brainstormed-with\":                      {\"Influenced-by\"},\n\t\t\"broken-by\":                              {\"Informed-by\"},\n\t\t\"bug-actually-spotted-by\":                {\"Reported-by\"},\n\t\t\"bug-fixed-by\":                           {\"Resolved-by\"},\n\t\t\"bug-found-by\":                           {\"Reported-by\"},\n\t\t\"bug-identified-by\":                      {\"Reported-by\"},\n\t\t\"bug-reported-by\":                        {\"Reported-by\"},\n\t\t\"bug-spotted-by\":                         {\"Reported-by\"},\n\t\t\"build-fixes-from\":                       {\"Resolved-by\"},\n\t\t\"build-tested-by\":                        {\"Tested-by\"},\n\t\t\"build-testing-by\":                       {\"Tested-by\"},\n\t\t\"catched-by-and-rightfully-ranted-at-by\": {\"Reported-by\"},\n\t\t\"caught-by\":                              {\"Reported-by\"},\n\t\t\"cause-discovered-by\":                    {\"Reported-by\"},\n\t\t\"cautiously-acked-by\":                    {\"Reviewed-by\"},\n\t\t\"cc\":                                     {\"Informed-by\"},\n\t\t\"celebrated-by\":                          {\"Reviewed-by\"},\n\t\t\"changelog-cribbed-from\":                 {\"Influenced-by\"},\n\t\t\"changelog-heavily-inspired-by\":          {\"Influenced-by\"},\n\t\t\"chucked-on-by\":                          {\"Reviewed-by\"},\n\t\t\"cked-by\":                                {\"Reviewed-by\"},\n\t\t\"cleaned-up-by\":                          {\"Co-authored-by\"},\n\t\t\"cleanups-from\":                          {\"Co-authored-by\"},\n\t\t\"co-author\":                              {\"Co-authored-by\"},\n\t\t\"co-authored\":                            {\"Co-authored-by\"},\n\t\t\"co-authored-by\":                         {\"Co-authored-by\"},\n\t\t\"co-debugged-by\":                         {\"Co-authored-by\"},\n\t\t\"co-developed-by\":                        {\"Co-authored-by\"},\n\t\t\"co-developed-with\":                      {\"Co-authored-by\"},\n\t\t\"committed\":                              {\"Committed-by\"},\n\t\t\"committed-by\":                           {\"Co-authored-by\", \"Committed-by\"},\n\t\t\"compile-tested-by\":                      {\"Tested-by\"},\n\t\t\"compiled-by\":                            {\"Tested-by\"},\n\t\t\"compiled-tested-by\":                     {\"Tested-by\"},\n\t\t\"complained-about-by\":                    {\"Reported-by\"},\n\t\t\"conceptually-acked-by\":                  {\"Reviewed-by\"},\n\t\t\"confirmed-by\":                           {\"Reviewed-by\"},\n\t\t\"confirms-rustys-story-ends-the-same-by\": {\"Reviewed-by\"},\n\t\t\"contributors\":                           {\"Co-authored-by\"},\n\t\t\"credit\":                                 {\"Co-authored-by\"},\n\t\t\"credit-to\":                              {\"Co-authored-by\"},\n\t\t\"credits-by\":                             {\"Reviewed-by\"},\n\t\t\"csigned-off-by\":                         {\"Co-authored-by\"},\n\t\t\"cut-and-paste-bug-by\":                   {\"Reported-by\"},\n\t\t\"debuged-by\":                             {\"Tested-by\"},\n\t\t\"debugged-and-acked-by\":                  {\"Reviewed-by\"},\n\t\t\"debugged-and-analyzed-by\":               {\"Reviewed-by\", \"Tested-by\"},\n\t\t\"debugged-and-tested-by\":                 {\"Reviewed-by\", \"Tested-by\"},\n\t\t\"debugged-by\":                            {\"Tested-by\"},\n\t\t\"deciphered-by\":                          {\"Tested-by\"},\n\t\t\"decoded-by\":                             {\"Tested-by\"},\n\t\t\"delightedly-acked-by\":                   {\"Reviewed-by\"},\n\t\t\"demanded-by\":                            {\"Reported-by\"},\n\t\t\"derived-from-code-by\":                   {\"Co-authored-by\"},\n\t\t\"designed-by\":                            {\"Influenced-by\"},\n\t\t\"diagnoised-by\":                          {\"Tested-by\"},\n\t\t\"diagnosed-and-reported-by\":              {\"Reported-by\"},\n\t\t\"diagnosed-by\":                           {\"Tested-by\"},\n\t\t\"discovered-and-analyzed-by\":             {\"Reported-by\"},\n\t\t\"discovered-by\":                          {\"Reported-by\"},\n\t\t\"discussed-with\":                         {\"Co-authored-by\"},\n\t\t\"earlier-version-tested-by\":              {\"Tested-by\"},\n\t\t\"embarrassingly-acked-by\":                {\"Reviewed-by\"},\n\t\t\"emphatically-acked-by\":                  {\"Reviewed-by\"},\n\t\t\"encouraged-by\":                          {\"Influenced-by\"},\n\t\t\"enthusiastically-acked-by\":              {\"Reviewed-by\"},\n\t\t\"enthusiastically-supported-by\":          {\"Reviewed-by\"},\n\t\t\"evaluated-by\":                           {\"Tested-by\"},\n\t\t\"eventually-typed-in-by\":                 {\"Reported-by\"},\n\t\t\"eviewed-by\":                             {\"Reviewed-by\"},\n\t\t\"explained-by\":                           {\"Influenced-by\"},\n\t\t\"fairly-blamed-by\":                       {\"Reported-by\"},\n\t\t\"fine-by-me\":                             {\"Reviewed-by\"},\n\t\t\"finished-by\":                            {\"Co-authored-by\"},\n\t\t\"fix-creation-mandated-by\":               {\"Resolved-by\"},\n\t\t\"fix-proposed-by\":                        {\"Resolved-by\"},\n\t\t\"fix-suggested-by\":                       {\"Resolved-by\"},\n\t\t\"fixed-by\":                               {\"Resolved-by\"},\n\t\t\"fixes-from\":                             {\"Resolved-by\"},\n\t\t\"forwarded-by\":                           {\"Informed-by\"},\n\t\t\"found-by\":                               {\"Reported-by\"},\n\t\t\"found-ok-by\":                            {\"Tested-by\"},\n\t\t\"from\":                                   {\"Informed-by\"},\n\t\t\"grudgingly-acked-by\":                    {\"Reviewed-by\"},\n\t\t\"grumpily-reviewed-by\":                   {\"Reviewed-by\"},\n\t\t\"guess-its-ok-by\":                        {\"Reviewed-by\"},\n\t\t\"hella-acked-by\":                         {\"Reviewed-by\"},\n\t\t\"helped-by\":                              {\"Co-authored-by\"},\n\t\t\"helped-out-by\":                          {\"Co-authored-by\"},\n\t\t\"hinted-by\":                              {\"Influenced-by\"},\n\t\t\"historical-research-by\":                 {\"Co-authored-by\"},\n\t\t\"humbly-acked-by\":                        {\"Reviewed-by\"},\n\t\t\"i-dont-see-any-problems-with-it\":        {\"Reviewed-by\"},\n\t\t\"idea-by\":                                {\"Influenced-by\"},\n\t\t\"idea-from\":                              {\"Influenced-by\"},\n\t\t\"identified-by\":                          {\"Reported-by\"},\n\t\t\"improved-by\":                            {\"Influenced-by\"},\n\t\t\"improvements-by\":                        {\"Influenced-by\"},\n\t\t\"includes-changes-by\":                    {\"Influenced-by\"},\n\t\t\"initial-analysis-by\":                    {\"Co-authored-by\"},\n\t\t\"initial-author\":                         {\"Co-authored-by\"},\n\t\t\"initial-fix-by\":                         {\"Resolved-by\"},\n\t\t\"initial-patch-by\":                       {\"Co-authored-by\"},\n\t\t\"initial-work-by\":                        {\"Co-authored-by\"},\n\t\t\"inspired-by\":                            {\"Influenced-by\"},\n\t\t\"inspired-by-patch-from\":                 {\"Influenced-by\"},\n\t\t\"intermittently-reported-by\":             {\"Reported-by\"},\n\t\t\"investigated-by\":                        {\"Tested-by\"},\n\t\t\"lightly-tested-by\":                      {\"Tested-by\"},\n\t\t\"liked-by\":                               {\"Reviewed-by\"},\n\t\t\"list-usage-fixed-by\":                    {\"Resolved-by\"},\n\t\t\"looked-over-by\":                         {\"Reviewed-by\"},\n\t\t\"looks-good-to\":                          {\"Reviewed-by\"},\n\t\t\"looks-great-to\":                         {\"Reviewed-by\"},\n\t\t\"looks-ok-by\":                            {\"Reviewed-by\"},\n\t\t\"looks-okay-to\":                          {\"Reviewed-by\"},\n\t\t\"looks-reasonable-to\":                    {\"Reviewed-by\"},\n\t\t\"makes-sense-to\":                         {\"Reviewed-by\"},\n\t\t\"makes-sparse-happy\":                     {\"Reviewed-by\"},\n\t\t\"maybe-reported-by\":                      {\"Reported-by\"},\n\t\t\"mentored-by\":                            {\"Influenced-by\"},\n\t\t\"modified-and-reviewed-by\":               {\"Reviewed-by\"},\n\t\t\"modified-by\":                            {\"Co-authored-by\"},\n\t\t\"more-or-less-tested-by\":                 {\"Tested-by\"},\n\t\t\"most-definitely-acked-by\":               {\"Reviewed-by\"},\n\t\t\"mostly-acked-by\":                        {\"Reviewed-by\"},\n\t\t\"much-requested-by\":                      {\"Reported-by\"},\n\t\t\"nacked-by\":                              {\"Reviewed-by\"},\n\t\t\"naked-by\":                               {\"Reviewed-by\"},\n\t\t\"narrowed-down-by\":                       {\"Reviewed-by\"},\n\t\t\"niced-by\":                               {\"Reviewed-by\"},\n\t\t\"no-objection-from-me-by\":                {\"Reviewed-by\"},\n\t\t\"no-problems-with\":                       {\"Reviewed-by\"},\n\t\t\"not-nacked-by\":                          {\"Reviewed-by\"},\n\t\t\"noted-by\":                               {\"Reviewed-by\"},\n\t\t\"noticed-and-acked-by\":                   {\"Reviewed-by\"},\n\t\t\"noticed-by\":                             {\"Reviewed-by\"},\n\t\t\"okay-ished-by\":                          {\"Reviewed-by\"},\n\t\t\"oked-to-go-through-tracing-tree-by\":     {\"Reviewed-by\"},\n\t\t\"once-upon-a-time-reviewed-by\":           {\"Reviewed-by\"},\n\t\t\"original-author\":                        {\"Co-authored-by\"},\n\t\t\"original-by\":                            {\"Co-authored-by\"},\n\t\t\"original-from\":                          {\"Co-authored-by\"},\n\t\t\"original-idea-and-signed-off-by\":        {\"Co-authored-by\"},\n\t\t\"original-idea-by\":                       {\"Influenced-by\"},\n\t\t\"original-patch-acked-by\":                {\"Reviewed-by\"},\n\t\t\"original-patch-by\":                      {\"Co-authored-by\"},\n\t\t\"original-signed-off-by\":                 {\"Co-authored-by\"},\n\t\t\"original-version-by\":                    {\"Co-authored-by\"},\n\t\t\"originalauthor\":                         {\"Co-authored-by\"},\n\t\t\"originally-by\":                          {\"Co-authored-by\"},\n\t\t\"originally-from\":                        {\"Co-authored-by\"},\n\t\t\"originally-suggested-by\":                {\"Influenced-by\"},\n\t\t\"originally-written-by\":                  {\"Co-authored-by\"},\n\t\t\"origionally-authored-by\":                {\"Co-authored-by\"},\n\t\t\"origionally-signed-off-by\":              {\"Co-authored-by\"},\n\t\t\"partially-reviewed-by\":                  {\"Reviewed-by\"},\n\t\t\"partially-tested-by\":                    {\"Tested-by\"},\n\t\t\"partly-suggested-by\":                    {\"Co-authored-by\"},\n\t\t\"patch-by\":                               {\"Co-authored-by\"},\n\t\t\"patch-fixed-up-by\":                      {\"Resolved-by\"},\n\t\t\"patch-from\":                             {\"Co-authored-by\"},\n\t\t\"patch-inspired-by\":                      {\"Influenced-by\"},\n\t\t\"patch-originally-by\":                    {\"Co-authored-by\"},\n\t\t\"patch-updated-by\":                       {\"Co-authored-by\"},\n\t\t\"patiently-pointed-out-by\":               {\"Reported-by\"},\n\t\t\"pattern-pointed-out-by\":                 {\"Influenced-by\"},\n\t\t\"performance-tested-by\":                  {\"Tested-by\"},\n\t\t\"pinpointed-by\":                          {\"Reported-by\"},\n\t\t\"pointed-at-by\":                          {\"Reported-by\"},\n\t\t\"pointed-out-and-tested-by\":              {\"Reported-by\", \"Tested-by\"},\n\t\t\"proposed-by\":                            {\"Reported-by\"},\n\t\t\"pushed-by\":                              {\"Co-authored-by\"},\n\t\t\"ranted-by\":                              {\"Reported-by\"},\n\t\t\"re-reported-by\":                         {\"Reported-by\"},\n\t\t\"reasoning-sounds-sane-to\":               {\"Reviewed-by\"},\n\t\t\"recalls-having-tested-once-upon-a-time-by\": {\"Tested-by\"},\n\t\t\"received-from\":                                  {\"Informed-by\"},\n\t\t\"recommended-by\":                                 {\"Reviewed-by\"},\n\t\t\"reivewed-by\":                                    {\"Reviewed-by\"},\n\t\t\"reluctantly-acked-by\":                           {\"Reviewed-by\"},\n\t\t\"repored-and-bisected-by\":                        {\"Reported-by\"},\n\t\t\"reporetd-by\":                                    {\"Reported-by\"},\n\t\t\"reporeted-and-tested-by\":                        {\"Reported-by\", \"Tested-by\"},\n\t\t\"report-by\":                                      {\"Reported-by\"},\n\t\t\"reportded-by\":                                   {\"Reported-by\"},\n\t\t\"reported\":                                       {\"Reported-by\"},\n\t\t\"reported--and-debugged-by\":                      {\"Reported-by\", \"Tested-by\"},\n\t\t\"reported-acked-and-tested-by\":                   {\"Reported-by\", \"Tested-by\"},\n\t\t\"reported-analyzed-and-tested-by\":                {\"Reported-by\"},\n\t\t\"reported-and-acked-by\":                          {\"Reviewed-by\"},\n\t\t\"reported-and-bisected-and-tested-by\":            {\"Reviewed-by\", \"Tested-by\"},\n\t\t\"reported-and-bisected-by\":                       {\"Reported-by\"},\n\t\t\"reported-and-reviewed-and-tested-by\":            {\"Reviewed-by\", \"Tested-by\"},\n\t\t\"reported-and-root-caused-by\":                    {\"Reported-by\"},\n\t\t\"reported-and-suggested-by\":                      {\"Reported-by\"},\n\t\t\"reported-and-test-by\":                           {\"Reported-by\"},\n\t\t\"reported-and-tested-by\":                         {\"Tested-by\"},\n\t\t\"reported-any-tested-by\":                         {\"Tested-by\"},\n\t\t\"reported-bisected-and-tested-by\":                {\"Reported-by\", \"Tested-by\"},\n\t\t\"reported-bisected-and-tested-by-the-invaluable\": {\"Reported-by\", \"Tested-by\"},\n\t\t\"reported-bisected-tested-by\":                    {\"Reported-by\", \"Tested-by\"},\n\t\t\"reported-bistected-and-tested-by\":               {\"Reported-by\", \"Tested-by\"},\n\t\t\"reported-by\":                                    {\"Reported-by\"},\n\t\t\"reported-by-and-tested-by\":                      {\"Reported-by\", \"Tested-by\"},\n\t\t\"reported-by-tested-by\":                          {\"Tested-by\"},\n\t\t\"reported-by-with-patch\":                         {\"Reported-by\"},\n\t\t\"reported-debuged-tested-acked-by\":               {\"Tested-by\"},\n\t\t\"reported-off-by\":                                {\"Reported-by\"},\n\t\t\"reported-requested-and-tested-by\":               {\"Reported-by\", \"Tested-by\"},\n\t\t\"reported-reviewed-and-acked-by\":                 {\"Reviewed-by\"},\n\t\t\"reported-tested-and-acked-by\":                   {\"Reviewed-by\", \"Tested-by\"},\n\t\t\"reported-tested-and-bisected-by\":                {\"Reported-by\", \"Tested-by\"},\n\t\t\"reported-tested-and-fixed-by\":                   {\"Co-authored-by\", \"Reported-by\", \"Tested-by\"},\n\t\t\"reported-tested-by\":                             {\"Tested-by\"},\n\t\t\"reported_by\":                                    {\"Reported-by\"},\n\t\t\"reportedy-and-tested-by\":                        {\"Reported-by\", \"Tested-by\"},\n\t\t\"reproduced-by\":                                  {\"Tested-by\"},\n\t\t\"requested-and-acked-by\":                         {\"Reviewed-by\"},\n\t\t\"requested-and-tested-by\":                        {\"Tested-by\"},\n\t\t\"requested-by\":                                   {\"Reported-by\"},\n\t\t\"researched-with\":                                {\"Co-authored-by\"},\n\t\t\"reveiewed-by\":                                   {\"Reviewed-by\"},\n\t\t\"review-by\":                                      {\"Reviewed-by\"},\n\t\t\"reviewd-by\":                                     {\"Reviewed-by\"},\n\t\t\"reviewed\":                                       {\"Reviewed-by\"},\n\t\t\"reviewed-and-tested-by\":                         {\"Reviewed-by\", \"Tested-by\"},\n\t\t\"reviewed-and-wanted-by\":                         {\"Reviewed-by\"},\n\t\t\"reviewed-by\":                                    {\"Reviewed-by\"},\n\t\t\"reviewed-off-by\":                                {\"Reviewed-by\"},\n\t\t\"reviewed–by\":                                    {\"Reviewed-by\"},\n\t\t\"reviewer\":                                       {\"Reviewed-by\"},\n\t\t\"reviewws-by\":                                    {\"Reviewed-by\"},\n\t\t\"root-cause-analysis-by\":                         {\"Reported-by\"},\n\t\t\"root-cause-found-by\":                            {\"Reported-by\"},\n\t\t\"seconded-by\":                                    {\"Reviewed-by\"},\n\t\t\"seems-ok\":                                       {\"Reviewed-by\"},\n\t\t\"seems-reasonable-to\":                            {\"Reviewed-by\"},\n\t\t\"sefltests-acked-by\":                             {\"Reviewed-by\"},\n\t\t\"sent-by\":                                        {\"Informed-by\"},\n\t\t\"serial-parts-acked-by\":                          {\"Reviewed-by\"},\n\t\t\"siged-off-by\":                                   {\"Co-authored-by\"},\n\t\t\"sighed-off-by\":                                  {\"Co-authored-by\"},\n\t\t\"signed\":                                         {\"Signed-off-by\"},\n\t\t\"signed-by\":                                      {\"Signed-off-by\"},\n\t\t\"signed-off\":                                     {\"Signed-off-by\"},\n\t\t\"signed-off-by\":                                  {\"Co-authored-by\", \"Signed-off-by\"},\n\t\t\"singend-off-by\":                                 {\"Co-authored-by\"},\n\t\t\"slightly-grumpily-acked-by\":                     {\"Reviewed-by\"},\n\t\t\"smoke-tested-by\":                                {\"Tested-by\"},\n\t\t\"some-suggestions-by\":                            {\"Influenced-by\"},\n\t\t\"spotted-by\":                                     {\"Reported-by\"},\n\t\t\"submitted-by\":                                   {\"Co-authored-by\"},\n\t\t\"suggested-and-acked-by\":                         {\"Reviewed-by\"},\n\t\t\"suggested-and-reviewed-by\":                      {\"Reviewed-by\"},\n\t\t\"suggested-and-tested-by\":                        {\"Reviewed-by\", \"Tested-by\"},\n\t\t\"suggested-by\":                                   {\"Reviewed-by\"},\n\t\t\"tested\":                                         {\"Tested-by\"},\n\t\t\"tested-and-acked-by\":                            {\"Tested-by\"},\n\t\t\"tested-and-bugfixed-by\":                         {\"Resolved-by\", \"Tested-by\"},\n\t\t\"tested-and-reported-by\":                         {\"Reported-by\", \"Tested-by\"},\n\t\t\"tested-by\":                                      {\"Tested-by\"},\n\t\t\"tested-off\":                                     {\"Tested-by\"},\n\t\t\"thanks-to\":                                      {\"Influenced-by\", \"Informed-by\"},\n\t\t\"to\":                                             {\"Informed-by\"},\n\t\t\"tracked-by\":                                     {\"Tested-by\"},\n\t\t\"tracked-down-by\":                                {\"Tested-by\"},\n\t\t\"was-acked-by\":                                   {\"Reviewed-by\"},\n\t\t\"weak-reviewed-by\":                               {\"Reviewed-by\"},\n\t\t\"workflow-found-ok-by\":                           {\"Reviewed-by\"},\n\t\t\"written-by\":                                     {\"Reported-by\"},\n\t}\n\t// GitTrailerOtherAuthors - trailer name to authors map (for all documents)\n\tGitTrailerOtherAuthors = map[string][2]string{\n\t\t\"Signed-off-by\":  {\"authors_signed\", \"signer\"},\n\t\t\"Co-authored-by\": {\"authors_co_authored\", \"co_author\"},\n\t\t\"Tested-by\":      {\"authors_tested\", \"tester\"},\n\t\t\"Approved-by\":    {\"authors_approved\", \"approver\"},\n\t\t\"Reviewed-by\":    {\"authors_reviewed\", \"reviewer\"},\n\t\t\"Reported-by\":    {\"authors_reported\", \"reporter\"},\n\t\t\"Informed-by\":    {\"authors_informed\", \"informer\"},\n\t\t\"Resolved-by\":    {\"authors_resolved\", \"resolver\"},\n\t\t\"Influenced-by\":  {\"authors_influenced\", \"influencer\"},\n\t}\n\t// GitTrailerSameAsAuthor - can a given trailer be the same as the main commit's author?\n\tGitTrailerSameAsAuthor = map[string]bool{\n\t\t\"Signed-off-by\":  true,\n\t\t\"Co-authored-by\": false,\n\t\t\"Tested-by\":      true,\n\t\t\"Approved-by\":    false,\n\t\t\"Reviewed-by\":    false,\n\t\t\"Reported-by\":    true,\n\t\t\"Informed-by\":    true,\n\t\t\"Resolved-by\":    true,\n\t\t\"Influenced-by\":  true,\n\t}\n\t// GitTrailerPPAuthors - trailer name to authors map (for pair programming)\n\tGitTrailerPPAuthors = map[string]string{\"Signed-off-by\": \"authors_signed_off\", \"Co-authored-by\": \"co_authors\"}\n\n\tIsHotRep                   = false\n\tCommitsByYearCacheFile     = \"commits-cache-%s.csv\"\n\tCommitsUpdateCacheFile     = \"commits-update-cache.csv\"\n\tCurrentCacheYear           = 1970\n\tCachedCommitsUpdates       = make(map[string]CommitCache)\n\tCommitsByYearHalfCacheFile = \"commits-cache-%s-%s.csv\"\n\tCurrentCacheYearHalf       = YearFirstHalf\n\tFirstCommitAt              time.Time\n)\n```\n\n## Functions\n\n```go\nfunc ParseFileExtension(filename string) string\n```\nParseFileExtension - return file extension if present\n\n## Types\n\n```go\ntype CommitCache struct {\n\tTimestamp      string `json:\"timestamp\"`\n\tEntityID       string `json:\"entity_id\"`\n\tSourceEntityID string `json:\"source_entity_id\"`\n\tFileLocation   string `json:\"file_location\"`\n\tHash           string `json:\"hash\"`\n\tOrphaned       bool   `json:\"orphaned\"`\n\tFromDL         bool   `json:\"from_dl\"`\n\tContent        string `json:\"content\"`\n\tCommitDate     time.Time\n}\n```\nCommitCache single commit cache schema\n\n```go\ntype CommitHashFields struct {\n\tID            string\n\tSHA           string\n\tRepositoryURL string\n\tRepositoryID  string\n\tMessage       string\n}\n```\nCommitHashFields elected fields from commit schema to hash\n\n```go\ntype DSGit struct {\n\tURL              string // git repo URL, for example https://github.com/cncf/devstats\n\tReposPath        string // path to store git repo clones, defaults to /tmp/git-repositories\n\tCachePath        string // path to store gitops results cache, defaults to /tmp/git-cache\n\tSkipCacheCleanup bool   // skip gitops cache cleanup\n\t// Flags\n\tFlagURL              *string\n\tFlagReposPath        *string\n\tFlagCachePath        *string\n\tFlagSkipCacheCleanup *bool\n\tFlagStream           *string\n\tFlagSourceID         *string\n\tFlagRepositorySource *string\n\t// Non-config variables\n\tRepoName        string // repo name\n\tLoc             int    // lines of code as reported by GitOpsCommand\n\tPls             []PLS  // programming language suppary as reported by GitOpsCommand\n\tStatsDt         time.Time\n\tGitPath         string                            // path to git repo clone\n\tLineScanner     *bufio.Scanner                    // line scanner for git log\n\tCurrLine        int                               // current line in git log\n\tParseState      int                               // 0-init, 1-commit, 2-header, 3-message, 4-file\n\tCommit          map[string]interface{}            // current parsed commit\n\tCommitFiles     map[string]map[string]interface{} // current commit's files\n\tRecentLines     []string                          // recent commit lines\n\tOrphanedCommits []string                          // orphaned commits SHAs\n\tOrphanedMap     map[string]struct{}               // orphaned commits SHAs\n\tDefaultBranch   string                            // default branch name, example: master, main\n\tBranches        map[string]struct{}               // all branches\n\tCurrentSHA      string                            // SHA of currently processing commit\n\t// PairProgramming mode\n\tPairProgramming bool\n\t// CommitsHash is a map of commit hashes for each repo\n\tCommitsHash map[string]map[string]struct{}\n\t// Publisher \u0026 stream\n\tPublisher\n\tStream string // stream to publish the data\n\tLogger logger.Logger\n\t// SourceID: the optional external source identifier (such as the repo ID from github/gitlab, or gerrit project slug)\n\t// this field is required for github, gitlab and gerrit. For github and gitlab, this is typically a numeric value\n\t// converted to a string such as 194341141. For gerrit this is the project (repository) slug.\n\tSourceID string\n\t// RepositorySource for example git, github or gerrit\n\tRepositorySource string\n\t// contains filtered or unexported fields\n}\n```\nDSGit - DS implementation for git\n\n```go\nfunc (j *DSGit) AddCacheProvider()\n```\nAddCacheProvider - adds cache provider\n\n```go\nfunc (j *DSGit) AddFlags()\n```\nAddFlags - add git specific flags\n\n```go\nfunc (j *DSGit) AddLogger(ctx *shared.Ctx)\n```\nAddLogger - adds logger\n\n```go\nfunc (j *DSGit) AddMetadata(ctx *shared.Ctx, item interface{}) (mItem map[string]interface{})\n```\nAddMetadata - add metadata to the item\n\n```go\nfunc (j *DSGit) AddPublisher(publisher Publisher)\n```\nAddPublisher - sets Kinesis publisher\n\n```go\nfunc (j *DSGit) AddReportProvider()\n```\nAddReportProvider - adds report provider\n\n```go\nfunc (j *DSGit) BuildCommit(ctx *shared.Ctx) (commit map[string]interface{})\n```\nBuildCommit - return commit structure from the current parsed object\n\n```go\nfunc (j *DSGit) BuildCommitMap(comm object.Commit) (map[string]interface{}, error)\n```\n\n```go\nfunc (j *DSGit) CreateGitRepo(ctx *shared.Ctx) (err error)\n```\nCreateGitRepo - clone git repo if needed\n\n```go\nfunc (j *DSGit) EnrichItem(ctx *shared.Ctx, item map[string]interface{}) (rich map[string]interface{}, err error)\n```\nEnrichItem - return rich item from raw item for a given author type\n\n```go\nfunc (*DSGit) ExtractPrevFileName(f string) (res string)\n```\nExtractPrevFileName - extracts previous file name (before rename/move etc.)\n\n```go\nfunc (j *DSGit) GetAuthors(ctx *shared.Ctx, m map[string]string, n map[string][]string) (authors map[string]struct{}, author string)\n```\nGetAuthors - parse multiple authors used in pair programming mode\n\n```go\nfunc (j *DSGit) GetAuthorsData(ctx *shared.Ctx, doc interface{}, auth string) (authorsMap map[string]struct{}, firstAuthor string)\n```\nGetAuthorsData - extract authors data from a given field (this supports pair programming)\n\n```go\nfunc (j *DSGit) GetCommitBranch(ctx *shared.Ctx, refs []string) (branch string)\n```\nGetCommitBranch - get commit branch from refs\n\n```go\nfunc (j *DSGit) GetCommitURL(origin, hash string) (string, string)\n```\nGetCommitURL - return git commit URL for a given path and SHA\n\n```go\nfunc (j *DSGit) GetGitBranches(ctx *shared.Ctx) (err error)\n```\nGetGitBranches - get default git branch name\n\n```go\nfunc (j *DSGit) GetGitOps(ctx *shared.Ctx, thrN int) (ch chan error, err error)\n```\nGetGitOps - LOC, lang summary stats\n\n```go\nfunc (j *DSGit) GetModelData(ctx *shared.Ctx, docs []interface{}) []git.CommitCreatedEvent\n```\nGetModelData - return data in lfx-event-schema format\n\n```go\nfunc (j *DSGit) GetOrphanedCommits(ctx *shared.Ctx, thrN int) (ch chan error, err error)\n```\nGetOrphanedCommits - return data about orphaned commits: commits present in git object storage but not present in rev-list - for example squashed commits\n\n```go\nfunc (j *DSGit) GetOtherPPAuthors(ctx *shared.Ctx, doc interface{}) (othersMap map[string]map[string]struct{})\n```\nGetOtherPPAuthors - get others authors - possible from fields: Signed-off-by and/or Co-authored-by\n\n```go\nfunc (j *DSGit) GetOtherTrailersAuthors(ctx *shared.Ctx, doc interface{}) (othersMap map[string]map[[2]string]struct{})\n```\nGetOtherTrailersAuthors - get others authors - from other trailers fields (mostly for korg) This works on a raw document\n\n```go\nfunc (j *DSGit) GetRepoShortURL(origin string) (repoShortName string)\n```\nGetRepoShortURL - return git commit URL for a given path and SHA\n\n```go\nfunc (j *DSGit) GitEnrichItems(ctx *shared.Ctx, thrN int, items []interface{}, docs *[]interface{}, final bool) (err error)\n```\nGitEnrichItems - iterate items and enrich them items is a current pack of input items docs is a pointer to where extracted identities will be stored\n\n```go\nfunc (j *DSGit) HandleRecentLines(line string)\n```\nHandleRecentLines - keep last 30 lines, so we can show them on parser error\n\n```go\nfunc (j *DSGit) IdentityFromGitAuthor(ctx *shared.Ctx, author string) (identity [3]string)\n```\nIdentityFromGitAuthor - construct identity from git author\n\n```go\nfunc (j *DSGit) Init(ctx *shared.Ctx) (err error)\n```\nInit - initialize git data source\n\n```go\nfunc (j *DSGit) ItemID(item interface{}) string\n```\nItemID - return unique identifier for an item\n\n```go\nfunc (j *DSGit) ItemUpdatedOn(item interface{}) time.Time\n```\nItemUpdatedOn - return updated on date for an item\n\n```go\nfunc (j *DSGit) ParseAction(ctx *shared.Ctx, data map[string]string)\n```\nParseAction - parse action line\n\n```go\nfunc (j *DSGit) ParseArgs(ctx *shared.Ctx) (err error)\n```\nParseArgs - parse git specific environment variables\n\n```go\nfunc (j *DSGit) ParseCommit(ctx *shared.Ctx, line string) (parsed bool, err error)\n```\nParseCommit - parse commit\n\n```go\nfunc (j *DSGit) ParseFile(ctx *shared.Ctx, line string) (parsed, empty bool, err error)\n```\nParseFile - parse file state\n\n```go\nfunc (j *DSGit) ParseGitLog(ctx *shared.Ctx) (cmd *exec.Cmd, err error)\n```\nParseGitLog - update git repo\n\n```go\nfunc (j *DSGit) ParseHeader(ctx *shared.Ctx, line string) (parsed bool, err error)\n```\nParseHeader - parse header state\n\n```go\nfunc (j *DSGit) ParseInit(ctx *shared.Ctx, line string) (parsed bool, err error)\n```\nParseInit - parse initial state\n\n```go\nfunc (j *DSGit) ParseMessage(ctx *shared.Ctx, line string) (parsed bool, err error)\n```\nParseMessage - parse message state\n\n```go\nfunc (j *DSGit) ParseNextCommit(ctx *shared.Ctx) (commit map[string]interface{}, ok bool, err error)\n```\nParseNextCommit - parse next git log commit or report end\n\n```go\nfunc (j *DSGit) ParseStats(ctx *shared.Ctx, data map[string]string)\n```\nParseStats - parse stats line\n\n```go\nfunc (j *DSGit) ParseTrailer(ctx *shared.Ctx, line string)\n```\nParseTrailer - parse possible trailer line\n\n```go\nfunc (j *DSGit) PublisherPushEvents(ev, ori, src, cat, env string, v []interface{}) error\n```\nPublisherPushEvents - this is a fake function to test publisher locally FIXME: don't use when done implementing\n\n```go\nfunc (j *DSGit) SetParentCommitFlag(richItem map[string]interface{}) (err error)\n```\nSetParentCommitFlag - additional operations on already enriched item for pair programming\n\n```go\nfunc (j *DSGit) Sync(ctx *shared.Ctx) (err error)\n```\nSync - sync git data source\n\n```go\nfunc (j *DSGit) SyncV2(ctx *shared.Ctx) (err error)\n```\n\n```go\nfunc (j *DSGit) UpdateGitRepo(ctx *shared.Ctx) (err error)\n```\nUpdateGitRepo - update git repo\n\n```go\nfunc (j *DSGit) Validate() (err error)\n```\nValidate - is current DS configuration OK?\n\n```go\nfunc (j *DSGit) WriteLog(ctx *shared.Ctx, timestamp time.Time, status, message string) error\n```\nWriteLog - writes to log\n\n```go\ntype PLS struct {\n\tLanguage string `json:\"language\"`\n\tFiles    int    `json:\"files\"`\n\tBlank    int    `json:\"blank\"`\n\tComment  int    `json:\"comment\"`\n\tCode     int    `json:\"code\"`\n}\n```\nPLS - programming language summary\n\n```go\ntype Publisher interface {\n\tPushEvents(action, source, eventType, subEventType, env string, data []interface{}, endpoint string) (string, error)\n}\n```\nPublisher - for streaming data to Kinesis\n\n```go\ntype RawPLS struct {\n\tLanguage string `json:\"language\"`\n\tFiles    string `json:\"files\"`\n\tBlank    string `json:\"blank\"`\n\tComment  string `json:\"comment\"`\n\tCode     string `json:\"code\"`\n}\n```\nRawPLS - programming language summary (all fields as strings)\n\n```go\ntype ReportData struct {\n\tID              string `json:\"id\"`\n\tSfdcID          string `json:\"sfdc_id\"`\n\tProjectName     string `json:\"project_name\"`\n\tURL             string `json:\"url\"`\n\tNewCommits      int64  `json:\"new_commits\"`\n\tDate            int64  `json:\"date\"`\n\tSyncStatus      string `json:\"sync_status\"`\n\tOrphanedCommits int64  `json:\"orphaned_commits\"`\n}\n```\nReportData schema\n\n","path":"github.com/LF-Engineering/insights-datasource-git/cmd/git","name":"main","synopsis":"","isRedistributable":true}
