threadlines 0.2.11 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/git/diff.js +14 -14
- package/package.json +1 -1
package/dist/git/diff.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.getCommitMessage = getCommitMessage;
|
|
|
7
7
|
exports.getCommitAuthor = getCommitAuthor;
|
|
8
8
|
exports.getCommitDiff = getCommitDiff;
|
|
9
9
|
const simple_git_1 = __importDefault(require("simple-git"));
|
|
10
|
+
const child_process_1 = require("child_process");
|
|
10
11
|
/**
|
|
11
12
|
* Get commit message for a specific commit SHA
|
|
12
13
|
* Returns full commit message (subject + body) or null if commit not found
|
|
@@ -26,26 +27,25 @@ async function getCommitMessage(repoRoot, sha) {
|
|
|
26
27
|
/**
|
|
27
28
|
* Get commit author name and email for a specific commit SHA or HEAD.
|
|
28
29
|
*
|
|
29
|
-
* Uses git log to extract author information
|
|
30
|
+
* Uses raw git log command to extract author information.
|
|
30
31
|
* Works in all environments where git is available.
|
|
31
32
|
*/
|
|
32
33
|
async function getCommitAuthor(repoRoot, sha) {
|
|
33
|
-
const git = (0, simple_git_1.default)(repoRoot);
|
|
34
34
|
try {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (!
|
|
35
|
+
// Use raw git command (same as test scripts) - more reliable than simple-git API
|
|
36
|
+
const commitRef = sha || 'HEAD';
|
|
37
|
+
const command = `git log -1 --format="%an <%ae>" ${commitRef}`;
|
|
38
|
+
const output = (0, child_process_1.execSync)(command, {
|
|
39
|
+
encoding: 'utf-8',
|
|
40
|
+
cwd: repoRoot
|
|
41
|
+
}).trim();
|
|
42
|
+
// Parse output: "Name <email>"
|
|
43
|
+
const match = output.match(/^(.+?)\s*<(.+?)>$/);
|
|
44
|
+
if (!match) {
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
47
|
-
const name =
|
|
48
|
-
const email =
|
|
47
|
+
const name = match[1].trim();
|
|
48
|
+
const email = match[2].trim();
|
|
49
49
|
if (!name || !email) {
|
|
50
50
|
return null;
|
|
51
51
|
}
|