You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+57-31Lines changed: 57 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@
28
28

29
29
> **Øh nøes!** The path to the folder containing all repositories *exists, but is empty!*
30
30
31
-

31
+

32
32
> **Success!**`JSON` parsed, based on **9** different repositories with a total of **25,537** commits.
33
33
34
34
Note that I've included two huge repos _(*react* & *react-native*, that have 7,813 & 10,065 commits respectively at the time of this writting)_ for the sake of demonstration. The resulting parsed `JSON` file has 715,040 lines. All that done in less than 25 seconds.
@@ -41,13 +41,17 @@ _I have successfully compiled **`470`** repositories at once_ (all repos under t
41
41
* Commits processed: `118,117`
42
42
* Parsed `JSON` file, lines: `3,307,280`
43
43
44
-
## Requirementss
44
+
## Getting started
45
45
46
-
[NodeJS][2] and [BabelJS][3].
46
+
**Gitlogg** requires [NodeJS][2] and [BabelJS][3].
47
47
48
48
1. Install `NodeJS` (visit [their page][2] to find the right install for your system).
49
-
2. Install `BabelJS` globally by running `npm install babel-cli -g`. One can also choose to install it locally by simply running `npm install babel-cli`, but in most cases it is smarter to install `-cli` packages globally.
50
-
3. Run `npm install` to install the remaining dependencies.
49
+
2. Run `npm run setup`. That will:
50
+
51
+
* Install `BabelJS` globally by running `npm install babel-cli -g`.
52
+
* Install all the local dependencies, through `npm install`.
53
+
* Create the directory in which all repos to be parsed to `JSON` will be at (only on **Simple Mode**).
54
+
* Create the directories expected by the scripts that output files.
51
55
52
56
## The `JSON` output
53
57
@@ -152,56 +156,68 @@ There are two modes and they are basically the same, except that the **Simple Mo
152
156
153
157
To simplify the generation process to a point that no configuration is required, follow this directory structure:
154
158
155
-
.
156
-
├── gitlogg
159
+
gitlogg/ <== This repository's root
160
+
├── scripts/
157
161
│ ├── gitlogg-generate-log.sh
158
162
│ ├── gitlogg-parse-json.js
159
163
│ └── gitlogg.sh
160
-
└── repos<== place/keep your repositories under the folder "repos"
164
+
└── _repos/ <== Copy/place/keep your repositories under the folder "_repos/"
161
165
├── repo1
162
166
├── repo2
163
167
├── repo3
164
168
└── repo4
165
169
166
-
1. Copy the `gitlogg` folder and all its content to the indicated relative path to your local repositories (shown above).
167
-
168
-
2. Navigate to the `gitlogg` directory:
170
+
1. Copy the all the repositories you wish to parse to `JSON` to the `_repos/` folder, as shown above.
169
171
170
-
$ cd path/to/the/folder/in/your/system/gitlogg/
172
+
2. Granted that you are within the `gitlogg` folder (this repo's root), run:
171
173
172
-
3. Run it:
173
-
174
-
$ ./gitlogg.sh
174
+
$ npm run gitlogg
175
175
176
176
#### Advanced Mode
177
177
178
178
To generate the `JSON` file based on repositories in any other location, you'll have to define the path to the folder that contains all your repositories.
179
179
180
-
1. Copy the `gitlogg` folder and all its content to a folder of your preference, it really doesn't matter where it is.
181
-
182
-
2. Open [`gitlogg-generate-log.sh`](https://github.com/dreamyguy/gitlogg/blob/master/gitlogg/gitlogg-generate-log.sh#L17) with an editor of your choice and edit the `yourpath` variable:
180
+
1. Open [`gitlogg-generate-log.sh`](https://github.com/dreamyguy/gitlogg/blob/master/scripts/gitlogg-generate-log.sh#L4) with an editor of your choice and edit the `yourpath` variable:
183
181
184
182
# define the absolute path to the directory that contains all your repositories
_**Tip:** drag the folder that contain your repositories to a terminal window, and you'll get the absolute system path to that folder._
188
186
189
-
$ cd path/to/the/folder/in/your/system/gitlogg/
187
+
2. Granted that you are within the `gitlogg` folder (this repo's root), run:
190
188
191
-
4. Run it:
192
-
193
-
$ ./gitlogg.sh
189
+
$ npm run gitlogg
194
190
195
191
## The parsed `JSON` file
196
192
197
-
> _Two files will be generated at the `gitlogg` folder: `gitlogg.tmp` and `gitlogg.json`._
193
+
> Two files will be generated when running `npm run gitlogg`: **`_tmp/gitlogg.tmp`** and **`_output/gitlogg.json`**.
194
+
195
+
gitlogg/ <== This repository's root
196
+
├── scripts/
197
+
│ ├── gitlogg-generate-log.sh
198
+
│ ├── gitlogg-parse-json.js
199
+
│ └── gitlogg.sh
200
+
├── _output/
201
+
│ └── gitlogg.json <== The parsed 'JSON', what we're all after. It's parsed from 'gitlogg.tmp'
202
+
└── _tmp/
203
+
└── gitlogg.tmp <== The processed 'git log'
198
204
199
205
Two files were necessary because of the nature of the script, that loops through all subdirectories and outputs the `git log` for all valid `git` repositories. Once that loop is done, a valid `JSON` file (`gitlogg.json`) is generated out of `gitlogg.tmp`.
200
206
201
207
`gitlogg.tmp` is just a temporary file from which `gitlogg.json` bases itself on. In case the parsing fails `gitlogg.tmp` can come in handy for debugging.
202
208
203
209
## Further Notes
204
210
211
+
#### Debugging
212
+
213
+
I've created error messages with suggested solutions, to help you get past the most common issues.
214
+
215
+
However, `git log`'s output can break while it's being processed. That's most certainly caused by fields that allow user input, like _commit messages_. These fields may contain characters (like `\r`) that crash with those reserved for the generation of `gitlogg.tmp`, namely `\n`.
216
+
217
+
Efforts have been made to mitigate errors by sanitizing characters that have caused errors before, but it might still happen in some edge cases. If it does happen, have a look at the generated `gitlogg.tmp` and see if the expected structure (which is obvious) breaks. Once you have identified the line, have a closer look at the commit and look for an unusual character.
218
+
219
+
Post an issue with a link to a _gist_ containing your broken `gitlogg.tmp` and I will try to reproduce the error.
220
+
205
221
#### Documentation
206
222
207
223
Documentation is done either by:
@@ -227,22 +243,32 @@ It's certainly not harmful to your repositories and it won't change any data in
echo -e "${Whi}[ERROR 002]: ${Yel}The path to the local repositories ${Red}'${yourpath}'${Yel}, which is set on the file ${Blu}'gitlogg-generate-log.sh' ${UYel}exists, but is empty!${RCol}"
91
+
echo -e "${Whi}[ERROR 002]: ${Yel}The path to the local repositories ${Red}'${yourpath}'${Yel}, which is set on the file ${Blu}'${thisFile}' ${UYel}exists, but is empty!${RCol}"
76
92
echo -e "${Yel}Please move the repos to ${Red}'${yourpath}'${Yel} or update the variable ${Pur}'yourpath'${Yel} to reflect the absolute path to the directory where the repos are located.${RCol}"
77
93
# if the path does not exists
78
94
elif [ !-d"${yourpathSanitized}" ];then
79
-
echo -e "${Whi}[ERROR 001]: ${Yel}The path to the local repositories ${Red}'${yourpath}'${Yel}, which is set on the file ${Blu}'gitlogg-generate-log.sh' ${UYel}does not exist!${RCol}"
95
+
echo -e "${Whi}[ERROR 001]: ${Yel}The path to the local repositories ${Red}'${yourpath}'${Yel}, which is set on the file ${Blu}'${thisFile}' ${UYel}does not exist!${RCol}"
80
96
echo -e "${Yel}Please create ${Red}'${yourpath}'${Yel} and move the repos under it, or update the variable ${Pur}'yourpath'${Yel} to reflect the absolute path to the directory where the repos are located.${RCol}"
0 commit comments